/* portal.css — Patient Portal demo (Demo #06) — Synkrew design language
   Inter · slate + blue-600 · rounded-2xl cards · soft shadows · dark sidebar */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --blue: #2563eb; --blue-d: #1d4ed8; --blue-soft: #eff6ff; --blue-line: #bfdbfe;
  --navy: #0f172a; --ink: #0f172a; --body: #475569; --mut: #94a3b8;
  --line: #e2e8f0; --line-soft: #eef2f7; --bg: #f1f5f9; --card: #ffffff;
  --emerald: #059669; --emerald-soft: #ecfdf5; --emerald-line: #a7f3d0;
  --amber: #b45309; --amber-soft: #fffbeb; --amber-line: #fde68a;
  --rose: #be123c; --rose-soft: #fff1f2; --rose-line: #fecdd3;
  --violet: #6d28d9; --violet-soft: #f5f3ff; --violet-line: #ddd6fe;
  --teal: #0f766e; --teal-soft: #f0fdfa; --teal-line: #99f6e4;
  --sh-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.06);
  --sh-md: 0 4px 14px -2px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.05);
  --sh-lg: 0 24px 60px -15px rgba(15,23,42,.18);
  --r: 16px; --r-sm: 10px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
::selection { background: var(--blue-soft); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ---------- scrollbars ---------- */
.scroll-thin { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.scroll-thin::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-thin::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }

/* ============================= LOGIN ============================= */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-brand {
  background: radial-gradient(1200px 700px at -10% -20%, #1e3a8a55 0%, transparent 55%),
              radial-gradient(900px 600px at 110% 115%, #1d4ed844 0%, transparent 55%), var(--navy);
  color: #e2e8f0; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.login-brand::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(148,163,184,.14) 1px, transparent 1px); background-size: 26px 26px;
  mask-image: radial-gradient(700px 500px at 30% 20%, #000 0%, transparent 75%); }
.lb-logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.lb-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center; color: #fff; box-shadow: 0 8px 20px -6px rgba(37,99,235,.55); }
.lb-name { font-weight: 700; font-size: 16px; color: #fff; letter-spacing: -.01em; }
.lb-sub { font-size: 12px; color: #94a3b8; }
.lb-body { margin: auto 0; max-width: 480px; position: relative; z-index: 1; padding: 48px 0; }
.lb-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: #93c5fd; background: rgba(37,99,235,.16); border: 1px solid rgba(147,197,253,.3);
  padding: 6px 12px; border-radius: 999px; }
.lb-h1 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 800; letter-spacing: -.03em; color: #fff; margin: 18px 0 14px; line-height: 1.15; }
.lb-h1 em { font-style: normal; background: linear-gradient(90deg, #93c5fd, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-p { color: #94a3b8; font-size: 15px; max-width: 42ch; }
.lb-feats { margin-top: 30px; display: grid; gap: 13px; }
.lb-feat { display: flex; gap: 12px; align-items: flex-start; }
.lb-ic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: rgba(59,130,246,.14);
  border: 1px solid rgba(96,165,250,.25); display: grid; place-items: center; color: #93c5fd; }
.lb-feat b { color: #e2e8f0; font-weight: 600; font-size: 14px; display: block; }
.lb-feat span { color: #7c8ba1; font-size: 13px; }
.lb-foot { position: relative; z-index: 1; font-size: 12px; color: #64748b; display: flex; gap: 18px; flex-wrap: wrap; }
.lb-foot a { color: #94a3b8; }
.demo-chip { position: absolute; top: 20px; right: 20px; z-index: 2; font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: #fbbf24; background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.35);
  border-radius: 999px; padding: 6px 12px; display: inline-flex; gap: 6px; align-items: center; }
.demo-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #fbbf24; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.login-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 410px; }
.login-card h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-card .sub { color: var(--body); font-size: 14px; margin: 6px 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.in { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); padding: 11px 14px; font-size: 14px;
  transition: border .15s, box-shadow .15s; }
.in:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.in::placeholder { color: #a3b0c2; }
.field .hint { font-size: 12px; color: var(--mut); margin-top: 5px; }
.login-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 20px; font-size: 13px; }
.chk { display: inline-flex; gap: 8px; align-items: center; color: var(--body); cursor: pointer; user-select: none; }
.chk input { accent-color: var(--blue); width: 15px; height: 15px; }
.hipaa-note { margin-top: 22px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--blue-soft);
  border: 1px solid var(--blue-line); color: #1e40af; font-size: 12.5px; display: flex; gap: 9px; align-items: flex-start; }
.hipaa-note svg { flex: 0 0 auto; margin-top: 1px; }
.login-err { color: var(--rose); font-size: 13px; margin: -8px 0 14px; display: none; }

/* ============================= SHELL ============================= */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0b1322 0%, var(--navy) 30%); color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; }
.sb-mark { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center; color: #fff; flex: 0 0 36px; }
.sb-brand b { color: #fff; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; display: block; }
.sb-brand span { font-size: 11px; color: #64748b; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.sb-sect { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #475569; padding: 16px 10px 7px; }
.sb-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 9.5px 11px; border-radius: 10px;
  color: #94a3b8; font-size: 13.5px; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; position: relative; }
.sb-item svg { flex: 0 0 auto; opacity: .85; }
.sb-item:hover { background: rgba(148,163,184,.09); color: #e2e8f0; }
.sb-item.active { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px rgba(37,99,235,.55); }
.sb-item .badge { margin-left: auto; background: var(--rose); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 6.5px; }
.sb-item.active .badge { background: #fff; color: var(--blue-d); }
.sb-pat { margin: 10px 12px 14px; padding: 12px; border-radius: 14px; background: rgba(148,163,184,.07);
  border: 1px solid rgba(148,163,184,.13); display: flex; gap: 11px; align-items: center; }
.sb-pat b { color: #e2e8f0; font-size: 13px; display: block; }
.sb-pat span { font-size: 11.5px; color: #64748b; }
.sb-pat button { margin-left: auto; color: #64748b; padding: 6px; border-radius: 8px; }
.sb-pat button:hover { color: #fca5a5; background: rgba(248,113,113,.12); }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--blue-soft); color: var(--blue-d); border: 1px solid var(--blue-line); }
.avatar.dark { background: rgba(59,130,246,.2); color: #93c5fd; border-color: rgba(96,165,250,.35); }
.sb-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 39; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(241,245,249,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 0 28px; height: 62px; display: flex; align-items: center; gap: 14px; }
.tb-burger { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; place-items: center; color: var(--body); }
.tb-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.tb-crumb { font-size: 12px; color: var(--mut); margin-top: -2px; }
.tb-spacer { flex: 1; }
.tb-search { position: relative; width: 300px; max-width: 34vw; }
.tb-search .in { padding-left: 36px; height: 38px; border-radius: 999px; background: #fff; }
.tb-search > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--mut); pointer-events: none; }
.search-pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--sh-lg); padding: 6px; z-index: 60; max-height: 320px; overflow: auto; }
.search-hit { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px; }
.search-hit:hover { background: var(--blue-soft); }
.search-hit b { font-size: 13px; color: var(--ink); font-weight: 600; display: block; }
.search-hit span { font-size: 11.5px; color: var(--mut); }
.search-ic { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; display: grid; place-items: center; background: var(--line-soft); color: var(--body); }
.tb-icon { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: var(--body); transition: background .15s; }
.tb-icon:hover { background: var(--line-soft); }
.tb-icon .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); border: 2px solid #fff; }
.pop { position: absolute; top: calc(100% + 10px); right: 0; width: 340px; max-width: calc(100vw - 32px); background: #fff;
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-lg); z-index: 60; overflow: hidden; }
.pop-head { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }
.pop-head b { font-size: 14px; }
.pop-head button { font-size: 12.5px; color: var(--blue); font-weight: 600; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); width: 100%; text-align: left; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: #f8fafc; }
.notif .nic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid; place-items: center; background: var(--line-soft); color: var(--body); }
.notif.unread .nic { background: var(--blue-soft); color: var(--blue); }
.notif b { font-size: 13px; font-weight: 600; color: var(--ink); display: block; line-height: 1.4; }
.notif span { font-size: 11.5px; color: var(--mut); }
.notif .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-left: auto; flex: 0 0 auto; margin-top: 6px; }

.page { padding: 26px 28px 48px; max-width: 1200px; width: 100%; margin: 0 auto; animation: pageIn .3s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { color: var(--body); font-size: 14px; margin-top: 3px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================= PRIMITIVES ============================= */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.card-head .lnk { font-size: 13px; color: var(--blue); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.card-head .lnk:hover { text-decoration: underline; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; font-size: 13.5px;
  border-radius: var(--r-sm); padding: 9px 16px; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px rgba(37,99,235,.5); }
.btn-primary:hover { background: var(--blue-d); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-danger { background: #fff; border: 1px solid var(--rose-line); color: var(--rose); }
.btn-danger:hover { background: var(--rose-soft); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-quiet { color: var(--body); padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.btn-quiet:hover { background: var(--line-soft); color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tone-emerald { background: var(--emerald-soft); color: var(--emerald); border: 1px solid var(--emerald-line); }
.tone-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); }
.tone-rose { background: var(--rose-soft); color: var(--rose); border: 1px solid var(--rose-line); }
.tone-blue { background: var(--blue-soft); color: var(--blue-d); border: 1px solid var(--blue-line); }
.tone-slate { background: var(--line-soft); color: var(--body); border: 1px solid var(--line); }
.tone-violet { background: var(--violet-soft); color: var(--violet); border: 1px solid var(--violet-line); }
.tone-teal { background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal-line); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.kpi .k-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--body); }
.kpi .k-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 30px; }
.kpi .k-val { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 9px; line-height: 1.1; }
.kpi .k-val small { font-size: 13px; font-weight: 600; color: var(--mut); margin-left: 3px; }
.kpi .k-sub { font-size: 12px; color: var(--mut); margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.spark { position: absolute; right: 12px; bottom: 12px; opacity: .9; }
.sect-title { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mut); margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.tabs { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 2px; }
.tab { padding: 7px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--body); transition: all .15s; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--navy); color: #fff; }
.subnav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.subnav button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 15px; font-size: 13px; font-weight: 600; color: var(--body); transition: all .15s; }
.subnav button:hover { border-color: #cbd5e1; color: var(--ink); }
.subnav button.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mut);
  padding: 11px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--body); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl b { color: var(--ink); font-weight: 600; }
.prog { height: 7px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.prog > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, var(--blue)); transition: width .5s ease; }
.prog.ok > i { background: linear-gradient(90deg, #34d399, var(--emerald)); }
.prog.warn > i { background: linear-gradient(90deg, #fbbf24, #d97706); }
.ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--line-soft) 0); transition: --p .5s; }
.ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.ring b { position: relative; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.ring em { position: relative; font-style: normal; font-size: 10px; color: var(--mut); font-weight: 600; text-align: center; line-height: 1.2; }
.empty { text-align: center; padding: 38px 20px; color: var(--mut); }
.empty .eic { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; background: var(--line-soft); display: grid; place-items: center; color: #94a3b8; }
.empty b { color: var(--body); font-size: 14px; display: block; margin-bottom: 3px; }
.empty span { font-size: 13px; }
.mini-list { display: grid; gap: 2px; }
.mini-item { display: flex; gap: 11px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); }
.mini-item:last-child { border-bottom: 0; }
.mini-item .mic { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; display: grid; place-items: center; }
.mini-item b { font-size: 13.5px; font-weight: 600; color: var(--ink); display: block; }
.mini-item span { font-size: 12px; color: var(--mut); }

/* ============================= DASHBOARD ============================= */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hello h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hello .date { color: var(--body); font-size: 14px; margin-top: 3px; }
.next-appt { background: linear-gradient(120deg, var(--navy) 0%, #16233f 100%); border-radius: var(--r); color: #cbd5e1;
  padding: 22px; position: relative; overflow: hidden; box-shadow: var(--sh-md); }
.next-appt::after { content: ''; position: absolute; right: -70px; top: -70px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.25), transparent 65%); }
.next-appt .na-tag { display: inline-flex; gap: 6px; align-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #93c5fd; background: rgba(37,99,235,.18); border: 1px solid rgba(96,165,250,.3);
  padding: 5px 11px; border-radius: 999px; }
.next-appt h3 { color: #fff; font-size: 19px; font-weight: 700; margin: 12px 0 3px; letter-spacing: -.01em; }
.next-appt .na-when { color: #93c5fd; font-weight: 600; font-size: 14px; }
.next-appt .na-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: #94a3b8; }
.next-appt .na-meta span { display: inline-flex; gap: 6px; align-items: center; }
.next-appt .na-actions { display: flex; gap: 10px; margin-top: 18px; position: relative; z-index: 1; flex-wrap: wrap; }
.btn-video { background: #fff; color: var(--navy); font-weight: 700; }
.btn-video:hover { background: #e2e8f0; }
.task { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.task:last-child { border-bottom: 0; }
.task .cbox { width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px; border: 1.6px solid #cbd5e1; display: grid; place-items: center; color: #fff; transition: all .15s; }
.task .cbox:hover { border-color: var(--blue); }
.task.done .cbox { background: var(--emerald); border-color: var(--emerald); }
.task.done .t-text { color: var(--mut); text-decoration: line-through; }
.task .t-text { font-size: 13.5px; font-weight: 500; flex: 1; }
.task .t-count { font-size: 11.5px; color: var(--mut); font-weight: 600; }
.ann { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.ann:last-child { border-bottom: 0; }
.ann .aic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid; place-items: center; }
.ann b { font-size: 13px; color: var(--ink); display: block; }
.ann span { font-size: 12.5px; color: var(--body); }
.vital-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============================= APPOINTMENTS ============================= */
.appt-card { display: flex; gap: 16px; padding: 18px 20px; align-items: flex-start; }
.appt-when { flex: 0 0 86px; text-align: center; border-right: 1px solid var(--line-soft); padding-right: 16px; }
.appt-when b { display: block; font-size: 17px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.appt-when span { font-size: 12px; color: var(--mut); font-weight: 600; }
.appt-when .tm { display: inline-block; margin-top: 7px; font-size: 12.5px; font-weight: 700; color: var(--blue-d);
  background: var(--blue-soft); border: 1px solid var(--blue-line); padding: 3px 10px; border-radius: 999px; }
.appt-body { flex: 1; min-width: 0; }
.appt-body h4 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.appt-body .why { color: var(--body); font-size: 13.5px; margin-top: 2px; }
.appt-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 9px; font-size: 12.5px; color: var(--mut); }
.appt-meta span { display: inline-flex; gap: 5px; align-items: center; }
.appt-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 128px; }
.past-note { font-size: 12.5px; color: var(--mut); margin-top: 6px; }
.pdot { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.c-blue { background: var(--blue-soft); color: var(--blue-d); border: 1px solid var(--blue-line); }
.c-violet { background: var(--violet-soft); color: var(--violet); border: 1px solid var(--violet-line); }
.c-teal { background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal-line); }
.c-rose { background: var(--rose-soft); color: var(--rose); border: 1px solid var(--rose-line); }
.c-emerald { background: var(--emerald-soft); color: var(--emerald); border: 1px solid var(--emerald-line); }
.c-slate { background: var(--line-soft); color: var(--body); border: 1px solid var(--line); }

/* ============================= RECORDS / LABS ============================= */
.rec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.rec-card { padding: 16px 18px; }
.rec-card h4 { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.rec-card .code { font-size: 11px; color: var(--mut); font-weight: 600; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.rec-card p { font-size: 13px; color: var(--body); margin-top: 7px; }
.rec-card .meta { font-size: 12px; color: var(--mut); margin-top: 9px; display: flex; gap: 12px; flex-wrap: wrap; }
.lab-row { display: flex; align-items: center; gap: 15px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); width: 100%; text-align: left; transition: background .12s; }
.lab-row:last-child { border-bottom: 0; }
.lab-row:hover { background: #f8fafc; }
.lab-row .lic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center; }
.lab-row b { font-size: 14px; color: var(--ink); font-weight: 700; display: block; }
.lab-row .lsub { font-size: 12px; color: var(--mut); margin-top: 1px; }
.lab-row .lright { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.gauge { height: 6px; border-radius: 999px; background: var(--line-soft); position: relative; margin: 10px 0 4px; }
.gauge > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; transition: width .6s ease; }
.g-ok > i { background: linear-gradient(90deg, #34d399, #059669); }
.g-warn > i { background: linear-gradient(90deg, #fbbf24, #d97706); }
.g-bad > i { background: linear-gradient(90deg, #fb7185, #be123c); }
.gauge .refmark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--navy); opacity: .35; border-radius: 2px; }
.lab-item { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.lab-item:last-child { border-bottom: 0; }
.lab-item .li-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lab-item .li-name { font-weight: 600; font-size: 13.5px; }
.lab-item .li-val { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-left: auto; }
.lab-item .li-val small { font-size: 12px; color: var(--mut); font-weight: 600; margin-left: 2px; }
.lab-item .li-ref { font-size: 12px; color: var(--mut); }
.lab-comment { margin-top: 14px; padding: 13px 15px; border-radius: 12px; background: var(--blue-soft); border: 1px solid var(--blue-line);
  font-size: 13px; color: #1e40af; display: flex; gap: 10px; }
.lab-comment svg { flex: 0 0 auto; margin-top: 2px; }
.doc-note { font-size: 12.5px; color: var(--mut); margin-top: 6px; }

/* ============================= PRESCRIPTIONS ============================= */
.med-card { padding: 17px 18px; display: flex; flex-direction: column; gap: 10px; }
.med-top { display: flex; align-items: flex-start; gap: 12px; }
.med-ic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-d); border: 1px solid var(--blue-line); }
.med-top h4 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.med-top .dose { font-size: 12.5px; color: var(--body); font-weight: 600; }
.med-top .pill { margin-left: auto; }
.med-sched { font-size: 13px; color: var(--body); display: flex; gap: 6px; align-items: center; }
.med-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--mut); border-top: 1px dashed var(--line); padding-top: 11px; }
.med-foot .prog { flex: 1; min-width: 90px; }
.med-warn { font-size: 12px; color: var(--amber); background: var(--amber-soft); border: 1px solid var(--amber-line); border-radius: 9px; padding: 8px 11px; display: flex; gap: 7px; }

/* ============================= MESSAGES ============================= */
.msg-grid { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }
.thread-list { overflow: hidden; }
.thread { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); width: 100%; text-align: left; transition: background .12s; align-items: flex-start; }
.thread:last-child { border-bottom: 0; }
.thread:hover { background: #f8fafc; }
.thread.active { background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.thread b { font-size: 13.5px; font-weight: 600; color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .subj { font-size: 12.5px; color: var(--body); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.thread .meta { font-size: 11px; color: var(--mut); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.chat { display: flex; flex-direction: column; min-height: 460px; max-height: calc(100vh - 220px); overflow: hidden; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 11px; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: #f8fafc; }
.bubble { max-width: 78%; padding: 12px 15px; border-radius: 16px; font-size: 13.5px; line-height: 1.55; position: relative; animation: pageIn .25s ease both; }
.bubble.them { background: #fff; border: 1px solid var(--line); color: var(--ink); border-top-left-radius: 6px; align-self: flex-start; box-shadow: var(--sh-sm); }
.bubble.me { background: var(--blue); color: #fff; border-top-right-radius: 6px; align-self: flex-end; }
.bubble .b-who { font-size: 11px; font-weight: 700; margin-bottom: 3px; color: var(--blue-d); display: flex; gap: 6px; align-items: center; }
.bubble.me .b-who { color: #bfdbfe; }
.bubble .b-when { font-size: 10.5px; opacity: .65; margin-top: 5px; }
.b-att { display: inline-flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; font-weight: 600;
  background: var(--line-soft); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; color: var(--body); }
.chat-foot { padding: 13px 16px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; background: #fff; }
.chat-foot .in { flex: 1; resize: none; min-height: 42px; max-height: 110px; }
.chat-back { display: none; }
.typing { display: inline-flex; gap: 4px; padding: 12px 15px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ============================= BILLING ============================= */
.balance-card { background: linear-gradient(130deg, var(--navy), #1e293b); color: #fff; border-radius: var(--r); padding: 22px;
  position: relative; overflow: hidden; box-shadow: var(--sh-md); }
.balance-card .amt { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.balance-card .due { color: #94a3b8; font-size: 13px; margin-top: 2px; }
.balance-card .brandmark { position: absolute; right: 18px; top: 18px; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: #64748b; }
.ins-card { border-radius: var(--r); padding: 18px; background: linear-gradient(130deg, #1e3a8a, var(--blue-d)); color: #fff;
  position: relative; overflow: hidden; box-shadow: var(--sh-md); min-height: 172px; display: flex; flex-direction: column; }
.ins-card::after { content: ''; position: absolute; inset: 0; background: radial-gradient(500px 200px at 85% -10%, rgba(255,255,255,.14), transparent 60%); }
.ins-card .payer { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.ins-card .plan { font-size: 12px; color: #bfdbfe; }
.ins-card .rows { margin-top: auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; position: relative; z-index: 1; }
.ins-card .rows span { display: block; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: #93c5fd; font-weight: 700; }
.ins-card .rows b { font-size: 13px; font-weight: 600; font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .04em; }
.deduc { padding: 15px 17px; border-radius: var(--r-sm); background: var(--line-soft); }
.deduc .d-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--body); font-weight: 600; }
.deduc .prog { margin-top: 9px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13.5px; color: var(--body); }
.summary-row b { color: var(--ink); font-weight: 600; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 13px; }
.summary-row.total b { font-size: 16px; font-weight: 800; }
.pay-method { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; font-weight: 600; }
.pay-method.sel { border-color: var(--blue); background: var(--blue-soft); }
.pay-method .pm-ic { width: 40px; height: 26px; border-radius: 5px; background: var(--navy); color: #fff; font-size: 9px; font-weight: 800;
  display: grid; place-items: center; letter-spacing: .05em; flex: 0 0 40px; }

/* ============================= DOCUMENTS ============================= */
.form-row { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.form-row:last-child { border-bottom: 0; }
.form-row .fic { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; }
.form-row b { font-size: 14px; color: var(--ink); display: block; }
.form-row .fsub { font-size: 12.5px; color: var(--mut); margin-top: 2px; }
.sig-line { border-bottom: 1.5px dashed #94a3b8; min-height: 38px; display: flex; align-items: flex-end; padding-bottom: 4px; }
.sig-script { font-family: 'Segoe Script', 'Bradley Hand', cursive; font-size: 21px; color: var(--navy); }
.dropzone { border: 1.6px dashed #cbd5e1; border-radius: 14px; padding: 26px; text-align: center; color: var(--mut);
  font-size: 13.5px; transition: all .15s; background: #fff; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-d); }
.dropzone b { color: var(--blue); font-weight: 700; }

/* ============================= SETTINGS ============================= */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.set-row:last-child { border-bottom: 0; }
.set-row .s-txt b { font-size: 13.5px; font-weight: 600; color: var(--ink); display: block; }
.set-row .s-txt span { font-size: 12.5px; color: var(--mut); }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 42px; border-radius: 999px; background: #cbd5e1; transition: background .18s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.25); transition: transform .18s; }
.switch.on { background: var(--blue); }
.switch.on::after { transform: translateX(18px); }
.session { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.session:last-child { border-bottom: 0; }
.session .sic { width: 34px; height: 34px; border-radius: 10px; background: var(--line-soft); display: grid; place-items: center; color: var(--body); }
.session .cur { margin-left: auto; }

/* ============================= MODALS & WIZARD ============================= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(3px); z-index: 80;
  display: grid; place-items: center; padding: 18px; animation: fadeIn .18s ease both; overflow-y: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 20px; box-shadow: var(--sh-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 36px);
  display: flex; flex-direction: column; animation: popIn .22s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 680px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.modal-x { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--mut); }
.modal-x:hover { background: var(--line-soft); color: var(--ink); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.modal-foot .left { margin-right: auto; }
.wiz-steps { display: flex; gap: 6px; align-items: center; margin-bottom: 20px; }
.wiz-step { flex: 1; height: 5px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.wiz-step i { display: block; height: 100%; background: var(--blue); width: 0; transition: width .3s; }
.wiz-step.done i, .wiz-step.cur i { width: 100%; }
.wiz-label { font-size: 12px; color: var(--mut); font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; }
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.opt { border: 1.4px solid var(--line); border-radius: 13px; padding: 13px 14px; text-align: left; transition: all .14s; background: #fff; }
.opt:hover { border-color: #cbd5e1; }
.opt.sel { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.opt b { font-size: 13.5px; font-weight: 700; display: block; color: var(--ink); }
.opt span { font-size: 12px; color: var(--mut); display: block; margin-top: 2px; }
.slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.slot { border: 1.4px solid var(--line); border-radius: 10px; padding: 9px 6px; font-size: 13px; font-weight: 600; color: var(--ink);
  text-align: center; transition: all .14s; background: #fff; }
.slot:hover { border-color: var(--blue); color: var(--blue-d); }
.slot.sel { background: var(--blue); border-color: var(--blue); color: #fff; }
.slot[disabled] { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-cell { border: 1.4px solid var(--line); border-radius: 12px; padding: 9px 4px; text-align: center; transition: all .14s; background: #fff; }
.day-cell .dw { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.day-cell .dn { font-size: 16px; font-weight: 800; margin-top: 2px; }
.day-cell:hover { border-color: var(--blue); }
.day-cell.sel { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.day-cell.sel .dn { color: var(--blue-d); }
.success-hero { text-align: center; padding: 14px 0 4px; }
.success-hero .okic { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--emerald-soft);
  border: 1.5px solid var(--emerald-line); display: grid; place-items: center; color: var(--emerald); animation: popIn .35s cubic-bezier(.2,.9,.3,1.4) both; }
.success-hero h3 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.success-hero p { color: var(--body); font-size: 13.5px; margin-top: 5px; }

/* ============================= TOASTS ============================= */
#toastRoot { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 9px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: #e2e8f0; font-size: 13.5px; font-weight: 500; border-radius: 12px; padding: 11px 17px;
  box-shadow: var(--sh-lg); display: flex; gap: 9px; align-items: center; animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2) both; max-width: min(480px, calc(100vw - 32px)); }
.toast.ok svg { color: #34d399; }
.toast.warn svg { color: #fbbf24; }
.toast.out { animation: toastOut .22s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ============================= AVA (AI assistant) ============================= */
.ava-fab { position: fixed; right: 22px; bottom: 22px; z-index: 70; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, var(--blue-d)); color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 30px -8px rgba(37,99,235,.6); transition: transform .15s; }
.ava-fab:hover { transform: scale(1.06); }
.ava-fab .ping { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid rgba(59,130,246,.5); animation: ringPulse 2.2s infinite; }
@keyframes ringPulse { 0% { transform: scale(.9); opacity: 1; } 70%, 100% { transform: scale(1.25); opacity: 0; } }
.ava-panel { position: fixed; right: 22px; bottom: 90px; z-index: 71; width: 372px; max-width: calc(100vw - 28px); height: 520px;
  max-height: calc(100vh - 120px); background: #fff; border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--sh-lg);
  display: flex; flex-direction: column; overflow: hidden; animation: popIn .22s cubic-bezier(.2,.9,.3,1.2) both; }
.ava-head { padding: 15px 17px; background: linear-gradient(120deg, var(--navy), #16233f); color: #fff; display: flex; gap: 11px; align-items: center; }
.ava-av { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #60a5fa, #2563eb); display: grid; place-items: center; flex: 0 0 38px; }
.ava-head b { font-size: 14.5px; display: block; }
.ava-head span { font-size: 11.5px; color: #93c5fd; display: flex; gap: 5px; align-items: center; }
.ava-head .st { width: 7px; height: 7px; border-radius: 50%; background: #34d399; }
.ava-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 11px; background: #f8fafc; }
.ava-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; animation: pageIn .22s ease both; }
.ava-msg.bot { background: #fff; border: 1px solid var(--line); border-top-left-radius: 5px; align-self: flex-start; box-shadow: var(--sh-sm); }
.ava-msg.user { background: var(--blue); color: #fff; border-top-right-radius: 5px; align-self: flex-end; }
.ava-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 10px; background: #f8fafc; }
.ava-chip { font-size: 12px; font-weight: 600; color: var(--blue-d); background: #fff; border: 1px solid var(--blue-line);
  border-radius: 999px; padding: 6px 12px; transition: all .13s; }
.ava-chip:hover { background: var(--blue-soft); }
.ava-foot { padding: 11px 13px; border-top: 1px solid var(--line-soft); display: flex; gap: 9px; background: #fff; }
.ava-foot .in { flex: 1; border-radius: 999px; padding: 9px 15px; }
.ava-send { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; }
.ava-send:hover { background: var(--blue-d); }
.ava-send:disabled { opacity: .5; cursor: not-allowed; }
.ava-note { font-size: 10.5px; color: var(--mut); text-align: center; padding: 0 14px 9px; background: #fff; }
.skel { position: relative; overflow: hidden; background: var(--line-soft); border-radius: 8px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ============================= RESPONSIVE ============================= */
@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .pp-hero, .pp-duo, .pp-rx, .pp-bill, .pp-doc { grid-template-columns: 1fr !important; }
  .pp-hero > .next-appt { order: -1; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-104%); transition: transform .24s ease; height: 100dvh; }
  .sidebar.open { transform: none; box-shadow: var(--sh-lg); }
  .tb-burger { display: grid; }
  .g4, .vital-strip { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
  .rec-grid { grid-template-columns: 1fr; }
  .msg-grid { grid-template-columns: 1fr; }
  .thread-list { max-height: 300px; }
  .chat-back { display: inline-flex; }
  .chat.hidden-m { display: none; }
  .thread-list.hidden-m { display: none; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .page { padding: 20px 16px 40px; }
  .topbar { padding: 0 14px; }
  .tb-search { display: none; }
  .appt-actions { flex-direction: row; min-width: 0; }
  .appt-card { flex-wrap: wrap; }
  .slot-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .g2, .g3, .g4, .vital-strip, .opt-grid { grid-template-columns: 1fr; }
  .slot-grid { grid-template-columns: repeat(2, 1fr); }
  .day-strip { grid-template-columns: repeat(4, 1fr); }
  .ins-card .rows { grid-template-columns: 1fr 1fr; }
  .balance-card .amt { font-size: 28px; }
  .tb-title { font-size: 14.5px; }
  .bubble { max-width: 92%; }
  .appt-when { flex-basis: 72px; }
  .page-head h1 { font-size: 19px; }
  .hello h1 { font-size: 20px; }
  .ava-panel { right: 10px; bottom: 84px; height: min(540px, calc(100dvh - 100px)); }
  .ava-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; }
  .pop { right: -62px; }
  .demo-chip { position: static; margin-bottom: 14px; }
}
@media print { .sidebar, .topbar, .ava-fab, .ava-panel { display: none !important; } }

/* ============================= DOCTOR PORTAL ADDITIONS (DEMO-15) ============================= */
/* login: clinician teal accent */
.dd-login .lb-eyebrow { color: #5eead4; background: rgba(15,118,110,.22); border-color: rgba(94,234,212,.35); }
.dd-login .lb-mark { background: linear-gradient(135deg, #14b8a6, #0f766e); box-shadow: 0 8px 20px -6px rgba(20,184,166,.5); }
.dd-login .lb-h1 em { font-style: normal; color: #5eead4; }

/* ---------- KPI stat row ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--kc, var(--blue)); opacity: .85; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .06em; }
.kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--body); margin-top: 2px; }
.kpi-sub b { font-weight: 700; }
.kpi-sub .up { color: var(--emerald); } .kpi-sub .warn { color: var(--amber); }

/* ---------- schedule timeline ---------- */
.sch-timeline { display: flex; flex-direction: column; }
.sch-row { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: stretch; }
.sch-time { font-size: 12px; font-weight: 700; color: var(--mut); text-align: right; padding: 12px 10px 0 0; font-variant-numeric: tabular-nums; border-top: 1px solid var(--line-soft); }
.sch-time small { display: block; font-weight: 500; color: #cbd5e1; }
.sch-ev { margin: 6px 0; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--sc, var(--blue)); border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--sh-sm); transition: box-shadow .15s ease, transform .15s ease; }
.sch-ev:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.sch-ev.now { background: var(--blue-soft); border-color: var(--blue-line); }
.sch-ev.past { opacity: .55; }
.sch-ev .who { min-width: 0; }
.sch-ev .who b { display: block; font-size: 14px; letter-spacing: -.01em; }
.sch-ev .who span { font-size: 12px; color: var(--mut); display: flex; gap: 10px; flex-wrap: wrap; }
.sch-ev .sp { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sch-gap { border-top: 1px dashed var(--line); margin: 8px 0 8px 92px; position: relative; }
.sch-gap span { position: absolute; top: -9px; left: 12px; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: #cbd5e1; background: var(--bg); padding: 0 8px; text-transform: uppercase; }

/* ---------- patient queue ---------- */
.queue-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line-soft); transition: background .14s ease; }
.queue-row:hover { background: #f8fafc; }
.queue-time { font-weight: 700; font-size: 13px; width: 64px; font-variant-numeric: tabular-nums; color: var(--body); }
.queue-who { min-width: 0; flex: 1; }
.queue-who b { font-size: 14px; display: block; letter-spacing: -.01em; }
.queue-who span { font-size: 12px; color: var(--mut); }
.queue-act { display: flex; gap: 8px; align-items: center; }

/* ---------- roster (patients table) ---------- */
.roster td { padding: 12px 14px; }
.roster .rname { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.roster .rsub { font-size: 12px; color: var(--mut); font-weight: 500; }
.roster tr:hover td { background: #f8fafc; }
.badge-portal { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--teal); background: var(--teal-soft); border: 1px solid var(--teal-line); padding: 2px 8px; border-radius: 999px; }

/* ---------- patient detail ---------- */
.alx-banner { display: flex; gap: 10px; align-items: center; background: var(--rose-soft); border: 1px solid var(--rose-line); color: var(--rose); border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600; }
.alx-banner small { font-weight: 500; color: #be123caa; }
.pd-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.pd-vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tline { position: relative; padding-left: 22px; }
.tline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tline-item { position: relative; padding: 0 0 16px; }
.tline-item::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--tc, var(--blue)); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tline-item b { font-size: 13px; display: block; }
.tline-item span { font-size: 12px; color: var(--mut); }

/* ---------- portal sync card ---------- */
.port-sync { background: linear-gradient(180deg, #f0fdfa, #fff); border: 1px solid var(--teal-line); border-radius: var(--r); padding: 16px 18px; }
.port-sync h4 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: -.01em; color: var(--teal); }
.ps-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--teal-line); font-size: 13px; color: var(--body); }
.ps-row:first-of-type { border-top: 0; }
.ps-row .ps-ic { width: 26px; height: 26px; border-radius: 8px; background: #fff; border: 1px solid var(--teal-line); display: grid; place-items: center; color: var(--teal); flex: none; }
.ps-row b { color: var(--ink); }
.ps-when { margin-left: auto; font-size: 11px; color: var(--mut); white-space: nowrap; padding-top: 2px; }

/* ---------- AI chart summary ---------- */
.ai-sum { border: 1px solid var(--violet-line); background: linear-gradient(180deg, #f5f3ff, #fff); border-radius: var(--r); padding: 16px 18px; }
.ai-sum h4 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--violet); letter-spacing: -.01em; }
.ai-sum .txt { font-size: 13.5px; line-height: 1.6; color: var(--body); margin-top: 10px; }
.ai-sum .txt b { color: var(--ink); }
.ai-sum.loading .txt { color: var(--mut); }
.shimmer { background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%; animation: shim 1.1s infinite; border-radius: 6px; height: 12px; margin: 8px 0; }
@keyframes shim { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- refill queue ---------- */
.rxq-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.rxq-row:hover { background: #f8fafc; }
.rxq-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.rxq-main { flex: 1; min-width: 0; }
.rxq-main b { display: block; font-size: 14px; letter-spacing: -.01em; }
.rxq-main span { font-size: 12px; color: var(--mut); }
.rxq-when { font-size: 12px; color: var(--mut); white-space: nowrap; }

/* ---------- review modal lab values ---------- */
.rev-val { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 13px; align-items: center; }
.rev-val:first-of-type { border-top: 0; }
.rev-val .rv-name { font-weight: 600; }
.rev-val .rv-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.rev-val .rv-ref { color: var(--mut); font-size: 12px; }
.rev-cmt { width: 100%; min-height: 74px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; resize: vertical; }
.rev-cmt:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .pd-grid { grid-template-columns: 1fr; }
  .pd-vitals { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-val { font-size: 24px; }
  .sch-row { grid-template-columns: 64px 1fr; }
  .sch-time { font-size: 11px; }
  .sch-gap { margin-left: 64px; }
  .queue-row, .rxq-row { flex-wrap: wrap; }
  .rev-val { grid-template-columns: 1.2fr 1fr; }
  .rev-val .rv-ref:nth-of-type(1) { display: none; }
}
.chat-head span { display: block; font-size: 12px; color: var(--mut); }
@media (max-width: 640px) {
  .sch-row { grid-template-columns: 1fr; }
  .sch-time { text-align: left; padding: 10px 2px 0; border-top: 0; display: flex; gap: 8px; align-items: baseline; }
  .sch-time small { display: inline; }
  .sch-ev { flex-wrap: wrap; min-width: 0; }
  .sch-ev .sp { margin-left: 0; width: 100%; }
  .card { min-width: 0; }
  .appt-card { flex-wrap: wrap; }
}
.ann.tone-teal, .ann.tone-blue, .ann.tone-slate { display: block; border-radius: 14px; padding: 13px 16px; border-bottom: 0; }
.ann.tone-teal b, .ann.tone-blue b, .ann.tone-slate b { margin: 0 0 3px; color: var(--ink); }
.ann.tone-teal span, .ann.tone-blue span, .ann.tone-slate span { display: block; font-size: 12.5px; color: var(--body); }
