/* ==========================================================================
   Telemedicine — design system
   Tokens → base → layout → components → pages. Light and dark themes. Inter/Poppins are self-hosted (public/assets/fonts) — no third-party font request, keeps working offline once cached, and satisfies our CSP (default-src 'self', no font-src exception needed).
   ========================================================================== */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter/inter-variable.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/inter/inter-variable.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/inter/inter-variable.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/inter/inter-variable.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/poppins/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/poppins/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/poppins/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/poppins/poppins-700.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/poppins/poppins-800.woff2') format('woff2'); }
:root {
  --bg: #f4f8fa;
  --surface: #ffffff;
  --surface-2: #eef4f7;
  --text: #0f1f2b;
  --muted: #566a7a;
  --brand: #1557c0;
  --brand-600: #0f47a1;
  --brand-100: #dce9fb;
  --brand-50: #eef4fd;
  --brand-ink: #0a2f87;
  --brand-green: #22b795;
  --brand-contrast: #ffffff;
  --accent: #f2a007;
  --border: #dbe5eb;
  --border-strong: #9fb1bf;
  --focus: #1a56db;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #05603a;
  --ok-bg: #ecfdf3;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --warn: #93370d;
  --warn-bg: #fffaeb;
  --match-yellow: #8a6d00;
  --hero-a: #0a2f87;
  --hero-b: #1557c0;
  --hero-c: #22b795;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 43, .06), 0 1px 3px rgba(15, 31, 43, .06);
  --shadow: 0 4px 14px rgba(15, 31, 43, .07), 0 2px 4px rgba(15, 31, 43, .04);
  --shadow-lg: 0 18px 40px rgba(6, 63, 69, .16), 0 4px 10px rgba(15, 31, 43, .06);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: 'Inter', system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: 'Poppins', 'Inter', system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b141b; --surface: #121f29; --surface-2: #17293a; --text: #e8eef2; --muted: #a3b3bf;
    --brand: #6ea0ff; --brand-600: #8db5ff; --brand-100: #12285a; --brand-50: #0e1f45; --brand-contrast: #06122e; --brand-ink: #dbe6ff; --brand-green: #3ed1af;
    --border: #23384a; --border-strong: #5f7c90; --focus: #7aa7ff;
    --danger: #ff8a80; --danger-bg: #3a1a18; --ok: #6ce9a6; --ok-bg: #0d2a1c; --info: #84caff; --info-bg: #10263f;
    --warn: #ffb86b; --warn-bg: #33230e; --match-yellow: #e8d44d;
    --hero-a: #071a4d; --hero-b: #1246a8; --hero-c: #128a76;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 4px 14px rgba(0, 0, 0, .35); --shadow-lg: 0 18px 40px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* The admin portal is a working tool: a slightly smaller, denser type scale than the public pages (everything is in rem). */
html.is-admin { font-size: 14px; }
html.is-admin h1 { font-size: clamp(1.5rem, 3vw, 1.75rem); margin-top: 22px; }
html.is-admin .field input[type=text], html.is-admin .field input[type=email], html.is-admin .field input[type=tel], html.is-admin .field input[type=password], html.is-admin .field input[type=number], html.is-admin .field input[type=search], html.is-admin .field input[type=date], html.is-admin .field input[type=time], html.is-admin .field input[type=datetime-local], html.is-admin .field select { min-height: 40px; padding: 8px 12px; }
html.is-admin .stat-value { font-size: 1.8rem; }
/* .site-nav a's rem size is tuned for the public 16px root; at the admin's 14px root it would drop below 12px. */
html.is-admin .site-nav a:not(.btn) { font-size: .95rem; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1 0 auto; }
img { max-width: 100%; }
:where(svg[focusable=false]) { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.2em; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-600); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px;
}
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin: 28px 0 10px; font-weight: 800; }
h2 { font-size: 1.25rem; margin: 30px 0 10px; font-weight: 700; }
h3 { font-size: .94rem; font-weight: 600; margin: 18px 0 6px; }
p { margin: 0 0 12px; }
.container { width: min(100% - 32px, 1140px); margin-inline: auto; }
.hint, .status-note { color: var(--muted); font-size: .85rem; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 10px max(16px, calc((100% - 1140px) / 2));
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border); transition: box-shadow .25s var(--ease);
}
.site-header.is-scrolled { box-shadow: var(--shadow); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--brand-ink); text-decoration: none; font-size: 1.2rem; letter-spacing: -.02em; }
.brand-logo { height: 38px; width: auto; display: block; flex: none; }
.brand-name { line-height: 1; }
.brand-tag { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin-top: 3px; }
.brand-text { display: grid; }
.brand:hover { color: var(--brand-ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--hero-b), var(--hero-c)); box-shadow: 0 4px 10px rgba(21, 87, 192, .30); }
.brand-mark svg { width: 20px; height: 20px; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a:not(.btn) { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: .82rem; }
.site-nav a:not(.btn):hover { background: var(--brand-50); color: var(--brand-600); }
.site-nav a[aria-current=page] { background: var(--brand-100); color: var(--brand-600); font-weight: 600; }
.site-nav .btn { margin-left: 6px; }
.site-nav .inline-form .link-button { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; }
.site-nav .inline-form .link-button:hover { background: var(--danger-bg); color: var(--danger); }
.nav-toggle { display: none; margin-left: auto; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; place-items: center; }
.nav-toggle svg { width: 22px; height: 22px; }

.workspace-nav { background: var(--surface); border-bottom: 1px solid var(--border); }
.workspace-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.workspace-nav a { display: block; padding: 12px 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .85rem; white-space: nowrap; border-bottom: 3px solid transparent; transition: color .15s, border-color .15s; }
.workspace-nav a:hover { color: var(--brand-600); }
.workspace-nav a[aria-current=page] { color: var(--brand-600); border-bottom-color: var(--brand); }

/* ---------- Buttons ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; min-height: 38px; font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer;
  background: linear-gradient(180deg, var(--brand), var(--brand-600)); color: var(--brand-contrast); border: 1px solid transparent; border-radius: 999px; text-decoration: none;
  box-shadow: 0 2px 6px rgba(21, 87, 192, .28); transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.btn:hover { color: var(--brand-contrast); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(21, 87, 192, .32); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-secondary, button.btn-secondary { background: var(--surface); color: var(--brand-600); border: 1px solid var(--brand); box-shadow: none; }
.btn-secondary:hover { background: var(--brand-50); color: var(--brand-600); box-shadow: none; }
.btn-danger, button.btn-danger { background: var(--danger); box-shadow: none; color: #fff; }
.btn-danger:hover { color: #fff; }
.btn-light, button.btn-light { background: #fff; color: #063f45; box-shadow: var(--shadow); }
.btn-light:hover { color: #063f45; }
.btn-ghost-light, button.btn-ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .55); box-shadow: none; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.btn-small { padding: 4px 11px; min-height: 30px; font-size: .82rem; }
.btn-lg { padding: 11px 22px; min-height: 46px; font-size: 1rem; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }

/* ---------- Forms ---------- */
/* Controls outside a .field wrapper (table cells, inline forms) still get the same look. */
:where(input:not([type=checkbox], [type=radio], [type=file], [type=hidden], [type=submit], [type=button], [type=range]), select, textarea) {
  font: inherit; color: var(--text); background: var(--surface); padding: 8px 12px; min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
:where(input[type=checkbox], input[type=radio]) { accent-color: var(--brand); }
table.list input:not([type=checkbox], [type=radio]), table.list select { width: 100%; min-width: 72px; }
.form { display: grid; gap: 18px; margin: 16px 0; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .95rem; }
.field .hint { margin: 0; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password], .field input[type=number],
.field input[type=search], .field input[type=date], .field input[type=time], .field input[type=datetime-local], .field select, .field textarea {
  width: 100%; padding: 10px 14px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--brand); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); outline: none; }
.field input[aria-invalid=true] { border-color: var(--danger); }
.field-error { color: var(--danger); margin: 0; font-size: .92rem; }
.field-error::before { content: "× "; font-weight: 700; }
.check { display: inline-flex; gap: 8px; align-items: center; margin: 2px 0; }
.form .check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
/* Segmented control, e.g. the sign-in "Patient / Provider" intent toggle: a row of radios styled as pill buttons. */
.segmented { display: flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; gap: 2px; }
.segmented label { flex: 1; text-align: center; padding: 9px 14px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.segmented input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.segmented label:has(input:checked) { background: var(--surface); color: var(--brand-600); box-shadow: var(--shadow-sm); }
.segmented label:hover { color: var(--brand-600); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 76px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--brand-600); font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.pw-toggle:hover { background: var(--brand-50); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 0; background: var(--surface); }
legend { font-weight: 700; padding: 0 8px; }
input[type=file] { max-width: 100%; padding: 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

/* ---------- Notices, badges, status ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; animation: slide-in .35s var(--ease); }
.notice-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: currentColor; }
.notice-icon > * { color: var(--surface); }
.notice-close { margin-left: auto; background: none; border: 0; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .7; }
.notice-close:hover { opacity: 1; }
.notice-success { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.notice-error { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.notice-info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.notice.is-leaving { opacity: 0; transform: translateY(-6px); transition: .3s; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.badge-ok { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); font-weight: 600; }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.status { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .86rem; font-weight: 600; border: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.status-ok { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.status-warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.status-bad { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.status-info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, transparent); }

/* ---------- Cards, tables, lists ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--surface); margin: 16px 0; box-shadow: var(--shadow-sm); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.qa-question-card { position: relative; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.qa-question-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.kv dt { color: var(--muted); font-size: .94rem; }
.kv dd { margin: 0; font-weight: 500; }
table.list { width: 100%; border-collapse: separate; border-spacing: 0; margin: 12px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.list th { text-align: left; padding: 11px 14px; background: var(--surface-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); }
table.list tbody th, table.list tfoot th, table.list th[scope=row] { background: transparent; text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--text); font-weight: 600; border-bottom: 1px solid var(--border); }
table.list tfoot th, table.list tfoot td { background: var(--surface-2); }
table.list td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { transition: background .15s; }
table.list tbody tr:hover { background: var(--brand-50); }
/* Opt a table into stacking as label:value cards on narrow screens instead of squeezing columns — add data-label="…" to each <td>. */
@media (max-width: 640px) {
  table.list.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  table.list.stack, table.list.stack tbody, table.list.stack tr, table.list.stack td { display: block; width: 100%; }
  table.list.stack { border-spacing: 0 10px; margin: 12px 0; background: none; border: 0; box-shadow: none; overflow: visible; }
  table.list.stack tbody tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 10px; padding: 4px 14px; }
  table.list.stack tbody tr:hover { background: var(--surface); }
  table.list.stack td { padding: 8px 0; border-bottom: 1px solid var(--border); }
  table.list.stack tr td:last-child { border-bottom: 0; }
  table.list.stack td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
  table.list.stack td:empty { display: none; }
}
.plain { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.codes { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 14px; border-radius: var(--radius-sm); columns: 2; list-style: none; margin: 8px 0; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; letter-spacing: .05em; word-break: break-all; background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); display: inline-block; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pager { display: flex; gap: 16px; align-items: center; margin: 16px 0; }
.wrap { word-break: break-word; max-width: 320px; }
details { margin: 8px 0; }
details summary { cursor: pointer; color: var(--brand-600); font-weight: 600; }
.todo { list-style: none; padding: 0; color: var(--warn); }
.rx-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; background: var(--surface); }
.rx-row legend { font-weight: 600; padding: 0 6px; }
.debug { background: var(--surface-2); border: 1px solid var(--border); padding: 12px; overflow-x: auto; border-radius: var(--radius-sm); }

/* ---------- Auth-style narrow pages ---------- */
.narrow { max-width: 480px; margin: 40px auto; padding: 30px 32px 26px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); position: relative; }
.narrow::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, var(--hero-b), var(--hero-c), var(--accent)); }
.narrow h1 { margin-top: 6px; font-size: 1.7rem; }
.form > .btn, .form > button.btn { justify-self: start; }
.narrow .btn[type=submit], .narrow .form .btn, .narrow .form > button.btn { width: 100%; justify-self: stretch; }
.narrow > p:last-child { margin-bottom: 0; }

/* ---------- Auth split layout (sign in / create account) ---------- */
.auth-split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: stretch; min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden; display: flex; align-items: center; color: #fff; min-height: 600px; padding: 64px 56px;
  background: radial-gradient(760px 360px at 88% -8%, rgba(255, 255, 255, .16), transparent 60%), linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 55%, var(--hero-c) 100%);
}
.auth-aside::after { content: ""; position: absolute; right: -90px; bottom: -110px; width: 340px; height: 340px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.auth-aside::before { content: ""; position: absolute; left: -80px; top: -90px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .05); }
.auth-brand { position: absolute; z-index: 2; top: 28px; left: 32px; display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; }
.auth-brand:hover { color: #fff; }
.auth-brand img { height: 30px; width: auto; display: block; }
.auth-aside-inner { position: relative; z-index: 1; max-width: 440px; margin-inline: auto; text-align: center; }
.auth-aside-inner h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 18px 0 12px; }
.auth-aside-inner .lead { color: rgba(255, 255, 255, .88); font-size: 1.02rem; margin-bottom: 22px; }
.auth-aside .trust-list { color: rgba(255, 255, 255, .9); display: inline-grid; text-align: left; margin-inline: auto; }
.auth-aside .trust-list li::before { color: #ffd57a; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin: 0 0 6px; }
.auth-card .form { margin: 18px 0; gap: 14px; }
.auth-card .field { gap: 5px; }
.auth-card .field label { font-size: .88rem; }
.auth-card .field input[type=text], .auth-card .field input[type=email], .auth-card .field input[type=tel], .auth-card .field input[type=password] {
  min-height: 40px; padding: 8px 12px; border-radius: 10px; font-size: .9rem;
}
.auth-card .pw-toggle { font-size: .78rem; }
.auth-card .segmented label { padding: 7px 14px; font-size: .88rem; }
.auth-card > p:last-child { margin: 18px 0 0; }
.auth-card-brand { display: none; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; min-height: 0; }
  .auth-aside { display: none; }
  .auth-form-side { padding: 36px 20px 56px; }
  .auth-card-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--brand-ink); text-decoration: none; font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; margin-bottom: 24px; }
  .auth-card-brand:hover { color: var(--brand-ink); }
  .auth-card-brand img { height: 30px; width: auto; display: block; }
  .auth-card .form .btn { justify-self: center; }
}

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px 0 88px;
  background: radial-gradient(900px 400px at 85% -10%, rgba(255, 255, 255, .16), transparent 60%), linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 55%, var(--hero-c) 100%);
}
.hero::after { content: ""; position: absolute; right: -80px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero::before { content: ""; position: absolute; left: -100px; top: -100px; width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .05); }
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); font-size: .88rem; font-weight: 600; }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 5.4vw, 3.4rem); line-height: 1.08; margin: 18px 0 16px; }
.hero h1 em { font-style: normal; color: #ffd57a; }
.hero .lead { font-size: 1.15rem; max-width: 34em; color: rgba(255, 255, 255, .9); }
.hero-search { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(170px, 1fr) auto; gap: 8px; background: var(--surface); padding: 8px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.hero-search .field { gap: 0; }
.hero-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.hero-search input, .hero-search select { border: 0 !important; background: var(--surface-2) !important; border-radius: 14px !important; min-height: 52px; box-shadow: none !important; }
.hero-search input:focus, .hero-search select:focus { box-shadow: 0 0 0 3px var(--brand-100) !important; }
.hero-search .btn { border-radius: 14px; min-height: 52px; }
.hero-links { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .92rem; color: rgba(255, 255, 255, .85); }
.hero-links a { color: #fff; text-decoration: none; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .22); }
.hero-links a:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.hero-visual { position: relative; min-height: 340px; }
.float-card { position: absolute; background: var(--surface); color: var(--text); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-lg); display: flex; gap: 12px; align-items: center; animation: float 6s ease-in-out infinite; }
.float-card strong { display: block; font-size: .98rem; }
.float-card span.sub { color: var(--muted); font-size: .84rem; }
.float-card .fc-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-100); color: var(--brand-600); flex: none; }
.float-card .fc-icon svg { width: 24px; height: 24px; }
.float-a { top: 6px; left: 8%; }
.float-b { top: 118px; right: 0; animation-delay: -2s; }
.float-c { bottom: 8px; left: 0; animation-delay: -4s; }
.float-card .fc-icon.warm { background: #fff1d6; color: #b45f06; }
.float-card .fc-icon.blue { background: #dde9ff; color: #1a56db; }

.section { padding: 56px 0 8px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 28px; }
.section-head h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); margin: 0 0 8px; font-weight: 800; }
.section-head p { color: var(--muted); margin: 0; }
.trust { margin-top: -48px; position: relative; z-index: 2; }
.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; }
.trust-item { display: flex; gap: 12px; align-items: center; padding: 18px 20px; border-right: 1px solid var(--border); }
.trust-item:last-child { border-right: 0; }
.trust-item .ti { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; flex: none; }
.trust-item .ti svg { width: 22px; height: 22px; }
.trust-item strong { display: block; line-height: 1.2; }
.trust-item span { color: var(--muted); font-size: .86rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.cat { display: flex; flex-direction: column; gap: 10px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.cat:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand); color: var(--text); }
.cat .ci { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); transition: background .2s, color .2s; }
.cat:hover .ci { background: var(--brand); color: var(--brand-contrast); }
.cat .ci svg { width: 26px; height: 26px; }
.cat strong { font-size: 1.02rem; }
.cat span.more { color: var(--brand-600); font-weight: 600; font-size: .9rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.feature { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .fi { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px; background: linear-gradient(135deg, var(--brand-100), var(--brand-50)); color: var(--brand); }
.feature .fi svg { width: 24px; height: 24px; }
.feature h3 { margin: 0 0 6px; }
.feature p { color: var(--muted); margin: 0; font-size: .96rem; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.how-step { position: relative; padding: 24px 22px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.how-step::before { counter-increment: step; content: counter(step); position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--hero-b), var(--hero-c)); box-shadow: 0 4px 10px rgba(21, 87, 192, .30); }
.how-step h3 { margin-top: 6px; }
.how-step p { color: var(--muted); margin: 0; }
.cta-band { margin: 56px 0 8px; padding: 36px 32px; border-radius: 24px; color: #fff; display: flex; gap: 24px; justify-content: space-between; align-items: center; flex-wrap: wrap; background: radial-gradient(500px 240px at 90% 0%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(135deg, var(--hero-a), var(--hero-b)); box-shadow: var(--shadow-lg); }
.cta-band h2 { margin: 0 0 6px; color: #fff; font-size: 1.6rem; }
.cta-band p { margin: 0; color: rgba(255, 255, 255, .88); max-width: 34em; }

/* ---------- Search and provider pages ---------- */
.search-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; margin: 16px 0; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
/* The filter form is inline on every page by default — CSS/JS below turns it into a full-screen sheet, opened from a
   "Filters" button, only on narrow screens and only once JS has run (without JS the form just stays inline and works). */
.filters-bar { display: none; margin: 0 0 12px; }
.filters-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #fff; color: var(--brand-600); font-size: .72rem; font-weight: 800; }
.filters-panel-head { display: none; }
@media (max-width: 640px) {
  .js .filters-bar { display: block; }
  .js .filters-panel { display: none; }
  .js .filters-panel.is-open {
    display: block; position: fixed; inset: 0; z-index: 70; overflow-y: auto; background: var(--bg); padding: 16px; animation: slide-up .22s var(--ease);
  }
  .js .filters-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .js .filters-panel-head h2 { margin: 0; }
  .js .filters-close { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
  .js .filters-panel .search-form { display: grid; grid-template-columns: 1fr; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
  .js .filters-panel .search-form .btn { position: sticky; bottom: 0; }
  body.filters-open { overflow: hidden; }
}
.results { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 14px; }
.provider-card { position: relative; display: flex; flex-direction: column; gap: 10px; margin: 0; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.provider-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.provider-card h2 { margin: 0; font-size: 1.05rem; }
.provider-card h2 a { text-decoration: none; color: var(--text); }
.provider-card h2 a:hover { color: var(--brand-600); }
/* Makes a whole card a click target while keeping one real link for a11y/SEO. The card needs position: relative. */
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.provider-card p { margin: 0; }
.pc-top { display: flex; gap: 12px; align-items: flex-start; }
.pc-top .avatar, .pc-top .avatar-blank { width: 52px; height: 52px; border-radius: 50%; font-size: 1.3rem; }
.pc-id { flex: 1; min-width: 0; }
.pc-specialty { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.pc-price { flex: none; text-align: right; display: grid; justify-items: end; line-height: 1.15; }
.pc-price strong { font-size: 1.05rem; color: var(--brand-600); }
.pc-price .hint { font-size: .72rem; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--muted); }
.pc-rating, .pc-location { display: inline-flex; align-items: center; gap: 4px; }
.pc-rating svg { width: 14px; height: 14px; color: var(--accent); }
.pc-location svg { width: 14px; height: 14px; flex: none; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag-ok { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.tag-gold { color: #92610a; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tag-mode { color: var(--brand-600); background: var(--brand-50); border-color: var(--brand-100); }
.pc-bio { color: var(--muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-cta { margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--brand-600); font-weight: 650; font-size: .85rem; }
.avatar { width: 68px; height: 68px; border-radius: 20px; object-fit: cover; flex: none; }
.avatar-lg { width: 104px; height: 104px; border-radius: 28px; }
.avatar-blank { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--hero-b), var(--hero-c)); color: #fff; font-weight: 800; font-size: 1.7rem; }
.store-head { display: flex; gap: 22px; align-items: center; margin: 20px 0 8px; flex-wrap: wrap; padding: 22px; background: linear-gradient(135deg, var(--brand-50), var(--surface)); border: 1px solid var(--border); border-radius: 20px; }
.store-head h1 { margin: 0 0 6px; }
.store-head .avatar, .store-head .avatar-blank { border-radius: 50%; }
.price-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.price-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.price-list li .btn { margin-left: auto; }
.store-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.store-main { min-width: 0; }
.store-aside { position: sticky; top: 84px; display: grid; gap: 16px; }
.store-aside .card, .store-aside .panel { margin: 0; }
.store-cta .btn { width: 100%; margin-bottom: 4px; }
.store-cta p { margin-bottom: 10px; }
.trust-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; color: var(--muted); font-size: .92rem; }
.trust-list li { display: flex; gap: 8px; align-items: flex-start; }
.trust-list li::before { content: "✓"; color: var(--ok); font-weight: 800; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 22px 18px; margin: 16px 0; box-shadow: var(--shadow-sm); }
.panel > h2:first-child { margin-top: 16px; }
.panel .card { box-shadow: none; background: var(--bg); }
.store-aside table.list { box-shadow: none; }

/* ---------- Booking & status ---------- */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.slot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s, transform .15s; font-weight: 500; }
.slot:hover { border-color: var(--brand); background: var(--brand-50); transform: translateY(-1px); }
.slot:has(input:checked) { border-color: var(--brand); background: var(--brand-100); box-shadow: 0 0 0 3px var(--brand-100); }
.slot input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- Provider onboarding ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.steps li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; }

/* ---------- Consultation room & chat ---------- */
.video-frame { width: 100%; height: min(70vh, 640px); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; background: #000; }
.chat-log { list-style: none; margin: 0 0 12px; padding: 14px; max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border-radius: var(--radius); }
.msg { max-width: 82%; padding: 9px 14px; border-radius: 18px; border: 1px solid var(--border); display: grid; gap: 2px; overflow-wrap: anywhere; animation: pop .25s var(--ease); }
.msg-mine { align-self: flex-end; background: var(--brand); color: var(--brand-contrast); border-color: var(--brand); border-bottom-right-radius: 5px; }
.msg-mine .msg-meta, .msg-mine a { color: inherit; opacity: .85; }
.msg-theirs { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 5px; }
.msg-meta { font-size: .78rem; color: var(--muted); }
.msg-file { font-size: .95rem; }

/* ---------- Admin ---------- */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; margin-top: 20px; }
.admin-nav { position: sticky; top: 78px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow-sm); }
.admin-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.admin-nav a { display: block; padding: 9px 14px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 500; transition: background .15s, padding .15s; }
.admin-nav a:hover { background: var(--brand-50); padding-left: 18px; }
.admin-nav a[aria-current=page] { background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: var(--brand-contrast); font-weight: 650; }
.admin-main { min-width: 0; }
.admin-main > h1:first-child { margin-top: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { margin: 0; text-align: left; position: relative; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 84px; height: 84px; border-radius: 50%; background: var(--brand-50); }
.stat-value { font-size: 2.1rem; font-weight: 800; margin: 0; letter-spacing: -.02em; position: relative; z-index: 1; color: var(--brand-600); }
.stat-label { color: var(--muted); margin: 0; position: relative; z-index: 1; font-size: .94rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.quick { display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.quick:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); }
.quick strong { color: var(--brand-600); }
.quick span { color: var(--muted); font-size: .9rem; }
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-form .field { min-width: 160px; }
.matrix-wrap { overflow-x: auto; }
.matrix th.rotate { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; height: 9em; }
.matrix td, .matrix th { padding: 4px 6px; text-align: center; }
.matrix th[scope=row] { text-align: left; white-space: nowrap; }

/* ---------- Footer & errors ---------- */
.error-page { padding: 64px 0; text-align: center; }
.error-code { margin: 0; font-size: 4.5rem; font-weight: 800; color: var(--brand); }
/* Same blue as the hero — hero-b stays dark enough for white text in both light and dark themes, so the footer never needs its own theme override. */
.site-footer { margin-top: 64px; background: var(--hero-b); border-top: 0; color: rgba(255, 255, 255, .82); }
.site-footer .brand, .site-footer .brand-name { color: #fff; }
.site-footer .brand-tag { color: rgba(255, 255, 255, .6); }
.site-footer .hint { color: rgba(255, 255, 255, .68); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding: 36px 0 20px; }
.footer-grid h4 { margin: 0 0 10px; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(255, 255, 255, .55); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-grid a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.footer-grid a:hover { color: #fff; text-decoration: underline; }
.footer-note { border-top: 1px solid rgba(255, 255, 255, .18); padding: 16px 0 24px; color: rgba(255, 255, 255, .6); font-size: .88rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-footer.container { width: 100%; }
.site-footer .container { width: min(100% - 32px, 1140px); }

/* ---------- Motion ---------- */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .reveal-2 { transition-delay: .08s; }
.js .reveal-3 { transition-delay: .16s; }
.js .reveal-4 { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .hero { padding: 48px 0 80px; }
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-item:nth-child(2) { border-right: 0; }
  .trust-item:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .how { grid-template-columns: 1fr; gap: 28px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) { .store-layout { grid-template-columns: 1fr; } .store-aside { position: static; } }
@media (max-width: 760px) {
  /* minmax(0, 1fr), not bare 1fr: a bare fr track's automatic minimum is its content's max-content size, which
     let .admin-main's descendants force this track (and the whole page) wider than the viewport. */
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { position: static; }
  .admin-nav ul { grid-auto-flow: column; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
  /* repeat(auto-fit, minmax(190px, 1fr)) loses track of the real available width when nested inside
     .admin-shell's own grid track, and lays out one column per item instead of wrapping — forcing the
     whole page wider than the viewport. Stack to one column instead of relying on auto-fit here. */
  .stat-grid, .quick-grid { grid-template-columns: 1fr; }
  .hero-search { grid-template-columns: 1fr; }
  .narrow { margin: 20px auto; padding: 24px 20px 20px; }
  .provider-card { flex-direction: column; }
  table.list th, table.list td { padding: 10px 8px; overflow-wrap: anywhere; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .js .nav-toggle { display: grid; }
  .js .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; padding: 12px 16px 16px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .js .site-nav.is-open { display: flex; animation: slide-in .25s var(--ease); }
  .js .site-nav a:not(.btn), .js .site-nav .inline-form .link-button { display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; }
  .site-nav .btn { margin: 6px 0 0; }
  .site-header { flex-wrap: wrap; }
  .site-nav { margin-left: 0; width: 100%; flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .trust-grid { grid-template-columns: 1fr; }
  .trust-item, .trust-item:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--border); }
  .trust-item:last-child { border-bottom: 0; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Installable app: safe areas, install banner, bottom tab bar ---------- */
html { -webkit-tap-highlight-color: transparent; }
a, button, summary, label, select { touch-action: manipulation; }
.site-header { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left), calc((100% - 1140px) / 2)); padding-right: max(16px, env(safe-area-inset-right), calc((100% - 1140px) / 2)); }

.install-banner { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; max-width: 520px; margin-inline: auto; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); animation: slide-up .4s var(--ease); }
.install-banner img { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.install-copy { display: grid; line-height: 1.3; min-width: 0; flex: 1; }
.install-copy span { color: var(--muted); font-size: .88rem; }
.install-close { background: none; border: 0; color: var(--muted); font-size: 1.5rem; line-height: 1; padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.install-close:hover { background: var(--surface-2); color: var(--text); }
@keyframes slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.tabbar { display: none; }
@media (max-width: 760px) {
  body.has-tabbar { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a[aria-current=page] { color: var(--brand-600); background: var(--brand-50); }
  .install-banner { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:not(.has-tabbar) .install-banner { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) {
  .footer-grid { display: none; }
  .site-footer { margin-top: 24px; }
  body { overscroll-behavior-y: none; }
}

/* ---------- App-style home (phones), tips, messages ---------- */
.app-home { display: none; }
.tip-art { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, var(--brand-100), var(--brand-50)); color: var(--brand); }
.tip-art svg { width: 28px; height: 28px; }
.tip-art-lg { width: 72px; height: 72px; border-radius: 20px; margin: 8px 0 4px; }
.tip-art-lg svg { width: 36px; height: 36px; }
.tip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 16px 0; }
.tip-card { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.tip-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); }
.tip-copy { display: grid; gap: 4px; }
.tip-more { color: var(--brand-600); font-weight: 600; font-size: .9rem; }
.article { max-width: 720px; margin-inline: auto; }
.article h1 { margin-top: 8px; }
.article-list { padding-left: 1.2em; display: grid; gap: 6px; }
.article-references { padding-left: 1.4em; display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }

/* ---------- Medical blog: search hero, cover-image cards, article hero, share row ---------- */
.blog-hero { background: radial-gradient(900px 400px at 85% -10%, rgba(255, 255, 255, .12), transparent 60%), linear-gradient(135deg, #0d3d33 0%, #145c4f 55%, #1f7a63 100%); padding: 64px 0 56px; text-align: center; }
.blog-hero-inner { position: relative; z-index: 1; max-width: 760px; margin-inline: auto; }
.blog-hero h1 { color: #fff; font-size: clamp(1.9rem, 4.6vw, 2.8rem); line-height: 1.15; margin: 16px 0 12px; }
.blog-hero .lead { color: rgba(255, 255, 255, .88); max-width: 46em; margin-inline: auto; }
.blog-search { max-width: 620px; margin: 26px auto 0; display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 999px; box-shadow: var(--shadow-lg); padding: 6px; }
.blog-search-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; color: var(--muted); }
.blog-search-icon svg { width: 20px; height: 20px; }
.blog-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1rem; color: var(--text); padding: 10px 2px; }
.blog-search input:focus { outline: none; }
.blog-search-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; background: var(--brand); color: #fff; cursor: pointer; transition: background .15s; }
.blog-search-btn svg { width: 18px; height: 18px; }
.blog-search-btn:hover { background: var(--brand-600); }
.blog-hero-status { margin: 14px 0 0; color: rgba(255, 255, 255, .85); font-size: .9rem; }
.blog-hero-status a { color: #fff; text-decoration: underline; }
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 16px 0; }
.blog-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.blog-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); }
.blog-card-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-alt, var(--brand-50)); }
.blog-card-body { padding: 16px; display: grid; gap: 6px; }
.blog-card-meta { color: var(--muted); font-size: .82rem; }
.blog-more { color: var(--brand-600); font-weight: 600; }
.blog-hero-cover { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius); margin: 12px 0 4px; }
.blog-byline { color: var(--muted); margin: 4px 0 16px; }
.blog-share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.blog-share a, .blog-share button.link-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); text-decoration: none; font-size: .85rem; font-weight: 600; }
.blog-share a svg, .blog-share button.link-button svg { width: 16px; height: 16px; flex: none; }
.blog-share a:hover, .blog-share button.link-button:hover { border-color: var(--brand); color: var(--brand); }
.blog-share-whatsapp:hover { border-color: #25D366; color: #25D366; }
.blog-share-facebook:hover { border-color: #1877F2; color: #1877F2; }
.blog-share-x:hover { border-color: var(--text); color: var(--text); background: var(--surface-alt, #f2f2f2); }
@media (max-width: 860px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  /* One column on phones: each card stays vertical (image on top, body below), just a single list, not a grid. */
  .blog-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ---------- STG Assistant: reference-tool hero, chapter/result cards, condition detail ---------- */
.stg-hero { background: radial-gradient(900px 400px at 85% -10%, rgba(255, 255, 255, .14), transparent 60%), linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 65%, var(--hero-c) 100%); padding: 56px 0 48px; text-align: center; }
.stg-hero-inner { position: relative; z-index: 1; max-width: 760px; margin-inline: auto; }
.stg-hero h1 { color: #fff; font-size: clamp(1.7rem, 4.2vw, 2.5rem); line-height: 1.18; margin: 16px 0 12px; }
.stg-hero .lead { color: rgba(255, 255, 255, .88); max-width: 46em; margin-inline: auto; }
.stg-edition { display: inline-flex; margin-top: 14px; color: rgba(255, 255, 255, .75); font-size: .82rem; }
.stg-chapters { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stg-chapter-link { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.stg-chapter-link:hover { border-color: var(--brand); transform: translateY(-2px); color: var(--text); }
.stg-chapter-num { flex: none; color: var(--brand-600); font-weight: 700; }
.stg-chapter-title { flex: 1; }
.stg-chapter-count { flex: none; color: var(--muted); font-size: .82rem; }
.stg-results { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.stg-result { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow-sm); }
.stg-result h2, .stg-result h3 { margin: 0 0 2px; font-size: 1.02rem; }
.stg-result .hint { margin: 0 0 6px; }
.stg-result-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.stg-result-actions .btn { padding: 3px 10px; min-height: 26px; font-size: .76rem; }

/* ---------- Symptom Check: "Other symptoms" modal ---------- */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 31, 43, .5); }
.modal-backdrop[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: 480px; width: 100%; max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex: none; }
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-close { border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 999px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); flex: none; }
.modal-symptom-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.symptom-modal-chip { display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text); font-size: .88rem; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.symptom-modal-chip:hover { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600); }
.symptom-modal-chip.is-selected { border-color: var(--brand); background: var(--brand); color: var(--brand-contrast); font-weight: 600; }
.progress-track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-600)); border-radius: 999px; }

/* ---------- Symptom Check: two-panel picker ---------- */
.symptom-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: stretch; margin: 24px 0; }
.symptom-panel, .checker-panel { margin: 0; }
.symptom-quickpicks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.symptom-quickpick { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); font-size: .88rem; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.symptom-quickpick:hover { border-color: var(--brand); }
.symptom-quickpick input { accent-color: var(--brand); width: 15px; height: 15px; }
.symptom-quickpick.is-checked { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.symptom-picker-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.symptom-picker-head .search-wrap { flex: 1; min-width: 220px; }
.symptom-picker-head .mh-search { max-width: none; margin: 0; }
.symptom-grid { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 4px 0; }
.symptom-alpha { position: sticky; top: 0; z-index: 1; padding: 4px 14px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.symptom-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: .88rem; cursor: pointer; }
.symptom-item:hover { background: var(--surface-2); }
.symptom-item input { accent-color: var(--brand); width: 16px; height: 16px; flex: none; }

/* Stretched to match the left panel's height (grid align-items: stretch) and capped to the viewport too, so a
   short left panel (few quickpicks, filtered list) still leaves the right panel scrollable rather than
   unbounded-tall; only .checker-results scrolls internally, so the summary/button stay in view. */
.checker-panel { position: sticky; top: 76px; display: flex; flex-direction: column; max-height: calc(100vh - 96px); overflow: hidden; }
#selected-summary { min-height: 24px; flex: none; }
.selected-summary-text { margin: 0; }
.checker-actions { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.checker-results { margin-top: 10px; overflow-y: auto; flex: 1; min-height: 0; }
.checker-placeholder { color: var(--muted); font-size: .92rem; line-height: 1.6; }

.match-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.match-meter .progress-track { flex: 1; margin-top: 0; }
.match-pct { flex: none; font-size: .82rem; font-weight: 700; }
.progress-fill.match-red, .match-pct.match-red { color: var(--danger); }
.progress-fill.match-red { background: var(--danger); }
.progress-fill.match-yellow, .match-pct.match-yellow { color: var(--match-yellow); }
.progress-fill.match-yellow { background: var(--match-yellow); }
.progress-fill.match-amber, .match-pct.match-amber { color: var(--warn); }
.progress-fill.match-amber { background: var(--warn); }
.progress-fill.match-green, .match-pct.match-green { color: var(--ok); }
.progress-fill.match-green { background: var(--ok); }

@media (max-width: 860px) {
    .symptom-check-grid { grid-template-columns: 1fr; }
    .checker-panel { position: static; display: block; max-height: none; overflow: visible; }
    .checker-results { overflow-y: visible; flex: none; }
}
.stg-section { margin: 0 0 18px; }
.stg-section h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-600); margin: 0 0 8px; }
.stg-section p { margin: 0 0 10px; }
.stg-section ul { margin: 0 0 10px; padding-left: 1.4em; display: grid; gap: 4px; }
.stg-section li::marker { color: var(--brand-600); }
.stg-caption { font-weight: 650; color: var(--muted); font-size: .9rem; margin: 14px 0 6px; }
.stg-table { white-space: pre; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .78rem; line-height: 1.5; color: var(--muted); margin: 0 0 12px; }
.stg-disclaimer { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 20px; }
@media (max-width: 560px) { .stg-chapters { grid-template-columns: 1fr; } }

/* ---------- Medicine Hub: search hero, product cards, seller contact ---------- */
.mh-hero { background: radial-gradient(900px 400px at 85% -10%, rgba(255, 255, 255, .12), transparent 60%), linear-gradient(135deg, #0d3d33 0%, #145c4f 55%, #1f7a63 100%); padding: 56px 0 48px; text-align: center; }
.mh-hero-inner { position: relative; z-index: 1; max-width: 760px; margin-inline: auto; }
.mh-hero h1 { color: #fff; font-size: clamp(1.7rem, 4.2vw, 2.5rem); line-height: 1.18; margin: 16px 0 12px; }
.mh-hero .lead { color: rgba(255, 255, 255, .88); max-width: 46em; margin-inline: auto; }
.mh-search { max-width: 600px; margin: 24px auto 0; display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 999px; box-shadow: var(--shadow-lg); padding: 6px; }
.mh-search-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; color: var(--muted); }
.mh-search-icon svg { width: 20px; height: 20px; }
.mh-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1rem; color: var(--text); padding: 10px 2px; }
.mh-search input:focus { outline: none; }
.mh-search-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; background: var(--brand); color: #fff; cursor: pointer; }
.mh-search-btn svg { width: 18px; height: 18px; }
.mh-search-btn:hover { background: var(--brand-600); }
.mh-hero-cats { margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mh-hero-cats a { color: rgba(255, 255, 255, .9); text-decoration: none; padding: 5px 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); font-size: .85rem; }
.mh-hero-cats a:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.mh-hero-cats a.is-active { background: #fff; color: #145c4f; font-weight: 600; border-color: #fff; }
.mh-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin: 16px 0; }
.mh-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.mh-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); }
.mh-card-cover { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--brand-50); }
.mh-card-body { padding: 14px; display: grid; gap: 4px; }
.mh-card-cat { color: var(--brand-600); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.mh-card-price { font-weight: 700; margin-top: 4px; }
.mh-price { font-size: 1.3rem; font-weight: 700; color: var(--brand-600); margin: 4px 0 12px; }
.mh-seller { margin-top: 24px; }
.mh-contact { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 1100px) { .mh-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .mh-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  /* A single column of horizontal rows (small image, larger details) reads better than a cramped 2-up grid. */
  .mh-grid { grid-template-columns: 1fr; gap: 10px; }
  .mh-card { flex-direction: row; align-items: stretch; }
  .mh-card-cover { width: 96px; height: 96px; aspect-ratio: auto; flex: none; }
  .mh-card-body { padding: 10px 12px; gap: 3px; }
  .mh-card-body strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
/* A provider's own listings: a table on wider screens, a tap-friendly card list on phones (the generic table.list gets cramped and wraps badly at phone widths). */
.mh-manage-list { display: none; }
.mh-manage-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.mh-manage-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
@media (max-width: 640px) {
  .mh-manage-table { display: none; }
  .mh-manage-list { display: block; }
}
.thread-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.thread { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .2s, transform .2s var(--ease); }
.thread:hover { border-color: var(--brand); transform: translateY(-2px); color: var(--text); }
.thread-avatar { width: 48px; height: 48px; font-size: 1.2rem; border-radius: 50%; }
.thread-body { display: grid; flex: 1; min-width: 0; }
.thread-body .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { display: grid; justify-items: end; gap: 6px; }
.unread { min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--brand); color: var(--brand-contrast); font-size: .8rem; font-weight: 700; text-align: center; }
.empty-state { text-align: center; padding: 32px 20px; }

@media (max-width: 760px) {
  .desktop-home { display: none; }
  .app-home { display: block; padding: 8px 16px 24px; }
  .app-logo { text-align: center; margin: 4px 0 2px; }
  .app-logo img { width: 170px; height: auto; }
  .app-hello { font-size: 1.7rem; margin: 10px 0 2px; color: var(--brand-ink); }
  .app-sub { color: var(--muted); margin-bottom: 18px; }
  .app-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .tile { display: grid; justify-items: center; align-content: center; gap: 8px; padding: 16px 6px 12px; min-height: 108px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); text-align: center; transition: transform .15s var(--ease), border-color .2s; }
  .tile:active { transform: scale(.97); }
  .tile:hover { color: var(--text); border-color: var(--brand); }
  .tile-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--brand); }
  .tile-icon svg { width: 34px; height: 34px; }
  .tile-green .tile-icon { color: var(--brand-green); }
  .tile-label { font-size: .78rem; font-weight: 600; line-height: 1.25; }
  .app-section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 2px 10px; }
  .app-section-head h2 { margin: 0; font-size: 1.05rem; color: var(--brand-ink); }
  .app-section-head a { font-size: .9rem; font-weight: 600; text-decoration: none; }
  .app-tips { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 10px; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .app-tips::-webkit-scrollbar { display: none; }
  .app-tip { flex: 0 0 82%; scroll-snap-align: start; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
  .app-tip:hover { color: var(--text); }
  .app-tip-copy { display: grid; gap: 8px; }
  .app-tip-more { color: var(--brand-600); font-size: .85rem; font-weight: 600; }
  /* Header on phones: menu button on the left, brand next to it; the home page shows the full logo itself. */
  .js .nav-toggle { order: -1; margin-left: 0; }
  body.is-home .site-header .brand { visibility: hidden; }
  .tabbar a { font-size: .68rem; }
  .thread-list { margin-top: 8px; }
}

/* ---------- Notification bell ---------- */
.site-nav { order: 2; }
.bell { order: 3; position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text); text-decoration: none; flex: none; transition: background .15s; }
.bell:hover { background: var(--brand-50); color: var(--brand-600); }
.bell[aria-current=page] { background: var(--brand-100); color: var(--brand-600); }
.bell svg { width: 24px; height: 24px; }
.bell-badge { position: absolute; top: 3px; right: 1px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 19px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.bell-badge[hidden] { display: none; }
.bell.is-ringing svg { animation: ring .9s var(--ease); transform-origin: 50% 0; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.notif-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .2s, transform .2s var(--ease); }
.notif:hover { border-color: var(--brand); transform: translateY(-2px); color: var(--text); }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; background: transparent; }
.notif.is-unread { background: var(--brand-50); border-color: var(--brand-100); }
.notif.is-unread .notif-dot { background: var(--brand); }
.notif-body { display: grid; gap: 2px; min-width: 0; }
@media (max-width: 760px) {
  .js .nav-toggle { order: -1; }
  .bell { margin-left: auto; }
  .js .site-nav { order: 4; }
}
@media (min-width: 761px) { .bell { margin-left: 2px; } }

@media print { .site-header, .site-footer, .skip-link, form, .actions { display: none !important; } body { background: #fff; } }

/* Tabs: shown as jump links without JavaScript, as a tab strip with it. */
.tab-nav { display: flex; gap: 4px; margin: 0 0 16px; padding: 0; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tab-nav::-webkit-scrollbar { display: none; }
.tab-nav a { flex: 0 0 auto; padding: 10px 16px 8px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.tab-nav a:hover { color: var(--brand); background: var(--brand-50); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tab-nav a[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tab-nav a:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tabs:not(.is-tabbed) .tab-panel + .tab-panel { margin-top: 16px; }
.tab-panel[hidden] { display: none; }
.tab-count { display: inline-block; min-width: 1.5em; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .8em; font-weight: 700; text-align: center; line-height: 1.6; }
.tab-nav a[aria-selected="true"] .tab-count { background: var(--brand-100); color: var(--brand-ink); }
/* A panel whose first heading only repeats its tab name: hide that heading once the tab strip is active. */
.is-tabbed > .tab-flat > h2:first-child { display: none; }
.tab-flat > :first-child { margin-top: 0; }
/* ---------- Visit record (encounter) ---------- */
.enc-back { display: inline-flex; gap: 6px; align-items: center; margin: 16px 0 0; font-weight: 600; text-decoration: none; font-size: .95rem; }
.enc-head { position: relative; overflow: hidden; margin: 10px 0 20px; padding: 24px 26px 20px; }
.enc-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--hero-b), var(--hero-c)); }
.enc-who { display: flex; gap: 16px; align-items: center; }
.enc-avatar { width: 60px; height: 60px; border-radius: 18px; font-size: 1.35rem; }
.enc-head h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 1.85rem); }
.enc-head h1 small { margin-left: 10px; font-size: .55em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.enc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 6px 0 0; color: var(--muted); }
.enc-reason { margin: 16px 0 0; padding: 12px 16px; border-left: 4px solid var(--brand-green); background: var(--brand-50); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.enc-reason strong { display: block; margin-bottom: 2px; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.enc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; align-items: start; }
.enc-main { min-width: 0; }
.enc-aside { position: sticky; top: 84px; display: grid; gap: 14px; }
.enc-aside .card { margin: 0; padding: 16px; }
.enc-aside h2 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.enc-aside .plain { margin: 0; gap: 6px; font-size: .95rem; }
.glance { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
.glance > div { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.glance dt { font-size: .74rem; color: var(--muted); }
.glance dd { margin: 0; font-size: 1.05rem; font-weight: 700; }
.glance-wide { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); margin-bottom: 16px; }
.glance-wide > div { background: var(--brand-50); }
.glance-wide dd { color: var(--brand-ink); font-size: 1.2rem; }

.note { padding: 0; overflow: hidden; }
.note-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 11px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.note-body { padding: 16px 18px; }
.note-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 24px; margin: 0; }
.note-fields dt { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.note-fields dd { margin: 2px 0 0; }
.note-body .notice { margin: 16px 0 0; }
.more { margin-top: 14px; }
.more > summary { cursor: pointer; font-weight: 600; color: var(--brand-600); }
.more[open] > summary { margin-bottom: 10px; }

.composer { margin: 18px 0; }
.composer > summary { list-style: none; cursor: pointer; }
.composer > summary::-webkit-details-marker { display: none; }
.composer[open] > summary { margin-bottom: 12px; }
.composer-body { margin: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.form-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 20px; }
.form-cols .span-all { grid-column: 1 / -1; }
.rx-more > summary { margin-bottom: 8px; }

.dx-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.dx-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.dx-text { flex: 1 1 200px; }
.code-chip { display: inline-block; padding: 2px 9px; border-radius: 7px; background: var(--brand-50); color: var(--brand-ink); font: 700 .85rem/1.5 ui-monospace, Consolas, monospace; text-decoration: none; }
a.code-chip:hover { background: var(--brand-100); }
.empty { margin: 0 0 12px; padding: 22px; border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; color: var(--muted); }
.enc-table-wrap { overflow-x: auto; margin-bottom: 8px; }
.enc-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; margin-top: 18px; }
.enc-cols .card { margin: 0; }
.enc-complete { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-top: 24px; }
.enc-complete p { margin: 2px 0 0; }
.enc-complete .btn { flex: none; }

@media (max-width: 900px) {
  .enc-layout { grid-template-columns: 1fr; }
  .enc-aside { display: none; }   /* everything in it is in the tabs; on a phone the tabs come first */
  .enc-head { padding: 20px 18px 16px; }
}

.apply-group-label { margin: 18px 0 4px; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- Printable download pages (prescriptions, diagnostic requests): these pages have no layout, only this
   stylesheet, and the site's CSP (style-src 'self') blocks any inline <style>/style="" — so every rule they need
   must live here, scoped under .dl-page rather than bare element selectors. */
.dl-page { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }
.dl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
.dl-head p.hint { margin: 0; }
.dl-right { text-align: right; }
.dl-actions { margin: 0 0 20px; }
dl.dl-facts { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0 0 20px; }
dl.dl-facts dt { color: var(--muted); }
dl.dl-facts dd { margin: 0; }
@media print {
  .dl-actions, .skip-link { display: none !important; }
  .dl-page { max-width: none; padding: 0; }
  .dl-page a { color: inherit; text-decoration: none; }
}
.apply-group-label:first-of-type { margin-top: 4px; }
