/* Amyra doctor console. Tokens from docs/care-platform.md §8 and the console designs. */
:root {
  /* docs/care-platform.md §11: one family (Geist), neutral tokens, ember for brand moments, orange for small accents. */
  --ember: #1C0F08;
  --ember-2: #2A160C;
  --on-ember: #FFFFFF;
  --on-ember-muted: rgba(255, 255, 255, .64);
  --ground: #F7F7F6;
  --surface: #FFFFFF;
  --surface-2: #F7F7F6;
  --chip: #F1F1EF;
  --card: #FFFFFF;
  --ink: #18181B;
  --ink-2: #3F3F46;
  --muted: #71717A;
  --faint: #A1A1AA;
  --line: #E7E7E4;
  --orange: #FC5F2B;
  --orange-text: #C2410C;
  --tint: #FFF1EB;
  --red: #B42318;
  --red-tint: #FEF3F2;
  --green: #15803D;
  --green-tint: #ECFDF3;
  --amber: #A16207;
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 8px 24px rgba(24, 24, 27, .05);
  --shadow-lift: 0 1px 2px rgba(24, 24, 27, .06), 0 10px 28px rgba(24, 24, 27, .08);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 21px;
}
a { color: var(--orange-text); }
a:hover { color: var(--orange-text); }
button, textarea, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.soft { color: var(--muted); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes breathe { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: .9; transform: scale(1.08); } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes draw { from { stroke-dashoffset: var(--len, 600); } to { stroke-dashoffset: 0; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.rise { animation: fadeUp .6s var(--ease) both; }
.rise-1 { animation-delay: .05s; } .rise-2 { animation-delay: .12s; } .rise-3 { animation-delay: .19s; } .rise-4 { animation-delay: .26s; } .rise-5 { animation-delay: .33s; }
.spin { animation: spin 6s linear infinite; }
.spin-fast { animation: spin 1.2s linear infinite; }

/* ---------------------------------------------------------------- shell */

.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 60px; flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--ember); color: #fff;
}
.wordmark { font-size: 18px; line-height: 24px; font-weight: 500; letter-spacing: -.02em; white-space: nowrap; }
.wordmark .soft { color: var(--on-ember-muted); font-weight: 400; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  height: 36px; padding: 0 14px; border-radius: 999px; color: var(--on-ember); font-size: 14px; text-decoration: none;
  display: flex; align-items: center; gap: 8px; transition: background .2s var(--ease), color .2s;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav a[aria-current='page'] { background: rgba(255, 255, 255, .12); color: #fff; }
.nav .count { font-size: 11px; font-weight: 500; min-width: 18px; height: 18px; border-radius: 9px; background: var(--orange); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.shift { font-size: 13px; color: var(--on-ember); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.shift-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; }
.shift-dot.off { background: var(--faint); }
.me-button { border: none; background: none; padding: 0; border-radius: 50%; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; background: var(--chip); color: var(--ink-2);
}
.avatar.ring { border: 2px solid var(--orange); }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; font-weight: 500; background: var(--chip); color: var(--ink); }
.avatar.md { width: 42px; height: 42px; font-size: 13px; }
.avatar.red { background: var(--red); color: #fff; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 44px; z-index: 30; min-width: 230px; background: var(--card); color: var(--ink); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(24, 24, 27, .14); padding: 8px; animation: fadeUp .25s var(--ease) both;
}
.menu-pop .who { padding: 10px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-pop .who strong { display: block; color: var(--ink); font-size: 14px; font-weight: 500; }
.menu-pop button { width: 100%; text-align: left; border: none; background: none; padding: 10px 12px; border-radius: 12px; }
.menu-pop button:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- queue */

.workspace { flex-grow: 1; display: flex; min-height: 0; position: relative; }
.queue {
  flex: 0 0 300px; border-right: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; min-height: 0;
}
.queue-head { padding: 18px 18px 10px; display: flex; flex-direction: column; gap: 10px; }
.queue-title { display: flex; align-items: baseline; justify-content: space-between; }
.queue-title h2 { margin: 0; font-size: 16px; line-height: 22px; font-weight: 500; }
.queue-title span { font-size: 12px; line-height: 18px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12px; line-height: 16px; font-weight: 500; padding: 6px 10px; border-radius: 999px; background: var(--chip); border: none; color: var(--ink-2);
  transition: background .2s var(--ease), color .2s;
}
.chip:hover { background: #E9E9E6; }
.chip[aria-pressed='true'] { background: var(--ink); color: #FFFFFF; }
.queue-list { flex-grow: 1; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 0; }
.qi {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; border: none; text-align: left; width: 100%;
  background: transparent; transition: background .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease);
  animation: fadeUp .5s var(--ease) both;
}
.qi:hover { background: rgba(255, 255, 255, .7); }
.qi.red { background: var(--red-tint); }
.qi[aria-current='true'] { background: var(--card); box-shadow: inset 3px 0 0 var(--orange), var(--shadow-lift); }
.qi-row { display: flex; align-items: center; gap: 10px; }
.qi-text { flex-grow: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.qi-top { display: flex; justify-content: space-between; gap: 6px; }
.qi-name { font-size: 14px; line-height: 21px; font-weight: 500; }
.qi-due { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.qi-due.now { color: var(--red); }
.qi[aria-current='true'] .qi-due { color: var(--orange-text); }
.qi-topic { font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { align-self: flex-start; font-size: 12px; line-height: 16px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--ink-2); }
.tag.red { background: var(--red); color: #fff; display: inline-flex; align-items: center; gap: 4px; }
.qi[aria-current='true'] .tag:not(.red) { background: var(--tint); color: var(--orange-text); }
.queue-empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.queue-empty strong { display: block; font-size: 16px; line-height: 22px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }

/* ---------------------------------------------------------------- case */

.case { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.case-scroll { flex-grow: 1; overflow-y: auto; padding: 22px 28px 16px; display: flex; flex-direction: column; gap: 16px; }
.case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.case-meta { font-size: 12px; line-height: 18px; color: var(--muted); }
.case-head h1 { margin: 4px 0 0; font-size: 24px; line-height: 30px; font-weight: 400; letter-spacing: -.02em; }
.case-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill { font-size: 12px; line-height: 16px; font-weight: 500; padding: 6px 10px; border-radius: 999px; background: var(--card); white-space: nowrap; }
.pill.tint { background: var(--tint); color: var(--orange-text); }
.pill.red { background: var(--red); color: #fff; display: inline-flex; align-items: center; gap: 5px; }
.pill.green { background: var(--green-tint); color: var(--green); }
.icon-button {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.why { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--card); font-size: 14px; line-height: 21px; color: var(--ink-2); }
.why strong { color: var(--ink); font-weight: 500; }
.why.red { background: var(--red-tint); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { background: var(--card); border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.card ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 21px; color: var(--ink); }
.card li + li { margin-top: 4px; }
.quote { font-size: 14px; line-height: 21px; color: var(--ink-2); border-radius: 12px; background: var(--surface-2); padding: 10px 12px; white-space: pre-wrap; }
.quote.corrected { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(24, 24, 27, .2); }
.note { font-size: 12px; line-height: 18px; color: var(--muted); }
.results-head { display: flex; justify-content: space-between; align-items: baseline; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.tile { border-radius: 14px; padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; animation: fadeUp .5s var(--ease) both; }
.tile .name { font-size: 12px; line-height: 16px; color: var(--muted); }
.tile .value { font-size: 20px; line-height: 26px; font-weight: 400; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile .flag { font-size: 12px; line-height: 16px; color: var(--muted); }
.tile.out { background: var(--tint); }
.tile.out .name { color: var(--orange-text); }
.tile.out .flag { font-weight: 500; color: var(--orange-text); }
.tile .flag.ok { color: var(--green); }

.thread { display: flex; flex-direction: column; gap: 10px; }
.thread summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.thread summary::-webkit-details-marker { display: none; }
.thread summary .chev { transition: transform .2s var(--ease); }
.thread[open] summary .chev { transform: rotate(180deg); }
.msgs { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.msg { max-width: 82%; font-size: 14px; line-height: 21px; white-space: pre-wrap; }
.msg .by { font-size: 12px; line-height: 16px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.msg.from-patient { align-self: flex-end; border: 1px solid var(--line); border-radius: 18px 18px 4px 18px; padding: 9px 13px; background: var(--surface-2); }
.msg.from-ai { align-self: flex-start; }
.msg.from-doctor { align-self: flex-start; background: var(--tint); border-radius: 18px 18px 18px 4px; padding: 9px 13px; }
.msg.from-system { align-self: stretch; max-width: 100%; background: var(--red-tint); border-radius: 14px; padding: 10px 13px; color: var(--ink); }
.msg.corrected .body { opacity: .5; }
.msg .held { font-size: 12px; font-weight: 500; color: var(--orange-text); }

.review-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-2); }
.input, .textarea, .select {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 10px 12px; font-size: 14px; line-height: 21px; font-weight: 400; color: var(--ink); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(252, 95, 43, .15); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

.btn {
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transition: background .2s var(--ease), transform .15s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.dark { background: var(--ink); color: #FFFFFF; border: none; }
.btn.dark:hover:not(:disabled) { background: #27272A; }
.btn.big { height: 44px; padding: 0 20px; font-size: 14px; }
.btn .arrow { color: var(--orange); }
.btn.danger { color: var(--red); }

/* ---------------------------------------------------------------- composer */

.composer {
  flex-shrink: 0; margin: 0 20px 18px; background: var(--card); border-radius: 24px; box-shadow: 0 -6px 30px rgba(24, 24, 27, .06);
  border: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; animation: slideIn .6s var(--ease) both;
  max-height: 58vh;
}
.composer.quiet { border-color: var(--line); }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: flex-end; }
.tab {
  height: 40px; padding: 0 12px; border: none; background: transparent; font-size: 14px; display: flex; align-items: center; gap: 6px;
  border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; transition: color .2s, border-color .25s var(--ease);
}
.tab[aria-selected='true'] { border-bottom-color: var(--orange); color: var(--ink); }
.tab .n { font-size: 11px; font-weight: 500; min-width: 18px; height: 18px; border-radius: 9px; background: var(--chip); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.tab[aria-selected='true'] .n { background: var(--ink); color: #FFFFFF; }
.tabs-right { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding-bottom: 10px; flex-wrap: wrap; }
.edited { font-weight: 500; color: var(--orange-text); background: var(--tint); border-radius: 999px; padding: 3px 8px; animation: pop .35s var(--ease) both; }
.panel { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.draft-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.draft-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.variant { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); background: var(--card); }
.variant[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: #FFFFFF; }
.reply { flex-grow: 1; border: none; outline: none; resize: none; font-size: 15px; line-height: 24px; color: var(--ink); background: transparent; padding: 0; min-height: 132px; width: 100%; }
.reply:focus-visible { outline: none; }
.rx-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); cursor: pointer; }
.rx-row input[type='checkbox'], .plan-row input[type='checkbox'] { width: 20px; height: 20px; accent-color: var(--ink); flex-shrink: 0; }
.rx-glyph { font-size: 20px; font-weight: 500; color: var(--orange); line-height: 1; }
.rx-text { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rx-text strong { font-size: 14px; line-height: 21px; font-weight: 500; }
.rx-text span { font-size: 12px; line-height: 18px; color: var(--muted); }
.ok-badge { font-size: 12px; font-weight: 500; color: var(--green); background: var(--green-tint); border-radius: 999px; padding: 4px 9px; white-space: nowrap; }
.warn-badge { font-size: 12px; font-weight: 500; color: var(--red); background: var(--red-tint); border-radius: 999px; padding: 4px 9px; display: inline-flex; gap: 4px; align-items: center; }
.checks { display: flex; gap: 10px; font-size: 12px; line-height: 18px; color: var(--muted); flex-wrap: wrap; }
.rx-edit { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr .8fr; gap: 8px; padding: 0 14px 6px; }
.rx-edit .input { padding: 8px 10px; font-size: 13px; border-radius: 10px; }
.plan-hint { font-size: 12px; line-height: 18px; color: var(--muted); }
.plan-row { display: flex; align-items: center; gap: 12px; min-height: 40px; cursor: pointer; }
.plan-row .t { flex-grow: 1; font-size: 14px; }
.plan-row .w { font-size: 12px; color: var(--muted); white-space: nowrap; }
.plan-add { display: grid; grid-template-columns: 130px 1fr 150px auto; gap: 8px; align-items: center; padding-top: 6px; border-top: 1px dashed var(--line); }
.plan-add .input, .plan-add .select { padding: 8px 10px; font-size: 13px; border-radius: 10px; }
.composer-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.attach { margin-left: auto; flex: 0 1 auto; min-width: 0; font-size: 12px; line-height: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer-foot .btn:not(.big) { height: 34px; padding: 0 12px; font-size: 13px; }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }
.sent { padding: 26px; display: flex; align-items: center; gap: 16px; animation: fadeUp .5s var(--ease) both; flex-wrap: wrap; }
.sent-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--green-tint); color: var(--green); display: flex; align-items: center; justify-content: center; animation: pop .5s var(--ease) both; flex-shrink: 0; }
.sent-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 3px; }
.sent-text strong { font-size: 16px; line-height: 22px; font-weight: 500; }
.sent-text span { font-size: 14px; line-height: 21px; color: var(--muted); }
.error-line { font-size: 13px; color: var(--red); display: flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- patient panel */

.patient {
  flex: 0 0 300px; border-left: 1px solid var(--line); background: var(--surface-2); overflow-y: auto; padding: 20px 18px;
  display: flex; flex-direction: column; gap: 16px; min-height: 0;
}
.patient .patient-id { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.patient-id .name { font-size: 16px; line-height: 22px; font-weight: 500; }
.patient-id .sub { font-size: 12px; line-height: 18px; color: var(--muted); }
.section { display: flex; flex-direction: column; gap: 8px; animation: fadeUp .6s var(--ease) both; }
.soft-chip { font-size: 13px; line-height: 18px; padding: 4px 10px; border-radius: 999px; background: var(--chip); color: var(--ink-2); }
.med { font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.med .sched { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.memory { font-size: 13px; line-height: 19px; color: var(--ink-2); }
.memory .src { color: var(--muted); }
.past { font-size: 14px; }
.spark-path { stroke-dasharray: var(--len, 600); animation: draw 1.4s var(--ease) both; }
.close-panel { display: none; }

/* ---------------------------------------------------------------- ops */

.ops { flex-grow: 1; overflow-y: auto; }
.ops-inner { max-width: 1360px; margin: 0 auto; padding: 26px 28px 32px; display: flex; flex-direction: column; gap: 18px; }
.ops-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ops-head h1 { margin: 4px 0 0; font-size: 24px; line-height: 30px; font-weight: 400; letter-spacing: -.02em; }
.period { display: flex; gap: 6px; }
.period button { font-size: 12px; font-weight: 500; padding: 8px 14px; border-radius: 999px; background: var(--card); border: none; }
.period button[aria-pressed='true'] { background: var(--ink); color: #FFFFFF; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; animation: fadeUp .6s var(--ease) both; }
.kpi .k { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); position: relative; }
.kpi .v { font-size: 32px; line-height: 38px; font-weight: 400; letter-spacing: -.02em; position: relative; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; line-height: 18px; color: var(--muted); position: relative; }
.kpi.lead .v { color: var(--ink); }
.kpi.lead .k::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); margin-right: 6px; vertical-align: 1px; }
.ops-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: 14px; }
.box { background: var(--card); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); animation: fadeUp .7s var(--ease) both; }
.box-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.box h2 { margin: 0; font-size: 16px; line-height: 22px; font-weight: 500; }
.box-head span { font-size: 12px; line-height: 18px; color: var(--muted); }
.doc-row { display: flex; align-items: center; gap: 14px; padding: 6px 0; flex-wrap: wrap; }
.doc-who { flex: 0 1 230px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-who .n { font-size: 14px; line-height: 21px; font-weight: 500; }
.doc-who .r { font-size: 12px; color: var(--muted); }
.meter { flex: 1 1 150px; display: flex; flex-direction: column; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; font-size: 12px; }
.meter-top span:first-child { color: var(--muted); }
.meter-top span:last-child { font-weight: 500; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > div { height: 6px; border-radius: 3px; background: var(--orange); transform-origin: left; animation: grow 1s var(--ease) both; }
.status { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--line); color: var(--ink-2); }
.status.on { background: var(--green-tint); color: var(--green); }
.status.new { background: var(--tint); color: var(--orange-text); }
.match-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--surface-2); flex-wrap: wrap; }
.match-who { flex: 1 1 200px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.match-who .n { font-size: 14px; line-height: 21px; font-weight: 500; }
.match-who .w { font-size: 12px; line-height: 18px; color: var(--muted); }
.matched { font-size: 13px; font-weight: 500; color: var(--green); animation: fadeUp .4s var(--ease) both; }
.q-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.q-item.correction { background: var(--red-tint); }
.q-kind { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--muted); padding-top: 2px; flex-shrink: 0; min-width: 78px; }
.q-item.correction .q-kind { color: var(--red); }
.q-item.routing .q-kind { color: var(--amber); }
.q-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.q-body .t { font-size: 14px; }
.q-body .d { font-size: 12px; color: var(--muted); }
.timeline { display: flex; flex-direction: column; padding: 4px 0; }
.tl { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-top: 4px; flex-shrink: 0; }
.tl-dot.done { background: var(--orange); }
.tl-line { width: 1.5px; flex-grow: 1; background: var(--line); }
.tl-body { padding-bottom: 12px; display: flex; flex-direction: column; gap: 2px; }
.tl-body .t { font-size: 14px; font-weight: 500; }
.tl-body .d { font-size: 12px; color: var(--muted); }
.empty-note { font-size: 14px; color: var(--muted); padding: 6px 0; }

/* ---------------------------------------------------------------- states */

.skeleton { border-radius: 14px; background: linear-gradient(90deg, #EFEFED 0, #F7F7F6 160px, #EFEFED 320px); background-size: 800px 100%; animation: shimmer 1.4s linear infinite; }
.center { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--red-tint); color: var(--ink); font-size: 14px; }
.toast {
  position: fixed; left: 50%; top: 72px; transform: translateX(-50%); background: var(--ink); color: #FFFFFF; padding: 12px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 18px 40px rgba(24, 24, 27, .2); z-index: 50; animation: fadeUp .35s var(--ease) both; display: flex; gap: 12px; align-items: center;
}
.toast button { background: none; border: none; color: var(--on-ember-muted); font-weight: 500; }

.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--ember); position: relative; overflow: hidden; }
.signin .halo { position: absolute; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(closest-side, rgba(252, 95, 43, .18), rgba(252, 95, 43, 0)); right: -180px; top: -200px; animation: breathe 7s ease-in-out infinite; }
.signin-card { position: relative; background: var(--surface); border-radius: 28px; padding: 36px; width: min(440px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: fadeUp .7s var(--ease) both; }
.signin-card .wordmark { color: var(--ink); }
.signin-card .wordmark .soft { color: var(--muted); }
.signin-card h1 { margin: 6px 0 0; font-size: 28px; line-height: 34px; font-weight: 400; letter-spacing: -.02em; }
.signin-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.signin-card .btn { align-self: flex-start; text-decoration: none; color: #FFFFFF; }

.drawer-toggle { display: none; }
.scrim { display: none; }

/* ---------------------------------------------------------------- responsive (down to tablet) */

@media (max-width: 1240px) {
  .patient {
    position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 90vw); z-index: 20;
    transform: translateX(105%); transition: transform .35s var(--ease); border-left: none; visibility: hidden;
  }
  .patient.open { transform: none; visibility: visible; box-shadow: -20px 0 50px rgba(24, 24, 27, .12); }
  .close-panel { display: inline-flex; align-self: flex-end; }
  .drawer-toggle.patient-toggle { display: inline-flex; }
  .scrim.show { display: block; position: absolute; inset: 0; background: rgba(24, 24, 27, .25); z-index: 15; }
}
@media (max-width: 1000px) {
  .queue {
    position: absolute; left: 0; top: 0; bottom: 0; width: min(320px, 90vw); z-index: 20;
    transform: translateX(-105%); transition: transform .35s var(--ease), visibility .35s; border-right: none; visibility: hidden;
  }
  .queue.open { transform: none; visibility: visible; box-shadow: 20px 0 50px rgba(24, 24, 27, .12); }
  .drawer-toggle.queue-toggle { display: inline-flex; }
  .shift { display: none; }
  .case-scroll { padding: 18px 18px 12px; }
  .composer { margin: 0 12px 12px; }
  .plan-add { grid-template-columns: 1fr 1fr; }
  .rx-edit { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav a { padding: 0 10px; }
  .ops-grid { grid-template-columns: 1fr; }
  .case-head h1 { font-size: 22px; line-height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.signin-card .error-line { color: var(--red); }

/* §10.1 verdicts */
.verdict-bar { display: flex; align-items: center; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap; border-top: 1px solid var(--line); }
.verdict-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-2); margin-right: 4px; }
.verdict { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); background: var(--card); }
.verdict[aria-checked='true'].v-confirmed { background: var(--green-tint); border-color: var(--green); color: var(--green); font-weight: 500; }
.verdict[aria-checked='true'].v-adjusted { background: var(--tint); border-color: var(--orange-text); color: var(--orange-text); font-weight: 500; }
.verdict[aria-checked='true'].v-different { background: var(--red-tint); border-color: var(--red); color: var(--red); font-weight: 500; }
.verdict-hint { font-size: 12px; color: var(--muted); flex: 1 1 220px; }
.verdict-note { flex: 1 1 100%; padding: 8px 10px; font-size: 13px; border-radius: 10px; }
.verdict-quote { flex: 1 1 100%; font-size: 12px; line-height: 18px; color: var(--muted); }
.verdict-chip { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; }
.verdict-chip.confirmed { background: var(--green-tint); color: var(--green); }
.verdict-chip.adjusted { background: var(--tint); color: var(--orange-text); }
.verdict-chip.different { background: var(--red-tint); color: var(--red); }
.attach-btn { margin-top: 6px; }
.composer-foot { border-top: none; }
.patient .section > .btn { align-self: flex-start; }
