/* Lensa Story OS — design system: terracotta, sage, gold di atas krem */
:root {
  /* Palet aplikasi keuangan lama: hijau tua + emas + sage */
  --brand: #1F3A33;
  --brand-ink: #F3F5F1;
  --brand-dark: #142721;
  --brand-soft: #DCE6DF;
  --gold: #B8913A;
  --gold-soft: #F4ECD8;
  --bg: #F3F5F1;
  --surface: #FFFFFF;
  --surface-2: #F7F8F5;
  --ink: #1B2B26;
  --ink-2: #5F6E68;
  --line: #DDE3DE;
  --good: #2D7A57;
  --good-soft: #E1EFE7;
  --bad: #A8483A;
  --bad-soft: #F7E6E2;
  --warn: #9A6A12;
  --warn-soft: #F6EBD3;
  --income: #00846E;          /* warna grafik: lolos uji buta warna (pakai legenda) */
  --expense: #C9733D;
  --income-soft: #E1F2EE;
  --expense-soft: #F8E9DF;
  --logo-filter: none;
  --link: #1F3A33;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 43, 38, .05), 0 4px 16px rgba(27, 43, 38, .05);
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2A4A41; --brand-ink: #EEF2EF; --brand-dark: #355C51; --brand-soft: #22302B;
    --gold: #D4B064; --gold-soft: #2E2A1E;
    --bg: #121A17; --surface: #1A2420; --surface-2: #1F2B26; --ink: #E7ECE8; --ink-2: #9AA8A1; --line: #2B3833;
    --good: #5EBE8E; --good-soft: #1D3229; --bad: #E07D6C; --bad-soft: #3A2421; --warn: #D9A54A; --warn-soft: #362C1A;
    --income: #2FA88C; --expense: #C9733D; --income-soft: #1B302A; --expense-soft: #33261D;
    --logo-filter: invert(1);
    --link: #D4B064;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #2A4A41; --brand-ink: #EEF2EF; --brand-dark: #355C51; --brand-soft: #22302B;
  --gold: #D4B064; --gold-soft: #2E2A1E;
  --bg: #121A17; --surface: #1A2420; --surface-2: #1F2B26; --ink: #E7ECE8; --ink-2: #9AA8A1; --line: #2B3833;
  --good: #5EBE8E; --good-soft: #1D3229; --bad: #E07D6C; --bad-soft: #3A2421; --warn: #D9A54A; --warn-soft: #362C1A;
  --income: #2FA88C; --expense: #C9733D; --income-soft: #1B302A; --expense-soft: #33261D;
  --logo-filter: invert(1);
  --link: #D4B064;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.02rem; font-weight: 700; }
h3 { font-size: .92rem; font-weight: 600; color: var(--ink-2); margin-top: 1rem; }
a { color: var(--link); }
small, .small { font-size: .82rem; }
.muted { color: var(--ink-2); }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.big { font-size: 1.6rem; font-weight: 700; margin: .1em 0; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { padding: 3rem; text-align: center; color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand { padding: 4px 8px 18px; }
.brand .logo { height: 46px; width: auto; display: block; filter: var(--logo-filter); }
.brand small { display: block; color: var(--ink-2); font-size: .75rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.sidebar nav a:hover { background: var(--bg); color: var(--ink); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--link); font-weight: 600; }
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 12px 8px 0; }
.me small { display: block; color: var(--ink-2); }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 28px; position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
.topbar h1 { margin: 0; }
#page { padding: 4px 28px 40px; max-width: 1200px; width: 100%; outline: none; }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  #page { padding: 0 16px 96px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem;
    color: var(--ink-2); text-decoration: none; padding: 4px 0; min-width: 0;
  }
  .bottom-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav a.active { color: var(--link); font-weight: 600; }
}

/* ---------- Komponen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.toolbar > p { margin: 0; flex: 1 1 260px; }
.toolbar select, .toolbar input[type=date] { width: auto; max-width: 100%; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav strong { min-width: 9.5em; text-align: center; }

.btn {
  font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 10px; padding: 9px 16px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn-danger-ghost { background: none; color: var(--bad); border-color: transparent; }
.btn-block { width: 100%; margin-top: 12px; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: .85rem; }
.icon-btn {
  background: none; border: 1px solid var(--line); border-radius: 10px; width: 36px; height: 36px; display: inline-grid;
  place-items: center; cursor: pointer; color: var(--ink-2); text-decoration: none; font-size: 1.1rem; flex: none;
}
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: none; font-weight: 600; font-size: .88rem; }
.link:hover { text-decoration: underline; }
.file-btn { cursor: pointer; }

input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); min-height: 40px;
}
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
input[readonly] { background: var(--bg); }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
label.check, label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: auto; min-height: 0; }
.w-num { width: 5em; }
.input-big { font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 10px 0; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 520px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid .span-2 { grid-column: auto; } }

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
@media (max-width: 860px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; padding: 3px; background: var(--bg); gap: 3px; margin: 0 0 6px; }
.seg label { flex: 1; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 9px; color: var(--ink-2); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input[value=income]:checked + span { color: var(--income); }
.seg input[value=expense]:checked + span { color: var(--expense); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }
.seg-inline { display: inline-flex; margin: 0; }
.seg-inline a { padding: 6px 14px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .88rem; }
.seg-inline a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--link); border-color: var(--link); }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { font-size: .78rem; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.table th.num, .table td.num { text-align: right; }
.table tbody th { font-weight: 500; }
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg); }
.pnl tr.sec th { background: var(--bg); font-weight: 700; padding-top: 12px; }
.pnl tr.tot th, .pnl tr.tot td { font-weight: 700; border-bottom: 2px solid var(--line); }
.pnl tr.grand th, .pnl tr.grand td { font-weight: 700; background: var(--gold-soft); font-size: .95rem; }
.pnl th:first-child { position: sticky; left: 0; background: var(--surface); min-width: 170px; }
.pnl tr.sec th:first-child { background: var(--bg); }
.pnl tr.grand th:first-child { background: var(--gold-soft); }
.cell-input { text-align: right; max-width: 150px; margin-left: auto; min-height: 34px; padding: 5px 8px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.pill-good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill-warn { background: var(--gold-soft); color: var(--warn); border-color: transparent; }

.alert { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; }
.alerts { border-left: 4px solid var(--gold); }
.alerts ul { margin: 0; padding-left: 1.2em; }
.alerts li { margin: 4px 0; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi span { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.kpi strong { display: block; font-size: 1.45rem; font-variant-numeric: tabular-nums; margin: 2px 0; overflow-wrap: anywhere; }
.kpi-accent { background: var(--gold-soft); border-color: transparent; }
@media (max-width: 640px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi strong { font-size: 1.3rem; } }

/* Transaksi */
.sumbar { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; font-size: .9rem; }
.sumbar strong { font-variant-numeric: tabular-nums; }
.day h3 { display: flex; justify-content: space-between; margin: 14px 4px 6px; }
.tx-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 12px; }
.day .tx-list { border: 1px solid var(--line); }
.tx { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tx:last-child { border-bottom: 0; }
.tx:hover { background: var(--bg); }
.tx-dot { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: var(--bg); color: var(--ink-2); }
.tx-dot.income { background: var(--income-soft); color: var(--income); }
.tx-dot.expense { background: var(--expense-soft); color: var(--expense); }
.tx-main { flex: 1; min-width: 0; }
.tx-main strong, .tx-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tx-main small { font-weight: 400; }
.tx-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amt.income { color: var(--income); }

/* Daftar */
.wallets, .goals, .debts, .hbars { list-style: none; margin: 0; padding: 0; }
.wallets li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.wallets li small { display: block; }
.wallets li.total { border: 0; font-size: 1.05rem; }
.goals li, .debts li { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.debts li.closed { opacity: .55; }
.goal-head { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.progress { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 6px 0; border: 1px solid var(--line); }
.progress i { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 4.5em; gap: 10px; align-items: center; padding: 4px 0; font-size: .88rem; }
.hbars li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--expense); border-radius: 0 4px 4px 0; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.chip { font: inherit; font-size: .86rem; border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 5px 12px; cursor: pointer; }
.chip.off { opacity: .5; text-decoration: line-through; }

/* Grafik */
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--ink-2); margin-bottom: 6px; }
.legend i, .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar-in { fill: var(--income); } .chart .bar-out { fill: var(--expense); }
.chart .avg { stroke: var(--gold); stroke-dasharray: 4 3; stroke-width: 1.2; }
.chart .axis { fill: var(--ink-2); font-size: 11px; font-family: var(--font); }
.chart .hit { fill: transparent; }
.chart .bar-group { cursor: pointer; transition: opacity .15s; }
.chart .bar-group.dim { opacity: .35; }
.tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: .8rem; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); }
.table-view { margin-top: 8px; font-size: .85rem; }
.table-view summary { cursor: pointer; color: var(--ink-2); }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(43, 36, 32, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 4px 18px 8px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.receipt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
@media (max-width: 640px) {
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
}
@keyframes fade { from { opacity: 0; } }

#toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: 90px; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast-err { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

.result { margin-top: 12px; padding: 12px 14px; border-radius: 12px; }
.result p { margin: 4px 0; }
.result.good { background: var(--good-soft); }
.result.bad { background: var(--bad-soft); }

/* Menu & login */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.menu-tile { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 600; }
.menu-tile svg { color: var(--link); }
.me-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.outlet-pick select { min-height: 36px; padding: 6px 10px; font-weight: 600; }
body.is-login #app { display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, var(--brand-soft), transparent 50%), radial-gradient(circle at 90% 90%, var(--good-soft), transparent 50%), var(--bg); }
.login-card { background: var(--surface); width: min(400px, 100%); padding: 32px 28px; border-radius: 22px; box-shadow: 0 10px 40px rgba(43, 36, 32, .1); display: flex; flex-direction: column; gap: 12px; }
.login-card .logo { height: 72px; width: auto; align-self: flex-start; filter: var(--logo-filter); }
.login-card h1 { margin: 4px 0 0; }
.login-card p { margin: 0; }
.login-links { display: flex; justify-content: space-between; }
.steps { padding-left: 1.2em; }

/* ---------- Gabungan fitur aplikasi lama ---------- */
.hero { background: var(--brand); color: var(--brand-ink); border-radius: 18px; padding: 20px 22px; position: relative; overflow: hidden; margin-bottom: 16px; }
.hero .lbl { opacity: .8; font-size: .85rem; }
.hero .big { font-family: var(--font-display); font-size: clamp(1.9rem, 6vw, 2.6rem); font-weight: 700; line-height: 1.1; margin: 4px 0 14px; color: var(--brand-ink); }
.hero .row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; border-top: 1px solid rgba(255,255,255,.16); padding-top: 12px; }
.hero .row small { display: block; opacity: .75; font-size: .75rem; }
.hero .row b { font-size: .98rem; font-variant-numeric: tabular-nums; }
.hero .mark-bg { position: absolute; right: 18px; top: 16px; height: 110px; filter: invert(1); opacity: .12; pointer-events: none; }
@media (max-width: 640px) { .hero .row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.days { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.day-dot { border: 0; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: .75rem; font-weight: 700; text-decoration: none; display: grid; place-items: center; }
.day-dot.ok { background: var(--good); } .day-dot.bad { background: var(--bad); } .day-dot.over { background: var(--warn); }
.day-dot.none { background: var(--bad-soft); color: var(--bad); border: 1px dashed var(--bad); } .day-dot.today { background: var(--line); color: var(--ink-2); }
.bills { list-style: none; margin: 0; padding: 0; }
.bills li { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.bills li:last-child { border: 0; }
.bills small { display: block; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.quick button, .quick label { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; text-align: left; cursor: pointer; color: var(--ink); font: inherit; display: block; }
.quick b { display: block; font-size: .92rem; } .quick small { color: var(--ink-2); font-size: .78rem; font-weight: 400; }
.quick > :first-child { background: var(--gold); border-color: var(--gold); color: #1B1408; }
.quick > :first-child small { color: #3d2f10; }
.pl .ln { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: .92rem; }
.pl .ln.sub { color: var(--ink-2); padding-left: 14px; font-size: .88rem; }
.pl .ln.tot { font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.pl .ln.grand { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; background: var(--gold-soft); margin: 8px -12px 0; padding: 12px; border-radius: 10px; }
.pl .num { white-space: nowrap; }
.delta { font-size: .75rem; margin-left: 6px; }
.btn-gold { background: var(--gold); color: #1B1408; }
.btn-wa { background: #1F8F55; color: #fff; } .btn-tg { background: #2A8BC9; color: #fff; }
.report-text { width: 100%; min-height: 280px; font: .9rem/1.5 var(--font); }
.pill-dp { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.slip-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 130px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.slip-row small { display: block; color: var(--ink-2); }
.slip-row input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
.theme-seg { max-width: 360px; }
.spark { display: block; }

@media print {
  .sidebar, .bottom-nav, .topbar .row-gap, .no-print, .toolbar .btn { display: none !important; }
  body, #page { background: #fff; padding: 0; }
  .card { box-shadow: none; border: 0; }
  .pnl { font-size: 9pt; }
}
.kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis-2 > div:not(.kpi) { min-width: 0; }
.card .kpis-2 { margin: 0 0 10px; }
.card .kpis-2 strong { font-variant-numeric: tabular-nums; }
.tx a.tx-main { color: inherit; text-decoration: none; }
@media (max-width: 640px) { .bills li { grid-template-columns: minmax(0, 1fr) 64px auto; } .bills .spark { width: 64px; } }

/* ---------- Tahap 2: SDM ---------- */
.nav-group { margin: 14px 12px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); opacity: .8; }
.sidebar .nav-group { color: inherit; opacity: .55; }
.menu-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 4px 0 8px; }
.kpis-3 .kpi small { display: block; font-size: .75rem; }
@media (max-width: 640px) {
  .kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpis-3 .kpi { padding: 10px; }
  .kpis-3 .kpi span { font-size: .72rem; }
  .kpis-3 .kpi strong { font-size: 1.05rem; }
}
.clock-card { display: grid; gap: 12px; }
.clock-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.clock-time { display: block; font-family: var(--font-display); font-size: 2.6rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.clock-shift { display: grid; justify-items: end; gap: 4px; text-align: right; }
.btn-clock { padding: 16px; font-size: 1.05rem; }
.done-line { font-size: 1.02rem; }
.selfie-pick { display: grid; place-items: center; gap: 8px; min-height: 200px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; text-align: center; padding: 12px; font-weight: 600; color: var(--ink-2); }
.selfie-pick:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.selfie-pick img { max-width: 220px; max-height: 260px; border-radius: 12px; object-fit: cover; }
.geo-line { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: .92rem; }
.geo-line.ok { background: var(--good-soft); color: var(--good); }
.geo-line.warn { background: var(--warn-soft); color: var(--warn); }
.selfie-thumb { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); border: 1px solid var(--line); cursor: zoom-in; }
.selfie-thumb.empty { cursor: default; display: inline-block; }
.selfie-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.selfie-pair figure { margin: 0; display: grid; gap: 6px; }
.selfie-pair img { width: 100%; border-radius: 12px; object-fit: cover; aspect-ratio: 3 / 4; background: var(--surface-2); }
.selfie-pair figcaption { font-size: .85rem; color: var(--ink-2); }
.roster th, .roster td { text-align: center; white-space: nowrap; }
.roster th[scope=row], .roster thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.roster .today { background: var(--gold-soft); }
.roster .me-row th { color: var(--link); }
.roster .shift-sel { min-width: 76px; padding: 6px 4px; text-align: center; }
.shift-sel.on, .shift-chip.on { background: var(--brand-soft); color: var(--ink); font-weight: 600; }
.shift-sel.off, .shift-chip.off { background: var(--surface-2); color: var(--ink-2); }
.shift-chip { display: inline-block; min-width: 56px; padding: 4px 8px; border-radius: 8px; font-size: .85rem; }
.slip td:last-child { white-space: nowrap; }
.tx .row-gap { flex-wrap: wrap; justify-content: flex-end; }
.warn-text { color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; white-space: nowrap; }
.pd-jump { margin-bottom: 12px; }
.pd-jump .chip small { color: var(--ink-2); margin-left: 4px; }
.pd-group { scroll-margin-top: 80px; }
#pd-q { min-width: 200px; }
.wa-warn { margin-bottom: 12px; }
.wa-warn ul { margin: 0; }
.wa-preview { white-space: pre-wrap; font-family: var(--font); background: var(--surface-2); border-radius: 12px; padding: 12px; font-size: .92rem; margin: 0; }
.bk-items { margin: 6px 0; }
.qty-in { width: 64px; text-align: center; }
textarea { width: 100%; font: inherit; }

/* ---------- Kalender booking ---------- */
.card-warn { border-left: 4px solid var(--gold); background: var(--gold-soft); }
.card-warn .tx-list { background: var(--surface); }
.link-big { font-weight: 700; font-size: 1.05rem; word-break: break-all; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: middle; }
.check-row { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check-row legend { padding: 0; margin-bottom: 4px; color: var(--ink-2); font-weight: 600; }
.cal-toolbar { align-items: center; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-date { position: relative; flex-direction: row; align-items: center; color: var(--ink); font-size: 1rem; font-weight: 700; min-width: 10.5em; justify-content: center; cursor: pointer; padding: 6px 8px; border-radius: 10px; }
.cal-date:hover { background: var(--surface); }
.cal-date input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; padding: 0; }
.cal-date input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.cal-pending, .cal-untimed { padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.cal-pending .chip { background: var(--surface); }
.cal-wrap {
  --time-w: 56px; overflow: auto; max-height: calc(100vh - 210px); min-height: 360px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overscroll-behavior: contain;
}
.cal { display: grid; grid-template-columns: var(--time-w) repeat(var(--cols), minmax(150px, 1fr)); min-width: max-content; }
.cal-head, .cal-body { display: contents; }
.cal-corner, .cal-colhead { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 10px 8px; min-height: 56px; }
.cal-corner { left: 0; z-index: 4; display: flex; align-items: flex-end; }
.cal-colhead { border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-colhead strong, .cal-colhead a { font-weight: 700; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-colhead .dot { margin-bottom: 2px; }
.cal-colhead.is-today a { color: var(--link); }
.cal-colhead small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); }
.cal-times span { position: absolute; right: 8px; transform: translateY(-50%); font-size: .72rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-times span:first-child { transform: none; top: 2px !important; }
.cal-col {
  position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px);
}
.cal-col:hover { background-color: color-mix(in srgb, var(--bg) 60%, transparent); }
.cal-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line) 55%, transparent) 6px 7px); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.cal-ev {
  position: absolute; z-index: 1; font: inherit; text-align: left; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; gap: 0; padding: 4px 8px; border-radius: 8px; color: #1B2B26;
  background: color-mix(in srgb, var(--c) 78%, white); border: 1px solid color-mix(in srgb, var(--c) 70%, black 10%); border-left: 4px solid color-mix(in srgb, var(--c) 75%, black 25%);
  font-size: .78rem; line-height: 1.25; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.cal-ev:hover { filter: brightness(.97); z-index: 2; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.cal-ev:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 2; }
.cal-ev strong { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev strong small { font-weight: 500; }
.cal-ev-time, .cal-ev-svc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.cal-ev.is-short { flex-direction: row; gap: 6px; align-items: center; padding-top: 1px; padding-bottom: 1px; }
.cal-ev.is-short .cal-ev-svc { display: none; }
.cal-ev.is-mid .cal-ev-svc { display: none; }
.cal-ev.is-short .cal-ev-time { flex: none; }
.cal-ev.is-pending { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 40%, white) 0 8px, color-mix(in srgb, var(--c) 22%, white) 8px 16px); border-style: dashed; }
.cal-legend { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.cal-key { display: inline-block; width: 22px; height: 12px; border-radius: 4px; border: 1px dashed var(--ink-2); background: repeating-linear-gradient(135deg, var(--gold-soft) 0 4px, var(--surface) 4px 8px); }
.bk-pending { margin-bottom: 10px; }
.bk-pending p { margin: 4px 0 8px; }
@media (max-width: 860px) {
  .cal-wrap { --time-w: 44px; max-height: calc(100vh - 250px); margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .cal { grid-template-columns: var(--time-w) repeat(var(--cols), minmax(132px, 1fr)); }
  .cal-toolbar > .row-gap { width: 100%; justify-content: space-between; }
}

/* ---------- Inventaris ---------- */
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-4 .kpi small, .inv-mini .kpi small { display: block; font-size: .75rem; color: var(--ink-2); }
@media (max-width: 860px) { .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .kpis-4 .kpi strong { font-size: 1.15rem; } }
.inv-mini { margin: 0; }
.inv-mini .kpi { text-decoration: none; color: inherit; box-shadow: none; background: var(--bg); }
.inv-mini .kpi:hover { border-color: var(--ink-2); }
.inv-tabs { margin: 0; border-bottom: 0; }
.inv-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.inv-cat { font: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 1px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.inv-cat span { font-weight: 600; font-size: .86rem; color: var(--ink-2); }
.inv-cat strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.inv-cat:hover { border-color: var(--ink-2); }
.inv-cat.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
@media (max-width: 860px) { .inv-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.inv-filters { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
@media (max-width: 860px) { .inv-filters { grid-template-columns: minmax(0, 1fr); } }
.inv-table td { vertical-align: middle; }
.inv-why { white-space: normal !important; }
.inv-actions { margin-top: 12px; background: var(--surface-2); box-shadow: none; }
.inv-actions h3 { margin: 0; }
.inv-loglist { margin-top: 10px; }
.inv-tx { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 4px; margin: 10px 0 4px; background: var(--surface-2); }
.inv-tx legend { font-weight: 700; padding: 0 6px; }
.seg-3 label span { padding: 7px 4px; font-size: .86rem; }
.result.warn { background: var(--gold-soft); }
.zw-reg { box-shadow: none; background: var(--surface-2); margin: 12px 0; }
.zw-reg h3 { margin: 0; color: var(--ink); }
