/* Klinik El Shadai - demo. Token warna: merek (merah/hijau/biru dari logo) + palet grafik tervalidasi */
:root {
  color-scheme: light;
  --brand: #b3202a; --brand-ink: #8f1822; --brand-wash: #fbeaeb;
  --ok: #1f8a3b; --ok-ink: #176a2d; --ok-wash: #e6f4ea;
  --blue: #1f4e9c; --blue-wash: #e8effa;
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #faf9f7;
  --ink: #14130f; --ink-2: #52514e; --muted: #898781;
  --line: #e6e4dc; --grid: #e1e0d9; --axis: #c3c2b7;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b;
  --good-text: #006300; --warn-text: #8a5a00; --crit-text: #a82424;
  --shadow: 0 1px 2px rgba(20,19,15,.06), 0 4px 14px rgba(20,19,15,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #e0636b; --brand-ink: #f0a0a5; --brand-wash: #3a1b1e;
    --ok: #3cae5a; --ok-ink: #7fd196; --ok-wash: #16301d;
    --blue: #6da7ec; --blue-wash: #17263d;
    --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #212120;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --line: #2c2c2a; --grid: #2c2c2a; --axis: #383835;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --good-text: #0ca30c; --warn-text: #fab219; --crit-text: #e66767;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #e0636b; --brand-ink: #f0a0a5; --brand-wash: #3a1b1e;
  --ok: #3cae5a; --ok-ink: #7fd196; --ok-wash: #16301d;
  --blue: #6da7ec; --blue-wash: #17263d;
  --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #212120;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --line: #2c2c2a; --grid: #2c2c2a; --axis: #383835;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --good-text: #0ca30c; --warn-text: #fab219; --crit-text: #e66767;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .sec { color: var(--ink-2); }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.sm { font-size: 12px; } .b { font-weight: 650; }

/* kerangka */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 12px; }
.brand svg { width: 54px; height: 40px; flex: none; }
.brand .nm { font-weight: 800; letter-spacing: .02em; color: var(--brand); font-size: 17px; line-height: 1.1; }
.brand .sub { font-size: 10.5px; color: var(--ok-ink); font-weight: 650; letter-spacing: .03em; }
.nav { padding: 4px 10px 16px; flex: 1; }
.nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 5px; font-weight: 650; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--brand-wash); color: var(--brand-ink); font-weight: 650; }
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .cnt { margin-left: auto; background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 650; }
.side .foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .ham { display: none; }
.top .clock { font-size: 12.5px; color: var(--ink-2); }
.top .sp { flex: 1; }
.top select { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.demo-tag { background: #fff3cd; color: #7a5a00; border: 1px solid #f1d98a; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: .04em; }
.page { padding: 22px 24px 60px; max-width: 1480px; width: 100%; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead .sub { color: var(--ink-2); margin-top: 2px; }
.pagehead .sp { flex: 1; }

/* komponen */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card > .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card > .hd .sp { flex: 1; }
.card > .hd .hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.grid { display: grid; gap: 14px; }
.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)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.gap-t { margin-top: 14px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 13px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.primary:hover { background: var(--ok-ink); }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.brand:hover { background: var(--brand-ink); }
.btn.danger { color: var(--crit-text); } .btn.sm { padding: 4px 9px; font-size: 12.5px; } .btn[disabled] { opacity: .45; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok-ink); background: var(--ok-wash); border-color: transparent; }
.badge.warn { color: var(--warn-text); background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border-color: transparent; }
.badge.crit { color: var(--crit-text); background: color-mix(in srgb, var(--crit) 12%, var(--surface)); border-color: transparent; }
.badge.info { color: var(--blue); background: var(--blue-wash); border-color: transparent; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12.5px; user-select: none; }
.chip.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.chip.static { cursor: default; }
.chip.al { background: color-mix(in srgb, var(--crit) 10%, var(--surface)); color: var(--crit-text); border-color: transparent; font-weight: 600; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 5px 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.on { background: var(--brand-wash); color: var(--brand-ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand-ink); border-color: var(--brand); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > label { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.field input, .field select, .field textarea, .in { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus, .in:focus { outline: 2px solid color-mix(in srgb, var(--ok) 45%, transparent); border-color: var(--ok); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row > .grow { flex: 1; min-width: 0; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; } .cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl th.r, .tbl td.r { text-align: right; } .tbl td.num { font-variant-numeric: tabular-nums; text-align: right; }
.scroll-x { overflow-x: auto; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.note { background: var(--blue-wash); color: var(--blue); border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.warnbox { background: color-mix(in srgb, var(--crit) 10%, var(--surface)); color: var(--crit-text); border-radius: 8px; padding: 9px 12px; font-size: 13px; font-weight: 600; }
.okbox { background: var(--ok-wash); color: var(--ok-ink); border-radius: 8px; padding: 9px 12px; font-size: 13px; }

/* kpi */
.kpi { position: relative; overflow: hidden; }
.kpi .lb { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.kpi .vl { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; }
.kpi .dl { font-size: 12.5px; font-weight: 650; }
.kpi .dl.up { color: var(--good-text); } .kpi .dl.down { color: var(--crit-text); } .kpi .dl.flat { color: var(--muted); }
.kpi .sp-svg { position: absolute; right: 12px; bottom: 12px; opacity: .9; }
.kpi.flash { animation: flash 1.6s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--ok); } 100% { box-shadow: var(--shadow); } }

/* grafik */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.14); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; min-width: 150px; opacity: 0; transition: opacity .08s; }
.tip.on { opacity: 1; } .tip .tt { font-weight: 650; margin-bottom: 4px; } .tip .tr { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tip .tr i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.hbar { display: grid; grid-template-columns: 112px 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .tr { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .fl { height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); }
.hbar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: flex; height: 18px; gap: 2px; border-radius: 5px; overflow: hidden; }
.stack div { min-width: 3px; }
.heat { display: grid; grid-template-columns: 38px repeat(10, 1fr); gap: 3px; font-size: 11px; color: var(--muted); }
.heat .c { height: 26px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink); cursor: default; }
.heat .hl { display: flex; align-items: center; }

/* perhatian */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 8px; cursor: pointer; }
.alert:hover { border-color: var(--axis); }
.alert .ic { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #1a1a19; }
.alert .ic.w { background: var(--warn); } .alert .ic.c { background: var(--crit); color: #fff; } .alert .ic.i { background: var(--s1); color: #fff; }
.alert .tx { flex: 1; } .alert .go { color: var(--blue); font-weight: 650; font-size: 12.5px; align-self: center; white-space: nowrap; }

/* antrean & papan */
.kb { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kb .col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 120px; }
.kb .col h3 { display: flex; justify-content: space-between; margin-bottom: 8px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 7px; }
.q .no { font-weight: 800; color: var(--brand-ink); margin-right: 6px; }
.q.now { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 30%, transparent); }
.q.sel { border-color: var(--blue); box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 30%, transparent); }
.q.click { cursor: pointer; }
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.listpane { max-height: calc(100vh - 170px); overflow-y: auto; }

/* modal & toast */
.ov { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.lg { max-width: 860px; } .modal.sm { max-width: 440px; }
.modal .mh { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal .mh h2 { flex: 1; } .modal .mb { padding: 16px 18px; } .modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1d1d1b; color: #fff; padding: 10px 14px; border-radius: 9px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 340px; animation: up .2s ease; }
.toast.ok { border-left: 4px solid var(--good); } .toast.err { border-left: 4px solid var(--crit); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, var(--brand-wash), transparent), var(--bg); }
.login .box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; width: 100%; max-width: 720px; box-shadow: var(--shadow); }
.login .hero { display: flex; gap: 16px; align-items: center; margin-bottom: 6px; }
.login .hero svg { width: 92px; height: 68px; }
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 16px; }
.role { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.role:hover { border-color: var(--ok); background: var(--ok-wash); } .role b { display: block; } .role span { color: var(--muted); font-size: 12px; }

/* layar TV */
.tv { position: fixed; inset: 0; z-index: 90; background: #101820; color: #fff; padding: 28px 40px; display: flex; flex-direction: column; }
.tv .th { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.tv .th .tn { font-size: 30px; font-weight: 800; letter-spacing: .02em; } .tv .th .tc { font-size: 34px; font-variant-numeric: tabular-nums; }
.tv .tg { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.tv .tp { background: #19232e; border-radius: 18px; padding: 20px 26px; display: flex; flex-direction: column; }
.tv .tp .pn { font-size: 22px; color: #9fc2ff; font-weight: 700; } .tv .tp .dr { color: #9aa7b4; margin-bottom: 8px; }
.tv .tp .big { font-size: 84px; font-weight: 800; line-height: 1; color: #6ee38d; } .tv .tp .nm { font-size: 22px; margin-bottom: 14px; }
.tv .tp .nx { color: #c8d3de; font-size: 18px; margin-top: auto; }
.tv .tf { margin-top: 16px; color: #9aa7b4; text-align: center; }

/* tur */
.tour { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; width: min(760px, calc(100vw - 24px)); background: #1d1d1b; color: #fff; border-radius: 14px; padding: 14px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.4); display: flex; gap: 14px; align-items: center; }
.tour .st { font-size: 11px; letter-spacing: .08em; color: #8fe0a4; font-weight: 700; } .tour .ct { font-size: 15px; font-weight: 600; margin-top: 2px; } .tour .ds { color: #c3c2b7; font-size: 13px; margin-top: 2px; }
.tour .bt { display: flex; gap: 6px; flex: none; } .tour .btn { background: #2d2d2b; border-color: #3a3a38; color: #fff; } .tour .btn.primary { background: var(--ok); border-color: var(--ok); }
.tour .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: #6ee38d; border-radius: 0 0 14px 14px; transition: width .4s linear; }
.hl-pulse { outline: 3px solid #ffb703 !important; outline-offset: 2px; border-radius: 8px; animation: pul 1.2s ease-in-out infinite; }
@keyframes pul { 50% { outline-color: transparent; } }

/* absen */
.absen-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.absen-hero .bigclock { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.shift { display: inline-block; min-width: 34px; text-align: center; padding: 3px 0; border-radius: 6px; font-weight: 700; font-size: 12px; cursor: pointer; user-select: none; border: 1px solid transparent; }
.shift.P { background: var(--blue-wash); color: var(--blue); } .shift.S { background: color-mix(in srgb, var(--s2) 16%, var(--surface)); color: var(--s2); }
.shift.F { background: var(--ok-wash); color: var(--ok-ink); } .shift.L { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--ok); border-radius: 50%; animation: sp 0.8s linear infinite; margin: 0 auto 8px; }
@keyframes sp { to { transform: rotate(360deg); } }
.cam { background: #20252b; border-radius: 12px; height: 200px; display: grid; place-items: center; color: #8ea0b3; position: relative; overflow: hidden; }
.cam::after { content: ""; position: absolute; inset: 22px 90px; border: 2px dashed #8ea0b3; border-radius: 50%; }

/* struk */
.struk { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; max-width: 320px; margin: 0 auto; }
.struk hr { border: 0; border-top: 1px dashed var(--axis); margin: 8px 0; } .struk .l { display: flex; justify-content: space-between; gap: 8px; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kb { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .top { flex-wrap: wrap; row-gap: 6px; } .demo-tag { font-size: 10px; padding: 2px 6px; } .top select { max-width: 150px; }
  .side { position: fixed; left: 0; top: 0; z-index: 60; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .top .ham { display: inline-flex; } .top { padding: 10px 14px; } .page { padding: 16px 14px 90px; }
  .g2, .g3, .cols2, .cols3 { grid-template-columns: 1fr; } .split { grid-template-columns: 1fr; } .listpane { max-height: none; }
  .kb { grid-template-columns: 1fr; } .tv .tg { grid-template-columns: 1fr; } .tv .tp .big { font-size: 56px; }
  .top .clock { display: none; } .hbar { grid-template-columns: 90px 1fr auto; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: 1fr 1fr; } .kpi .vl { font-size: 20px; } .kpi .sp-svg { display: none; } .pagehead h1 { font-size: 19px; } .card { padding: 12px; } .tour { flex-direction: column; align-items: stretch; } }
@media print {
  body * { visibility: hidden; } .ov, .ov * { visibility: visible; } .ov { position: absolute; background: none; padding: 0; } .modal { box-shadow: none; max-width: none; } .mf, .x, .noprint { display: none !important; }
}
@media (forced-colors: active) { .hbar .fl, .stack div { forced-color-adjust: none; } }
