/* ClinicFlow — โปรแกรมคลินิกเวชกรรม */
:root{
  --bg:#F3F6F6; --surface:#FFFFFF; --surface-2:#F7FAFA; --line:#E1E8E8; --line-2:#CCD8D8;
  --ink:#152624; --ink-2:#3E5250; --muted:#6D817F;
  --accent:#148A78; --accent-strong:#0F6F61; --accent-soft:#E3F4F0; --accent-ink:#0B5248;
  --danger:#C8323C; --danger-soft:#FDECEC; --warn:#B86E00; --warn-soft:#FFF4DE; --ok:#1E8A4C; --ok-soft:#E5F6EC;
  --info:#2A66B0; --info-soft:#E7F0FB;
  --sidebar-bg:#0D2B27; --sidebar-bg-2:#123833; --sidebar-text:#C2DBD5; --sidebar-dim:#7FA19A; --sidebar-active:#1A8C76;
  --radius:12px; --radius-sm:8px;
  --shadow:0 1px 2px rgba(16,40,36,.06), 0 2px 8px rgba(16,40,36,.05);
  --shadow-pop:0 10px 40px rgba(10,30,28,.22);
  --font: "Leelawadee UI", "Segoe UI", Tahoma, sans-serif;
  --fs: 14px;
  --t1:#C8323C; --t2:#E8730C; --t3:#D8A800; --t4:#2E9A4E; --t5:#3B79C4;
}
*{ box-sizing:border-box; }
html,body{ margin:0; height:100%; }
body{ font-family:var(--font); font-size:var(--fs); color:var(--ink); background:var(--bg); -webkit-font-smoothing:antialiased; }
button,input,select,textarea{ font:inherit; color:inherit; }
a{ color:var(--accent-strong); }
[hidden]{ display:none !important; }
.tabular{ font-variant-numeric:tabular-nums; }
.muted{ color:var(--muted); }
.small{ font-size:12.5px; }
.nowrap{ white-space:nowrap; }
.right{ text-align:right; }
.center{ text-align:center; }
.grow{ flex:1 1 auto; }
.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.row.nowrap{ flex-wrap:nowrap; }
.stack{ display:flex; flex-direction:column; gap:12px; }
.spacer{ flex:1; }
.mt{ margin-top:14px; } .mb{ margin-bottom:14px; } .mt-s{ margin-top:8px; }

/* ---------------------------------------------------------------- layout */
#app{ display:flex; min-height:100vh; }
.sidebar{ width:236px; flex:0 0 236px; background:linear-gradient(180deg,var(--sidebar-bg-2),var(--sidebar-bg) 45%); color:var(--sidebar-text);
  display:flex; flex-direction:column; padding:14px 10px; position:sticky; top:0; height:100vh; overflow-y:auto; }
.brand{ display:flex; gap:10px; align-items:center; padding:4px 8px 14px; border-bottom:1px solid rgba(255,255,255,.08); margin-bottom:6px; }
.brand img{ width:40px; height:40px; border-radius:10px; object-fit:cover; background:#fff; flex:none; }
.brand-name{ color:#fff; font-weight:700; font-size:14.5px; line-height:1.25; }
.brand-sub{ font-size:11px; color:var(--sidebar-dim); }
.nav-group{ font-size:10.5px; font-weight:700; letter-spacing:.06em; color:var(--sidebar-dim); padding:14px 10px 5px; }
.nav-item{ display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:9px; color:var(--sidebar-text); text-decoration:none; font-size:14px; margin:1px 0; position:relative; }
.nav-item svg{ width:18px; height:18px; flex:none; opacity:.85; }
.nav-item:hover{ background:rgba(120,210,195,.10); color:#fff; }
.nav-item.active{ background:var(--sidebar-active); color:#fff; box-shadow:0 2px 8px rgba(0,0,0,.18); }
.nav-badge{ margin-left:auto; background:#E8473F; color:#fff; font-size:11px; font-weight:700; border-radius:99px; min-width:20px; height:20px; padding:0 6px; display:inline-flex; align-items:center; justify-content:center; }
.nav-badge.soft{ background:rgba(255,255,255,.16); }
.sidebar-foot{ margin-top:auto; padding:12px 8px 0; border-top:1px solid rgba(255,255,255,.08); font-size:12px; }
.user-chip{ display:flex; align-items:center; gap:8px; color:#fff; }
.avatar{ width:32px; height:32px; border-radius:50%; background:var(--sidebar-active); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; flex:none; }
.user-chip .role{ font-size:11px; color:var(--sidebar-dim); }
.sidebar-foot .links{ display:flex; flex-wrap:wrap; gap:4px 12px; margin-top:8px; }
.sidebar-foot .links a{ white-space:nowrap; }
.sidebar-foot .links a{ color:var(--sidebar-dim); text-decoration:none; cursor:pointer; }
.sidebar-foot .links a:hover{ color:#fff; }

.main{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; }
.topbar{ display:flex; align-items:center; gap:12px; padding:10px 22px; background:var(--surface); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:20; min-height:58px; }
.page-title{ font-size:18px; font-weight:700; margin:0; white-space:nowrap; }
.topbar .search-global{ margin-left:auto; position:relative; width:min(420px,40vw); }
.topbar .clock{ color:var(--muted); font-size:12.5px; white-space:nowrap; }
.content{ padding:20px 22px 60px; max-width:1500px; width:100%; }

/* ---------------------------------------------------------------- cards */
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.card-pad{ padding:16px 18px; }
.card-head{ display:flex; align-items:center; gap:10px; padding:12px 18px; border-bottom:1px solid var(--line); }
.card-head h3{ margin:0; font-size:15px; }
.card-body{ padding:14px 18px; }
.grid{ display:grid; gap:14px; }
.grid-2{ grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid-3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.grid-4{ grid-template-columns:repeat(4,minmax(0,1fr)); }
@media (max-width:1100px){ .grid-4{ grid-template-columns:repeat(2,minmax(0,1fr)); } .grid-3{ grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:760px){ .grid-2,.grid-3,.grid-4{ grid-template-columns:1fr; } .sidebar{ display:none; } }
.stat{ padding:14px 16px; display:flex; flex-direction:column; gap:4px; }
.stat .label{ font-size:12.5px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.stat .value{ font-size:24px; font-weight:700; font-variant-numeric:tabular-nums; }
.stat .sub{ font-size:12px; color:var(--muted); }
.stat.link{ cursor:pointer; } .stat.link:hover{ border-color:var(--accent); }
.section-title{ font-size:14.5px; font-weight:700; margin:18px 0 10px; display:flex; align-items:center; gap:8px; color:var(--ink-2); }
.section-title:first-child{ margin-top:0; }
.empty{ padding:28px; text-align:center; color:var(--muted); }

/* ---------------------------------------------------------------- forms */
.field{ display:flex; flex-direction:column; gap:5px; min-width:0; }
.field > label, .lbl{ font-size:12.5px; color:var(--ink-2); font-weight:600; }
.field .hint{ font-size:11.5px; color:var(--muted); }
.req::after{ content:" *"; color:var(--danger); }
.input, select.input, textarea.input{ width:100%; border:1px solid var(--line-2); background:#fff; border-radius:var(--radius-sm); padding:8px 10px; outline:none; transition:border-color .12s, box-shadow .12s; min-height:36px; }
textarea.input{ resize:vertical; min-height:64px; line-height:1.5; }
.input:focus{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(20,138,120,.15); }
.input:disabled, .input[readonly]{ background:var(--surface-2); color:var(--ink-2); }
.input.sm{ min-height:30px; padding:4px 8px; font-size:13px; }
.input.num{ text-align:right; font-variant-numeric:tabular-nums; }
.form-grid{ display:grid; gap:12px 14px; grid-template-columns:repeat(4,minmax(0,1fr)); }
.form-grid .span-2{ grid-column:span 2; } .form-grid .span-3{ grid-column:span 3; } .form-grid .span-4{ grid-column:1 / -1; }
@media (max-width:900px){ .form-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); } .form-grid .span-3,.form-grid .span-4{ grid-column:1 / -1; } }
.radio-row{ display:flex; gap:6px; flex-wrap:wrap; }
.chip-opt{ display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border:1px solid var(--line-2); border-radius:99px; cursor:pointer; background:#fff; user-select:none; font-size:13.5px; }
.chip-opt input{ display:none; }
.chip-opt.on, .chip-opt:has(input:checked){ background:var(--accent-soft); border-color:var(--accent); color:var(--accent-ink); font-weight:600; }
.check{ display:inline-flex; align-items:center; gap:7px; cursor:pointer; }
.check input{ width:16px; height:16px; accent-color:var(--accent); }
.input-group{ display:flex; } .input-group .input{ border-radius:var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon{ border:1px solid var(--line-2); border-left:0; border-radius:0 var(--radius-sm) var(--radius-sm) 0; padding:0 10px; display:flex; align-items:center; background:var(--surface-2); color:var(--muted); font-size:12.5px; white-space:nowrap; }

/* ---------------------------------------------------------------- buttons */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:7px; border:1px solid transparent; border-radius:var(--radius-sm); padding:8px 14px; cursor:pointer; font-weight:600; font-size:13.5px; background:var(--surface-2); color:var(--ink); border-color:var(--line-2); white-space:nowrap; text-decoration:none; min-height:36px; }
.btn svg{ width:16px; height:16px; flex:none; }
.btn{ transition:background-color .12s, filter .12s, transform .06s; user-select:none; touch-action:manipulation; }
.btn:hover{ filter:brightness(.97); }
.btn:active:not(:disabled), .icon-btn:active, .tab:active, .seg button:active, .chip-opt:active{ transform:translateY(1px); filter:brightness(.92); }
table.data tbody tr.click:active td{ background:#E8F4F1; }
.rm-opt{ display:flex; gap:12px; align-items:flex-start; padding:12px 14px; border:1px solid var(--line-2); border-radius:10px; cursor:pointer; background:#fff; }
.rm-opt input{ margin-top:3px; width:17px; height:17px; accent-color:var(--danger); flex:none; }
.rm-opt.on{ border-color:var(--danger); background:#FFF8F8; }
.lm-details{ display:grid; grid-template-columns:max-content 1fr max-content 1fr; gap:4px 14px; margin-top:12px; padding:12px 14px; background:var(--surface-2); border-radius:10px; font-size:13px; }
.lm-details span{ color:var(--muted); } .lm-details b{ font-weight:600; white-space:pre-wrap; }
@media (max-width:900px){ .lm-details{ grid-template-columns:max-content 1fr; } }
.btn:disabled{ opacity:.5; cursor:default; }
.btn-primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn-primary:hover{ background:var(--accent-strong); filter:none; }
.btn-soft{ background:var(--accent-soft); border-color:transparent; color:var(--accent-ink); }
.btn-ghost{ background:transparent; border-color:transparent; color:var(--ink-2); }
.btn-ghost:hover{ background:var(--surface-2); }
.btn-danger{ background:var(--danger); border-color:var(--danger); color:#fff; }
.btn-danger-soft{ background:var(--danger-soft); color:var(--danger); border-color:transparent; }
.btn-warn{ background:#E8920C; border-color:#E8920C; color:#fff; }
.btn-ok{ background:var(--ok); border-color:var(--ok); color:#fff; }
.btn-info{ background:var(--info); border-color:var(--info); color:#fff; }
.btn-sm{ padding:4px 10px; min-height:30px; font-size:12.5px; }
.btn-lg{ padding:11px 20px; font-size:15px; min-height:44px; }
.icon-btn{ display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:8px; border:0; background:transparent; cursor:pointer; color:var(--ink-2); }
.icon-btn:hover{ background:var(--surface-2); color:var(--ink); }
.icon-btn svg{ width:17px; height:17px; }
.icon-btn.danger:hover{ color:var(--danger); background:var(--danger-soft); }

/* ---------------------------------------------------------------- tables */
.table-wrap{ overflow-x:auto; }
table.data{ width:100%; border-collapse:collapse; }
table.data th{ text-align:left; font-size:12px; font-weight:700; color:var(--muted); padding:9px 10px; border-bottom:1px solid var(--line); background:var(--surface-2); white-space:nowrap; position:sticky; top:0; }
table.data td{ padding:9px 10px; border-bottom:1px solid var(--line); vertical-align:middle; }
table.data tr:last-child td{ border-bottom:0; }
table.data tbody tr.click{ cursor:pointer; }
table.data tbody tr.click:hover td{ background:#F4FAF8; }
table.data td.num, table.data th.num{ text-align:right; font-variant-numeric:tabular-nums; }
table.data tfoot td{ font-weight:700; background:var(--surface-2); border-top:1px solid var(--line-2); }
.cell-name{ font-weight:600; }
.cell-sub{ font-size:12px; color:var(--muted); }

/* ---------------------------------------------------------------- badges */
.badge{ display:inline-flex; align-items:center; gap:4px; padding:2px 9px; border-radius:99px; font-size:12px; font-weight:600; white-space:nowrap; background:var(--surface-2); color:var(--ink-2); border:1px solid var(--line); }
.badge-ok{ background:var(--ok-soft); color:var(--ok); border-color:transparent; }
.badge-warn{ background:var(--warn-soft); color:var(--warn); border-color:transparent; }
.badge-danger{ background:var(--danger-soft); color:var(--danger); border-color:transparent; }
.badge-info{ background:var(--info-soft); color:var(--info); border-color:transparent; }
.badge-accent{ background:var(--accent-soft); color:var(--accent-ink); border-color:transparent; }
.badge svg{ width:12px; height:12px; }
.triage{ display:inline-flex; align-items:center; justify-content:center; min-width:28px; height:24px; padding:0 7px; border-radius:6px; color:#fff; font-weight:700; font-size:12.5px; }
.triage.t1{ background:var(--t1); } .triage.t2{ background:var(--t2); } .triage.t3{ background:var(--t3); color:#3a2c00; } .triage.t4{ background:var(--t4); } .triage.t5{ background:var(--t5); } .triage.t0{ background:#B8C4C3; }
.allergy-banner{ display:flex; gap:10px; align-items:flex-start; background:var(--danger-soft); border:1px solid #F3B5B8; color:#8E1C24; padding:10px 14px; border-radius:var(--radius-sm); font-weight:600; }
.allergy-banner svg{ width:20px; height:20px; flex:none; margin-top:1px; }
.allergy-none{ color:var(--ok); font-weight:600; }
.alert{ padding:10px 14px; border-radius:var(--radius-sm); display:flex; gap:10px; align-items:flex-start; }
.alert svg{ width:18px; height:18px; flex:none; margin-top:2px; }
.alert-warn{ background:var(--warn-soft); color:#7A4A00; }
.alert-danger{ background:var(--danger-soft); color:#8E1C24; }
.alert-info{ background:var(--info-soft); color:#1D4E8A; }
.alert-ok{ background:var(--ok-soft); color:#14653A; }

/* ---------------------------------------------------------------- tabs */
.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--line); margin-bottom:14px; flex-wrap:wrap; }
.tab{ padding:9px 14px; border:0; background:none; cursor:pointer; font-weight:600; color:var(--muted); border-bottom:2px solid transparent; margin-bottom:-1px; display:inline-flex; align-items:center; gap:7px; }
.tab svg{ width:16px; height:16px; }
.tab:hover{ color:var(--ink); }
.tab.active{ color:var(--accent-strong); border-bottom-color:var(--accent); }
.tab .count{ background:var(--surface-2); border:1px solid var(--line); border-radius:99px; font-size:11.5px; padding:0 7px; }
.seg{ display:inline-flex; border:1px solid var(--line-2); border-radius:9px; overflow:hidden; background:#fff; }
.seg button{ border:0; background:none; padding:6px 12px; cursor:pointer; font-weight:600; color:var(--ink-2); border-right:1px solid var(--line); }
.seg button:last-child{ border-right:0; }
.seg button.active{ background:var(--accent); color:#fff; }

/* ---------------------------------------------------------------- modal & toast */
.modal-back{ position:fixed; inset:0; background:rgba(10,25,23,.45); display:flex; align-items:flex-start; justify-content:center; z-index:100; padding:5vh 16px; overflow-y:auto; }
.modal{ background:var(--surface); border-radius:14px; box-shadow:var(--shadow-pop); width:min(560px,100%); display:flex; flex-direction:column; max-height:90vh; }
.modal.wide{ width:min(900px,100%); } .modal.xwide{ width:min(1150px,100%); }
.modal-head{ display:flex; align-items:center; gap:10px; padding:14px 18px; border-bottom:1px solid var(--line); }
.modal-head h3{ margin:0; font-size:16px; }
.modal-body{ padding:16px 18px; overflow-y:auto; }
.modal-foot{ display:flex; gap:8px; justify-content:flex-end; padding:12px 18px; border-top:1px solid var(--line); background:var(--surface-2); border-radius:0 0 14px 14px; flex-wrap:wrap; }
#toasts{ position:fixed; right:20px; bottom:20px; display:flex; flex-direction:column; gap:8px; z-index:200; }
.toast{ background:#173A35; color:#fff; padding:11px 16px; border-radius:10px; box-shadow:var(--shadow-pop); max-width:420px; font-weight:500; animation:tin .18s ease-out; }
.toast.err{ background:#9E222B; } .toast.warn{ background:#8A5300; }
@keyframes tin{ from{ transform:translateY(10px); opacity:0; } to{ transform:none; opacity:1; } }

/* ---------------------------------------------------------------- search / pickers */
.search-box{ position:relative; }
.search-box svg{ position:absolute; left:10px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--muted); pointer-events:none; }
.search-box .input{ padding-left:34px; }
.dropdown{ position:absolute; left:0; right:0; top:calc(100% + 4px); background:#fff; border:1px solid var(--line-2); border-radius:10px; box-shadow:var(--shadow-pop); z-index:50; max-height:380px; overflow-y:auto; }
.dropdown .opt{ padding:9px 12px; cursor:pointer; border-bottom:1px solid var(--line); display:flex; gap:10px; align-items:center; }
.dropdown .opt:last-child{ border-bottom:0; }
.dropdown .opt:hover, .dropdown .opt.hl{ background:var(--accent-soft); }
.pick-list{ border:1px solid var(--line); border-radius:10px; max-height:52vh; overflow-y:auto; }
.pick-list .opt{ padding:9px 12px; border-bottom:1px solid var(--line); cursor:pointer; display:flex; gap:10px; align-items:center; }
.pick-list .opt:hover{ background:var(--accent-soft); }
.pick-list .opt:last-child{ border-bottom:0; }
.dx-chips{ display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.dx-chip{ display:inline-flex; align-items:center; gap:6px; background:var(--info-soft); color:#1D4E8A; border-radius:8px; padding:4px 6px 4px 10px; font-size:13px; }
.dx-chip b{ font-variant-numeric:tabular-nums; }
.dx-chip.principal{ background:var(--info); color:#fff; }
.dx-chip button{ border:0; background:rgba(0,0,0,.08); color:inherit; border-radius:6px; cursor:pointer; width:20px; height:20px; line-height:1; }

/* ---------------------------------------------------------------- patient banner / visit */
.pt-banner{ display:flex; gap:16px; align-items:flex-start; flex-wrap:wrap; }
.pt-avatar{ width:52px; height:52px; border-radius:14px; background:var(--accent-soft); color:var(--accent-ink); font-weight:800; font-size:20px; display:flex; align-items:center; justify-content:center; flex:none; }
.pt-name{ font-size:19px; font-weight:700; }
.pt-meta{ display:flex; gap:6px 16px; flex-wrap:wrap; color:var(--ink-2); font-size:13px; margin-top:4px; }
.pt-meta b{ color:var(--ink); }
.visit-head{ position:sticky; top:58px; z-index:15; }
.vitals-grid{ display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px 12px; }
@media (max-width:1200px){ .vitals-grid{ grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media (max-width:800px){ .vitals-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); } }
.vital .input{ font-size:16px; font-weight:600; text-align:center; font-variant-numeric:tabular-nums; }
.vital.abn .input{ border-color:var(--danger); background:#FFF6F6; color:var(--danger); }
.vital.warn .input{ border-color:#E8A23C; background:#FFFBF2; }
.bp-pair{ display:flex; align-items:center; gap:4px; } .bp-pair span{ color:var(--muted); }
.news{ display:flex; align-items:center; gap:12px; padding:10px 14px; border-radius:10px; border:1px solid var(--line); }
.news .score{ font-size:26px; font-weight:800; min-width:44px; text-align:center; font-variant-numeric:tabular-nums; }
.news.low{ background:var(--ok-soft); color:#14653A; } .news.lowmed{ background:var(--warn-soft); color:#7A4A00; } .news.med{ background:#FFE7D1; color:#8A3D00; } .news.high{ background:var(--danger-soft); color:#8E1C24; }
.triage-pick{ display:flex; gap:6px; flex-wrap:wrap; }
.triage-pick button{ border:2px solid transparent; border-radius:10px; padding:8px 12px; cursor:pointer; color:#fff; font-weight:700; opacity:.45; min-width:110px; text-align:left; line-height:1.25; }
.triage-pick button small{ display:block; font-weight:500; font-size:11.5px; opacity:.95; }
.triage-pick button.on{ opacity:1; border-color:#0003; box-shadow:0 2px 8px rgba(0,0,0,.2); }
.triage-pick .t1{ background:var(--t1); } .triage-pick .t2{ background:var(--t2); } .triage-pick .t3{ background:var(--t3); color:#3a2c00; } .triage-pick .t4{ background:var(--t4); } .triage-pick .t5{ background:var(--t5); }
.save-ind{ font-size:12.5px; color:var(--muted); display:inline-flex; align-items:center; gap:5px; }
.save-ind.saving{ color:var(--warn); } .save-ind.saved{ color:var(--ok); } .save-ind.err{ color:var(--danger); }
.action-bar{ position:sticky; bottom:0; background:rgba(255,255,255,.96); backdrop-filter:blur(6px); border-top:1px solid var(--line); padding:10px 22px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; z-index:15; margin:0 -22px -60px; }
.items-table .input{ min-height:32px; padding:4px 8px; }
.items-table td{ padding:6px 8px; }
.sig-text{ font-size:12px; color:var(--accent-ink); margin-top:2px; cursor:pointer; }
.sig-text:hover{ text-decoration:underline; }
.totals{ margin-left:auto; min-width:280px; display:flex; flex-direction:column; gap:4px; }
.totals .r{ display:flex; justify-content:space-between; gap:20px; font-variant-numeric:tabular-nums; }
.totals .grand{ font-size:20px; font-weight:800; color:var(--accent-ink); border-top:1px solid var(--line); padding-top:6px; margin-top:2px; }
.hist-item{ border:1px solid var(--line); border-radius:10px; padding:12px 14px; margin-bottom:10px; }
.hist-item .h{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.hist-item dl{ display:grid; grid-template-columns:90px 1fr; gap:3px 10px; margin:8px 0 0; font-size:13px; }
.hist-item dt{ color:var(--muted); } .hist-item dd{ margin:0; white-space:pre-wrap; }
.status-flow{ display:flex; align-items:center; gap:4px; flex-wrap:wrap; font-size:12px; }
.status-flow .st{ padding:3px 9px; border-radius:99px; background:var(--surface-2); color:var(--muted); border:1px solid var(--line); }
.status-flow .st.on{ background:var(--accent); color:#fff; border-color:var(--accent); }
.status-flow .st.past{ background:var(--accent-soft); color:var(--accent-ink); border-color:transparent; }

/* ---------------------------------------------------------------- login */
.login-shell{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;
  background:radial-gradient(1200px 600px at 20% 10%, #1B5A51 0%, transparent 60%), linear-gradient(160deg,#0D2B27,#0A1F1C); }
.login-card{ width:min(420px,100%); background:#fff; border-radius:18px; padding:28px 28px 24px; box-shadow:var(--shadow-pop); }
.login-card.wide{ width:min(640px,100%); }
.login-logo{ display:flex; gap:12px; align-items:center; margin-bottom:18px; }
.login-logo img{ width:52px; height:52px; border-radius:14px; object-fit:cover; }
.login-logo h1{ font-size:19px; margin:0; } .login-logo p{ margin:2px 0 0; color:var(--muted); font-size:12.5px; }

/* ---------------------------------------------------------------- calendar */
.cal{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal .dow{ text-align:center; font-size:11.5px; color:var(--muted); font-weight:700; padding:4px 0; }
.cal .day{ border:1px solid var(--line); border-radius:8px; min-height:58px; padding:5px 6px; cursor:pointer; background:#fff; font-size:12.5px; display:flex; flex-direction:column; gap:3px; }
.cal .day:hover{ border-color:var(--accent); }
.cal .day.other{ opacity:.4; }
.cal .day.today{ border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.cal .day.sel{ background:var(--accent-soft); border-color:var(--accent); }
.cal .day .n{ font-weight:700; }
.cal .day .c{ margin-top:auto; align-self:flex-start; background:var(--accent); color:#fff; border-radius:99px; padding:0 7px; font-size:11px; font-weight:700; }

/* ---------------------------------------------------------------- bars (reports) */
.bar-row{ display:grid; grid-template-columns:minmax(140px,240px) 1fr 90px; gap:10px; align-items:center; padding:5px 0; font-size:13px; }
.bar-row .bar{ height:10px; border-radius:99px; background:var(--surface-2); overflow:hidden; }
.bar-row .bar i{ display:block; height:100%; background:var(--accent); border-radius:99px; }
.bar-row .lbl2{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chart-days{ display:flex; align-items:flex-end; gap:3px; height:150px; padding-top:10px; }
.chart-days .col{ flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:4px; min-width:0; height:100%; }
.chart-days .col i{ width:100%; max-width:26px; background:var(--accent); border-radius:4px 4px 0 0; min-height:1px; }
.chart-days .col span{ font-size:10px; color:var(--muted); }

/* ---------------------------------------------------------------- analytics */
.an-hero{ font-size:28px; font-weight:700; line-height:1.1; }
.an-delta{ font-size:12.5px; font-weight:600; color:var(--muted); }
.an-delta.up{ color:var(--ok); } .an-delta.down{ color:var(--danger); }
.an-fin{ display:grid; grid-template-columns:1fr auto; gap:3px 12px; margin:6px 0 4px; font-size:13.5px; }
.an-fin span{ color:var(--ink-2); } .an-fin b{ text-align:right; font-weight:600; }
.an-fin .tot{ border-top:1px solid var(--line); padding-top:5px; font-weight:700; color:var(--ink); font-size:15px; }
.vchart{ display:grid; grid-template-columns:52px 1fr; grid-template-rows:auto 22px; }
.vc-axis{ display:flex; flex-direction:column; justify-content:space-between; font-size:11px; color:var(--muted); text-align:right; padding-right:8px; font-variant-numeric:tabular-nums; margin-top:-7px; margin-bottom:-7px; }
.vc-plot{ position:relative; border-bottom:1px solid var(--line-2); }
.vc-grid{ position:absolute; left:0; right:0; border-top:1px solid var(--line); }
.vc-grid.zero{ border-top-color:var(--line-2); }
.vc-bars{ position:absolute; inset:0; display:flex; align-items:flex-end; gap:2px; }
.vc-col{ flex:1 1 0; height:100%; display:flex; align-items:flex-end; justify-content:center; min-width:0; outline:none; border-radius:4px; }
.vc-col i{ display:block; width:100%; max-width:34px; margin:0 auto; background:var(--accent); border-radius:4px 4px 0 0; }
.vc-col i.neg{ background:#C9545C; }
.vc-col.hl i{ background:var(--accent-ink); }
.vc-col:hover, .vc-col:focus-visible{ background:var(--surface-2); }
.vc-col:hover i, .vc-col:focus-visible i{ filter:brightness(.85); }
.vc-x{ grid-column:2; display:flex; gap:2px; font-size:10.5px; color:var(--muted); padding-top:4px; }
.vc-x span{ flex:1 1 0; text-align:center; white-space:nowrap; min-width:0; overflow:visible; }
#anTip{ position:fixed; z-index:300; background:#173A35; color:#fff; padding:8px 11px; border-radius:8px; font-size:12.5px; line-height:1.5; pointer-events:none; box-shadow:var(--shadow-pop); max-width:300px; }
.an-rank .bar-row{ grid-template-columns:minmax(180px,2.2fr) minmax(60px,1fr) 92px; border-radius:6px; padding:5px 4px; outline:none; }
.an-rank .bar-row:hover, .an-rank .bar-row:focus-visible{ background:var(--surface-2); }
.an-no{ display:inline-block; min-width:22px; color:var(--muted); font-variant-numeric:tabular-nums; }
.an-inline{ display:flex; align-items:center; gap:8px; } .an-inline .bar{ flex:1; height:8px; border-radius:99px; background:var(--surface-2); overflow:hidden; } .an-inline .bar i{ display:block; height:100%; background:var(--accent); border-radius:99px; }
.an-tv{ margin-top:10px; font-size:13px; } .an-tv summary{ cursor:pointer; color:var(--accent-strong); font-weight:600; width:max-content; }
.an-tv[open] summary{ margin-bottom:8px; } .an-tv .table-wrap{ max-height:320px; overflow:auto; border:1px solid var(--line); border-radius:8px; }
.heat{ display:grid; gap:2px; font-size:11px; }
.heat .hh{ text-align:center; color:var(--muted); font-variant-numeric:tabular-nums; }
.heat .hd{ color:var(--ink-2); display:flex; align-items:center; font-size:12px; }
.heat .c{ height:30px; border-radius:4px; display:flex; align-items:center; justify-content:center; font-variant-numeric:tabular-nums; outline:none; }
.heat .c:hover, .heat .c:focus-visible{ box-shadow:inset 0 0 0 2px var(--ink); }
.heat-scale{ width:140px; height:10px; border-radius:99px; background:linear-gradient(90deg, rgba(15,111,97,.1), rgba(15,111,97,.95)); }
/* ---------------------------------------------------------------- ID card */
.idc-chip{ display:inline-flex; align-items:center; gap:5px; border:1px solid var(--line-2); background:var(--surface-2); color:var(--ink-2); border-radius:99px; padding:4px 11px; font-size:12.5px; font-weight:600; cursor:pointer; white-space:nowrap; }
.idc-chip.on{ background:var(--ok-soft); border-color:transparent; color:var(--ok); }
.idc-chip svg{ width:14px; height:14px; }
.idc-box{ display:flex; flex-direction:column; align-items:center; gap:8px; padding:18px 8px; text-align:center; }
.idc-icon{ width:84px; height:84px; border-radius:20px; background:var(--accent-soft); color:var(--accent-ink); display:flex; align-items:center; justify-content:center; animation:idcPulse 1.6s ease-in-out infinite; }
@keyframes idcPulse{ 50%{ transform:scale(1.06); box-shadow:0 0 0 8px rgba(20,138,120,.08); } }
.idc-msg{ font-size:16px; font-weight:600; display:flex; align-items:center; gap:6px; }
.idc-bar{ background:linear-gradient(90deg,var(--accent-soft),#fff 70%); }
.idc-photo{ width:56px; height:68px; border-radius:8px; background:#fff; border:1px solid var(--line-2); display:flex; align-items:center; justify-content:center; color:var(--muted); position:relative; overflow:hidden; flex:none; }
.idc-photo img{ width:100%; height:100%; object-fit:cover; }
.idc-photo .icon-btn{ position:absolute; top:0; right:0; width:22px; height:22px; background:rgba(255,255,255,.85); }
.pt-avatar.photo{ background:#eee; overflow:hidden; padding:0; border-radius:10px; }
.pt-avatar.photo img{ width:100%; height:100%; object-fit:cover; }
.kbd{ font-family:Consolas,monospace; font-size:11.5px; background:var(--surface-2); border:1px solid var(--line-2); border-bottom-width:2px; border-radius:5px; padding:0 5px; }
.print-frame{ position:fixed; width:0; height:0; border:0; right:0; bottom:0; }
