@font-face {
  font-family: "Inter";
  src: url("/static/vendor/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #f4f3ee;
  --surface: #ffffff;
  --ink: #0f1e1b;
  --text: #283633;
  --muted: #5f6b67;
  --faint: #8a9591;
  --line: #e3e5df;
  --line-strong: #cdd4cd;
  --brand: #0c6152;
  --brand-ink: #0a5547;
  --brand-tint: #e2eee9;
  --found: #0c6152;
  --faster: #c2650a;
  --faster-tint: #fdf0e1;
  --danger: #b42318;
  --closed: repeating-linear-gradient(135deg, #f1f1ec 0 6px, #e9eae4 6px 12px);
  --t0: #2f6f9f;
  --t1: #8a4f9e;
  --t2: #b8651f;
  --t3: #3b8456;
  --shadow: 0 1px 2px rgb(15 30 27 / 5%), 0 8px 24px -10px rgb(15 30 27 / 16%);
  --radius: 16px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
h2 { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 650; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- top bar */

.bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand .practice { font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; }
.chip { background: var(--brand-tint); color: var(--brand-ink); font-weight: 650; border-radius: 99px; padding: 1px 8px; font-size: 11.5px; }

.status { display: flex; align-items: center; gap: 12px; min-width: 300px; }
.status-label { font-weight: 700; color: var(--ink); font-size: 16px; }
.status-sub { color: var(--muted); font-size: 12.5px; }
.orb { width: 46px; height: 46px; border-radius: 50%; background: #eef0eb; display: flex; align-items: center; justify-content: center; gap: 3px; transition: background .3s; }
.orb span { width: 4px; height: 6px; border-radius: 2px; background: var(--faint); transition: height .15s, background .3s; }
.status[data-state="connecting"] .orb { animation: pulse 1.2s infinite; }
.status[data-state="listening"] .orb { background: var(--brand-tint); }
.status[data-state="listening"] .orb span { background: var(--brand); }
.status[data-state="thinking"] .orb { background: #f6efe1; }
.status[data-state="thinking"] .orb span { background: var(--faster); animation: think 1s infinite ease-in-out; }
.status[data-state="thinking"] .orb span:nth-child(2) { animation-delay: .1s; }
.status[data-state="thinking"] .orb span:nth-child(3) { animation-delay: .2s; }
.status[data-state="thinking"] .orb span:nth-child(4) { animation-delay: .3s; }
.status[data-state="thinking"] .orb span:nth-child(5) { animation-delay: .4s; }
.status[data-state="speaking"] .orb { background: var(--brand); }
.status[data-state="speaking"] .orb span { background: #fff; }
.status[data-state="offline"] .orb { background: #fbeae8; }
.status[data-state="offline"] .orb span { background: var(--danger); }
.status[data-state="offline"] .status-label { color: var(--danger); }
@keyframes think { 0%, 100% { height: 6px; } 50% { height: 18px; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(12 97 82 / 30%); } 50% { box-shadow: 0 0 0 10px rgb(12 97 82 / 0%); } }

.actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.icon-btn:hover { background: #f5f6f2; }
.icon-btn svg, .call-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.call-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--brand); color: #fff; border: 0; border-radius: 14px;
  padding: 12px 22px; font-weight: 650; font-size: 16px;
  box-shadow: 0 6px 16px -6px rgb(12 97 82 / 55%);
}
.call-btn:hover { background: var(--brand-ink); }
.call-btn.live { background: var(--danger); box-shadow: 0 6px 16px -6px rgb(180 35 24 / 55%); }
.call-btn.live svg { transform: rotate(135deg); }
.call-btn:disabled { opacity: .6; cursor: wait; }
.mic { display: flex; gap: 2px; align-items: flex-end; height: 20px; opacity: 0; transition: opacity .2s; }
.mic.on { opacity: 1; }
.mic i { display: block; width: 4px; height: 4px; border-radius: 2px; background: var(--brand); transition: height .08s; }

/* ---------------------------------------------------------------- layout */

.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(330px, 1fr);
  gap: 16px;
  padding: 16px 20px 20px;
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.hint { color: var(--faint); font-size: 12px; }
.side { display: flex; flex-direction: column; gap: 16px; min-height: 0; }

/* ---------------------------------------------------------------- calendar */

.calendar { display: flex; flex-direction: column; min-height: 0; }
.seg { display: inline-flex; background: #f0f1ec; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }

.days { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.days button {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 5px 10px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.2; position: relative;
}
.days button b { display: block; color: var(--ink); font-size: 14px; }
.days button.sel { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-ink); }
.days button.mark::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--found); }
.days button.mark-fast::after { background: var(--faster); }

.view { flex: 1; min-height: 0; overflow: auto; padding: 0 16px 6px; }

/* week overview: therapists x days */
.week { display: grid; gap: 6px; align-items: stretch; min-height: 100%; }
.week .corner { }
.week .dh { font-size: 12px; color: var(--muted); text-align: center; padding-bottom: 2px; line-height: 1.2; }
.week .dh b { display: block; color: var(--ink); font-size: 13px; }
.week .dh.today b { color: var(--brand); }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 0; border-radius: 12px; min-width: 0; transition: background .3s; }
.who .av { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.who .nm { font-weight: 650; color: var(--ink); font-size: 14px; white-space: nowrap; }
.who .fc { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .tag { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 99px; padding: 0 6px; vertical-align: 1px; }
.who.wanted { background: var(--brand-tint); padding-left: 8px; }

.cell {
  border: 1px solid var(--line); border-radius: 10px; padding: 5px; min-height: 64px; background: var(--surface);
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.cell:hover { border-color: var(--line-strong); }
.cell.off { background: var(--closed); border-color: transparent; cursor: default; }
/* the cell is a small picture of the day: time runs downwards, booked steps tinted */
.cell .load { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 1px; padding: 1px; }
.cell .load i { flex: 1; background: #fcfdfb; }
.cell .load i.b { background: color-mix(in srgb, var(--c) 24%, white); }
.cell .load i.p { background: #f0f1ed; }
.cell .free, .cell .pins { position: relative; z-index: 1; }
.cell .free { white-space: nowrap; font-size: 12px; color: var(--muted); background: rgb(255 255 255 / 88%); border-radius: 6px; padding: 0 5px; font-weight: 600; }
.cell.full .free { color: var(--ink); }
.cell .pins { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.pin { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 4px; color: #fff; background: var(--found); white-space: nowrap; animation: pop .35s ease-out both; }
.pin.fast { background: var(--faster); }
.pin.new { background: var(--ink); }
.cell.hit { box-shadow: 0 0 0 2px var(--found); }
.cell.hit-fast { box-shadow: 0 0 0 2px var(--faster); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* day view */
.day { display: grid; gap: 0 8px; position: relative; }
.day .colhead { padding: 4px 0 8px; position: sticky; top: 0; background: var(--surface); z-index: 3; }
.day .times { position: relative; }
.day .times span { position: absolute; right: 2px; font-size: 11px; color: var(--faint); transform: translateY(-50%); }
.day .col { position: relative; border-radius: 10px; background: var(--closed); overflow: hidden; }
.day .work { position: absolute; left: 0; right: 0; background: #fbfcfa; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.day .gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed #edefea; }
.appt {
  position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 2px 6px; overflow: hidden;
  font-size: 11.5px; line-height: 1.25; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 13%, white); color: var(--ink);
}
.appt b { font-weight: 650; }
.appt .svc { color: var(--muted); }
.appt.new { background: var(--brand); color: #fff; border-left-color: var(--ink); z-index: 2; box-shadow: 0 0 0 3px rgb(12 97 82 / 25%); animation: glow 1.4s ease-in-out 4; }
.appt.new .svc { color: #d8ece6; }
.slot { position: absolute; left: 3px; right: 3px; border: 2px dashed var(--found); border-radius: 7px; background: rgb(12 97 82 / 6%); z-index: 1; font-size: 11px; font-weight: 700; color: var(--found); padding: 1px 6px; animation: pop .35s ease-out both; }
.slot.fast { border-color: var(--faster); color: var(--faster); background: var(--faster-tint); }
.nowline { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 4; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
@keyframes glow { 50% { box-shadow: 0 0 0 7px rgb(12 97 82 / 12%); } }

.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 16px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.booked { background: color-mix(in srgb, var(--t0) 24%, white); }
.lg.free { background: #fbfcfa; border: 1px solid var(--line-strong); }
.lg.found { border: 2px dashed var(--found); }
.lg.faster { border: 2px dashed var(--faster); background: var(--faster-tint); }
.lg.new { background: var(--brand); }

/* ---------------------------------------------------------------- note, feed, transcript */

.note dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; padding: 0 16px 14px; font-size: 14px; }
.note dt { color: var(--muted); }
.note dd { margin: 0; color: var(--ink); font-weight: 600; animation: pop .3s ease-out both; }

.feed { flex: 1.1; min-height: 0; display: flex; flex-direction: column; }
.feed ol { list-style: none; margin: 0; padding: 0 16px 12px; overflow: auto; flex: 1; }
.feed ol:empty { display: none; }
.feed li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 7px 0; border-top: 1px solid #f0f1ec; animation: slide .3s ease-out both; }
.feed li:first-child { border-top: 0; }
.feed .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #eef1ed; font-size: 14px; }
.feed .ic svg { width: 15px; height: 15px; fill: none; stroke: var(--brand-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feed .t { font-weight: 650; color: var(--ink); font-size: 14px; }
.feed .d { color: var(--muted); font-size: 13px; }
.feed .d .fast { color: var(--faster); font-weight: 650; }
.feed .d .ok { color: var(--brand); font-weight: 650; }
.feed .tm { color: var(--faint); font-size: 11.5px; padding-top: 2px; }
.feed li.busy .ic { background: #f6efe1; }
.feed li.busy .ic svg { stroke: var(--faster); animation: spin 1.2s linear infinite; }
.feed li.err .ic { background: #fbe9e7; }
.feed li.err .ic svg { stroke: var(--danger); }
.feed li.mail .ic { background: #e8eef7; }
.feed li.mail .ic svg { stroke: var(--t0); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.empty { padding: 0 16px 14px; color: var(--muted); font-size: 14px; }
.empty p { margin: 0 0 8px; }
.empty .eg { background: #f5f6f2; border-radius: 10px; padding: 7px 10px; color: var(--text); font-style: italic; }

.talk { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.transcript { flex: 1; overflow: auto; padding: 2px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 88%; padding: 8px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.4; animation: slide .25s ease-out both; }
.msg .who-s { display: block; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 1px; }
.msg.assistant { background: var(--brand-tint); color: var(--ink); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.assistant .who-s { color: var(--brand-ink); }
.msg.caller { background: #f1f2ee; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.caller .who-s { color: var(--muted); }
.msg .interim { color: var(--faint); font-style: italic; }
.typebox { display: flex; gap: 8px; padding: 0 12px 12px; }
.typebox input { flex: 1; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; font: inherit; }
.typebox button { border: 0; border-radius: 10px; padding: 8px 14px; background: var(--brand-tint); color: var(--brand-ink); font-weight: 650; }

/* ---------------------------------------------------------------- dialogs, toast */

dialog { border: 0; border-radius: 18px; padding: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 35%); }
dialog::backdrop { background: rgb(15 30 27 / 35%); backdrop-filter: blur(2px); }
dialog h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--ink); margin-bottom: 8px; }
dialog input { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 16px; margin: 6px 0 10px; }
dialog label { display: block; font-weight: 600; color: var(--ink); }
dialog .small { font-size: 13px; color: var(--muted); }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
dialog button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 16px; font-weight: 600; }
dialog button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
dialog .err { color: var(--danger); font-size: 13px; margin: 0 0 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 10; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------------------------------------------------------------- smaller screens */

@media (max-width: 1100px) {
  .bar { grid-template-columns: 1fr auto; }
  .status { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .grid { grid-template-columns: 1fr; overflow: auto; }
  body { overflow: auto; }
  .calendar { min-height: 560px; }
  .side { min-height: 640px; }
}
@media (max-width: 600px) {
  .bar { padding: 10px 16px; }
  .grid { padding: 12px 16px 16px; }
  .icon-btn { width: 36px; height: 36px; }
  .call-btn { padding: 10px 16px; }
  .legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
