/* Pure Reception client portal. Brand: Electric Blue #0043FF, Deep Navy #0E1B2B,
   Soft Grey #E6EAED, Mint Green #2BC48B. Type: Archivo (normal width). */

:root {
  color-scheme: light;
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F4F6F8;
  --line: #DCE2E8;
  --line-soft: #E9EDF1;
  --text: #0E1B2B;
  --text-2: #3F4F63;
  --muted: #66758A;
  --accent: #0043FF;
  --accent-hover: #0036D1;
  --accent-ink: #0036D1;
  --accent-soft: #E6ECFF;
  --mark: #0043FF;
  --mark-hover: #3366FF;
  --band: rgba(0, 67, 255, 0.06);
  --good: #0E7A51;
  --good-bg: #DCF5EA;
  --good-dot: #2BC48B;
  --warn: #8F5200;
  --warn-bg: #FCEBD2;
  --crit: #B91C2B;
  --crit-bg: #FCE3E6;
  --neutral-bg: #ECF0F3;
  --side-bg: #0E1B2B;
  --side-text: #B3BFCC;
  --side-strong: #FFFFFF;
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: rgba(0, 67, 255, 0.30);
  --side-line: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 2px rgba(14, 27, 43, 0.05), 0 4px 14px rgba(14, 27, 43, 0.04);
  --shadow-lg: 0 18px 50px rgba(14, 27, 43, 0.22);
  --tip-bg: #0E1B2B;
  --tip-text: #FFFFFF;
  --sk-1: #E9EDF1;
  --sk-2: #F5F7F9;
  --radius: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #08111C;
    --surface: #0E1B2B;
    --surface-2: #132438;
    --line: #23364D;
    --line-soft: #1A2B40;
    --text: #E6EAED;
    --text-2: #B4C0CD;
    --muted: #8797AA;
    --accent-ink: #84A4FF;
    --accent-soft: rgba(0, 67, 255, 0.22);
    --mark: #5B8CFF;
    --mark-hover: #86AAFF;
    --band: rgba(91, 140, 255, 0.08);
    --good: #5DDCA9;
    --good-bg: rgba(43, 196, 139, 0.15);
    --warn: #F4BC66;
    --warn-bg: rgba(244, 188, 102, 0.14);
    --crit: #FF8A94;
    --crit-bg: rgba(255, 99, 112, 0.15);
    --neutral-bg: #182A3F;
    --side-bg: #050C15;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
    --tip-bg: #E6EAED;
    --tip-text: #0E1B2B;
    --sk-1: #15263A;
    --sk-2: #1C3048;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08111C;
  --surface: #0E1B2B;
  --surface-2: #132438;
  --line: #23364D;
  --line-soft: #1A2B40;
  --text: #E6EAED;
  --text-2: #B4C0CD;
  --muted: #8797AA;
  --accent-ink: #84A4FF;
  --accent-soft: rgba(0, 67, 255, 0.22);
  --mark: #5B8CFF;
  --mark-hover: #86AAFF;
  --band: rgba(91, 140, 255, 0.08);
  --good: #5DDCA9;
  --good-bg: rgba(43, 196, 139, 0.15);
  --warn: #F4BC66;
  --warn-bg: rgba(244, 188, 102, 0.14);
  --crit: #FF8A94;
  --crit-bg: rgba(255, 99, 112, 0.15);
  --neutral-bg: #182A3F;
  --side-bg: #050C15;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --tip-bg: #E6EAED;
  --tip-text: #0E1B2B;
  --sk-1: #15263A;
  --sk-2: #1C3048;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
h2 { font-size: 15.5px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent-ink); }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.muted { color: var(--muted); font-size: 13px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.07em;
  font-size: 11px; font-weight: 600; color: var(--muted); margin: 0 0 3px;
}
.ok-text { color: var(--good); font-weight: 600; }

/* icons */
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* boot + loading */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.94); } }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; overflow: hidden; pointer-events: none; }
.progress::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 3px;
  background: linear-gradient(90deg, rgba(0, 67, 255, 0), #0043FF 40%, #2BC48B);
  animation: indet 1.1s var(--ease) infinite;
}
@keyframes indet { from { left: -40%; } to { left: 100%; } }
.sk {
  display: block; border-radius: 8px; color: transparent !important;
  background: linear-gradient(90deg, var(--sk-1) 25%, var(--sk-2) 37%, var(--sk-1) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.sk-line { height: 12px; margin: 6px 0; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost:disabled { opacity: 0.5; cursor: default; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text-2);
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.spinning .ico { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 4px 2px; color: var(--accent-ink); font-weight: 600;
  font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.link-btn:hover { text-decoration: underline; }
.link-btn .ico { width: 15px; height: 15px; }

/* forms */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input {
  height: 44px; width: 100%; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 400; font-size: 15px; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:hover { border-color: #C3CCD6; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--accent-ink); font-weight: 600; font-size: 12.5px; padding: 6px 8px; cursor: pointer;
}
.form-error { min-height: 20px; color: var(--crit); font-size: 13px; font-weight: 500; }
.form-error.ok { color: var(--good); }
.stack { display: grid; gap: 14px; }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); animation: fadeIn 0.3s ease-out; }
.login-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 52px; color: #fff;
  background-color: #0043FF;
  background-image: url("/assets/pattern.png");
  background-size: 150px 156px;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(165deg, rgba(14, 27, 43, 0) 35%, rgba(14, 27, 43, 0.6) 100%);
}
.login-brand > * { position: relative; z-index: 1; }
.login-logo { width: 160px; height: auto; }
.login-pitch { max-width: 440px; }
.login-pitch .eyebrow { color: rgba(255, 255, 255, 0.85); font-size: 12px; }
.login-pitch h1 { font-size: clamp(36px, 4.2vw, 54px); line-height: 1.04; font-weight: 800; letter-spacing: -0.03em; margin: 12px 0 16px; }
.login-pitch p { font-size: 16px; color: rgba(255, 255, 255, 0.88); max-width: 360px; line-height: 1.55; }
.login-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.login-points li { display: flex; gap: 10px; align-items: center; font-size: 14.5px; color: rgba(255, 255, 255, 0.92); }
.login-points .ico { width: 18px; height: 18px; color: #2BC48B; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.login-form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.login-form h2 { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; margin-top: 8px; }
.login-form h2 + .muted { margin-top: -12px; font-size: 14.5px; }
.login-logo-sm { display: none; width: 150px; height: auto; }
.login-help { color: var(--muted); font-size: 13px; text-align: center; line-height: 1.5; }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-logo-sm { display: block; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-logo-sm { content: url("/assets/logo-light-text.png"); }
}
:root[data-theme="dark"] .login-logo-sm { content: url("/assets/logo-light-text.png"); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  padding: 24px 14px 18px; background: var(--side-bg); color: var(--side-text);
}
.side-logo { padding: 2px 10px 0; display: block; }
.side-logo img { width: 140px; height: auto; display: block; }
.side-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; margin: 0 0 6px; color: #8392A5; font-weight: 600; }
.clinic-pick { padding: 12px; border: 1px solid var(--side-line); border-radius: 12px; background: rgba(255, 255, 255, 0.03); min-width: 0; }
.clinic-pick select {
  width: 100%; height: 38px; border-radius: 9px; padding: 0 10px;
  background: #14243A; border: 1px solid rgba(255, 255, 255, 0.12); color: #fff; font-size: 14px; font-weight: 600;
}
.clinic-name { color: var(--side-strong); font-size: 15px; font-weight: 650; display: block; overflow-wrap: anywhere; }
.clinic-sub { display: block; font-size: 12.5px; color: #8E9CAE; margin-top: 2px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-btn {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--side-text); text-decoration: none; font-weight: 550; font-size: 14.5px; border: 0; background: none;
  cursor: pointer; width: 100%; text-align: left; transition: background-color 0.15s, color 0.15s;
}
.side-nav a:hover, .side-btn:hover { background: var(--side-hover); color: var(--side-strong); }
.side-nav a[aria-current="page"] { background: var(--side-active); color: var(--side-strong); }
.side-nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #2BC48B;
}
.side-nav a[aria-current="page"] .ico { color: #8FAEFF; }
.side-foot { margin-top: auto; display: grid; gap: 4px; border-top: 1px solid var(--side-line); padding-top: 14px; }
.side-note { font-size: 12px; color: #77869A; padding: 8px 12px 0; line-height: 1.45; }

.main { min-width: 0; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.topbar { display: flex; align-items: center; gap: 16px; padding-top: 24px; padding-bottom: 10px; }
.top-title { flex: 1 1 auto; min-width: 0; }
.top-title h1 { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
.top-title .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.account { display: flex; align-items: center; gap: 12px; flex: none; min-width: 0; }
.account-text { display: grid; text-align: right; min-width: 0; max-width: 220px; line-height: 1.3; }
.account-text strong { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #0043FF, #2B6BFF); color: #fff; font-weight: 700; font-size: 13px;
}
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 18px; }
.updated { font-size: 12.5px; color: var(--muted); }
.content { padding-bottom: 56px; flex: 1; }
.content.is-loading .view { opacity: 0.55; transition: opacity 0.2s; pointer-events: none; }
.view:not([hidden]) { animation: viewIn 0.3s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes fadeIn { from { opacity: 0; } }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px;
  background: var(--crit-bg); color: var(--crit); font-weight: 600; font-size: 14px; margin-bottom: 16px;
  animation: fadeIn 0.2s ease-out;
}
.banner span:first-of-type { flex: 1 1 240px; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; transition: background-color 0.15s, color 0.15s;
}
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0, 67, 255, 0.3); }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head > div { min-width: 0; }
.card-head .muted { margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.grid-2 > .span-2 { grid-column: 1 / -1; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; }
.tile-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.tile-icon .ico { width: 18px; height: 18px; }
.tile-icon.good { background: var(--good-bg); color: var(--good); }
.tile-icon.crit { background: var(--crit-bg); color: var(--crit); }
.tile-icon.navy { background: var(--neutral-bg); color: var(--text-2); }
.tile-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.tile-value { font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.tile-value.sk { width: 56px; height: 32px; margin: 2px 0; }
.tile-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.tile-sub.sk { width: 80%; height: 12px; margin-top: 6px; }

.tile-hero {
  grid-column: span 2; grid-row: span 2; justify-content: space-between; gap: 18px; padding: 24px 26px;
  color: #fff; border: 0; position: relative; overflow: hidden;
  background:
    radial-gradient(110% 90% at 100% 0%, rgba(0, 67, 255, 0.6) 0%, rgba(0, 67, 255, 0) 58%),
    radial-gradient(70% 60% at 95% 105%, rgba(43, 196, 139, 0.28) 0%, rgba(43, 196, 139, 0) 60%),
    #0E1B2B;
}
.tile-hero .tile-label { color: #C9D3DF; display: flex; align-items: center; gap: 8px; }
.tile-hero .tile-label .ico { color: #8FAEFF; width: 17px; height: 17px; }
.tile-hero .tile-value { font-size: 60px; font-weight: 750; letter-spacing: -0.035em; line-height: 1; margin-top: 14px; }
.tile-hero .tile-value.sk { width: 90px; height: 58px; background: rgba(255, 255, 255, 0.1); animation: pulse 1.4s ease-in-out infinite; }
.tile-hero .tile-sub { color: #B9C5D3; font-size: 14.5px; max-width: 420px; margin-top: 10px; line-height: 1.5; }
.hero-split { display: flex; flex-wrap: wrap; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 16px; }
.hero-split div { display: grid; padding-right: 24px; margin-right: 24px; border-right: 1px solid rgba(255, 255, 255, 0.12); }
.hero-split div:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.hero-split strong { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.hero-split span { font-size: 12.5px; color: #A9B6C6; }

/* charts */
.chart { position: relative; min-height: 230px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line-soft); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--mark); transition: fill 0.12s; pointer-events: none; }
.chart svg.grow .bar {
  transform-box: fill-box; transform-origin: 50% 100%;
  animation: grow 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 10ms);
}
@keyframes grow { from { transform: scaleY(0); } }
.chart .hit { fill: transparent; outline: none; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { fill: var(--mark-hover); }
.chart .hit:focus-visible { stroke: var(--accent); stroke-width: 2; }
.chart .band { fill: var(--band); }
.chart .band-label { fill: var(--text-2); font-size: 11px; font-weight: 600; }
.chart .value-label { fill: var(--text-2); font-size: 11px; font-weight: 700; }
.chart-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.chart-table th, .chart-table td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--line-soft); }
.chart-table td:last-child, .chart-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.chart-wrap-table { max-height: 260px; overflow: auto; }
.chart-empty { display: grid; place-items: center; min-height: 210px; color: var(--muted); font-size: 13.5px; text-align: center; padding: 0 16px; }
.chart-sk { height: 210px; border-radius: 12px; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none; padding: 8px 12px; border-radius: 10px;
  background: var(--tip-bg); color: var(--tip-text); font-size: 12.5px; line-height: 1.35; box-shadow: var(--shadow-lg);
  max-width: 240px; animation: fadeIn 0.12s ease-out;
}
.tooltip strong { display: block; font-size: 16px; font-weight: 700; }
.tooltip span { opacity: 0.8; }

/* mini lists */
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; }
.mini-list li + li { border-top: 1px solid var(--line-soft); }
.mini-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 14px; align-items: center;
  padding: 11px 10px; margin: 0; border-radius: 10px; color: inherit; cursor: pointer;
  background: none; border: 0; width: 100%; text-align: left; transition: background-color 0.15s;
}
.card .mini-list { margin: 0 -10px; width: calc(100% + 20px); } /* hover wash reaches into the card padding */
.mini-row:hover { background: var(--surface-2); }
.mini-row .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .why { grid-column: 1 / -1; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.mini-empty { padding: 16px 0 6px; color: var(--muted); font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.mini-empty .ico { color: var(--good-dot); }
.mini-sk { padding: 12px 0; }

/* badges */
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--text-2); line-height: 1.5;
}
.badge .ico { width: 13px; height: 13px; }
.badge .ico svg { stroke-width: 2.2; }
.b-good { background: var(--good-bg); color: var(--good); }
.b-info { background: var(--accent-soft); color: var(--accent-ink); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-crit { background: var(--crit-bg); color: var(--crit); }

/* calls */
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 240px; max-width: 360px;
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input { border: 0; outline: 0; background: none; width: 100%; height: 100%; color: var(--text); min-width: 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { border-color: #C3CCD6; color: var(--text); }
.chip .n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-checked="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip[aria-checked="true"] .n { color: inherit; opacity: 0.75; }

.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.calls-table { width: 100%; border-collapse: collapse; }
.calls-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 650; color: var(--muted); padding: 13px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
  background: var(--surface-2);
}
.calls-table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: 13.5px; }
.calls-table tbody tr { cursor: pointer; transition: background-color 0.12s; }
.calls-table tbody tr:hover { background: var(--surface-2); }
.calls-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.calls-table tbody tr:last-child td { border-bottom: 0; }
.calls-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calls-table th.num { text-align: right; }
.c-when { white-space: nowrap; }
.c-when small, .c-who small { display: block; color: var(--muted); font-size: 12px; }
.c-who { min-width: 130px; max-width: 220px; }
.c-who strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.c-why { min-width: 180px; max-width: 380px; color: var(--text-2); }
.c-why span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mood { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.mood i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.mood.pos i { background: var(--good-dot); }
.mood.neg i { background: var(--crit); }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.table-foot:empty { display: none; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.row-sk td { cursor: default; }

/* call detail drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 17, 28, 0.45); z-index: 40; animation: fadeIn 0.2s ease-out; }
.drawer-backdrop.closing { animation: fadeOut 0.2s ease-in forwards; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); z-index: 50;
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn 0.28s var(--ease);
}
.drawer.closing { animation: slideOut 0.2s ease-in forwards; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes slideOut { to { transform: translateX(40px); opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 18px 24px 16px; border-bottom: 1px solid var(--line-soft); }
.drawer-head .avatar { width: 42px; height: 42px; font-size: 14px; }
.drawer-head > div { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-head .eyebrow { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; margin: 2px 0 0; }
.drawer-body { overflow-y: auto; padding: 18px 24px 40px; display: grid; gap: 22px; align-content: start; }
.drawer-section h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 650; margin-bottom: 10px; }
.player { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.player audio { width: 100%; height: 40px; }
.player-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.summary { font-size: 14.5px; color: var(--text); line-height: 1.65; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 18px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.kv dd .link-btn { padding: 0; }
.transcript { display: grid; gap: 12px; }
.line { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; }
.line .who-dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--neutral-bg); color: var(--text-2); margin-top: 2px;
}
.line.agent .who-dot { background: var(--side-bg); }
.line.agent .who-dot img { width: 12px; height: auto; }
.line .bubble {
  padding: 9px 13px; border-radius: 4px 14px 14px 14px; background: var(--surface-2); overflow-wrap: anywhere;
  transition: box-shadow 0.2s, background-color 0.2s;
}
.line.agent .bubble { background: var(--accent-soft); }
.line .meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.line .meta b { color: var(--text-2); font-weight: 650; }
.line .ts { border: 0; background: none; color: var(--accent-ink); font-size: 12px; padding: 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.line .ts:hover { text-decoration: underline; }
.line.playing .bubble { box-shadow: 0 0 0 2px var(--accent); }
.event {
  justify-self: center; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600;
  color: var(--text-2); padding: 4px 11px; border-radius: 999px; background: var(--neutral-bg);
}
.event.ok { color: var(--good); background: var(--good-bg); }
.event.fail { color: var(--crit); background: var(--crit-bg); }
.event .ico { width: 13px; height: 13px; }

/* clinic info */
.clinic-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 24px 26px;
  color: #fff; border: 0;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(0, 67, 255, 0.55) 0%, rgba(0, 67, 255, 0) 60%),
    #0E1B2B;
}
.clinic-hero .eyebrow { color: #A9B6C6; }
.clinic-hero h2 { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.clinic-hero .hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; color: #D0D8E2; font-size: 14px; }
.clinic-hero .hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.clinic-hero .hero-meta .ico { width: 16px; height: 16px; color: #8FAEFF; }
.clinic-hero a { color: #fff; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good-dot); box-shadow: 0 0 0 4px rgba(43, 196, 139, 0.25); }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.info-grid .card h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.info-grid .card h2 .ico {
  width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink);
}
.info-grid p { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.info-grid ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14px; display: grid; gap: 6px; line-height: 1.5; }
.hours { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 8px; }
.hours td { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.hours td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.hours tr.today td { font-weight: 700; color: var(--text); }
.hours tr.today td:first-child::after { content: " · today"; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.visit { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.visit:last-child { border-bottom: 0; }
.visit small { display: block; color: var(--muted); font-size: 12.5px; }
.visit b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.missing { color: var(--muted); font-style: italic; }
.policy + .policy { margin-top: 12px; }
.policy strong { display: block; font-size: 13.5px; margin-bottom: 2px; }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.steps { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; display: grid; gap: 6px; line-height: 1.5; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70;
  background: var(--tip-bg); color: var(--tip-text); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: toastIn 0.25s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-hero { grid-row: span 1; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-mood { display: none; }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
  }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .side-scrim { position: fixed; inset: 0; z-index: 44; background: rgba(8, 17, 28, 0.4); animation: fadeIn 0.2s ease-out; }
  .menu-btn { display: inline-grid; }
  .grid-2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .c-why { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .topbar { padding-top: 16px; }
  .top-title h1 { font-size: 22px; }
  .account-text, .account .lbl { display: none; }
  .account .btn-sm { width: 38px; padding: 0; }
  .toolbar .seg { flex: 1 1 100%; }
  .toolbar .seg button { flex: 1; padding: 7px 6px; }
  .tiles, .info-grid { grid-template-columns: minmax(0, 1fr); }
  .tile-hero { grid-column: auto; }
  .tile-hero .tile-value { font-size: 52px; }
  .clinic-hero { grid-template-columns: minmax(0, 1fr); }
  .c-len, .c-cost { display: none; }
  .calls-table td, .calls-table th { padding: 11px 10px; }
  .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
