/* ═══════════════════════════════════════════════════════════════
   Hospital Jarvis, app styles
   ═══════════════════════════════════════════════════════════════ */

:root {
  --brand-900: #0b2a63;
  --brand-800: #11388a;
  --brand-700: #1747a6;
  --brand-600: #1a5fb4;
  --brand-500: #0f9488;
  --brand-100: #dbe7fa;
  --brand-50: #eef4fd;
  --mint: #2dd4bf;
  /* Logo colours: blue cross, teal side. Text-safe teal is --brand-teal-ink (5:1 on white). */
  --brand-blue: #1747a6;
  --brand-teal: #0f9488;
  --brand-teal-ink: #0b7a70;
  --grad-brand: linear-gradient(135deg, #123a8c 0%, #1747a6 48%, #0e8579 100%);
  --grad-line: linear-gradient(90deg, #1747a6, #0f9488 70%, #2dd4bf);

  --bg: #f5f8fc;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #e3e9ec;
  --border-strong: #cbd5da;
  --text: #0f1f24;
  --text-2: #475a61;
  --text-3: #5b6e75;

  --ok: #0b7350;
  --ok-bg: #e7f7ef;
  --warn: #b45309;
  --warn-bg: #fff4e5;
  --err: #c2372b;
  --err-bg: #fdecea;
  --info: #1d5fbf;
  --info-bg: #e9f1fd;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 36, .06);
  --shadow: 0 1px 2px rgba(15, 31, 36, .05), 0 8px 24px -8px rgba(15, 31, 36, .12);
  --shadow-lg: 0 24px 60px -20px rgba(11,42,99, .35);
  --focus: 0 0 0 3px rgba(15,148,136, .28);

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-700); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Brand ─────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: inherit; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; flex: none; display: block; }
.brand-name { color: var(--brand-800); }
.brand-j { color: var(--brand-teal-ink); margin-left: .22em; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 700; font-size: 15px; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn[disabled], .btn.is-loading { opacity: .65; cursor: not-allowed; }
.btn-primary { background: var(--brand-700); color: #fff; }
.btn-primary:hover { background: var(--brand-800); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(15, 31, 36, .05); color: var(--text); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #a52c21; }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: #085c40; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.is-loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--brand-700); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn[disabled] { color: var(--text-3); cursor: default; text-decoration: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ─────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--text); }
.label .opt { font-weight: 500; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23475a61' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.input::placeholder, .textarea::placeholder { color: #9aabb1; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--focus); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea, .field.has-error .pin-boxes input, .field.has-error .otp-boxes input { border-color: var(--err); }
.field-error { font-size: 13px; color: var(--err); font-weight: 600; min-height: 0; }
.field-error:empty { display: none; }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.field-hint.ok { color: var(--ok); font-weight: 600; }
.field-hint.bad { color: var(--err); font-weight: 600; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: inline-flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--text-2); font-weight: 600; }
.input-prefix .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-icon { position: relative; }
.input-icon .status-dot { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand-700); }

/* OTP & PIN boxes */
.otp-boxes, .pin-boxes { display: flex; gap: 10px; }
.otp-boxes input, .pin-boxes input {
  width: 100%; max-width: 54px; height: 56px; text-align: center;
  font: inherit; font-size: 22px; font-weight: 800; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  -webkit-text-security: none;
}
.pin-boxes input { max-width: 60px; }
.pin-boxes.masked input { -webkit-text-security: disc; }
.otp-boxes input:focus, .pin-boxes input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--focus); }
.pin-row { display: flex; align-items: center; gap: 12px; }
.pin-toggle { font-size: 13px; }

/* File input */
.file-drop {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--brand-500); background: var(--brand-50); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop .file-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; flex: none; }
.file-drop .file-text { display: flex; flex-direction: column; min-width: 0; }
.file-drop .file-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-drop .file-sub { font-size: 12.5px; color: var(--text-3); }
.file-drop.has-file { border-style: solid; border-color: var(--brand-500); background: var(--brand-50); }
.field:focus-within .file-drop { box-shadow: var(--focus); }

/* ── Alerts & toasts ───────────────────────────────── */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; margin-bottom: 16px; }
.alert-success { background: var(--ok-bg); color: #0b5e40; }
.alert-error { background: var(--err-bg); color: #8e241b; }
.alert-info { background: var(--info-bg); color: #16478f; }
.alert-warn { background: var(--warn-bg); color: #8a3f06; }
.alert:empty { display: none; }
.toast-wrap { position: fixed; z-index: 100; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--text); color: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Badges ────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-rejected, .badge-blocked { background: var(--err-bg); color: var(--err); }
.badge-role { background: var(--brand-50); color: var(--brand-700); }
.badge-role::before { display: none; }

/* ═══════════════ AUTH (landing) PAGE ═══════════════ */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(1200px 600px at -10% -10%, #0f9488 0%, transparent 55%),
              radial-gradient(900px 600px at 110% 110%, #1a5fb4 0%, transparent 50%),
              linear-gradient(160deg, var(--brand-800), var(--brand-900));
  padding: 44px 56px; display: flex; flex-direction: column;
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M18 12h4v6h6v4h-6v6h-4v-6h-6v-4h6z' fill='%23fff'/%3E%3C/svg%3E");
}
.auth-hero .brand { color: #fff; font-size: 20px; }
.hero-body { margin: auto 0; max-width: 520px; position: relative; z-index: 1; padding: 40px 0; }
.hero-eyebrow { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); font-size: 13px; font-weight: 600; margin-bottom: 22px; }
.hero-eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(45,212,191,.25); }
.hero-title { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.12; font-weight: 800; letter-spacing: -.02em; margin-bottom: 16px; }
.hero-title span { color: var(--mint); }
.hero-sub { font-size: 17px; color: rgba(255,255,255,.82); margin-bottom: 32px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.hero-points li { display: flex; gap: 14px; align-items: flex-start; }
.hero-points .ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); }
.hero-points b { display: block; font-size: 15px; }
.hero-points small { color: rgba(255,255,255,.72); font-size: 13.5px; }
.hero-foot { position: relative; z-index: 1; font-size: 13px; color: rgba(255,255,255,.6); }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-mobile-brand { display: none; margin-bottom: 20px; }
.auth-card { width: 100%; max-width: 460px; }
.auth-card .card { padding: 32px; }
.auth-head { margin-bottom: 22px; }
.auth-head h1 { font-size: 24px; margin-bottom: 4px; }
.auth-head p { color: var(--text-2); margin: 0; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-2); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #e8eef0; border-radius: 12px; margin-bottom: 24px; }
.tab { border: 0; background: transparent; min-height: 40px; border-radius: 9px; font: inherit; font-weight: 700; color: var(--text-2); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab:focus-visible { outline: none; box-shadow: var(--focus); }

/* Stepper */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.step .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #e8eef0; color: var(--text-2); font-size: 12.5px; }
.step.is-active { color: var(--text); }
.step.is-active .num { background: var(--brand-700); color: #fff; }
.step.is-done .num { background: var(--ok); color: #fff; }
.step-line { flex: 1; height: 2px; background: #e3e9ec; border-radius: 2px; min-width: 12px; }
.step-line.is-done { background: var(--ok); }

.email-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--brand-50); border: 1px solid var(--brand-100); margin-bottom: 18px; font-size: 14px; }
.email-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resend-row { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--text-2); margin: -4px 0 18px; }

.role-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1.5px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s; }
.role-card input { position: absolute; opacity: 0; }
.role-card .role-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand-700); }
.role-card b { font-size: 15px; }
.role-card small { color: var(--text-3); font-size: 12.5px; line-height: 1.4; }
.role-card:hover { border-color: var(--brand-500); }
.role-card:has(input:checked) { border-color: var(--brand-700); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-700); }
.role-card:has(input:checked) .role-ico { background: var(--brand-700); color: #fff; }
.role-card:has(input:focus-visible) { box-shadow: var(--focus); }

.form-section { padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--border); }
.form-section-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 0 0 14px; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); color: #7a3a07; font-size: 13.5px; margin-bottom: 16px; }
.notice svg { flex: none; margin-top: 2px; }

/* ═══════════════ APP SHELL ═══════════════ */
.appbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.appbar-inner { max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 20px; }
.appbar .brand { color: var(--text); }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.is-active { color: var(--brand-700); background: var(--brand-50); }
.nav .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; color: var(--text); }
.me:hover { background: var(--surface-2); text-decoration: none; }
.me .who { display: flex; flex-direction: column; line-height: 1.2; }
.me .who b { font-size: 14px; }
.me .who small { font-size: 12px; color: var(--text-3); font-weight: 600; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-100); color: var(--brand-800); font-weight: 800; font-size: 13px; flex: none; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; border-radius: 16px; }

.page { max-width: 1160px; margin: 0 auto; padding: 28px 24px 64px; }
.page-narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.crumb { font-size: 13.5px; margin-bottom: 8px; display: inline-flex; gap: 6px; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat small { display: block; color: var(--text-2); font-weight: 600; font-size: 13px; }
.stat b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.stat.is-warn { border-color: #f7d9b0; background: linear-gradient(180deg, #fff, var(--warn-bg)); }
.stat.is-warn b { color: var(--warn); }

.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table .person { display: flex; gap: 12px; align-items: center; }
.table .person b { display: block; }
.table .person small { color: var(--text-3); }
.table .actions { display: flex; gap: 8px; justify-content: flex-end; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .empty-ico { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters .input, .filters .select { min-height: 42px; width: auto; }
.filters .grow { flex: 1 1 240px; }
.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 38px; }

/* Doctor cards (patient view) */
.doctor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.doctor-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.doctor-card .top { display: flex; gap: 14px; align-items: center; }
.doctor-card h3 { margin: 0; font-size: 16px; }
.doctor-card .spec { color: var(--brand-700); font-weight: 700; font-size: 13.5px; }
.doctor-card .meta { display: grid; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.doctor-card .meta div { display: flex; gap: 8px; align-items: center; }
.doctor-card .meta svg { color: var(--text-3); flex: none; }
.doctor-card .bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.doctor-card .fee { font-weight: 800; }
.doctor-card .fee small { font-weight: 500; color: var(--text-3); }
.soon { font-size: 12px; font-weight: 700; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; }

/* Welcome banner */
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; margin-bottom: 22px; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(120deg, var(--brand-700), var(--brand-900)); box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.welcome h1 { font-size: 24px; margin: 0 0 4px; }
.welcome p { margin: 0; color: rgba(255,255,255,.8); }

/* Status screen (pending / rejected) */
.status-screen { max-width: 620px; margin: 24px auto 0; text-align: center; }
.status-screen .card { padding: 40px 32px; }
.status-ico { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 18px; display: grid; place-items: center; }
.status-ico.warn { background: var(--warn-bg); color: var(--warn); }
.status-ico.err { background: var(--err-bg); color: var(--err); }
.timeline { list-style: none; padding: 0; margin: 26px 0 0; text-align: left; display: grid; gap: 0; }
.timeline li { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); }
.timeline .dot { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border); color: var(--text-3); }
.timeline .done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.timeline .now .dot { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.timeline b { display: block; font-size: 14.5px; }
.timeline small { color: var(--text-2); }
.reason { text-align: left; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--warn-bg); border-left: 4px solid var(--warn); margin: 18px 0 22px; }
.reason small { display: block; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; margin-bottom: 4px; }

/* Definition list */
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--text-2); font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }

.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc-list li a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
.doc-list li a:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border-strong); }
.doc-list .file-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); flex: none; }
.doc-list b { display: block; font-size: 14px; }
.doc-list small { color: var(--text-3); font-weight: 500; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 12px 22px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.activity li:last-child { border-bottom: 0; }
.activity small { display: block; color: var(--text-3); }

/* Pagination */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; font-size: 14px; color: var(--text-2); }
.pager .btns { display: flex; gap: 8px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(6, 30, 35, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
.modal { width: min(480px, 100%); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 24px; }
.modal h2 { margin-bottom: 6px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.quick .card { padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.quick .q-ico { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); }
.quick b { display: block; }
.quick small { color: var(--text-2); }

/* Error page */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-page .code { font-size: 72px; font-weight: 800; color: var(--brand-700); letter-spacing: -.04em; line-height: 1; margin-bottom: 8px; }

/* ═══════════════ Responsive ═══════════════ */
@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; }
  .layout-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .me .who { display: none; }
  .page { padding: 20px 16px 48px; }
  .appbar-inner { padding: 0 16px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 10px; }
  .table .hide-sm { display: none; }
  .mobile-nav { display: flex !important; }
}
@media (max-width: 520px) {
  .auth-main { padding: 24px 16px; justify-content: flex-start; }
  .auth-card .card { padding: 22px 18px; }
  .grid-2 { grid-template-columns: 1fr; }
  .role-cards { grid-template-columns: 1fr; }
  .role-card { flex-direction: row; align-items: center; }
  .steps .step .txt { display: none; }
  .otp-boxes, .pin-boxes { gap: 7px; }
  .otp-boxes input { height: 50px; font-size: 20px; }
  .welcome { padding: 20px; }
}

.mobile-nav { display: none; gap: 6px; overflow-x: auto; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.mobile-nav a { padding: 7px 12px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 13px; white-space: nowrap; }
.mobile-nav a.is-active { background: var(--brand-700); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Refinements */
@media (min-width: 981px) {
  .auth-hero { position: sticky; top: 0; height: 100vh; }
}
.field > label.check { font-weight: 500; font-size: 14px; color: var(--text-2); }
.doc-uploads { display: grid; gap: 0; }
.filters .search { flex: 1 1 260px; }
.dl-stack { display: grid; gap: 12px; margin: 0; font-size: 14px; }
.dl-stack div { display: flex; flex-direction: column; gap: 1px; }
.dl-stack dt { color: var(--text-3); font-weight: 600; font-size: 12.5px; }
.dl-stack dd { margin: 0; font-weight: 600; word-break: break-word; }

/* Google Sign-In */
.google-wrap { display: flex; flex-direction: column; align-items: center; min-height: 44px; }
.google-slot { width: 100%; display: flex; justify-content: center; }
.google-wrap.is-ready .google-loading { display: none; }
.google-wrap.is-busy { opacity: .6; pointer-events: none; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-3); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-alert:empty { display: none; }

/* ═══════════════ Care features ═══════════════ */
.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); }
.bell:hover, .bell.is-active { background: var(--surface-2); color: var(--text); text-decoration: none; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--err); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }

.badge-booked, .badge-report_ready { background: var(--ok-bg); color: var(--ok); }
.badge-completed, .badge-sample_collected { background: var(--info-bg); color: var(--info); }
.badge-cancelled_patient, .badge-cancelled_doctor, .badge-cancelled_lab { background: var(--err-bg); color: var(--err); }
.badge-no_show { background: #eef1f3; color: var(--text-2); }
.badge-awaiting_sample { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: var(--surface-2); color: var(--text-2); }
.badge-muted::before { display: none; }

.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.subtabs a, .subtabs button { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.subtabs a:hover { text-decoration: none; border-color: var(--border-strong); }
.subtabs .is-active, .subtabs [aria-selected="true"] { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.subtabs .count { opacity: .8; margin-left: 4px; }

.list { display: grid; gap: 12px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
a.list-item:hover { border-color: var(--brand-500); text-decoration: none; box-shadow: var(--shadow-sm); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { display: block; }
.list-item small { color: var(--text-2); display: block; }
.time-chip { flex: none; min-width: 74px; text-align: center; padding: 8px 10px; border-radius: 10px; background: var(--brand-50); color: var(--brand-800); font-weight: 800; font-size: 13.5px; line-height: 1.25; }
.time-chip small { display: block; font-weight: 600; font-size: 11.5px; color: var(--brand-700); }

/* Booking */
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; scrollbar-width: thin; }
.date-pill { flex: none; width: 66px; padding: 10px 6px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); text-align: center; cursor: pointer; font: inherit; color: var(--text); }
.date-pill small { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 700; text-transform: uppercase; }
.date-pill b { display: block; font-size: 19px; }
.date-pill em { display: block; font-style: normal; font-size: 11px; color: var(--text-3); }
.date-pill:hover { border-color: var(--brand-500); }
.date-pill.is-active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.date-pill.is-active small, .date-pill.is-active em { color: rgba(255,255,255,.8); }
.date-pill[disabled] { opacity: .45; cursor: not-allowed; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slot { padding: 10px 6px; border-radius: 10px; border: 1.5px solid var(--border-strong); background: var(--surface); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--text); }
.slot:hover:not([disabled]) { border-color: var(--brand-500); background: var(--brand-50); }
.slot.is-active, .slot.is-active:hover:not([disabled]) { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.slot[disabled] { text-decoration: line-through; color: var(--text-3); background: var(--surface-2); cursor: not-allowed; border-style: dashed; }
.sticky-card { position: sticky; top: 84px; }
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.week-list li { display: flex; justify-content: space-between; gap: 10px; }
.week-list li span:first-child { font-weight: 700; }
.week-list .off { color: var(--text-3); }

/* Person chooser */
.people { display: flex; gap: 8px; flex-wrap: wrap; }
.person-opt { position: relative; }
.person-opt input { position: absolute; opacity: 0; }
.person-opt span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--border-strong); font-weight: 700; font-size: 14px; cursor: pointer; background: var(--surface); }
.person-opt small { font-weight: 600; color: var(--text-3); }
.person-opt input:checked + span { border-color: var(--brand-700); background: var(--brand-50); color: var(--brand-800); }
.person-opt input:focus-visible + span { box-shadow: var(--focus); }

/* Vitals */
.vitals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.vital { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.vital small { display: block; color: var(--text-3); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.vital b { font-size: 19px; font-weight: 800; }
.vital em { font-style: normal; color: var(--text-3); font-size: 12.5px; margin-left: 2px; }
.vital.is-warn { background: var(--warn-bg); border-color: #f5d2a2; }
.vital.is-warn b { color: var(--warn); }
.vitals-form .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.bp-row { display: flex; align-items: center; gap: 6px; }
.bp-row .input { min-width: 0; }
.table.compact td, .table.compact th { padding: 9px 12px; font-size: 13.5px; }

/* Profile header for doctor view */
.patient-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.patient-head .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.chip.warn { background: var(--err-bg); border-color: #f3c9c4; color: var(--err); }

/* Timeline */
.timeline-h { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline-h::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 16px; }
.tl-dot { position: relative; z-index: 1; flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--border); color: var(--brand-700); }
.tl-item.rx .tl-dot { background: var(--brand-50); border-color: var(--brand-100); }
.tl-item.lab .tl-dot { background: #f3efff; border-color: #e3dbff; color: #6b46c1; }
.tl-item.rec .tl-dot { background: var(--info-bg); border-color: #d3e3fb; color: var(--info); }
.tl-item.vit .tl-dot { background: var(--warn-bg); border-color: #f5d9b3; color: var(--warn); }
.tl-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tl-body header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.tl-body header b { font-size: 15px; }
.tl-body header small { color: var(--text-3); font-weight: 600; }
.tl-meta { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.med-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.med-list li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.med-list li b { font-weight: 700; }
.med-list li span { color: var(--text-2); font-size: 13px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.code-box { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: #0f1f24; color: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 800; letter-spacing: .08em; }
.code-sm { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; }

.rows { display: grid; gap: 10px; }
.row-card { display: grid; grid-template-columns: 2fr 1fr 1fr 90px 1.4fr 36px; gap: 8px; align-items: start; }
.row-card .input { min-height: 40px; padding: 8px 10px; font-size: 14px; }
.icon-btn { width: 36px; height: 40px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); cursor: pointer; }
.icon-btn:hover { color: var(--err); border-color: #f3c9c4; }
.test-row { display: grid; grid-template-columns: 1fr 36px; gap: 8px; }

.check-list { display: grid; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.check-item:has(input:checked) { border-color: var(--brand-700); background: var(--brand-50); }
.check-item input { width: 18px; height: 18px; accent-color: var(--brand-700); }
.check-item .grow { flex: 1; min-width: 0; }
.check-item small { color: var(--text-3); display: block; }
.check-item .price { font-weight: 800; }

.notif { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: #f4fbfb; }
.notif .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-500); margin-top: 7px; flex: none; }
.notif:not(.unread) .dot { background: transparent; }
.notif b { display: block; font-size: 14.5px; }
.notif span { color: var(--text-2); font-size: 13.5px; display: block; }
.notif small { color: var(--text-3); font-size: 12px; }

.kpi-link { color: inherit; text-decoration: none; }
.kpi-link:hover { text-decoration: none; border-color: var(--brand-500); }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 26px 0 12px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; }
.day-grid { display: grid; gap: 10px; }
.day-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.day-row .ranges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--brand-50); border: 1px solid var(--brand-100); font-weight: 700; font-size: 13.5px; color: var(--brand-800); }
.range-chip button { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(23,71,166,.1); color: var(--brand-800); cursor: pointer; display: grid; place-items: center; }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.weekday-picks label { position: relative; }
.weekday-picks input { position: absolute; opacity: 0; }
.weekday-picks span { display: inline-block; padding: 8px 12px; border-radius: 8px; border: 1.5px solid var(--border-strong); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.weekday-picks input:checked + span { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.weekday-picks input:focus-visible + span { box-shadow: var(--focus); }

@media (max-width: 720px) {
  .row-card { grid-template-columns: 1fr 1fr; }
  .row-card > :first-child { grid-column: 1 / -1; }
  .vitals-form .grid-3 { grid-template-columns: 1fr 1fr; }
  .day-row { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
}

/* Mobile overflow guards */
.layout-2 > *, .grid-2 > *, .grid-3 > * { min-width: 0; }
.patient-head { flex-wrap: nowrap; align-items: flex-start; }
.patient-head > div { flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .patient-head .avatar-lg { width: 52px !important; height: 52px !important; font-size: 17px !important; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
.alert.lab-callout { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.code-box { max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .list-item { flex-wrap: wrap; }
  .list-item .grow { flex-basis: 150px; }
  .list-item > span:last-child:not(.grow) { flex-basis: 100%; align-items: flex-start !important; flex-direction: row !important; flex-wrap: wrap; }
  .code-box { font-size: 18px; }
}
[style*="display:grid"] > * { min-width: 0; }

/* Google button: keep hidden (and tiny) until its iframe is ready, no big-logo flash */
.google-slot { height: 44px; overflow: hidden; }
.google-slot svg { max-width: 20px; max-height: 20px; }
.google-wrap:not(.is-ready) .google-slot { visibility: hidden; height: 0; }

/* ═══════════════ v3, brand refresh, clinics, pharmacy, Rx pad ═══════════════ */
/* --accent is the bright coral for decoration only. Text-bearing coral (buttons, links) uses --accent-ink (4.9:1 on white). */
:root { --accent: #ff6b4a; --accent-ink: #c94127; --accent-600: #b2391f; --accent-50: #fff1ec; --amber: #ffb547; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-tag { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .01em; color: var(--text-2); margin-top: 3px; }
.auth-hero .brand-tag, .auth-hero .brand-name, .auth-hero .brand-j { color: #fff; }
.auth-hero .brand-j { color: #9ff0e4; }
.btn-accent { background: var(--accent-ink); color: #fff; box-shadow: 0 8px 20px -10px rgba(201,65,39,.8); }
.btn-accent:hover { background: var(--accent-600); text-decoration: none; }
.btn-soft { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); }
.appbar { box-shadow: 0 1px 0 rgba(15,31,36,.02), 0 6px 24px -18px rgba(11,42,99,.35); }
.nav a.is-active { position: relative; }
.card { transition: box-shadow .2s; }
.page-head h1 { letter-spacing: -.02em; }
.auth-single { grid-template-columns: 1fr; background: radial-gradient(800px 400px at 80% 0%, rgba(15,148,136,.12), transparent 60%), var(--bg); }
.set-pin-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; margin-bottom: 14px; box-shadow: var(--shadow); }
.partner-note { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--accent-50); color: #8a3b24; font-size: 13.5px; font-weight: 600; text-align: center; }
.partner-note a { color: var(--accent-600); }
.book-cta { background: linear-gradient(135deg, #fff, var(--accent-50)); border-color: #ffd9cc; }

/* Hero banner for portal dashboards */
.hero-card { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 26px 28px; color: #fff;
  background: radial-gradient(500px 220px at 90% -20%, rgba(45,212,191,.35), transparent 60%), var(--grad-brand); box-shadow: var(--shadow-lg); margin-bottom: 22px; }
.hero-card h1 { color: #fff; margin: 4px 0 6px; font-size: 26px; }
.hero-card p { color: rgba(255,255,255,.8); margin: 0; }
.hero-card .eyebrow-light { display: inline-flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #bdeaea; }
.hero-card .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero-card .btn-secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.hero-card .btn-secondary:hover { background: rgba(255,255,255,.2); }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.tile .ti { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand-700); }
.tile .ti.accent { background: var(--accent-50); color: var(--accent-600); }
.tile .ti.ok { background: var(--ok-bg); color: var(--ok); }
.tile .ti.warn { background: var(--warn-bg); color: var(--warn); }
.tile b { display: block; font-size: 24px; line-height: 1.1; }
.tile small { color: var(--text-2); font-weight: 600; font-size: 12.5px; }

/* People tables / lists */
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.person { display: flex; gap: 10px; align-items: center; }
.person b { display: block; }
.person small { color: var(--text-3); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.badge-new { background: var(--accent-50); color: var(--accent-600); }
.badge-ready { background: var(--ok-bg); color: var(--ok); }
.badge-dispensed { background: var(--info-bg); color: var(--info); }
.badge-cancelled { background: var(--err-bg); color: var(--err); }
.badge-updated { background: #fff4d6; color: #8a5a00; }
.badge-updated::before { display: none; }
.badge-contacted { background: var(--info-bg); color: var(--info); }
.badge-onboarded { background: var(--ok-bg); color: var(--ok); }
.badge-closed { background: #eef1f3; color: var(--text-2); }
.badge-temp { background: var(--warn-bg); color: var(--warn); }
.badge-temp::before { display: none; }

/* Onboarding form */
.ob-section { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 18px; overflow: hidden; }
.ob-head { display: flex; gap: 14px; align-items: center; padding: 16px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ob-head .num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-700); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.ob-head h2 { margin: 0; font-size: 17px; }
.ob-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.ob-body { padding: 20px; }
.ob-row { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 16px 16px 4px; margin-bottom: 14px; position: relative; background: #fff; }
.ob-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ob-row-head b { font-size: 14px; color: var(--brand-800); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.toggle-card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 700; margin-bottom: 16px; }
.toggle-card input { width: 20px; height: 20px; accent-color: var(--brand-700); }
.toggle-card:has(input:checked) { border-color: var(--brand-600); background: var(--brand-50); }
.sticky-submit { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(245,248,252,0), var(--bg) 30%); padding: 18px 0 12px; display: flex; gap: 10px; justify-content: flex-end; z-index: 5; }
.cred-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; white-space: pre-wrap; }

/* Pharmacy */
.rx-items input.input { padding: 8px 10px; font-size: 14px; }
.rx-items .qty { width: 80px; }
.rx-items .price { width: 110px; }
.rx-items tr.na td { opacity: .5; }
.rx-items tr.na td:last-child, .rx-items tr.na td:first-child { opacity: 1; }
.bill-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-top: 2px solid var(--text); font-size: 18px; font-weight: 800; }
.code-sm { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; background: var(--text); color: #fff; padding: 2px 8px; border-radius: 6px; font-size: 12.5px; letter-spacing: .04em; white-space: nowrap; }
.status-steps { display: flex; gap: 0; margin: 6px 0 4px; }
.status-steps span { flex: 1; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-3); position: relative; padding-top: 30px; }
.status-steps span::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%; background: var(--border); z-index: 1; }
.status-steps span::after { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--border); }
.status-steps span:first-child::after { display: none; }
.status-steps span.done { color: var(--ok); }
.status-steps span.done::before { background: var(--ok); }
.status-steps span.done::after { background: var(--ok); }

/* Rx pad settings */
.design-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.design-picks label { cursor: pointer; }
.design-picks input { position: absolute; opacity: 0; pointer-events: none; }
.design-picks .dp { display: block; border: 2px solid var(--border); border-radius: 12px; padding: 10px; background: #fff; transition: .15s; }
.design-picks input:checked + .dp { border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(15,148,136,.2); }
.design-picks .dp i { display: block; height: 92px; border-radius: 6px; background: #f7f9fa; position: relative; overflow: hidden; }
.design-picks .dp b { display: block; text-align: center; margin-top: 8px; font-size: 13px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--border-strong); }
.swatches input:checked + span { box-shadow: 0 0 0 3px var(--text); }
.rx-preview-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .design-picks { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero-card { padding: 22px 18px; }
  .tile b { font-size: 20px; }
}
.mini { --c: var(--brand-700); }
.mini::before, .mini::after { content: ""; position: absolute; }
.mini-classic { border-top: 6px solid var(--c); }
.mini-classic::before { left: 8px; right: 8px; top: 18px; height: 3px; border-top: 1px solid var(--c); border-bottom: 1px solid var(--c); }
.mini-modern::before { left: 0; right: 0; top: 0; height: 26px; background: var(--c); }
.mini-modern::after { left: 0; right: 0; bottom: 0; height: 12px; background: var(--c); border-radius: 60% 40% 0 0; opacity: .8; }
.mini-minimal::before { left: 8px; right: 8px; top: 20px; height: 1px; background: #333; }
.mini-minimal::after { left: 10px; top: 28px; content: "℞"; font: 700 22px Georgia, serif; color: #333; }
.mini-elegant::before { left: 0; top: 0; bottom: 0; width: 10px; background: var(--c); }
.mini-elegant::after { left: 16px; right: 8px; top: 20px; height: 2px; background: var(--c); }
.rx-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.pharmacy-card { margin-top: 16px; border: 1.5px solid #ffd9cc; background: linear-gradient(135deg, #fff, var(--accent-50)); border-radius: var(--radius-lg); padding: 16px 18px; }

/* Alerts hold sentences with inline links/bold, keep them as normal text flow. */
.alert { display: block; }
.alert.lab-callout { display: flex; }
.brand-text { white-space: nowrap; }
@media (max-width: 560px) {
  .brand { font-size: 16px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-tag { font-size: 9.5px; }
  /* Pharmacy bill: each medicine becomes a compact card */
  .rx-items thead { display: none; }
  .rx-items, .rx-items tbody, .rx-items tr, .rx-items td { display: block; width: 100%; }
  .rx-items tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .rx-items td { border: 0; padding: 0; text-align: left !important; }
  .rx-items td:first-child { grid-column: 1 / -1; }
  .rx-items td[data-amount] { align-self: center; font-weight: 800; text-align: right !important; }
  .rx-items td.num { display: flex; flex-direction: column; }
  .rx-items .qty, .rx-items .price { width: 100%; }
  .rx-items .select { width: 100%; }
  .rx-items td:nth-child(3) { grid-column: 1 / -1; }
}

/* ── Medical history, complaints, follow-ups (v6) ── */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 720px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
textarea.input { resize: vertical; min-height: 44px; line-height: 1.45; padding-top: 10px; padding-bottom: 10px; font: inherit; }
.history-grid { display: grid; gap: 10px; margin: 0; }
.history-grid > div { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.history-grid > div:last-child { border-bottom: 0; }
.history-grid dt { font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.history-grid dd { margin: 0; white-space: pre-line; }
.history-grid .is-allergy dd { color: var(--err); font-weight: 700; }
@media (max-width: 520px) { .history-grid > div { grid-template-columns: 1fr; gap: 2px; } }
.versions { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.versions li { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.versions li b { font-weight: 700; }
.versions .changed { color: var(--text-2); white-space: pre-line; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; background: var(--brand-50); color: var(--text-2); text-transform: uppercase; }
.tag-doctor { background: #e0f2fe; color: #075985; }
.tag-staff { background: #fef3c7; color: #92400e; }
.tag-patient { background: #dcfce7; color: #166534; }
.vital-old { opacity: .62; }
.fu-card { border-left: 4px solid var(--brand-600); }
.fu-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.timeline-mini { list-style: none; padding: 0; margin: 10px 0 0; border-left: 2px solid var(--border); }
.timeline-mini li { position: relative; padding: 0 0 10px 14px; font-size: 13px; }
.timeline-mini li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-600); }
.badge-scheduled { background: #e0f2fe; color: #075985; }
.badge-needs_reschedule { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f1f5f9; color: #475569; }

/* ═══════════════ Profile photos + Health Card (feature: photo-healthcard) ═══════════════ */
/* Avatars: photo with initials fallback */
.avatar { overflow: hidden; position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.has-photo { background: var(--brand-50); }
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-xl { width: 112px; height: 112px; font-size: 34px; border-radius: 50%; box-shadow: 0 0 0 4px #fff, 0 14px 30px -14px rgba(11,42,99,.55); }
.avatar-xxl { width: 116px; height: 116px; font-size: 36px; border-radius: 28px; box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 18px 36px -18px rgba(11,42,99,.6); }
.chip-person { padding-left: 4px; }

/* Photo picker */
.photo-up { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.photo-up-preview { position: relative; flex: none; }
.photo-up-badge { position: absolute; right: 2px; bottom: 4px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-ink); color: #fff; border: 3px solid #fff; }
.photo-up-body { flex: 1; min-width: 220px; display: grid; gap: 10px; justify-items: start; }
.photo-up-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-up-btns label { position: relative; cursor: pointer; min-height: 46px; }
.photo-up-btns label:focus-within { box-shadow: var(--focus); }
.photo-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.photo-up-hint { margin: 0; }
.photo-up-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-remove { color: var(--err); }
@media (hover: hover) and (pointer: fine) { .photo-cam { display: none !important; } }
.photo-up-big { flex-direction: column; text-align: center; gap: 16px; margin: 6px 0 18px; }
.photo-up-big .photo-up-body { justify-items: center; min-width: 0; width: 100%; }
.photo-up-big .photo-up-btns { justify-content: center; }
.photo-up-big .avatar-xl { width: 136px; height: 136px; font-size: 40px; }

/* Add-photo prompt (full page) */
.photo-gate { position: relative; min-height: 100vh; display: flex; flex-direction: column; padding: 0 16px 32px; background: linear-gradient(180deg, #f1f6fd 0%, #f7f9fd 55%, #fff8f3 100%); }
.photo-gate > * { position: relative; z-index: 1; }
.photo-gate .auth2-bg { z-index: 0; }
.photo-gate-top { max-width: 1080px; width: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 0 8px; }
.photo-gate-main { flex: 1; display: grid; place-items: start center; padding-top: 10px; }
.photo-gate-card { position: relative; width: 100%; max-width: 480px; padding: 30px 28px; border-radius: 24px; text-align: center; overflow: hidden; border: 1px solid rgba(23,71,166,.08); box-shadow: 0 1px 2px rgba(15,31,36,.04), 0 40px 80px -36px rgba(11,42,99,.45); }
.photo-gate-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--grad-line); }
.photo-gate-card h1 { font-size: 25px; letter-spacing: -.02em; margin: 10px 0 6px; }
.photo-gate-card .steps { justify-content: center; margin-bottom: 18px; }
.photo-gate-eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--accent-50); color: var(--accent-600); font-size: 12.5px; font-weight: 800; }
.photo-tips { list-style: none; margin: 0 0 18px; padding: 14px 16px; display: grid; gap: 8px; text-align: left; font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.photo-tips li { display: flex; gap: 8px; align-items: center; }
.photo-tips svg { color: var(--ok); flex: none; }
.photo-gate-foot .btn-ghost { color: var(--text-2); border: 1px dashed var(--border-strong); }
.photo-gate-note { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--warn); font-weight: 700; margin: 0; }
@media (max-width: 520px) { .photo-gate-card { padding: 24px 18px; } .photo-gate-card .steps .step .txt { display: none; } }

/* Print */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .appbar, .tabbar, .mobile-nav, .no-print, .toast-wrap, .crumb, .alert { display: none !important; }
  .page { padding: 0; max-width: none; }
  a { color: inherit; text-decoration: none; }
}
.avatar-doc { width: 72px; height: 72px; font-size: 22px; }
.list-item > .avatar { flex: none; }
@media (max-width: 600px) {
  .photo-up { justify-content: center; text-align: center; }
  .photo-up-body { justify-items: center; }
  .photo-up-btns { justify-content: center; }
}

/* ═══════════════ v7: one warm shell for every role ═══════════════ */
body {
  background:
    radial-gradient(900px 380px at 100% -140px, rgba(45,212,191,.16), transparent 62%),
    radial-gradient(700px 320px at -12% -80px, rgba(255,107,74,.06), transparent 60%),
    linear-gradient(180deg, #e9f1fc 0, #f2f6fc 280px, var(--bg) 560px) no-repeat,
    var(--bg);
}
.page-flash { padding-bottom: 0 !important; }

/* Page title with the brand accent line (same gradient as the login card) */
.page-head { position: relative; padding-bottom: 16px; }
.page-head::after { content: ""; position: absolute; left: 0; bottom: 0; width: 64px; height: 4px; border-radius: 4px; background: var(--grad-line); }
.page-head p { max-width: 70ch; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.row-head h2 { margin: 0; font-size: 17px; }

/* Hero banners get the same accent edge */
.hero-card::after, .welcome::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--grad-line); opacity: .9; }
.welcome { position: relative; overflow: hidden; background: radial-gradient(500px 220px at 90% -20%, rgba(45,212,191,.35), transparent 60%), var(--grad-brand); }
.welcome .btn-secondary, .hero-card .btn-secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.28); }
.welcome .btn-secondary:hover { background: rgba(255,255,255,.2); }

/* Cards */
.card { border-color: rgba(23,71,166,.09); }
.card-head h2 { display: inline-flex; align-items: center; gap: 8px; }

/* Buttons: teal primary, darker coral for the single main action, ghost secondary, destructive outline */
.btn-icon { width: 44px; min-height: 44px; padding: 0; }
.btn-ghost.btn-outline, .btn-outline { background: var(--surface); color: var(--brand-800); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--brand-50); border-color: var(--brand-500); }
.btn-danger-outline { background: var(--surface); color: var(--err); border-color: #eab9b3; }
.btn-danger-outline:hover { background: var(--err-bg); border-color: var(--err); }
.btn-accent:focus-visible { box-shadow: 0 0 0 3px rgba(201,65,39,.3); }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }
.btn .hi, .hi-sub { font-weight: 600; font-size: .78em; opacity: .85; }
.btn .hi { margin-left: 2px; }
.hi-sub { display: block; color: var(--text-3); font-size: 11.5px; line-height: 1.2; }

/* Disclosure rows ("Medical history", "Earlier readings"): look like a tappable row */
summary.disclosure {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 14px; font-weight: 700; color: var(--text); cursor: pointer; list-style: none; user-select: none;
}
summary.disclosure::-webkit-details-marker { display: none; }
summary.disclosure::after { content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
details[open] > summary.disclosure { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 12px; }
details[open] > summary.disclosure::after { transform: rotate(-135deg) translate(-2px, -2px); }
summary.disclosure:hover { border-color: var(--border-strong); background: var(--brand-50); }
summary.disclosure:focus-visible { outline: none; box-shadow: var(--focus); }

/* Icon + text on one line */
.ico-line { display: inline-flex; align-items: center; gap: 6px; }
div.ico-line { display: flex; align-items: flex-start; }
div.ico-line svg { margin-top: 3px; flex: none; }
.role-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.email-chip-txt { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.email-chip-txt svg { color: var(--ok); flex: none; }
.badge svg { flex: none; }

/* Tap targets (>= 44px on touch screens) */
.pin-toggle { min-height: 44px; padding: 0 6px; }
.crumb { min-height: 44px; margin-bottom: 4px; }
.crumb a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.icon-btn { width: 44px; height: 44px; }
.range-chip button { width: 32px; height: 32px; }
.link-row { display: inline-flex; align-items: center; min-height: 44px; }
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; padding: 0 14px; }
  .range-chip { padding: 4px 4px 4px 12px; }
  .range-chip button { width: 36px; height: 36px; }
  .subtabs a, .subtabs button { min-height: 44px; display: inline-flex; align-items: center; }
  .card-head a.small, .card-head .small a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Badges never stretch inside flex/grid rows */
.badge { align-self: center; justify-self: start; width: max-content; max-width: 100%; }
td > .badge, .list-item .badge { flex: none; }

/* Stat tiles: one style everywhere */
.tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tile { border-color: rgba(23,71,166,.09); box-shadow: var(--shadow-sm); color: inherit; min-width: 0; }
a.tile { text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .1s; }
a.tile:hover { text-decoration: none; border-color: var(--brand-500); box-shadow: var(--shadow); }
.tile > div { min-width: 0; }
.tile b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.tile small { display: block; line-height: 1.3; }
.tile.is-warn { border-color: #f3d3a6; background: linear-gradient(180deg, #fff, var(--warn-bg)); }
.tile.is-warn b { color: var(--warn); }
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 10px 11px; border-radius: 14px; }
  .tile .ti { width: 28px; height: 28px; border-radius: 9px; }
  .tile .ti svg { width: 16px; height: 16px; }
  .tile b { font-size: 20px; }
  .tile small { font-size: 11.5px; overflow-wrap: anywhere; }
}

/* Empty states */
.empty { padding: 40px 20px; }
.empty span { display: block; max-width: 42ch; margin: 0 auto; }
.empty .btn { margin-top: 14px; }

/* Search inputs: room for long placeholders */
.filters .search { min-width: 0; }
.search .input { text-overflow: ellipsis; }
@media (max-width: 560px) {
  .filters { flex-direction: column; align-items: stretch; }
  .filters > *, .filters .input, .filters .select, .filters .btn, .filters .search, .filters .grow { width: 100%; flex: none; }
}

/* Rx pad: form + live preview; preview goes below the form on small screens */
.layout-pad { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.pad-preview { position: sticky; top: 90px; }
@media (max-width: 980px) {
  .layout-pad { grid-template-columns: minmax(0, 1fr); }
  .pad-preview { position: static; }
  .rx-preview-frame { height: 560px; }
}

/* ── Mobile bottom tab bar (logged-in, <= 720px) ── */
.tabbar { display: none; }
@media (max-width: 720px) {
  .nav, .mobile-nav { display: none !important; }
  .appbar-logout { display: none; }
  body:has(.tabbar) { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    padding: 4px max(6px, env(safe-area-inset-left)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-right));
    background: rgba(255,255,255,.97); backdrop-filter: saturate(1.4) blur(10px);
    border-top: 1px solid var(--border); box-shadow: 0 -10px 30px -18px rgba(11,42,99,.35);
  }
  .tabbar > a, .tabbar-more { flex: 1 1 0; min-width: 0; }
  .tabbar-item {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; padding: 4px 2px; border-radius: 12px; color: var(--text-2);
    font-size: 11.5px; font-weight: 700; line-height: 1.15; text-align: center; cursor: pointer; list-style: none;
  }
  .tabbar-item::-webkit-details-marker { display: none; }
  .tabbar-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar-item:hover { text-decoration: none; color: var(--text); }
  .tabbar-item.is-active { color: var(--brand-700); }
  .tabbar-item.is-active svg { background: var(--brand-50); border-radius: 10px; box-shadow: 0 0 0 5px var(--brand-50); }
  .tabbar-item.is-active::before { content: ""; position: absolute; top: -5px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--brand-600), var(--mint)); }
  .tabbar-item:focus-visible { outline: none; box-shadow: var(--focus); }
  .tabbar-dot { position: absolute; top: 7px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--err); border: 2px solid #fff; }
  .tabbar-more { position: static; }
  .tabbar-more .sheet {
    position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 41;
    max-height: calc(100vh - 140px); overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 8px;
    box-shadow: 0 30px 60px -20px rgba(11,42,99,.45); animation: sheet-in .16s ease-out;
  }
  .tabbar-more[open]::before { content: ""; position: fixed; inset: 0; z-index: 39; background: rgba(6,30,35,.32); }
  .sheet-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
  .sheet-head b { display: block; font-size: 15px; }
  .sheet-head small { display: block; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
  .sheet-head > span:last-child { min-width: 0; }
  .sheet-link {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 12px; border: 0; border-radius: 12px;
    background: transparent; font: inherit; font-weight: 700; font-size: 15px; color: var(--text); text-align: left; cursor: pointer;
  }
  .sheet-link svg { color: var(--brand-700); flex: none; }
  .sheet-link:hover { background: var(--surface-2); text-decoration: none; }
  .sheet-link.is-active { background: var(--brand-50); color: var(--brand-800); }
  .sheet-count { margin-left: auto; font-style: normal; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--err); color: #fff; font-size: 12px; display: grid; place-items: center; }
  .sheet-logout { color: var(--err); border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; margin-top: 4px; }
  .sheet-logout svg { color: var(--err); }
  .toast-wrap { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .sticky-submit { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .appbar-inner { height: 58px; gap: 10px; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Tables become cards on small screens (actions stay visible) ── */
@media (max-width: 560px) {
  .table-wrap { overflow: visible; }
  table.table:not(.no-stack) thead { display: none; }
  table.table:not(.no-stack), table.table:not(.no-stack) tbody, table.table:not(.no-stack) tr, table.table:not(.no-stack) td { display: block; width: 100%; }
  table.table:not(.no-stack) tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.table:not(.no-stack) tr:last-child { border-bottom: 0; }
  table.table:not(.no-stack) td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: right; font-size: 14px; min-height: 30px; }
  table.table:not(.no-stack) td[data-label]::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
  table.table:not(.no-stack) td > * { min-width: 0; }
  table.table:not(.no-stack) td:first-child { display: block; text-align: left; padding-top: 0; }
  table.table:not(.no-stack) td:first-child::before { display: none; }
  table.table:not(.no-stack) td.hide-sm { display: none; }
  table.table:not(.no-stack) td:last-child:has(.row-actions, .actions, form, .btn) { display: block; text-align: left; padding-top: 10px; }
  table.table:not(.no-stack) td:last-child:has(.row-actions, .actions, form, .btn)::before { display: none; }
  table.table:not(.no-stack) .row-actions, table.table:not(.no-stack) .actions { justify-content: flex-start; }
  table.table:not(.no-stack) td.num { justify-content: space-between; }
  table.table:not(.no-stack) td:empty { display: none; }
}

/* Error / 404 page */
.error-page { min-height: auto; padding: 40px 16px 64px; }
.error-card { max-width: 520px; margin: 0 auto; text-align: center; padding: 36px 28px; position: relative; overflow: hidden; }
.error-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--grad-line); }
.error-art { width: 168px; height: auto; margin: 0 auto 10px; display: block; }
.error-card .code { display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-700); background: var(--brand-50); border-radius: 999px; padding: 4px 12px; margin-bottom: 10px; }
.error-card h1 { font-size: 24px; margin-bottom: 8px; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.error-help { margin: 18px 0 0; }
.error-top { max-width: 1160px; margin: 0 auto; padding: 18px 24px 0; }
@media (max-width: 520px) { .error-actions .btn { flex: 1 1 100%; } }

/* Doctor visit page: sticky section pills */
.visit-pills { position: sticky; top: 64px; z-index: 15; display: flex; gap: 6px; overflow-x: auto; margin: 0 -24px 18px; padding: 10px 24px; background: rgba(245,249,249,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.visit-pills::-webkit-scrollbar { display: none; }
.visit-pills a { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13.5px; font-weight: 700; }
.visit-pills a:hover { text-decoration: none; border-color: var(--brand-500); color: var(--brand-800); }
.visit-pills a.is-active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.visit-pills .done { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
[data-section] { scroll-margin-top: 130px; }
@media (max-width: 720px) {
  .visit-pills { top: 58px; margin: 0 -16px 16px; padding: 8px 16px; }
  .visit-pills a { min-height: 44px; }
}
.visit-cancel { margin-top: 26px; padding-top: 18px; border-top: 1px dashed var(--border-strong); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.visit-cancel p { margin: 0; color: var(--text-2); font-size: 13.5px; }

/* Rx not yet available */
.rx-wait { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #fff, var(--brand-50)); border: 1px dashed var(--brand-100); }
.rx-wait .rx-wait-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #fff; color: var(--brand-700); flex: none; box-shadow: var(--shadow-sm); }
.rx-wait b { display: block; }
.rx-wait small { color: var(--text-2); }

/* Public doctor profile: sticky "Book appointment" on phones */
.book-sticky { display: none; }
@media (max-width: 720px) {
  .book-sticky { display: flex; position: fixed; z-index: 35; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); min-height: 52px; font-size: 16px; border-radius: 14px; box-shadow: 0 14px 30px -10px rgba(201,65,39,.6); }
  body:has(.tabbar) .book-sticky { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:has(.book-sticky) { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  body:has(.book-sticky):has(.tabbar) { padding-bottom: calc(148px + env(safe-area-inset-bottom)); }
  .book-sticky.is-hidden { display: none; }
}

/* Inputs */
.select.is-full, .field .select { width: 100%; }
@media (max-width: 560px) {
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form > * { width: 100%; }
  .page-head { align-items: flex-start; }
  .page-head .btn { flex: 1 1 auto; }
  h1 { font-size: 23px; }
}
summary.disclosure-lg { min-height: 52px; font-size: 16px; background: var(--surface); }
summary.disclosure-lg > span { display: inline-flex; align-items: center; gap: 8px; }
summary.disclosure-lg svg { color: var(--brand-700); }
summary.disclosure .muted { font-weight: 600; }
a.chip-link { color: var(--brand-800); min-height: 30px; }
a.chip-link:hover { text-decoration: none; border-color: var(--brand-500); }
.list-item > .badge:last-child { flex-basis: auto !important; }
.welcome .btn .hi, .btn-accent .hi, .btn-primary .hi { opacity: .9; }
.hi { font-family: var(--font), "Noto Sans Devanagari", sans-serif; }
.hi-title { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: var(--brand-50); color: var(--brand-teal-ink); font-size: 13px; font-weight: 700; letter-spacing: 0; vertical-align: 5px; }

.help-line { margin: 16px 0 0; text-align: center; }
.app-foot { max-width: 1160px; margin: 8px auto 0; padding: 18px 24px 26px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; }
.app-foot a { font-weight: 600; }
.app-foot-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.app-foot-brand img { display: block; }
@media (max-width: 720px) { .app-foot { padding: 16px 16px 20px; justify-content: center; text-align: center; } }
@media (max-width: 420px) {
  .appbar .brand-tag { display: none; }
  .appbar-right { gap: 4px; }
  .appbar-right .btn-sm { padding: 0 12px; }
  .hide-xs { display: none; }
}
@media (max-width: 720px) {
  .btn-sm { min-height: 44px; }
  .range-chip button { width: 40px; height: 40px; }
  .appbar .brand { min-height: 44px; }
}

/* ═══════════ Calendar, account & notifications release ═══════════ */
.nav a { white-space: nowrap; }
@media (max-width: 1240px) { .nav a { padding: 8px 9px; font-size: 13.5px; } }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Notification drop-down (bell in the top bar) */
.bell-wrap { position: relative; }
.bell-wrap.is-open .bell { background: var(--brand-50); color: var(--brand-700); }
.notif-pop {
  position: absolute; top: calc(100% + 10px); right: -8px; width: 380px; max-width: calc(100vw - 24px); z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.notif-pop::before { content: ""; position: absolute; top: -7px; right: 22px; width: 12px; height: 12px; background: var(--surface); border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg); }
.notif-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.notif-pop-head b { font-size: 16px; }
.notif-pop-head .btn { color: var(--brand-700); }
.notif-pop-list { max-height: min(460px, 65vh); overflow-y: auto; overscroll-behavior: contain; }
.notif-pop-empty { margin: 0; padding: 22px 18px; color: var(--text-2); font-size: 14px; text-align: center; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; color: var(--text); border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover, .notif-item:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.notif-item.unread { background: #f1f8fb; }
.notif-item.unread:hover { background: #e7f2f7; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; background: transparent; }
.notif-item.unread .notif-dot { background: var(--brand-500); }
.notif-text { flex: 1; min-width: 0; }
.notif-text b { display: block; font-size: 14px; line-height: 1.35; }
.notif-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); font-size: 13px; margin-top: 2px; }
.notif-text small { display: block; color: var(--text-3); font-size: 12px; margin-top: 3px; }
.notif-text em { font-style: normal; font-weight: 800; color: var(--brand-teal-ink); }
.notif-pop-foot { display: block; text-align: center; padding: 12px; font-weight: 700; font-size: 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 720px) {
  .bell-wrap { position: static; }
  .notif-pop { position: fixed; top: 62px; left: 12px; right: 12px; width: auto; max-width: none; }
  .notif-pop::before { display: none; }
  .notif-pop-list { max-height: calc(100vh - 220px); }
}
.me .who { max-width: 150px; min-width: 0; }
.me .who b, .me .who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .appbar .me .who { display: none; } }
.date-nav { display: flex; align-items: center; gap: 4px; }
.date-nav .btn-icon { font-size: 22px; line-height: 1; }
.date-nav .input { width: auto; }

/* Live clinic queue (token) card */
.live-q { padding: 18px 20px; margin-bottom: 22px; border-color: rgba(15,148,136,.25); background: linear-gradient(180deg, #f3fbfa, #fff 60%); }
.live-q-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.live-q-title { font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; color: var(--brand-teal-ink); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: livepulse 1.8s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); } 70% { box-shadow: 0 0 0 9px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.live-q-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.live-q-grid > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.live-q-grid small { display: block; color: var(--text-2); font-size: 12px; font-weight: 600; }
.live-q-grid b { display: block; font-size: 24px; font-weight: 800; line-height: 1.2; }
.live-q-token { background: var(--brand-700) !important; border-color: var(--brand-700) !important; color: #fff; }
.live-q-token small { color: rgba(255,255,255,.85) !important; }
.live-q-eta { margin: 12px 0 0; font-size: 14.5px; }
.live-q:not(.is-today) .live-q-grid { grid-template-columns: minmax(0, 200px); }
@media (max-width: 560px) { .live-q-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Doctor / reception day counters */
.day-counter { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.day-counter > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.day-counter b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; }
.day-counter small { color: var(--text-2); font-size: 12px; font-weight: 600; }
.day-counter .is-now { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.day-counter .is-now small { color: rgba(255,255,255,.85); }
.token-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.token { min-width: 38px; text-align: center; padding: 4px 8px; border-radius: 8px; font-weight: 800; font-size: 12.5px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.token.t-seen { background: var(--info-bg); color: var(--info); border-color: transparent; text-decoration: line-through; }
.token.t-waiting { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.token.t-missed { background: #eef1f3; color: var(--text-3); border-color: transparent; }
.token.t-now { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.doc-counts { display: grid; gap: 8px; margin-bottom: 18px; }
.doc-count { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); font-size: 13.5px; }
.doc-count b { font-size: 14.5px; margin-right: auto; }
.doc-count span { color: var(--text-2); font-weight: 600; }
.doc-count span strong { color: var(--text); font-size: 15px; }
.time-chip .tok { display: block; font-size: 11px; font-weight: 800; color: var(--brand-teal-ink); }
@media (max-width: 720px) { .day-counter { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.live-line { display: flex !important; align-items: center; gap: 6px; color: var(--brand-teal-ink) !important; font-weight: 700; margin-top: 3px; }
.chip-id { background: var(--brand-50); color: var(--brand-800); } .chip-id b { margin-left: 4px; letter-spacing: .03em; }
.wi-found { padding: 12px 14px; border-radius: var(--radius); background: var(--brand-50); margin-bottom: 14px; }
.wi-found b { display: block; font-size: 16px; }
.wi-found small { color: var(--text-2); }
.wi-people { display: grid; gap: 8px; }
.wi-person { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.wi-person:has(input:checked) { border-color: var(--brand-700); background: var(--brand-50); }
.wi-person input { margin-top: 4px; }
.wi-person b, .wi-person small { display: block; }
.wi-person small { color: var(--text-2); font-size: 12.5px; }
.wi-person .wi-hid { color: var(--brand-teal-ink); font-weight: 700; }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--text-2); }
.plain-list b { color: var(--text); }
.danger-zone { border-color: #f0c4be; }
.change-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.range-edit { display: inline-block; vertical-align: top; }
.range-edit > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.range-edit > summary::-webkit-details-marker { display: none; }
.range-edit[open] > summary { background: var(--brand-700); color: #fff; }
.range-form { margin-top: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 280px; }
.range-form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.range-form .field { margin-bottom: 8px; }
.range-form label { font-size: 12px; }
.range-form-actions { display: flex; gap: 8px; }
@media (max-width: 560px) { .range-form-row { grid-template-columns: 1fr 1fr; } }
.block { display: block; }
.table-tight td, .table-tight th { padding-top: 10px; padding-bottom: 10px; vertical-align: top; }
.table-tight small.block { font-size: 12px; margin-top: 2px; }
/* Admin master record */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--text-2); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.rec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-bottom: 22px; }
.rec-grid > .card { margin: 0; }
.rec-section { margin-bottom: 22px; }
.issue-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.trail { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.trail li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.trail li small { color: var(--text-3); }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th, .mini-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.mini-table th { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
/* Data flow diagram */
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; align-items: stretch; margin-bottom: 22px; }
.flow-step { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-right: 26px; }
.flow-step:last-child { margin-right: 0; }
.flow-step:not(:last-child)::after { content: ""; position: absolute; right: -22px; top: 50%; width: 18px; height: 2px; background: var(--brand-500); }
.flow-step:not(:last-child)::before { content: ""; position: absolute; right: -24px; top: calc(50% - 5px); border: 6px solid transparent; border-left-color: var(--brand-500); }
.flow-step h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-teal-ink); }
.flow-step .big { font-size: 30px; font-weight: 800; line-height: 1.1; }
.flow-step ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.flow-step ul b { color: var(--text); }
.dcheck { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; }
.dcheck > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.dcheck > summary::-webkit-details-marker { display: none; }
.dcheck-count { min-width: 40px; text-align: center; font-weight: 800; padding: 4px 8px; border-radius: 8px; background: var(--ok-bg); color: var(--ok); }
.dcheck.is-err .dcheck-count { background: var(--err-bg); color: var(--err); }
.dcheck.is-warn .dcheck-count { background: var(--warn-bg); color: var(--warn); }
.dcheck-body { padding: 0 16px 14px 68px; font-size: 13.5px; }
.dcheck-body ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 3px; }
@media (max-width: 900px) {
  .rec-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr 1fr; gap: 14px; }
  .flow-step { margin-right: 0; }
  .flow-step::after, .flow-step::before { display: none; }
}
@media (max-width: 560px) { .flow { grid-template-columns: 1fr; } .kv, .trail li { grid-template-columns: 1fr; } .dcheck-body { padding-left: 16px; } }
.badge-deleted { background: #eef1f3; color: var(--text-2); }
.appbar-inner { min-width: 0; }
.nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.me.is-active, .me:hover { background: var(--surface-2); text-decoration: none; }
.slots-full { grid-column: 1 / -1; margin: 6px 0 0; }

/* Start Clinic */
.clinic-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #eef1f3; color: var(--text-2); }
.clinic-status i { width: 9px; height: 9px; border-radius: 50%; background: #9aa7ad; flex: none; }
.clinic-status.is-open { background: var(--ok-bg); color: var(--ok); }
.clinic-status.is-open i { background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.45); animation: livepulse 1.8s infinite; }
.clinic-status.is-paused { background: var(--warn-bg); color: var(--warn); }
.clinic-status.is-paused i { background: var(--warn); }
.clinic-status.is-closed { background: #eef1f3; color: var(--text-3); }
@media (prefers-reduced-motion: reduce) { .clinic-status.is-open i { animation: none; } }
.clinic-ctl { padding: 18px 20px; margin-bottom: 22px; border-color: rgba(23,71,166,.18); }
.clinic-ctl-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.clinic-ctl-head b { font-size: 16px; }
.clinic-ctl-head small { flex-basis: 100%; }
.clinic-now { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--radius); background: var(--brand-50); margin-bottom: 12px; }
.clinic-now.is-empty { background: var(--surface-2); }
.clinic-now-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-teal-ink); }
.clinic-now b { font-size: 17px; }
.clinic-now-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.clinic-ctl-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.clinic-end { color: var(--err); }
.clinic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 18px; }
.clinic-grid .clinic-ctl { margin: 0; }
.live-q-clinic { margin: 0 0 10px; }
.live-q-turn { padding: 12px 14px; border-radius: var(--radius); background: #16a34a; color: #fff; margin-bottom: 12px; font-size: 15px; }

/* ─────────────── Sidebar (doctor and reception, desktop) ─────────────── */
.sidenav { display: none; }
@media (min-width: 1024px) {
  :root { --side-w: 236px; }
  html.side-min { --side-w: 72px; }
  body:has(> .sidenav) { padding-left: var(--side-w); }
  .sidenav { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30; background: var(--surface); border-right: 1px solid var(--border); padding: 0 12px 14px; transition: width .18s ease; overflow: hidden; }
  .sidenav-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 64px; flex: none; border-bottom: 1px solid var(--border); margin: 0 -12px 12px; padding: 0 10px 0 16px; }
  .sidenav-top .brand { color: var(--text); min-width: 0; }
  .sidenav-top .brand-tag { display: none; }
  .sidenav-toggle { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); cursor: pointer; transform: rotate(180deg); }
  .sidenav-toggle:hover { color: var(--text); background: var(--surface-2); }
  .sidenav-nav, .sidenav-foot { display: grid; gap: 2px; }
  .sidenav-nav { flex: 1; align-content: start; overflow-y: auto; scrollbar-width: thin; }
  .sidenav-foot { border-top: 1px solid var(--border); padding-top: 10px; }
  .sidenav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14.5px; white-space: nowrap; }
  .sidenav a svg { flex: none; }
  .sidenav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
  .sidenav a.is-active { background: var(--brand-50); color: var(--brand-700); box-shadow: inset 3px 0 0 var(--brand-700); }
  body:has(> .sidenav) .appbar .brand, body:has(> .sidenav) .appbar .nav { display: none; }
  body:has(> .sidenav) .appbar-inner, body:has(> .sidenav) .page { max-width: 1280px; }
  html.side-min .sidenav { padding: 0 10px 14px; }
  html.side-min .sidenav-top { flex-direction: column; justify-content: center; padding: 0; gap: 0; height: 64px; }
  html.side-min .sidenav-top .brand-text { display: none; }
  html.side-min .sidenav-top .brand-mark { width: 30px; height: 30px; }
  html.side-min .sidenav-toggle { width: 22px; height: 18px; border: 0; transform: none; }
  html.side-min .sidenav a { justify-content: center; padding: 11px 0; }
  html.side-min .sidenav a span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sidenav { transition: none; } }

/* ─────────────── Lab result values ─────────────── */
.lv-wrap { display: grid; gap: 14px; }
.lv-test { margin: 0 0 6px; font-size: 13.5px; color: var(--brand-800); }
.lv-table td, .lv-table th { vertical-align: top; }
.lv-table .lv-val { font-weight: 800; white-space: nowrap; }
.lv-table tr.lv-bad .lv-val { color: var(--err); }
.lv-table tr.lv-bad { background: #fff8f7; }
.lv-corr { display: block; font-size: 12px; color: var(--text-3); font-weight: 500; }
.lv-flag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.lv-flag-normal { background: var(--ok-bg); color: var(--ok); }
.lv-flag-low, .lv-flag-high, .lv-flag-abnormal { background: var(--err-bg); color: var(--err); }
.lv-flag-critical { background: var(--err); color: #fff; }
.lv-fix summary { list-style: none; }
.lv-fix summary::-webkit-details-marker { display: none; }
.lv-fix-form { text-align: left; min-width: 220px; padding: 10px; margin-top: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lv-tl { margin-top: 10px; }
.lv-tl summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--brand-700); margin-bottom: 8px; }
.lv-upload > summary { list-style: none; margin-bottom: 12px; }
.lv-upload > summary::-webkit-details-marker { display: none; }
.lv-ed th { font-size: 12px; white-space: nowrap; }
.lv-ed { table-layout: fixed; min-width: 640px; }
.lv-ed th, .lv-ed td { padding: 3px; }
.lv-ed th { padding-left: 6px; }
.lv-ed .input-sm, .input-sm { height: 34px; padding: 5px 7px; font-size: 13px; min-width: 0; width: 100%; }
.lv-ed .lv-in-val { font-weight: 700; }
.lv-ed td:last-child { text-align: center; }
.lv-ed-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.lv-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; }
.chip-btn:hover { border-color: var(--brand-500); color: var(--brand-800); }
.badge-processing { background: var(--info-bg); color: var(--info); }
.badge-sample_rejected { background: var(--err-bg); color: var(--err); }
.ev-list { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: grid; gap: 10px; font-size: 13.5px; }
.ev-list li { position: relative; }
.ev-list li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-600); }
.ev-list b { display: block; }
.ev-list small { color: var(--text-3); }
.review-card { margin-bottom: 22px; border-left: 4px solid #7c3aed; }
.review-card h2 { display: inline-flex; align-items: center; gap: 8px; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: #7c3aed; color: #fff; font-size: 12px; }
.review-list { list-style: none; margin: 0; padding: 0; }
.review-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--border); }
.review-list li:first-child { border-top: 0; }
.review-list a { color: var(--text); min-width: 0; display: grid; }
.review-list a:hover { text-decoration: none; }
.review-list a span { font-size: 13.5px; color: var(--text-2); }
.review-list a small { font-size: 12px; color: var(--text-3); }
.review-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.review-form .field { flex: 1 1 260px; margin: 0; }
.review-form .form-alert { flex-basis: 100%; }
/* Encounters and diagnoses */
.enc-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--surface-2); color: var(--text-2); }
.enc-in_progress { background: var(--info-bg); color: var(--info); }
.enc-completed { background: var(--ok-bg); color: var(--ok); }
.enc-cancelled { background: var(--err-bg); color: var(--err); }
.allergy-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px; border-radius: 10px; background: var(--err-bg); border: 1px solid #f3c9c4; color: var(--err); font-size: 14px; }
.dx-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.dx-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.dx-list li.dx-ruled_out b, .dx-list li.dx-resolved b { text-decoration: line-through; color: var(--text-3); }
.dx-main { min-width: 0; display: grid; gap: 4px; }
.dx-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.dx-tag { padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.dx-primary { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.dx-t-provisional { background: var(--warn-bg); border-color: #f7d8a8; color: var(--warn); }
.dx-t-confirmed { background: var(--ok-bg); border-color: #bfe6d2; color: var(--ok); }
.dx-t-differential { background: var(--info-bg); border-color: #c8dbf7; color: var(--info); }
.dx-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dx-add summary { list-style: none; }
.dx-add summary::-webkit-details-marker { display: none; }
.dx-add[open] summary { margin-bottom: 10px; }
.dx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 0 0 12px; }
@media (max-width: 520px) { .dx-row { grid-template-columns: 1fr; } }

/* ── Brand buttons: the main call to action is brand blue everywhere (was coral) ── */
.btn-accent { background: linear-gradient(135deg, #2a86f0 0%, #1a63d6 55%, #1747a6 100%); color: #fff; border-color: transparent; box-shadow: 0 10px 22px -12px rgba(23, 92, 214, .75); }
.btn-accent:hover { background: linear-gradient(135deg, #2a86f0 0%, #1a63d6 55%, #1747a6 100%); filter: brightness(1.06); color: #fff; text-decoration: none; }
.btn-accent:focus-visible { box-shadow: 0 0 0 3px rgba(42, 134, 240, .35); }
.btn-accent[disabled] { filter: saturate(.6); }
.partner-note { background: #eef8f6; color: #0b5f57; border: 1px solid rgba(15, 148, 136, .14); }
.partner-note a { color: var(--brand-teal-ink); }
.book-cta { background: linear-gradient(135deg, #fff, var(--brand-50)); border-color: var(--brand-100); }

/* ── Top bar: the tagline gives way so every menu link fits (admin has seven) ── */
@media (min-width: 761px) and (max-width: 1400px) { .appbar .brand-tag { display: none; } }
/* Admin has seven menu links: the tagline makes room for them at every desktop width. */
@media (min-width: 761px) { .appbar-inner:has(.nav a:nth-child(7)) .brand-tag { display: none; } }

/* ── Admin overview: the six platform tiles stay in one row on desktop ── */
.tiles.tiles-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .tiles.tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
