/* =========================================================
   Ammarai Keuangan — app.css
   Brand: Navy #143a6f · Teal #158d7e · Trust Blue #1c69b0 · Care Coral #e64642
   ========================================================= */
:root {
  --navy: #143a6f; --navy-900: #0a2144; --navy-800: #0f2e5a;
  --teal: #158d7e; --teal-700: #0e6f63; --teal-50: #e8f6f3;
  --blue: #1c69b0; --blue-50: #e9f1fa;
  --coral: #e64642; --coral-50: #fdeceb;

  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #eef2f7;
  --ink: #0f1f33; --ink-2: #3b4a5e; --muted: #6b7a8f; --line: #e3e8ef; --line-2: #d3dbe5;
  --focus: #1c69b0;

  --good: #177245; --good-bg: #e6f5ec;
  --warn: #9a5b00; --warn-bg: #fff3dc;
  --bad: #b42318; --bad-bg: #fdecea;
  --info: #1c5fa0; --info-bg: #e8f1fb;
  --neutral: #5b6777; --neutral-bg: #eef1f5;

  --chart-a: #1c69b0; --chart-b: #e64642; --chart-grid: #e8edf3; --chart-axis: #8593a6;

  --sidebar-bg: linear-gradient(180deg, #0a2144 0%, #0f2e5a 100%);
  --sidebar-ink: #c9d6ea; --sidebar-ink-2: #7f95b6; --sidebar-active: rgba(255,255,255,.1);

  --f: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15,31,51,.05), 0 1px 3px rgba(15,31,51,.04);
  --shadow: 0 8px 24px -10px rgba(20,58,111,.2), 0 2px 6px -2px rgba(20,58,111,.08);
  --shadow-lg: 0 24px 64px -16px rgba(10,33,68,.35);
  --ease: cubic-bezier(.22,1,.36,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1422; --surface: #111d2f; --surface-2: #14223a; --surface-3: #1a2a45;
    --ink: #e7eef8; --ink-2: #bccadc; --muted: #8497b0; --line: #22324b; --line-2: #2c3f5c;
    --good: #5fd49a; --good-bg: rgba(95,212,154,.12); --warn: #f2b84b; --warn-bg: rgba(242,184,75,.12);
    --bad: #ff8a80; --bad-bg: rgba(255,138,128,.12); --info: #8fbfff; --info-bg: rgba(143,191,255,.12);
    --neutral: #a3b1c4; --neutral-bg: rgba(163,177,196,.12);
    --teal-50: rgba(21,141,126,.16); --blue-50: rgba(28,105,176,.18); --coral-50: rgba(230,70,66,.16);
    --chart-a: #4a90d9; --chart-b: #e8605c; --chart-grid: #1f2e45; --chart-axis: #7d8fa8;
    --sidebar-bg: linear-gradient(180deg, #07101d 0%, #0b1627 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1422; --surface: #111d2f; --surface-2: #14223a; --surface-3: #1a2a45;
  --ink: #e7eef8; --ink-2: #bccadc; --muted: #8497b0; --line: #22324b; --line-2: #2c3f5c;
  --good: #5fd49a; --good-bg: rgba(95,212,154,.12); --warn: #f2b84b; --warn-bg: rgba(242,184,75,.12);
  --bad: #ff8a80; --bad-bg: rgba(255,138,128,.12); --info: #8fbfff; --info-bg: rgba(143,191,255,.12);
  --neutral: #a3b1c4; --neutral-bg: rgba(163,177,196,.12);
  --teal-50: rgba(21,141,126,.16); --blue-50: rgba(28,105,176,.18); --coral-50: rgba(230,70,66,.16);
  --chart-a: #4a90d9; --chart-b: #e8605c; --chart-grid: #1f2e45; --chart-axis: #7d8fa8;
  --sidebar-bg: linear-gradient(180deg, #07101d 0%, #0b1627 100%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--f); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
.num, .tbl td.num, .tbl th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar-bg); color: var(--sidebar-ink); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; z-index: 40; }
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.sidebar__brand img { height: 40px; width: auto; }
.sidebar__brand small { display: block; font-size: 11px; color: var(--sidebar-ink-2); letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.nav-group { margin-top: 10px; }
.nav-group > span { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--sidebar-ink-2); padding: 6px 10px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--sidebar-ink); font-weight: 500; text-decoration: none; position: relative; transition: background .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #3fd0bb; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.sidebar__foot { margin-top: auto; padding: 12px 10px 4px; font-size: 11.5px; color: var(--sidebar-ink-2); border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__foot b { color: var(--sidebar-ink); font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar__title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.search-btn { display: flex; align-items: center; gap: 8px; min-width: 240px; padding: 8px 12px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; color: var(--muted); }
.search-btn kbd { margin-left: auto; font: 600 11px var(--f); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.content { padding: 24px 28px 64px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; text-decoration: none !important; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn--primary:hover { background: var(--teal-700); border-color: var(--teal-700); }
.btn--navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn--navy:hover { background: var(--navy-800); }
.btn--danger { color: var(--bad); }
.btn--danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Cards / layout ---------- */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card__head h3 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.card__head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card__body { padding: 16px 20px 20px; }
.card__body--flush { padding: 8px 0 4px; }
.section-head { display: flex; align-items: flex-end; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 16px; flex: 1; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.page-actions .spacer { flex: 1; }

/* KPI tiles */
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi__label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi__label i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-style: normal; }
.kpi__label i svg { width: 16px; height: 16px; }
.kpi__value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi__sub b { font-weight: 600; }
.tone-teal i { background: var(--teal-50); color: var(--teal); }
.tone-blue i { background: var(--blue-50); color: var(--blue); }
.tone-coral i { background: var(--coral-50); color: var(--coral); }
.tone-navy i { background: var(--surface-3); color: var(--navy); }
[data-theme="dark"] .tone-navy i { color: #8fbfff; }
.up { color: var(--good); } .down { color: var(--bad); }

/* ---------- Chips / status ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip--good { color: var(--good); background: var(--good-bg); }
.chip--warn { color: var(--warn); background: var(--warn-bg); }
.chip--bad { color: var(--bad); background: var(--bad-bg); }
.chip--info { color: var(--info); background: var(--info-bg); }
.chip--neutral { color: var(--neutral); background: var(--neutral-bg); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button .n { color: var(--muted); font-weight: 500; margin-left: 4px; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7a8f' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.input--sm, .select--sm { height: 32px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { margin: 22px 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--teal); }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-input .input { padding-left: 34px; min-width: 240px; }

/* ---------- Table ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td .title { font-weight: 600; color: var(--ink); }
.tbl td .sub { font-size: 12px; color: var(--muted); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-2); border-bottom: 0; }
.tbl .actions { text-align: right; white-space: nowrap; width: 1%; }
.tbl--compact td { padding: 8px 12px; }
.tbl--report td, .tbl--report th { padding: 8px 10px; }
.tbl--report td:first-child { position: sticky; left: 0; background: var(--surface); min-width: 260px; }
.tbl--report tr.grp td { font-weight: 700; background: var(--surface-2); }
.tbl--report tr.total td { font-weight: 800; border-top: 2px solid var(--line-2); }
.tbl--report tr.ind td:first-child { padding-left: 26px; color: var(--ink-2); }
.neg { color: var(--bad); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 42px; height: 42px; margin: 0 auto 10px; opacity: .45; }
.empty h4 { margin: 0 0 4px; color: var(--ink); font-size: 15px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .s { font-size: 12px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; background: var(--teal-50); color: var(--teal); }
.avatar--blue { background: var(--blue-50); color: var(--blue); }
.avatar--coral { background: var(--coral-50); color: var(--coral); }

.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal); border-radius: 99px; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-label { fill: var(--chart-axis); font-size: 11px; font-family: var(--f); }
.chart .bar-a { fill: var(--chart-a); }
.chart .bar-b { fill: var(--chart-b); }
.chart .line-net { stroke: var(--ink); stroke-width: 2; fill: none; }
.chart .dot-net { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .hit:hover + .hl, .chart .col:hover .hl { opacity: 1; }
.chart .hl { fill: var(--surface-3); opacity: 0; transition: opacity .1s; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; 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: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 0; width: 14px; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; min-width: 170px; z-index: 5; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.tip.show { opacity: 1; transform: none; }
.tip b { display: block; margin-bottom: 4px; }
.tip .r { display: flex; gap: 10px; justify-content: space-between; }
.tip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip .r i { width: 8px; height: 8px; border-radius: 2px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.hbar .lbl2 { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .val { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: var(--surface-3); border-radius: 99px; margin-bottom: 8px; }
.hbar .track span { display: block; height: 100%; border-radius: 99px; background: var(--chart-a); }

/* ---------- Drawer / Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,20,40,.45); backdrop-filter: blur(2px); z-index: 80; opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); z-index: 90; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .28s var(--ease); }
.drawer.wide { width: min(980px, 100vw); }
.drawer.show { transform: none; }
.drawer__head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.drawer__head h3 { margin: 0; font-size: 17px; flex: 1; }
.drawer__head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }
.drawer__foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer__foot .sum { margin-right: auto; font-size: 13px; color: var(--muted); }
.drawer__foot .sum b { color: var(--ink); font-size: 16px; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98); width: min(460px, calc(100vw - 32px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 95; opacity: 0; transition: opacity .18s, transform .18s var(--ease); }
.modal.show { opacity: 1; transform: translate(-50%, -50%); }
.modal__body { padding: 22px 24px 8px; }
.modal__body h3 { margin: 0 0 6px; font-size: 17px; }
.modal__body p { margin: 0; color: var(--ink-2); }
.modal__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 24px 20px; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy-900); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; display: flex; align-items: center; gap: 10px; animation: toast-in .3s var(--ease); }
.toast svg { width: 18px; height: 18px; color: #3fd0bb; }
.toast a { color: #8fd8ff; font-weight: 600; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* Command palette */
.cmdk { position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 110; overflow: hidden; border: 1px solid var(--line); }
.cmdk input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: 16px; background: transparent; outline: none; }
.cmdk ul { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow-y: auto; }
.cmdk li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.cmdk li.on { background: var(--surface-3); }
.cmdk li .k { font-size: 11px; color: var(--muted); margin-left: auto; text-transform: uppercase; letter-spacing: .06em; }
.cmdk .grp { font-size: 11px; color: var(--muted); padding: 8px 12px 4px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }

/* Dropdown */
.dd { position: relative; }
.dd__menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none; }
.dd.open .dd__menu { display: block; }
.dd__menu button, .dd__menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--ink); font-weight: 500; text-decoration: none; }
.dd__menu button:hover, .dd__menu a:hover { background: var(--surface-3); }
.dd__menu svg { width: 16px; height: 16px; color: var(--muted); }
.dd__menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* Items editor */
.items { width: 100%; border-collapse: collapse; }
.items th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; padding: 0 6px 6px; font-weight: 700; }
.items td { padding: 4px 6px; vertical-align: top; }
.items td.amt { padding-top: 12px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.items .rm { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 8px; margin-top: 3px; }
.items .rm:hover { background: var(--bad-bg); color: var(--bad); }
.totals { margin-left: auto; width: min(360px, 100%); display: grid; gap: 6px; margin-top: 14px; }
.totals .r { display: flex; justify-content: space-between; gap: 16px; align-items: center; font-variant-numeric: tabular-nums; }
.totals .r.big { font-size: 17px; font-weight: 800; padding-top: 8px; border-top: 1px solid var(--line); }
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); color: var(--ink-2); font-size: 13px; align-items: flex-start; }
.callout svg { width: 18px; height: 18px; flex: none; color: var(--info); margin-top: 1px; }
.callout--warn { background: var(--warn-bg); } .callout--warn svg { color: var(--warn); }
.callout--good { background: var(--good-bg); } .callout--good svg { color: var(--good); }

/* Detail layout */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.detail aside { position: sticky; top: 84px; display: grid; gap: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.paper-wrap { background: var(--surface-3); border-radius: var(--r-lg); padding: 24px; overflow-x: auto; }
.paper { background: #fff; color: #111; margin: 0 auto; box-shadow: 0 10px 40px -12px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.04); border-radius: 4px; }
.paper.portrait { width: 794px; min-height: 1060px; padding: 56px 60px; }
.paper.landscape { width: 1060px; min-height: 740px; padding: 44px 56px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--teal); }
.tabs .n { font-weight: 500; font-size: 12px; background: var(--surface-3); border-radius: 99px; padding: 0 7px; margin-left: 4px; }

.project-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s; text-decoration: none !important; color: inherit; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.project-card h4 { margin: 0; font-size: 15px; }
.project-card .meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-row div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stat-row small { display: block; font-size: 11px; color: var(--muted); }
.stat-row b { font-size: 13.5px; font-variant-numeric: tabular-nums; }

.sig-preview { height: 60px; border: 1px dashed var(--line-2); border-radius: 10px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.sig-preview img { max-height: 56px; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--r); padding: 26px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--teal); background: var(--teal-50); }

/* ---------- Dokumen cetak (dipakai di pratinjau & print) ---------- */
.doc { font-family: "Plus Jakarta Sans", Arial, sans-serif; font-size: 12.5px; color: #111; line-height: 1.45; }
.doc table { border-collapse: collapse; width: 100%; }
.doc .d-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 20px; }
.doc .d-logo { height: 58px; width: auto; }
.doc .d-co { text-align: right; font-size: 11.5px; color: #333; }
.doc .d-co b { display: block; font-size: 13.5px; color: #111; margin-bottom: 2px; }
.doc .d-title { align-self: center; justify-self: center; font-size: 17px; font-weight: 800; letter-spacing: .04em; padding: 8px 22px; }
.doc .d-title.hl { background: #fff200; }
.doc .d-title.plain { color: #143a6f; font-size: 26px; padding: 0; letter-spacing: .08em; }
.doc .d-info { margin-top: 22px; display: grid; grid-template-columns: 170px 12px 1fr; row-gap: 2px; font-size: 13px; }
.doc .d-grid { width: 100%; margin-top: 16px; font-size: 12.5px; }
.doc .d-grid th, .doc .d-grid td { border: 1px solid #222; padding: 3px 7px; }
.doc .d-grid th { font-weight: 800; text-align: center; background: #fff; }
.doc .d-grid td { text-align: center; }
.doc .d-grid td.rp { text-align: left; border-right: 0; width: 26px; }
.doc .d-grid td.amt { text-align: right; border-left: 0; }
.doc .d-grid .lbl-r { text-align: right; font-weight: 800; }
.doc .d-grid tr.grand td { font-weight: 800; font-size: 13.5px; }
.doc .d-words { background: #fff200; font-weight: 700; font-style: italic; padding: 3px 7px; border: 1px solid #222; border-top: 0; }
.doc .d-words.plain { background: #f2f6fb; border: 0; border-left: 3px solid #158d7e; font-style: italic; margin-top: 10px; padding: 8px 12px; }
.doc .d-sign { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 8px; gap: 12px; }
.doc .d-sign .box { display: flex; flex-direction: column; align-items: center; }
.doc .d-sign .img { height: 64px; display: flex; align-items: center; justify-content: center; margin: 4px 0; }
.doc .d-sign .img img { max-height: 64px; max-width: 180px; }
.doc .d-sign .nm { font-weight: 500; }
.doc .muted { color: #666; }
.doc .d-bar { height: 4px; background: linear-gradient(90deg, #143a6f, #1c69b0 45%, #158d7e); border-radius: 2px; margin: 18px 0 22px; }
.doc .d-meta { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; }
.doc .d-meta h5 { margin: 0 0 6px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #158d7e; }
.doc .d-meta .big { font-size: 15px; font-weight: 800; }
.doc .d-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; }
.doc .d-kv span:nth-child(odd) { color: #666; }
.doc .d-kv span:nth-child(even) { text-align: right; font-weight: 600; }
.doc .d-items { margin-top: 24px; }
.doc .d-items th { background: #143a6f; color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 9px 10px; text-align: left; }
.doc .d-items th:first-child { border-radius: 6px 0 0 6px; } .doc .d-items th:last-child { border-radius: 0 6px 6px 0; }
.doc .d-items td { padding: 10px; border-bottom: 1px solid #e5e9ef; vertical-align: top; }
.doc .d-items .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc .d-sum { margin-left: auto; width: 330px; margin-top: 12px; }
.doc .d-sum td { padding: 5px 10px; font-variant-numeric: tabular-nums; }
.doc .d-sum td:last-child { text-align: right; }
.doc .d-sum tr.grand td { background: #e8f6f3; font-weight: 800; font-size: 15px; color: #0e6f63; padding: 9px 10px; }
.doc .d-sum tr.due td { font-weight: 800; color: #b42318; }
.doc .d-foot { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; margin-top: 28px; align-items: end; }
.doc .d-note { font-size: 11.5px; color: #444; }
.doc .d-note h5 { margin: 0 0 4px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #158d7e; }
.doc .d-bank { background: #f4f7fb; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.doc .stamp { position: absolute; right: 70px; top: 190px; border: 3px solid #177245; color: #177245; font-weight: 900; font-size: 30px; letter-spacing: .12em; padding: 2px 16px; transform: rotate(-12deg); border-radius: 8px; opacity: .8; }
.doc .stamp.bad { border-color: #b42318; color: #b42318; }
.doc .d-payslip td { padding: 5px 0; }
.doc .d-payslip td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.doc .d-payslip tr.sub td { border-top: 1px solid #ccd5e0; font-weight: 800; }
.doc .d-payslip h5 { margin: 18px 0 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #158d7e; }
.doc .d-thp { margin-top: 18px; background: #143a6f; color: #fff; border-radius: 10px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 16px; }
.paper { position: relative; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .detail { grid-template-columns: 1fr; }
  .detail aside { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: grid; }
  .search-btn { min-width: 0; }
  .search-btn span, .search-btn kbd { display: none; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 64px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .paper-wrap { padding: 10px; }
  .search-input .input { min-width: 0; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi__value { font-size: 19px; }
  .topbar .btn span { display: none; }
}

/* ---------- Print ---------- */
#print-root { display: none; }
@media print {
  body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .paper { box-shadow: none; margin: 0; width: auto !important; min-height: 0 !important; padding: 0 !important; border-radius: 0; }
  .doc { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .page-break { page-break-after: always; }
}

/* ---------- Login ---------- */
body:not(.authed) .app { visibility: hidden; }
.login { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, rgba(21,141,126,.35), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(28,105,176,.35), transparent 60%), linear-gradient(160deg, #0a2144, #0f2e5a); overflow-y: auto; }
.login__card { width: min(460px, 100%); background: var(--surface); border-radius: 22px; padding: 32px 30px 26px; box-shadow: var(--shadow-lg); }
.login__logo { height: 54px; width: auto; margin-bottom: 18px; }
.login h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
.login__users { display: grid; gap: 8px; }
.login__user { display: flex; align-items: center; gap: 12px; text-align: left; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); transition: border-color .15s, background .15s, transform .1s; }
.login__user:hover { border-color: var(--teal); background: var(--teal-50); }
.login__user:active { transform: scale(.99); }
.login__user b { display: block; font-size: 14px; }
.login__user small { color: var(--muted); font-size: 12px; }
.login__err { color: var(--bad); font-size: 13px; font-weight: 600; min-height: 18px; margin-top: 8px; }
.sidebar__user { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 12px 6px 6px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__me { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; color: var(--sidebar-ink); text-decoration: none !important; padding: 4px; border-radius: 10px; }
.sidebar__me:hover { background: rgba(255,255,255,.06); }
.sidebar__me b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__me small { display: block; color: var(--sidebar-ink-2); font-size: 11.5px; }
.sidebar__user + .sidebar__foot { margin-top: 0; border-top: 0; padding-top: 4px; }

/* ---------- Pilihan yang bisa diedit ---------- */
.chipx { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.chipx__t { border: 0; background: none; padding: 4px 4px 4px 11px; font-size: 13px; font-weight: 500; }
.chipx__t:hover { color: var(--teal); }
.chipx__x { border: 0; background: none; width: 26px; height: 26px; display: grid; place-items: center; color: var(--muted); }
.chipx__x:hover { color: var(--bad); background: var(--bad-bg); }
.chipx__x svg { width: 13px; height: 13px; }
.fieldlist { margin: 0 -20px -20px !important; }
.fieldlist li { padding: 9px 20px; gap: 6px; }
.fieldlist .icon-btn svg { width: 14px; height: 14px; }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
[hidden] { display: none !important; }

/* Invoice: Keterangan & tanda tangan */
.doc .d-ket { margin-top: 18px; border: 1px solid #222; padding: 8px 12px; font-size: 11px; line-height: 1.5; }
.doc .d-ket ol { margin: 2px 0 0; padding-left: 16px; }
.doc .d-ket .sub { padding-left: 4px; }
.doc .d-sign2 { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #222; border-top: 0; text-align: center; padding: 10px 12px 12px; }
.doc .d-sign2 .box { display: flex; flex-direction: column; align-items: center; }
.doc .d-sign2 .sh { font-weight: 800; font-size: 11px; letter-spacing: .02em; }
.doc .d-sign2 .img { height: 74px; display: flex; align-items: center; justify-content: center; margin: 2px 0; }
.doc .d-sign2 .img img { max-height: 74px; max-width: 230px; }
.doc .d-sign2 .nm { text-decoration: underline; font-weight: 600; }

/* Status sinkron server */
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sync[data-s="saving"]::before { background: var(--warn); animation: pulse 1s infinite; }
.sync[data-s="offline"]::before, .sync[data-s="error"]::before { background: var(--bad); }
.sync[data-s="offline"], .sync[data-s="error"] { color: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
@media (max-width: 700px) { .sync { font-size: 0; gap: 0; } }

/* Ikon di pencarian cepat */
.cmdk li svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.cmdk li > div { flex: 1; }
