@import url("fonts.css");

:root {
  --sidebar: #14243b;
  --sidebar-ink: #c9d3e0;
  --sidebar-hover: #1d3150;
  --sidebar-active: #26406a;
  --primary: #1f4e8c;
  --primary-hover: #183f73;
  --primary-soft: #e8eef7;
  --ink: #1a2433;
  --ink-2: #3b4757;
  --muted: #5b6676;
  --line: #e1e6ec;
  --line-strong: #cbd3dd;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --bg: #f2f4f7;
  --ok: #2b7a4b;
  --ok-soft: #e5f2ea;
  --warn: #a8690c;
  --warn-soft: #fbf1df;
  --risk: #b9382f;
  --risk-soft: #fbe7e5;
  --gold: #9a7216;
  --hl-code: #e3ecf8;
  --hl-code-line: #1f4e8c;
  --hl-flag: #fbefd6;
  --hl-flag-line: #a8690c;
  --radius: 4px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --topbar-h: 48px;
  --sidebar-w: 208px;
}

* { box-sizing: border-box; margin: 0; }
html { font-size: 14px; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 600; color: var(--ink); }
.num, td.num, .value, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
svg.icon { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* app frame */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
body.nav-collapsed { --sidebar-w: 56px; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.wordmark { height: var(--topbar-h); display: flex; align-items: center; padding: 0 16px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.wordmark .short { display: none; }
body.nav-collapsed .wordmark { justify-content: center; padding: 0; }
body.nav-collapsed .wordmark .full { display: none; }
body.nav-collapsed .wordmark .short { display: inline; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--sidebar-ink); text-decoration: none; white-space: nowrap; }
.side-nav a svg.icon { width: 18px; height: 18px; }
.side-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.side-nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
body.nav-collapsed .side-nav a { justify-content: center; padding: 9px 0; }
body.nav-collapsed .side-nav a span { display: none; }
.side-foot { padding: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.side-foot button { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--sidebar-ink); padding: 8px 10px; border-radius: var(--radius); white-space: nowrap; }
.side-foot button:hover { background: var(--sidebar-hover); color: #fff; }
body.nav-collapsed .side-foot button { justify-content: center; }
body.nav-collapsed .side-foot button span { display: none; }
body.nav-collapsed .side-foot svg { transform: rotate(180deg); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.hospital { font-weight: 600; white-space: nowrap; padding-right: 12px; border-right: 1px solid var(--line); }
.topbar select { height: 30px; padding: 0 6px; }
.search { position: relative; }
.topbar .search input { height: 30px; width: 240px; padding: 0 8px 0 28px; }
.search svg { position: absolute; left: 8px; top: 7px; color: var(--muted); }
.dropdown { position: absolute; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(20, 36, 59, 0.12); z-index: 40; min-width: 100%; }
.dropdown .item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.dropdown .item:last-child { border-bottom: 0; }
.dropdown .item:hover, .dropdown .item:focus { background: var(--surface-2); }
.dropdown .item .sub { font-size: 12px; color: var(--muted); }
.dropdown .empty { padding: 10px; color: var(--muted); }
.dropdown.right { right: 0; }
.topbar-spacer { flex: 1; }
.sync { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sync.standalone .dot { background: var(--muted); }
.bell { position: relative; }
.bell > button { position: relative; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); width: 32px; height: 30px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.bell .count { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--risk); color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.bell .dropdown { width: 320px; }
.notice { display: flex; gap: 8px; align-items: flex-start; }
.notice .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; background: var(--muted); }
.notice .dot.risk { background: var(--risk); }
.notice .dot.warn { background: var(--warn); }
.notice .dot.ok { background: var(--ok); }
.user { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line); white-space: nowrap; }
.user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.user .who { line-height: 1.2; }
.user .who b { display: block; font-size: 13px; font-weight: 600; }
.user .who span { font-size: 11.5px; color: var(--muted); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); height: 30px; padding: 0 8px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; }
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }

/* page */
.view { padding: 16px 20px 32px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; min-height: 32px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; line-height: 1.25; }
.page-head .context { color: var(--ink-2); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sim-badge { font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 3px; padding: 2px 6px; white-space: nowrap; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.split { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: start; }
.grid.side { grid-template-columns: minmax(360px, 0.85fr) minmax(0, 2fr); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.panel.flush { padding: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; min-height: 26px; }
.panel.flush .panel-head { padding: 10px 14px 0; margin-bottom: 8px; }
.panel-head h2 { font-size: 14px; font-weight: 600; }
.panel-head .aside { margin-left: auto; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.scroll-col { max-height: calc(100vh - var(--topbar-h) - 150px); overflow: auto; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.mb { margin-bottom: 12px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat .label { font-size: 12.5px; color: var(--ink-2); }
.stat .value { font-size: 22px; font-weight: 600; line-height: 1.25; margin-top: 2px; }
.stat .value small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* director kpis */
.kpis { display: grid; grid-template-columns: minmax(300px, 1.25fr) repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto; gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: end; }
.kpi .label { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-2); }
.kpi .value { font-size: 22px; font-weight: 600; line-height: 1.2; }
.kpi .value small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi .spark { grid-row: 2 / span 2; grid-column: 2; align-self: center; }
.kpi .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi.hero { grid-row: 1 / span 2; grid-template-columns: 1fr; align-content: space-between; padding: 14px 16px; }
.kpi.hero .value { font-size: 34px; color: var(--gold); }
.kpi.hero .spark { grid-row: auto; grid-column: auto; margin-top: 8px; }
.kpi.hero .facts { display: flex; gap: 18px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.kpi.hero .facts b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--risk); }
.delta.flat { color: var(--muted); }
.spark polyline { fill: none; stroke: var(--primary); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--primary); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px; border-radius: 3px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge.ok, .badge.warn, .badge.risk { border-color: transparent; }
.badge.ok::before, .badge.warn::before, .badge.risk::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.risk { background: var(--risk-soft); color: var(--risk); }
.badge.info { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.plain { background: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; border: 1px solid var(--primary); background: var(--primary); color: #fff; border-radius: var(--radius); padding: 0 12px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--risk); border-color: #e5bdb8; }
.btn.danger:hover { background: var(--risk-soft); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12.5px; }
.btn .spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }
.progress-line .spinner { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--primary); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.progress-line .elapsed { margin-left: auto; color: var(--ink-2); }
.changed { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: 3px; padding: 2px 6px; white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.menu-wrap { position: relative; }
.menu-wrap .dropdown { min-width: 200px; }

/* forms */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters label { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
select, input[type=text], input[type=password], textarea { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 4px 7px; font-size: 13px; min-width: 0; }
select, input[type=text] { height: 28px; }
select:focus, input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; }
textarea { width: 100%; resize: vertical; line-height: 1.45; }

/* tables */
.table-wrap { overflow: auto; }
.table-wrap.tall { max-height: calc(100vh - var(--topbar-h) - 190px); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-2); padding: 7px 8px; border-bottom: 1px solid var(--line-strong); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; user-select: none; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--ink); }
.table th .arrow { display: inline-block; width: 10px; color: var(--primary); }
.table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: #fafbfc; }
.table tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: #eef3f9; }
.table tr.selected td { background: #e6eef8 !important; }
.table tr.done td { color: var(--muted); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .name { font-weight: 600; }
.table .sub { font-size: 12px; color: var(--muted); }
.table .sub.tabular { white-space: nowrap; }
.table .clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.table .code { font-variant-numeric: tabular-nums; font-weight: 600; }

/* meters */
.meter { position: relative; height: 6px; border-radius: 3px; background: #e4e9ef; overflow: hidden; min-width: 60px; }
.meter > span { position: absolute; inset: 0 auto 0 0; background: var(--primary); }
.meter.ok > span { background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.meter.risk > span { background: var(--risk); }
.meter-row { display: flex; align-items: center; gap: 8px; }
.meter-row .meter { flex: 1; }
.meter-row b { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 42px; text-align: right; font-size: 12.5px; }

/* coder */
.case-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.case-head .who { flex: 1; min-width: 0; }
.case-head h1 { font-size: 20px; }
.case-head .facts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 3px; font-size: 13px; color: var(--ink-2); }
.case-head .facts b { color: var(--muted); font-weight: 400; margin-right: 4px; }
.claim-box { text-align: right; white-space: nowrap; }
.claim-box .label { font-size: 12px; color: var(--muted); }
.claim-box .amount { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.claim-box .delta { display: block; }
.note-entry { padding: 10px 0; border-bottom: 1px solid var(--line); }
.note-entry:first-child { padding-top: 0; }
.note-entry:last-child { border-bottom: 0; }
.note-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.note-meta b { font-weight: 600; }
.note-meta span { font-size: 12px; color: var(--muted); }
.soap-row { display: grid; grid-template-columns: 18px 1fr; gap: 6px; margin: 2px 0; line-height: 1.55; }
.soap-row > span:first-child { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 1px; }
.ref { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 3px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--hl-code); color: var(--hl-code-line); }
.ref.flag { background: var(--hl-flag); color: var(--hl-flag-line); }
mark.hl { background: var(--hl-code); color: inherit; padding: 0 1px; border-radius: 2px; box-shadow: inset 0 -1px 0 var(--hl-code-line); }
mark.hl.hl-flag { background: var(--hl-flag); box-shadow: inset 0 -1px 0 var(--hl-flag-line); }
mark.hl.active { background: #c9daf2; }
mark.hl.hl-flag.active { background: #f5dca8; }
mark.hl sup { font-size: 10px; font-weight: 700; color: var(--hl-code-line); margin-left: 2px; vertical-align: 0.3em; }
mark.hl.hl-flag sup { color: var(--hl-flag-line); }
.sugg { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; margin-bottom: 8px; background: var(--surface); }
.sugg:hover, .sugg.focus { border-color: #9fb4d1; }
.sugg-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sugg-code { font-weight: 700; font-variant-numeric: tabular-nums; }
.sugg-name { font-weight: 600; }
.sugg-top .badge { margin-left: auto; }
.sugg-why { color: var(--ink-2); margin: 5px 0 4px; }
.quote { font-size: 12.5px; color: var(--ink-2); margin: 2px 0; cursor: pointer; }
.quote::before { content: "Kutipan: "; color: var(--muted); }
.quote .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }
.decide { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; align-items: center; }
.decided { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.edit-row { display: flex; gap: 6px; margin-top: 7px; align-items: center; flex-wrap: wrap; }
.edit-row select { max-width: 300px; }
.group-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.group-label:first-child { margin-top: 0; }
.risk-box { border-radius: var(--radius); padding: 9px 10px; border: 1px solid var(--line); }
.risk-box.risk { background: var(--risk-soft); border-color: #efc9c4; }
.risk-box.warn { background: var(--warn-soft); border-color: #eed7ae; }
.risk-box.ok { background: var(--ok-soft); border-color: #c4e0cf; }
.risk-box ul { margin: 6px 0 0 18px; padding: 0; }
.flagged-codes { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 7px 9px; margin-bottom: 8px; }
.source-line { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; margin-bottom: 8px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.mini-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.trail { list-style: none; padding: 0; font-size: 12.5px; }
.trail li { display: grid; grid-template-columns: 100px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.trail li span:first-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.code-chip { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.code-list { display: flex; flex-wrap: wrap; gap: 5px; }
details.more summary { cursor: pointer; color: var(--primary); margin-top: 6px; font-size: 13px; }
details.more[open] summary { margin-bottom: 6px; }

/* rekam medis */
.res-list { list-style: none; padding: 0; }
.res-item { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.res-item:last-child { border-bottom: 0; }
.res-item .res-name { font-weight: 600; }
.res-item .res-name small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.res-item .res-why { font-size: 12.5px; color: var(--ink-2); }
.res-item.na .res-name { color: var(--muted); font-weight: 500; }
.res-item .res-act { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.res-item .requested { font-size: 12px; color: var(--muted); }
.state-icon { width: 18px; height: 18px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; }
.state-icon svg.icon { width: 13px; height: 13px; stroke-width: 2.4; }
.state-icon.ok { background: var(--ok-soft); color: var(--ok); }
.state-icon.risk { background: var(--risk-soft); color: var(--risk); }
.state-icon.na { background: var(--surface-2); color: var(--muted); }
.ratio { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ratio small { font-size: 13px; color: var(--muted); font-weight: 500; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-strong); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 7px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button .count { font-variant-numeric: tabular-nums; color: var(--muted); margin-left: 4px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--primary); font-weight: 600; }
.error-box { font-size: 12.5px; color: var(--ink); margin-top: 2px; }
.error-box span { color: var(--muted); }
.draft-section { padding: 8px 0; border-bottom: 1px solid var(--line); }
.draft-section:last-child { border-bottom: 0; }
.draft-section h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.draft-section p { white-space: pre-line; }
.draft-section textarea { min-height: 60px; }
.status-strip { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; font-size: 13px; }

/* direktur */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid-line { stroke: #e7ebf0; stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--primary); opacity: 0.07; }
.chart .dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart .target { stroke: var(--ink-2); stroke-width: 1; stroke-opacity: 0.45; }
.chart .target-text { fill: var(--ink-2); font-size: 11px; font-family: var(--font); }
.chart .crosshair { stroke: var(--ink-2); stroke-width: 1; opacity: 0.35; }
.chart .end-label { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: var(--font); }
.tooltip { position: fixed; z-index: 60; pointer-events: none; background: #1a2433; color: #fff; border-radius: var(--radius); padding: 6px 8px; font-size: 12px; box-shadow: 0 4px 12px rgba(20, 36, 59, 0.2); max-width: 260px; }
.tooltip b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tooltip span { color: #c9d3e0; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 4px 10px; font-size: 12.5px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.active { background: var(--primary); color: #fff; }
.hbar { display: grid; grid-template-columns: minmax(150px, 220px) minmax(60px, 1fr) 96px; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.hbar:last-child { border-bottom: 0; }
.hbar .track { height: 12px; position: relative; }
.hbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--primary); border-radius: 0 3px 3px 0; min-width: 2px; }
.hbar .val { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; font-weight: 600; }
.hbar .val small { color: var(--muted); display: block; font-size: 11.5px; font-weight: 400; }
.readiness { display: grid; grid-template-columns: minmax(220px, 0.7fr) minmax(0, 2fr); gap: 20px; align-items: center; }
.score { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.score small { font-size: 14px; color: var(--muted); }
.ind { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(120px, 1fr) 56px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ind:last-child { border-bottom: 0; }
.ind .meter { overflow: visible; }
.ind .meter i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); }
.ind b { text-align: right; font-variant-numeric: tabular-nums; }

.cash { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cash .label { font-size: 12.5px; color: var(--ink-2); }
.cash .value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.cash .value small { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.cash .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stack { display: flex; gap: 2px; height: 10px; margin-top: 12px; }
.stack span { display: block; height: 100%; min-width: 2px; }
.stack span:first-child { border-radius: 3px 0 0 3px; }
.stack span:last-child { border-radius: 0 3px 3px 0; }
.seg-ok { background: var(--ok); }
.seg-warn { background: var(--warn); }
.seg-plain { background: #9aa6b5; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend b { font-variant-numeric: tabular-nums; }

/* integrasi */
.switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.switch button { border: 0; background: var(--surface); padding: 4px 12px; font-size: 13px; color: var(--ink-2); }
.switch button + button { border-left: 1px solid var(--line-strong); }
.switch button.active { background: var(--primary); color: #fff; font-weight: 600; }
.log { list-style: none; padding: 0; font-size: 12.5px; }
.log li { display: grid; grid-template-columns: 96px 70px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.log li span:first-child { font-variant-numeric: tabular-nums; color: var(--muted); }
.log li.risk span:last-child { color: var(--risk); }
.flow { display: flex; align-items: center; gap: 10px; }
.flow .node { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 7px 10px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.flow .node b { display: block; color: var(--ink); font-size: 13px; }
.flow .arrow { flex: 1; height: 1px; background: var(--line-strong); min-width: 20px; position: relative; }
.flow .arrow::after { content: ""; position: absolute; right: 0; top: -4px; border-left: 7px solid var(--line-strong); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.mic-inline { width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.mic-inline.rec { background: var(--risk); border-color: var(--risk); color: #fff; }
.mic-inline svg, .mic svg { width: 45%; height: 45%; }
.json-view { position: relative; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow: auto; white-space: pre; max-height: calc(100vh - var(--topbar-h) - 210px); }
.json-view .missing { background: var(--risk-soft); color: var(--risk); }

/* dialogs, drawer, toast */
.overlay { position: fixed; inset: 0; background: rgba(20, 36, 59, 0.45); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 6px; width: min(440px, 100%); padding: 18px; box-shadow: 0 10px 30px rgba(20, 36, 59, 0.25); }
.dialog h2 { font-size: 16px; margin-bottom: 2px; }
.dialog .field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.dialog .field input, .dialog .field select { font-size: 13.5px; color: var(--ink); height: 32px; }
.dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.dialog .err { color: var(--risk); font-size: 12.5px; min-height: 16px; margin-top: 6px; }
.drawer-overlay { position: fixed; inset: 0; background: rgba(20, 36, 59, 0.35); z-index: 65; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 66; display: flex; flex-direction: column; box-shadow: -6px 0 24px rgba(20, 36, 59, 0.18); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 15px; }
.drawer-body { padding: 12px 16px; overflow: auto; flex: 1; }
.audit-item { padding: 8px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 112px 1fr; gap: 10px; font-size: 12.5px; }
.audit-item .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-item b { font-weight: 600; }
.audit-item .meta { color: var(--muted); margin-top: 2px; }
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 6px; }
.toast { background: #1a2433; color: #fff; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; box-shadow: 0 4px 14px rgba(20, 36, 59, 0.2); max-width: 380px; }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); }
.loading { opacity: 0.6; pointer-events: none; transition: opacity 0.15s; }

/* gate */
.gate { position: fixed; inset: 0; background: var(--bg); z-index: 90; display: flex; align-items: center; justify-content: center; }
.gate .box { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 24px; width: 320px; }
.gate .gate-mark { font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.gate h1 { font-size: 15px; margin-bottom: 2px; }
.gate p { color: var(--ink-2); font-size: 13px; margin-bottom: 12px; }
.gate input { width: 100%; height: 36px; font-size: 16px; letter-spacing: 0.15em; margin-bottom: 8px; }
.gate .err { color: var(--risk); font-size: 12.5px; min-height: 16px; margin-bottom: 4px; }
.gate .btn { height: 34px; }

/* dokter (voice assistant) */
.doctor-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.room { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 8px; background: var(--surface); }
.room b { font-size: 15px; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.lang-toggle { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.lang-toggle button { border: 0; background: var(--surface); color: var(--ink-2); padding: 4px 10px; font-size: 12.5px; }
.lang-toggle button.on { background: var(--primary); color: #fff; }
.assistant { max-width: 900px; margin: 0 auto; padding-bottom: 90px; }
.hint-card { color: var(--ink-2); }
.hint-card ul { margin: 6px 0 0 18px; }
.hint-card li { margin: 2px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0 0; }

.card h2 { font-size: 15px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.card .who { font-size: 15px; font-weight: 600; }
.card .who span { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.transcript { font-size: 13px; color: var(--ink-2); padding: 2px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.transcript b { color: var(--ink); }
.card table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.card th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 5px 6px; border-bottom: 1px solid var(--line-strong); }
.card td { padding: 5px 6px; border-bottom: 1px solid var(--line); font-size: 13px; }
.card td.num { font-variant-numeric: tabular-nums; }
.card tr:last-child td { border-bottom: 0; }
.flag { font-size: 11.5px; border-radius: 3px; padding: 0 5px; }
.flag.H { background: var(--risk-soft); color: var(--risk); }
.flag.L { background: var(--warn-soft); color: var(--warn); }
.flag.N { color: var(--ok); }
.pill { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; padding: 0 6px; font-size: 12.5px; margin: 2px 4px 2px 0; }
.pill.warn { background: var(--risk-soft); border-color: transparent; color: var(--risk); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; margin-top: 6px; }
.kv div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 8px; }
.kv b { display: block; font-variant-numeric: tabular-nums; }
.kv small { color: var(--muted); font-size: 11.5px; }
.soap { margin: 8px 0 0; }
.soap .visit { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.soap .visit .d { font-weight: 600; font-variant-numeric: tabular-nums; }
.soap .visit .meta { color: var(--muted); font-size: 12.5px; }
.soap .visit p { margin-top: 2px; }
.soap .visit p b { font-weight: 600; color: var(--muted); }
.vision-body { white-space: pre-wrap; margin-top: 4px; }
.vision-body .h { font-weight: 600; display: block; margin-top: 6px; }
.scan-thumb { display: block; max-width: 200px; max-height: 200px; border-radius: var(--radius); border: 1px solid var(--line); cursor: zoom-in; margin-bottom: 6px; }
.scan-hint { font-size: 12px; color: var(--muted); margin: -2px 0 8px; }
.lightbox { position: fixed; inset: 0; background: rgba(20, 36, 59, 0.88); z-index: 100; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 92vw; max-height: 92vh; }
.disclaimer { margin-top: 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.strip { position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
.strip-inner { max-width: 900px; margin: 0 auto; display: flex; gap: 8px; align-items: center; }
.mic { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 6px; border: 1px solid var(--primary); background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.mic.rec { background: var(--risk); border-color: var(--risk); color: #fff; }
.mic:disabled { opacity: 0.5; }
.strip-status { font-size: 12.5px; color: var(--ink-2); min-width: 150px; }
.strip input[type=text] { flex: 1; height: 34px; }
.strip .btn { height: 34px; }

/* phone page */
.phone-wrap { max-width: 420px; margin: 0 auto; padding: 24px; text-align: center; }
.phone-wrap .brand-line { font-weight: 700; font-size: 18px; margin-bottom: 16px; }
.phone-wrap .mic { width: 132px; height: 132px; margin: 28px auto; display: flex; }
.phone-wrap input { text-align: center; font-size: 24px; letter-spacing: 6px; padding: 12px; width: 100%; height: auto; }

/* print */
@media print {
  .sidebar, .topbar, .page-head .actions, .strip, .toast-host, .filters, .tabs, .decide, button { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .view { padding: 0; }
  .panel, .stat, .kpi { border-color: #ccc; break-inside: avoid; }
  .scroll-col, .table-wrap, .table-wrap.tall { max-height: none !important; overflow: visible !important; }
  .table th { position: static; }
}

/* responsive */
@media (max-width: 1500px) {
  .topbar .search input { width: 180px; }
  .user .who span { display: none; }
}
@media (max-width: 1400px) {
  .kpis { grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(0, 1fr)); }
  .topbar .search input { width: 160px; }
}
@media (max-width: 1280px) {
  .cash { grid-template-columns: 1fr 1fr; }
  .grid.split, .grid.side, .readiness { grid-template-columns: 1fr; }
  .scroll-col { max-height: none; }
  .user .who { display: none; }
}
@media (max-width: 900px) {
  .grid.two, .kpis { grid-template-columns: 1fr; }
  .kpi.hero { grid-row: auto; }
  body { --sidebar-w: 56px; }
  .side-nav a span, .wordmark .full, .side-foot span { display: none; }
  .wordmark .short { display: inline; }
  .topbar { flex-wrap: wrap; height: auto; padding: 6px 10px; }
  .strip-status { display: none; }
}
