/* Arunaditya HIMS — design tokens and components.
   System fonts only: the app must look right with no internet. */

:root {
  --navy: #082B5B;
  --navy-2: #0E3A75;
  --navy-3: #15498F;
  --teal: #139C98;
  --teal-2: #0F807D;
  --teal-soft: #E3F4F3;
  --gold: #F6B528;
  --orange: #FFA468;

  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #E1E6EE;
  --line-2: #CBD3DF;
  --text: #16202E;
  --text-2: #4A5668;
  --text-3: #7A8699;

  --ok: #14804A;      --ok-bg: #E6F4EC;
  --warn: #9A5B00;    --warn-bg: #FFF4DB;
  --danger: #B42318;  --danger-bg: #FDECEA;
  --info: #175CD3;    --info-bg: #EAF1FD;
  --muted-bg: #EEF1F5;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(8, 43, 91, .18);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Gujarati", "Nirmala UI", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --side-w: 224px;
  --top-h: 56px;
}

:root[data-theme="dark"] {
  --bg: #0D1520;
  --surface: #131E2C;
  --surface-2: #182536;
  --line: #243449;
  --line-2: #33475F;
  --text: #E7EDF5;
  --text-2: #B3C0D1;
  --text-3: #8797AC;
  --teal-soft: #0F3434;
  --ok-bg: #0F2E1F; --ok: #5BD08E;
  --warn-bg: #33270C; --warn: #F5C152;
  --danger-bg: #3A1512; --danger: #F7867C;
  --info-bg: #13284A; --info: #82AEF5;
  --muted-bg: #1C2A3C;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--teal-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.boot { height: 100vh; display: grid; place-content: center; text-align: center; color: var(--text-2); }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #D7E2F2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 34px; height: 34px; border-radius: 8px; background: #fff; }
.brand b { display: block; color: #fff; font-size: 13px; letter-spacing: .2px; }
.brand small { color: #9FB3CE; font-size: 11px; }
.nav { padding: 8px 8px 16px; display: flex; flex-direction: column; gap: 1px; }
.nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: #7F95B5; padding: 12px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: #D7E2F2; font-size: 13.5px; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.on { background: var(--teal); color: #fff; }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.nav a .count { margin-left: auto; background: var(--orange); color: #3A1D00; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 16px; position: sticky; top: 0; z-index: 20; }
.top .menu-btn { display: none; }
.content { padding: 16px 20px 40px; max-width: 1600px; width: 100%; }

.gsearch { position: relative; flex: 1; max-width: 520px; }
.gsearch input { width: 100%; padding-left: 32px; }
.gsearch::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-52%); color: var(--text-3); font-size: 17px; }
.results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 60vh; overflow-y: auto; z-index: 50; }
.results .r { padding: 8px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }
.results .r:last-child { border-bottom: 0; }
.results .r:hover, .results .r.active { background: var(--teal-soft); }
.results .empty { padding: 12px; color: var(--text-3); }

.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 20px; background: var(--muted-bg); color: var(--text-2); white-space: nowrap; cursor: pointer; border: 0; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sync.online .dot { background: #1DB46A; }
.sync.syncing .dot { background: var(--gold); animation: pulse 1s infinite; }
.sync.offline { background: var(--warn-bg); color: var(--warn); }
.sync.offline .dot { background: var(--warn); }
.sync.error { background: var(--danger-bg); color: var(--danger); }
.sync.error .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- page scaffolding */
.page-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-h .sub { color: var(--text-3); font-size: 13px; }
.page-h .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.crumb a { color: var(--text-3); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { flex: 1; }
.card-b { padding: 14px; }
.card-b.tight { padding: 0; }
.card-f { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: span 4; } .spanall { grid-column: 1 / -1; }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1fr) 380px; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb { margin-bottom: 12px; } .mb0 { margin-bottom: 0; }
.muted { color: var(--text-3); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-2); border-color: var(--teal-2); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--muted-bg); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; }
.icon-btn { width: 32px; padding: 0; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.on { background: var(--navy); color: #fff; border-color: var(--navy); z-index: 1; }

input, select, textarea { font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 6px 9px; min-height: 34px; width: 100%; }
textarea { min-height: 70px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 20%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 16px; min-height: 16px; height: 16px; accent-color: var(--teal); vertical-align: middle; }
input[readonly] { background: var(--surface-2); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.field .err { font-size: 11.5px; color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }
.input-unit { position: relative; }
.input-unit input { padding-right: 46px; }
.input-unit span { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12px; pointer-events: none; }
.section-t { font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--teal-2); margin: 6px 0 -2px; grid-column: 1 / -1; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--teal); }
.chip.on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-2); font-weight: 600; }
.chip .x { cursor: pointer; opacity: .6; margin-left: 2px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--muted-bg); color: var(--text-2); white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-brand { background: var(--teal-soft); color: var(--teal-2); }
.b-navy { background: var(--navy); color: #fff; }
.b-gold { background: #FEF3D4; color: #7A5300; }

.flag { font-weight: 700; font-size: 11px; padding: 0 5px; border-radius: 4px; }
.flag-H, .flag-L, .flag-A { background: var(--warn-bg); color: var(--warn); }
.flag-HH, .flag-LL { background: var(--danger); color: #fff; }
.val-H, .val-L, .val-A { color: var(--warn); font-weight: 600; }
.val-HH, .val-LL { color: var(--danger); font-weight: 700; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: 500 13.5px var(--font); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--navy); border-bottom-color: var(--teal); font-weight: 600; }
:root[data-theme="dark"] .tabs button.on { color: #fff; }
.tabs .count { background: var(--muted-bg); border-radius: 8px; padding: 0 6px; font-size: 11px; margin-left: 4px; }

/* ---------- tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; z-index: 1; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.click { cursor: pointer; }
.tbl tr.sel td { background: var(--teal-soft) !important; }
.tbl tfoot td { font-weight: 650; background: var(--surface-2); }
.tbl.compact td { padding: 4px 8px; }
.tbl td.act { white-space: nowrap; text-align: right; width: 1%; }
.tbl input, .tbl select { min-height: 30px; padding: 4px 7px; }

.empty { text-align: center; color: var(--text-3); padding: 36px 16px; }
.empty .big { font-size: 28px; margin-bottom: 6px; }

/* ---------- dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: block; color: inherit; }
.kpi:hover { text-decoration: none; border-color: var(--teal); }
.kpi .k { font-size: 12px; color: var(--text-2); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
:root[data-theme="dark"] .kpi .v { color: #fff; }
.kpi .s { font-size: 12px; color: var(--text-3); }
.kpi.alert { border-left: 3px solid var(--danger); }
.kpi.warn { border-left: 3px solid var(--gold); }

.alerts .a { display: flex; gap: 10px; align-items: flex-start; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.alerts .a:last-child { border-bottom: 0; }
.alerts .a .ic { font-size: 16px; line-height: 1.2; }

.banner { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13.5px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.banner.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.banner.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.banner.info { background: var(--info-bg); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); }
.banner .btn { margin-left: auto; }

/* ---------- patient header */
.pt-head { display: flex; gap: 14px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); flex-wrap: wrap; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none; overflow: hidden; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pt-head .name { font-size: 17px; font-weight: 650; }
.pt-head .meta { color: var(--text-2); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.allergy { background: var(--danger-bg); color: var(--danger); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 14px; }
.tl::before { content: ""; position: absolute; left: -18px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); border: 2px solid var(--surface); }
.tl .when { font-size: 12px; color: var(--text-3); }
.tl .what { font-weight: 600; }

/* ---------- boards */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; align-items: start; }
.lane { background: var(--muted-bg); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.lane h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); padding: 2px 4px 8px; display: flex; }
.lane h3 .badge { margin-left: auto; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 6px; box-shadow: var(--shadow); cursor: pointer; }
.ticket:hover { border-color: var(--teal); }
.ticket .tok { font-weight: 700; color: var(--navy); font-size: 15px; }
:root[data-theme="dark"] .ticket .tok { color: var(--gold); }

.beds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.bed { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-height: 118px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; box-shadow: var(--shadow); }
.bed:hover { border-color: var(--teal); }
.bed .code { font-weight: 700; font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.bed.free { border-style: dashed; background: var(--surface-2); color: var(--text-3); }
.bed.occupied { border-left: 4px solid var(--teal); }
.bed.clean { border-left: 4px solid var(--gold); }
.bed.conflict { border-left: 4px solid var(--danger); }

/* ---------- MAR / charts */
.mar td, .mar th { text-align: center; }
.mar td:first-child, .mar th:first-child { text-align: left; }
.dose { display: inline-block; min-width: 42px; padding: 2px 4px; border-radius: 4px; font-size: 11.5px; cursor: pointer; border: 1px dashed var(--line-2); }
.dose.given { background: var(--ok-bg); color: var(--ok); border-style: solid; border-color: transparent; }
.dose.held { background: var(--warn-bg); color: var(--warn); border-style: solid; border-color: transparent; }
.dose.due { border-color: var(--danger); color: var(--danger); }
.spark { display: block; }

/* ---------- modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(8, 20, 40, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; display: flex; flex-direction: column; max-height: 90vh; }
.modal.lg { max-width: 920px; }
.modal.xl { max-width: 1180px; }
.modal.sm { max-width: 420px; }
.modal-h { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 8px; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 16px; overflow-y: auto; }
.modal-f { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 10px 10px; }

#toast-root { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13.5px; animation: slide .18s ease-out; }
.toast.ok { background: #0F6B3E; }
.toast.err { background: var(--danger); }
.toast.warn { background: #7A4B00; }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

.menu { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 4px; min-width: 200px; z-index: 60; }
.menu button, .menu a { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 10px; border: 0; background: none; text-align: left; font: 13.5px var(--font); color: var(--text); border-radius: 5px; cursor: pointer; }
.menu button:hover, .menu a:hover { background: var(--muted-bg); text-decoration: none; }

/* ---------- auth screens */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .art { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-3) 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .art h1 { font-size: 30px; font-weight: 700; margin-top: 18px; }
.auth .art p { color: #BFD0E8; max-width: 440px; }
.auth .art ul { color: #D7E2F2; padding-left: 18px; line-height: 1.9; }
.auth .form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.auth .form > div { width: 100%; max-width: 380px; }
.auth .logo { width: 72px; height: 72px; border-radius: 16px; background: #fff; padding: 6px; }

/* ---------- prescription builder */
.rx-line { display: grid; grid-template-columns: 26px minmax(200px, 2.4fr) 90px 110px minmax(120px, 1.4fr) 76px 32px; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.rx-line .n { color: var(--text-3); text-align: center; }
.rx-head { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; }
.picker { position: relative; }

.score-q { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); align-items: center; }
.score-total { font-size: 22px; font-weight: 700; color: var(--navy); }
:root[data-theme="dark"] .score-total { color: #fff; }

.pos-total { font-size: 28px; font-weight: 750; color: var(--navy); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .pos-total { color: #fff; }

.news { font-weight: 700; border-radius: 6px; padding: 1px 8px; }
.news-low { background: var(--ok-bg); color: var(--ok); }
.news-low-medium, .news-medium { background: var(--warn-bg); color: var(--warn); }
.news-high { background: var(--danger); color: #fff; }

.tv { background: var(--navy); color: #fff; min-height: 100vh; padding: 28px; }
.tv h1 { font-size: 34px; }
.tv .now { font-size: 110px; font-weight: 800; color: var(--gold); line-height: 1; }
.tv .next { font-size: 38px; font-weight: 700; }

.tv-mode .side, .tv-mode .top, .tv-mode .banners { display: none !important; }
.tv-mode .shell { display: block; }
.tv-mode .content { padding: 0; max-width: none; }
.view { animation: fade .12s ease-out; }
@keyframes fade { from { opacity: .4; } }
a.name:hover { text-decoration: none; color: var(--teal-2) !important; }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface-2); }
.stat-inline { display: inline-flex; flex-direction: column; padding: 4px 12px; border-left: 1px solid var(--line); }
.stat-inline:first-child { border-left: 0; padding-left: 0; }
.stat-inline b { font-size: 16px; }
.stat-inline span { font-size: 11.5px; color: var(--text-3); }
.drop { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--text-3); cursor: pointer; }
.drop.over { border-color: var(--teal); background: var(--teal-soft); }

/* ---------- responsive */
.hims-install[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split, .split.wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 90; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .top .menu-btn { display: inline-flex; }
  .content { padding: 12px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .span2, .span3, .span4 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .rx-line { grid-template-columns: 22px 1fr 1fr; }
  .rx-line > :nth-child(n+3) { grid-column: span 1; }
  .score-q { grid-template-columns: 1fr; }
  .top .hide-sm { display: none; }
}
@media print {
  .side, .top, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}

/* queue signals */
.queue-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ticket.urgent { border-left: 3px solid var(--danger); }
.signals { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.sig { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 9px; background: var(--muted-bg); color: var(--text-2); }
.sig.good { color: var(--ok); }
.sig.warn { color: var(--warn); background: var(--warn-bg); }
.sig.bad { color: var(--danger); background: var(--danger-bg); }

/* calendar */
.cal-week { --cal-cols: 7; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 72vh; }
.cal-head, .cal-body { display: grid; grid-template-columns: 54px repeat(var(--cal-cols), minmax(110px, 1fr)); }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.cal-day { background: none; border: 0; padding: 7px 4px; font: inherit; font-weight: 600; cursor: pointer; color: inherit; }
.cal-day.today { color: var(--teal); }
.cal-gutter { position: relative; border-right: 1px solid var(--line); }
.cal-hour { position: absolute; right: 5px; font-size: 11px; color: var(--text-2); transform: translateY(-7px); }
.cal-col { position: relative; border-right: 1px solid var(--line); background: var(--muted-bg); }
.cal-col.closed { background: repeating-linear-gradient(45deg, var(--muted-bg), var(--muted-bg) 6px, transparent 6px, transparent 12px); }
.cal-col.over { outline: 2px solid var(--teal); outline-offset: -2px; }
.cal-open { position: absolute; left: 0; right: 0; background: var(--surface); }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.cal-appt { position: absolute; left: 2px; right: 2px; min-height: 20px; background: var(--surface); border: 1px solid var(--line); border-left-width: 3px; border-radius: 4px; padding: 1px 4px; font-size: 11.5px; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: grab; z-index: 2; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 2px 4px; }
.cal-cell { min-height: 92px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; color: inherit; cursor: pointer; overflow: hidden; }
.cal-cell.other { opacity: .5; }
.cal-cell.today { border-color: var(--teal); }
.cal-cell.closed { background: var(--muted-bg); }

/* consultation */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 14px; margin-bottom: 12px; padding: 9px 14px; border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.glance .lbl { margin: 0; }
.dx-row { display: flex; flex-wrap: wrap; gap: 6px; }
.dx-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 16px; padding: 2px 4px 2px 10px; font-size: 13px; }
.dx-chip select { width: auto; min-height: 24px; padding: 0 2px; font-size: 12px; border: 0; background: transparent; }
.finding { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.finding.danger { border-color: var(--danger); background: var(--danger-bg); }
.finding.warn { border-color: var(--warn); background: var(--warn-bg); }
.snippets { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px #0002; max-height: 180px; overflow: auto; }
.snippets button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; }
.snippets button:hover, .snippets button.on { background: var(--muted-bg); }

/* help and tools */
.steps { margin: 6px 0 0; padding-left: 20px; }
.steps li { margin-bottom: 3px; }
.tool-out { font-size: 20px; font-weight: 700; }
