/* ==========================================================================
   HOPE Admin console — design system (2026-10-11)
   Ported 1:1 from the approved mockups (HOPE Admin Console canvas).
   Every admin page links this file; page <style> blocks hold page-only CSS.
   ========================================================================== */

:root {
  --navy: #1a2a1a;
  --sage: #4A7C59;
  --sage-dark: #3a6347;
  --sage-ink: #2f5a3c;
  --sage-tint: #E3EDE5;
  --sage-wash: #F0F6F1;
  --sand: #e9c46a;
  --sand-tint: #F7E9C3;
  --sand-ink: #6b5414;
  --sand-bar: #b8862a;
  --coral: #e76f51;
  --coral-tint: #F9DDD4;
  --coral-ink: #933a22;
  --coral-bar: #c4553a;
  --coral-line: #E8B9AA;
  --cream: #F5F1E8;
  --paper: #FFFDF8;
  --side: #EFE9DA;
  --line: #E4DDCB;
  --line-soft: #EFE9DA;
  --input-line: #D6CEB9;
  --gray-tint: #ECE8DD;
  --gray-ink: #465060;
  --muted: #566070;
  --font-display: 'Clash Display', 'General Sans', system-ui, sans-serif;
  --font-body: 'General Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--navy); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
a { color: var(--sage-ink); }
a:hover { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 1000; background: var(--navy); color: var(--cream); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ── Type ───────────────────────────────────────────────────────────── */
.disp { font-family: var(--font-display); letter-spacing: -0.015em; }
.h1 { font-family: var(--font-display); letter-spacing: -0.015em; font-size: 34px; font-weight: 600; line-height: 1.15; }
.h2 { font-family: var(--font-display); letter-spacing: -0.015em; font-size: 18px; font-weight: 600; }
.big { font-family: var(--font-display); letter-spacing: -0.015em; font-size: 28px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.lbl { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.b { font-weight: 600; }
.ink-coral { color: var(--coral-ink); }
.ink-sage { color: var(--sage-ink); }

/* ── Layout ─────────────────────────────────────────────────────────── */
.adm { display: flex; flex-wrap: wrap; min-height: 100vh; }
.adm-main { flex: 999 1 560px; min-width: 0; padding: 28px 36px 48px; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.col-3 { flex: 3 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-2 { flex: 2 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hstack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.ml-auto { margin-left: auto; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.page-head .t { display: flex; flex-direction: column; gap: 4px; flex: 1 1 320px; }
.crumb { font-size: 13px; text-decoration: none; }

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sb { flex: 1 1 232px; background: var(--side); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 20px; }
.sb-brand { display: flex; align-items: baseline; gap: 6px; padding: 0 10px; text-decoration: none; color: var(--navy); }
.sb-brand b { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -0.015em; }
.sb-brand i { font-style: normal; font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: .22em; text-transform: uppercase; }
.sb-brand .chip { margin-left: auto; font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .lbl { padding: 0 12px 6px; }
.nav .lbl.gap { padding-top: 16px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #2a3a2a; text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--line); color: var(--navy); }
.nav a.on { background: var(--navy); color: var(--cream); }
.nav a svg { flex: none; }
.nav .bdg { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--sage); color: #fff; border-radius: 999px; padding: 1px 8px; }
.sb-user { margin-top: auto; padding: 12px; display: flex; align-items: center; gap: 10px; }
.sb-user .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-user .who span:first-child { font-weight: 600; font-size: 13px; }
.sb-user .who span:last-child { font-size: 12px; color: var(--muted); }
.sb-out { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: flex; }
.sb-out:hover { background: var(--line); color: var(--navy); }

/* ── Avatars ────────────────────────────────────────────────────────── */
.av { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: var(--cream); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.av.sm { width: 34px; height: 34px; font-size: 12px; background: var(--sage-tint); color: var(--sage-ink); }
.av.lg { width: 60px; height: 60px; font-size: 20px; background: var(--sage-tint); color: var(--sage-ink); font-family: var(--font-display); }
.av.gray { background: var(--gray-tint); color: var(--gray-ink); }
.av.sand { background: var(--sand-tint); color: var(--sand-ink); }
.av.green { background: var(--sage); color: #fff; }

/* ── Cards, chips, buttons ──────────────────────────────────────────── */
.card { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.card.pad { padding: 20px; }
.card.pad-lg { padding: 22px; }
.card.alert { border-color: var(--coral-line); }
.card.accent { border-color: var(--sage); }
.card.dash { background: var(--cream); border-style: dashed; }
.card.dark { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head .ml-auto { margin-left: auto; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.c-sage { background: var(--sage-tint); color: var(--sage-ink); }
.c-sand { background: var(--sand-tint); color: var(--sand-ink); }
.c-coral { background: var(--coral-tint); color: var(--coral-ink); }
.c-gray { background: var(--gray-tint); color: var(--gray-ink); }
.c-navy { background: var(--navy); color: var(--cream); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 500; font-size: 14px; cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.btn-p { background: var(--sage); color: #fff; }
.btn-p:hover { background: var(--sage-dark); color: #fff; }
.btn-s { background: var(--paper); color: var(--navy); border-color: var(--input-line); }
.btn-s:hover { background: var(--cream); color: var(--navy); }
.btn-d { background: var(--paper); color: var(--coral-ink); border-color: var(--coral-line); }
.btn-d:hover { background: #FCEFEA; color: var(--coral-ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { background: var(--gray-tint); color: #7a818a; border-color: transparent; cursor: not-allowed; }
.btn.is-busy { opacity: .7; pointer-events: none; }
.linkbtn { border: 0; background: none; color: var(--sage-ink); cursor: pointer; text-decoration: underline; padding: 0; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.inp { height: 42px; border: 1px solid var(--input-line); border-radius: 10px; padding: 0 12px; background: #fff; color: var(--navy); }
.inp.sm { height: 34px; border-radius: 8px; font-size: 13px; padding: 0 10px; }
textarea.inp { height: auto; padding: 10px 12px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .fl { font-size: 13px; font-weight: 600; }
.field .inp { width: 100%; }
.hint { font-size: 12px; color: var(--muted); }
.err { font-size: 12px; color: var(--coral-ink); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
fieldset.card { margin: 0; padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
fieldset.card legend { font-family: var(--font-display); font-size: 18px; font-weight: 600; padding: 0 6px; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--input-line); border-radius: 10px; background: #fff; cursor: pointer; }
.opt.sel, .opt:has(input:checked) { border-color: var(--sage); background: var(--sage-wash); }
.opt.dis, .opt:has(input:disabled) { opacity: .6; cursor: not-allowed; background: var(--cream); }
.opt input { margin-top: 3px; }
.seg { display: inline-flex; border: 1px solid var(--input-line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; font-size: 13px; font-weight: 500; padding: 8px 14px; cursor: pointer; color: var(--gray-ink); }
.seg button.on { background: var(--navy); color: var(--cream); }

/* ── Tabs & pills ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 10px 2px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; cursor: pointer; }
.tab.on { border-color: var(--navy); color: var(--navy); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 6px 12px; border-radius: 999px; font-weight: 500; font-size: 13px; text-decoration: none; color: var(--gray-ink); border: 1px solid var(--input-line); background: var(--paper); cursor: pointer; }
.pill.on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.pill.flat { border-color: transparent; background: transparent; }
.pill.flat.on { background: var(--navy); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.tbl-box { overflow-x: auto; position: relative; }   /* relative: keeps .sr-only labels inside the scroll box */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.hover:hover td { background: #FBF8F1; }
.tbl tr.warn td { background: #FCEFEA; }
.tbl tr.flag td { background: #FBF4E4; }
.tbl .nm { font-weight: 600; text-decoration: none; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell > div:last-child { display: flex; flex-direction: column; }

/* ── KV, stats, meters ──────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding: 0; }
.kpis > div { padding: 18px 20px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.kpis > div:last-child { border-right: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--cream); border-radius: 10px; }
.meter { display: flex; align-items: center; gap: 10px; }
.meter .track { width: 120px; height: 8px; border-radius: 6px; background: var(--gray-tint); }
.meter.sm .track { width: 80px; }
.meter .fill { height: 8px; border-radius: 6px; background: var(--sage); }
.meter .fill.warn { background: var(--sand-bar); }
.meter .fill.full { background: var(--coral-bar); }
.hrow { display: grid; grid-template-columns: 170px minmax(0,1fr) 54px; align-items: center; gap: 12px; font-size: 13px; }
.hrow .track { height: 10px; border-radius: 6px; background: var(--gray-tint); }
.hrow .fill { height: 10px; border-radius: 6px; background: var(--navy); }
.hrow .fill.sage { background: var(--sage); }

/* ── Action queue tiles ─────────────────────────────────────────────── */
.qtile { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.qtile .n { font-family: var(--font-display); font-size: 36px; font-weight: 600; letter-spacing: -0.015em; }
.qtile .head { display: flex; align-items: center; gap: 8px; }
.qtile .head .xs { margin-left: auto; color: var(--muted); }
.qtile .what { display: flex; align-items: baseline; gap: 10px; }
.qtile .what span:last-child { font-weight: 600; }
.qtile p { margin: 0; font-size: 13px; color: var(--muted); }

/* ── Timeline ───────────────────────────────────────────────────────── */
.tl { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 0 12px; }
.tl .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sage); margin: 4px auto 0; }
.tl .dot.todo { background: #fff; border: 2px solid var(--sand-bar); }
.tl .line { width: 2px; background: #D9E5DC; margin: 0 auto; min-height: 26px; }
.tl > div:last-child { padding-bottom: 12px; }
.steprow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.steprow:last-child { border-bottom: 0; }
.ok { width: 22px; height: 22px; border-radius: 50%; background: var(--sage); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.todo { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #B9B09A; flex: none; }

/* Wizard steps (Add doctor) */
.steps { display: flex; gap: 28px; flex-wrap: wrap; padding: 4px 0; }
.step { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--muted); }
.step .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #B9B09A; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.step.done .n { background: var(--sage); border-color: var(--sage); color: #fff; }
.step.on { color: var(--navy); }
.step.on .n { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ── Banners ────────────────────────────────────────────────────────── */
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; flex-wrap: wrap; font-size: 14px; }
.banner.sand { background: var(--sand-tint); color: #4e3d0c; }
.banner.coral { background: var(--coral-tint); color: #6e2a17; }
.banner.sage { background: var(--sage-tint); color: var(--sage-ink); }
.banner svg { flex: none; }
.note { padding: 12px 14px; background: var(--cream); border-radius: 10px; font-size: 13px; }

/* ── Support inbox ──────────────────────────────────────────────────── */
.inbox { display: flex; flex-wrap: wrap; overflow: hidden; min-height: 760px; }
.inbox .list { flex: 1 1 300px; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.inbox .thread { flex: 3 1 460px; display: flex; flex-direction: column; min-width: 0; }
.inbox .ctx { flex: 1 1 280px; border-left: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 16px; min-width: 0; background: var(--paper); }
.tk { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--navy); background: none; text-align: left; cursor: pointer; width: 100%; }
.tk:hover { background: var(--cream); }
.tk.on { background: #EEF4EF; box-shadow: inset 3px 0 0 var(--sage); }
.msgs { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: #FBF8F1; overflow-y: auto; }
.msg { max-width: 560px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; display: flex; flex-direction: column; gap: 6px; white-space: pre-wrap; }
.msg.out { align-self: flex-end; background: var(--sage-wash); border-color: #CFE0D4; border-radius: 14px 4px 14px 14px; }
.msg.internal { align-self: stretch; max-width: none; background: var(--sand-tint); border-color: #EBD9A8; border-radius: 10px; }
.sysline { align-self: center; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); text-align: center; }

/* ── Drawer & modal ─────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(26,42,26,.35); z-index: 500; display: flex; justify-content: flex-end; }
.scrim.center { justify-content: center; align-items: center; padding: 16px; }
.drawer { width: min(520px, 100%); height: 100%; background: var(--paper); border-left: 1px solid var(--line); padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.x { margin-left: auto; border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); display: flex; }
.x:hover { background: var(--gray-tint); }

/* ── States ─────────────────────────────────────────────────────────── */
.empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.skel { background: linear-gradient(90deg, #EFE9DA 0%, #F7F3EA 50%, #EFE9DA 100%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; border-radius: 8px; min-height: 14px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Brand page loader animations (loader markup is the brand invariant) */
@keyframes hopePulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes hopeShimmer { 0% { opacity: .3; transform: scaleX(.6); } 50% { opacity: 1; transform: scaleX(1); } 100% { opacity: .3; transform: scaleX(.6); } }

/* ── Phone width ────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .adm-main { padding: 20px 16px 40px; }
  .h1 { font-size: 28px; }
  .sb { padding: 16px 12px; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .hrow { grid-template-columns: 110px minmax(0,1fr) 48px; }
  .grid-auto { grid-template-columns: 1fr; }
  .inbox .list, .inbox .ctx { border: 0; border-bottom: 1px solid var(--line); }
}
