/* Consolidated Finance Tracker — Modernize-style admin theme, light & dark */
:root, [data-theme="light"] {
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --primary: #5d87ff;
  --primary-hover: #4570ea;
  --primary-light: #ecf2ff;
  --secondary: #49beff;
  --secondary-light: #e8f7ff;
  --success: #13deb9;
  --success-text: #0bb193;
  --success-light: #e6fffa;
  --warning: #ffae1f;
  --warning-text: #d68c00;
  --warning-light: #fef5e5;
  --error: #fa896b;
  --error-text: #e5532d;
  --error-light: #fdede8;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f9fc;
  --hover: #f2f6fa;
  --line: #e5eaef;
  --line-2: #eef2f6;
  --text: #2a3547;
  --heading: #2a3547;
  --muted: #5a6a85;
  --faint: #7c8fac;
  --input: #ffffff;
  --sidebar: #ffffff;
  --sidebar-line: #e5eaef;
  --shadow: rgba(145, 158, 171, .30) 0 0 2px 0, rgba(145, 158, 171, .12) 0 12px 24px -4px;
  --shadow-sm: rgba(145, 158, 171, .24) 0 1px 3px;
  --radius: 14px;
  --radius-sm: 8px;
  --pos: var(--success-text);
  --neg: var(--error-text);
  color-scheme: light;
}
[data-theme="dark"] {
  --primary: #5d87ff;
  --primary-hover: #7a9dff;
  --primary-light: rgba(93, 135, 255, .16);
  --secondary-light: rgba(73, 190, 255, .14);
  --success-text: #13deb9;
  --success-light: rgba(19, 222, 185, .12);
  --warning-text: #ffae1f;
  --warning-light: rgba(255, 174, 31, .13);
  --error-text: #fa896b;
  --error-light: rgba(250, 137, 107, .13);

  --bg: #202936;
  --surface: #2a3547;
  --surface-2: #253041;
  --hover: #333f55;
  --line: #333f55;
  --line-2: #2e3a4e;
  --text: #eaeff4;
  --heading: #ffffff;
  --muted: #9aa8bd;
  --faint: #7c8fac;
  --input: #202936;
  --sidebar: #2a3547;
  --sidebar-line: #333f55;
  --shadow: rgba(0, 0, 0, .25) 0 0 2px 0, rgba(0, 0, 0, .18) 0 12px 24px -4px;
  --shadow-sm: rgba(0, 0, 0, .3) 0 1px 3px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; transition: background .2s, color .2s; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .15rem; font-weight: 700; color: var(--heading); letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; font-weight: 700; color: var(--heading); }
h3 { font-size: 1.05rem; margin: 0 0 .9rem; font-weight: 600; color: var(--heading); }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); border: 1px solid var(--line); padding: .05em .4em; border-radius: 6px; }
.muted { color: var(--muted); }
.sm { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 270px; background: var(--sidebar); border-right: 1px solid var(--sidebar-line);
  display: flex; flex-direction: column; overflow-y: auto; z-index: 40; padding: 0 16px 16px; scrollbar-width: thin;
}
.shell { margin-left: 270px; min-height: 100vh; }
.main { padding: 8px 30px 48px; max-width: 1440px; }
.brand { display: flex; gap: .6rem; align-items: center; padding: 22px 8px 18px; color: var(--heading); text-decoration: none !important; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #5d87ff, #49beff); color: #fff; box-shadow: 0 6px 16px -6px rgba(93, 135, 255, .7); }
.logo svg { width: 22px; height: 22px; stroke-width: 2; }
.logo.lg { width: 52px; height: 52px; border-radius: 15px; }
.brand-text { font-size: 1.2rem; font-weight: 500; letter-spacing: -.01em; }
.brand-text b { font-weight: 700; color: var(--primary); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--heading); padding: 18px 10px 8px; }
.nav a { display: flex; gap: .8rem; align-items: center; color: var(--muted); padding: 10px 14px; border-radius: 7px; font-weight: 500; font-size: .92rem; transition: background .15s, color .15s; }
.nav a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; box-shadow: 0 6px 14px -6px rgba(93, 135, 255, .8); }
.scope-tree { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.scope-item { display: flex; align-items: center; gap: .55rem; color: var(--muted); padding: 7px 12px; border-radius: 7px; font-size: .86rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.scope-item:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.scope-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.scope-item.lvl1 { font-weight: 600; color: var(--text); margin-top: 4px; }
.scope-item.lvl1.active { color: var(--primary); }
.scope-item.lvl2 { padding-left: 30px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot.all { background: var(--primary); }
.dot.person { background: var(--secondary); }
.dot.company { background: var(--warning); }
.dot.acc { background: var(--success); }
.acc-ico { display: inline-block; width: 15px; height: 11px; border-radius: 3px; border: 1.6px solid currentColor; opacity: .75; margin-right: .45rem; vertical-align: -1px; flex: none; }
.acc-ico.credit_card { box-shadow: inset 0 3px 0 -1.4px currentColor; }
.acc-ico.saving { border-radius: 2px 2px 5px 5px; }
.backdrop { display: none; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; padding: 14px 30px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: grid; }
[data-theme="dark"] .theme-btn .i-moon { display: none; }
.theme-btn span { display: grid; }
.scope-chip { display: inline-flex; align-items: center; gap: .45rem; padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .86rem; background: var(--surface); max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-chip b { color: var(--heading); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.scope-chip:hover { text-decoration: none; border-color: var(--primary); }
.user-menu { display: flex; align-items: center; gap: .55rem; padding-left: .4rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: var(--primary); background: var(--primary-light); }
.user-name { font-weight: 600; color: var(--heading); font-size: .9rem; }
.only-mobile { display: none; }

@media (max-width: 1100px) {
  .shell { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: min(290px, 86vw); box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .main { padding: 4px 16px 40px; }
}
@media (max-width: 640px) {
  .user-name, .sc-label { display: none; }
  .scope-chip { max-width: 48vw; padding: 7px 11px; }
}

/* ---------------------------------------------------------------- building blocks */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: 6px 0 22px; }
.page-head p { margin: 0; max-width: 780px; color: var(--muted); }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; min-width: 0; border: 1px solid transparent; }
[data-theme="dark"] .card, [data-theme="dark"] .stat { border-color: var(--line); }
.card.flush { padding: 0; overflow: hidden; }
.card-toolbar { display: flex; gap: .7rem; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 24px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .grid-2, .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); } }

label { display: flex; flex-direction: column; gap: .35rem; font-size: .84rem; font-weight: 600; color: var(--heading); margin-bottom: 1rem; flex: 1; min-width: 0; }
label .muted { font-weight: 400; }
label.check, label.radio { flex-direction: row; align-items: center; gap: .55rem; font-weight: 500; color: var(--text); font-size: .9rem; }
label.check input, label.radio input { flex: none; width: 17px; height: 17px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 12px; width: 100%; min-width: 0; outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--faint); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
input[type=color] { padding: 3px; height: 40px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > label { min-width: 150px; }
.indent { margin-left: 1.75rem; width: calc(100% - 1.75rem); margin-bottom: 1rem; }
.actions { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-top: .3rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .88rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 18px; border-radius: 7px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; box-shadow: 0 6px 14px -6px rgba(93, 135, 255, .8); }
.btn.primary:disabled { opacity: .7; }
.btn.danger { color: var(--error-text); border-color: transparent; background: var(--error-light); }
.btn.danger:hover { background: var(--error); color: #fff; }
.btn.sm { padding: 5px 11px; font-size: .78rem; border-radius: 6px; }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0 .2rem; font: inherit; }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok, .pill.income { background: var(--success-light); color: var(--success-text); }
.pill.err, .pill.expense { background: var(--error-light); color: var(--error-text); }
.pill.warn { background: var(--warning-light); color: var(--warning-text); }
.pill.transfer { background: var(--secondary-light); color: var(--secondary); }
.pill.company { background: var(--warning-light); color: var(--warning-text); }
.pill.person { background: var(--primary-light); color: var(--primary); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .5rem; vertical-align: 0; }
.cat { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; }
.cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; background: var(--success-light); color: var(--success-text); font-weight: 500; }
.flash.err { background: var(--error-light); color: var(--error-text); }
.flash.warn { background: var(--warning-light); color: var(--warning-text); margin: .7rem 0; font-size: .86rem; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem !important; }
.inactive { opacity: .5; }
details.more summary { cursor: pointer; color: var(--primary); font-size: .88rem; font-weight: 600; margin-bottom: .8rem; }

/* ---------------------------------------------------------------- welcome + stats */
.welcome { position: relative; overflow: hidden; background: var(--primary-light); border-radius: var(--radius); padding: 26px 28px; margin-bottom: 24px; display: flex; align-items: center; gap: 1rem; }
.welcome .avatar { width: 48px; height: 48px; font-size: 1rem; background: var(--surface); }
.welcome h2 { margin: 0; font-size: 1.15rem; }
.welcome p { margin: .15rem 0 0; color: var(--muted); }
.welcome::after { content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(93, 135, 255, .22), transparent 70%); }
.welcome .seg { margin-left: auto; position: relative; z-index: 1; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.stat { border-radius: var(--radius); padding: 22px 20px; min-width: 0; background: var(--surface); box-shadow: var(--shadow); border: 1px solid transparent; position: relative; }
.stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; background: var(--surface); }
.stat-ico svg { width: 24px; height: 24px; }
.stat-label { font-size: .84rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 2px; overflow-wrap: anywhere; color: var(--heading); }
.stat-value.sm { font-size: 1.02rem; }
.stat-sub { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.stat.tone-primary { background: var(--primary-light); box-shadow: none; }
.stat.tone-primary .stat-ico, .stat.tone-primary .stat-value { color: var(--primary); }
.stat.tone-success { background: var(--success-light); box-shadow: none; }
.stat.tone-success .stat-ico, .stat.tone-success .stat-value { color: var(--success-text); }
.stat.tone-error { background: var(--error-light); box-shadow: none; }
.stat.tone-error .stat-ico, .stat.tone-error .stat-value { color: var(--error-text); }
.stat.tone-warning { background: var(--warning-light); box-shadow: none; }
.stat.tone-warning .stat-ico, .stat.tone-warning .stat-value { color: var(--warning-text); }
.stat.tone-info { background: var(--secondary-light); box-shadow: none; }
.stat.tone-info .stat-ico, .stat.tone-info .stat-value { color: var(--secondary); }
[data-theme="dark"] .stat[class*="tone-"] { border-color: transparent; }
[data-theme="dark"] .stat-ico { background: rgba(255, 255, 255, .06); }
@media (max-width: 1200px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (max-width: 640px) { .stats { gap: 12px; } .stat { padding: 16px; } .stat-ico { width: 36px; height: 36px; margin-bottom: 10px; } .stat-value { font-size: .95rem; white-space: nowrap; overflow-wrap: normal; } .welcome { padding: 18px; flex-wrap: wrap; } .welcome .seg { margin-left: 0; } }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg a { padding: 6px 12px; border-radius: 7px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.seg a.on { background: var(--primary); color: #fff; }
.seg a:hover { text-decoration: none; color: var(--primary); }
.seg a.on:hover { color: #fff; }

/* ---------------------------------------------------------------- tables */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; color: var(--heading); font-weight: 600; padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.num { text-align: right; }
.table th a.sort { color: inherit; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--hover); }
.table tr.dup { opacity: .45; }
.table tr.grp td { background: var(--surface-2); }
.table tr.sub td:first-child { padding-left: 2rem; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }
.cb { width: 40px; }
.trx-table .trx-main { min-width: 260px; max-width: 520px; }
.trx-table .cp { overflow-wrap: anywhere; color: var(--heading); font-weight: 600; }
.note-wrap { color: var(--muted); }
.note:not(:empty)::before { content: "· "; }
.note-input { display: inline-block; width: 230px; padding: 4px 8px; font-size: .82rem; }
.details-toggle summary { cursor: pointer; list-style: none; display: inline; color: var(--faint); }
.details-toggle summary::-webkit-details-marker { display: none; }
.details { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin-top: .35rem; line-height: 1.55; overflow-wrap: anywhere; }
.extra { margin-top: .3rem; display: flex; gap: .3rem .8rem; flex-wrap: wrap; }
.cat-cell { min-width: 200px; }
.cat-select { padding: 6px 10px 6px 26px; font-size: .82rem; border-radius: 7px; background-image: radial-gradient(circle at 12px 50%, var(--c) 0 4px, transparent 4.5px); background-repeat: no-repeat; }
.cat-meta { display: flex; justify-content: space-between; margin-top: .3rem; font-size: .72rem; }
.src { font-size: .7rem; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.src-manual { color: var(--primary); }
.src-learned { color: #8763fb; }
.src-rule { color: var(--success-text); }
.bulk-bar { background: var(--primary-light); position: sticky; top: 0; z-index: 5; }
.bulk-bar select { width: auto; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 1rem 0; }

/* mobile: table rows become cards */
@media (max-width: 760px) {
  .table.cards-sm thead { display: none; }
  .table.cards-sm, .table.cards-sm tbody, .table.cards-sm tr, .table.cards-sm td { display: block; width: 100%; }
  .table.cards-sm tr { padding: 14px 16px; border-bottom: 1px solid var(--line); position: relative; }
  .table.cards-sm td { border: 0; padding: 3px 0; max-width: none; min-width: 0; }
  .table.cards-sm td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--faint); font-weight: 600; }
  .table.cards-sm td.num { text-align: left; }
  .table.cards-sm .row-actions { justify-content: flex-start; margin-top: .5rem; }
  .table.cards-sm tr.sub td:first-child { padding-left: 0; }
  .trx-table.cards-sm tr { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; }
  .trx-table.cards-sm td { grid-column: 2 / 4; }
  .trx-table.cards-sm td.cb { grid-column: 1; grid-row: 1 / 3; }
  .trx-table.cards-sm td[data-label="Tanggal"] { grid-column: 2; font-size: .78rem; color: var(--muted); }
  .trx-table.cards-sm td[data-label="Jumlah"] { grid-column: 3; grid-row: 1; text-align: right; font-weight: 700; font-size: 1rem; }
  .trx-table.cards-sm td[data-label="Saldo"] { display: none; }
  .trx-table.cards-sm td[data-label]::before { display: none; }
  .trx-table.cards-sm .trx-main { max-width: none; }
  .note-input { width: 100%; }
  .card { padding: 18px; border-radius: 12px; }
  .card.flush { padding: 0; }
  h1 { font-size: 1.3rem; }
}

/* ---------------------------------------------------------------- misc components */
.filters { padding: 16px; }
.filter-main { display: flex; gap: .6rem; flex-wrap: wrap; }
.filter-main .grow { flex: 1 1 240px; }
.filter-main select { width: auto; }
.filter-more { display: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1rem; margin-top: 1rem; }
.filter-more.open { display: grid; }
.filter-more .actions { grid-column: 1 / -1; }
@media (max-width: 760px) { .filter-more { grid-template-columns: 1fr 1fr; } }
.search-inline input { width: 280px; max-width: 60vw; padding: 7px 12px; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; justify-content: space-between; gap: 1rem; padding: 10px 2px; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.checks li > span::before { content: "✓"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: .72rem; margin-right: .6rem; background: var(--success-light); color: var(--success-text); font-weight: 800; }
.checks li.err > span::before { content: "!"; background: var(--error-light); color: var(--error-text); }
.checks li b { font-variant-numeric: tabular-nums; text-align: right; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 1.1rem 0 0; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--heading); }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 2.4rem 1rem; align-items: center; text-align: center; cursor: pointer; transition: .15s; color: var(--text); background: var(--surface-2); }
.dropzone svg { width: 38px; height: 38px; color: var(--primary); stroke-width: 1.4; }
.dropzone input { display: none; }
.dropzone.drag, .dropzone:hover { border-color: var(--primary); background: var(--primary-light); }
.dz-title { font-size: 1rem; font-weight: 600; color: var(--heading); }
.dz-file.has { color: var(--primary); font-weight: 600; }
.upload-card { max-width: 780px; }

.rule-test { font-size: .84rem; margin: .2rem 0 1rem; }
.rule-test .rt-count { font-weight: 700; color: var(--primary); }
.rule-test ul { margin: .4rem 0 0; padding: 0; list-style: none; }
.rule-test li { display: flex; justify-content: space-between; gap: .6rem; padding: 4px 0; border-bottom: 1px dashed var(--line); }

.legend { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .45rem; margin: -.4rem 0 .8rem; }
.lgd { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lgd.in, .bar.in { background: var(--primary); }
.lgd.out, .bar.out { background: var(--secondary); }
.lgd.out { margin-left: .8rem; }
.month-chart { display: flex; gap: .4rem; align-items: stretch; height: 240px; overflow-x: auto; padding-bottom: .2rem; }
.mc-col { flex: 1 0 36px; display: flex; flex-direction: column; color: var(--faint); border-radius: 8px; padding: .25rem; }
.mc-col:hover { background: var(--hover); text-decoration: none; }
.mc-bars { flex: 1; display: flex; gap: 4px; align-items: flex-end; justify-content: center; border-bottom: 1px dashed var(--line); }
.bar { width: 9px; border-radius: 99px; min-height: 2px; }
.mc-label { text-align: center; font-size: .72rem; line-height: 1.2; padding-top: .35rem; }
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars a { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 7.5rem; gap: .8rem; align-items: center; padding: 7px 4px; color: var(--text); font-size: .86rem; border-radius: 7px; }
.hbars a:hover { background: var(--hover); text-decoration: none; }
.hb-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hb-track { height: 7px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.hb-val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .82rem; text-align: right; color: var(--heading); }
.acc-list { list-style: none; margin: 0; padding: 0; }
.acc-list a { display: flex; gap: .75rem; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--line-2); color: var(--text); }
.acc-list li:last-child a { border-bottom: 0; }
.acc-list a:hover { text-decoration: none; background: var(--hover); }
.acc-badge { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--primary-light); color: var(--primary); }
.acc-badge.credit_card { background: var(--error-light); color: var(--error-text); }
.acc-badge .acc-ico { margin: 0; opacity: 1; }
.acc-name { flex: 1; min-width: 0; font-weight: 600; font-size: .9rem; color: var(--heading); }
.acc-name small, .acc-bal small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.acc-bal { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--heading); }
.acc-bal.neg { color: var(--error-text); }
.empty-state ol { line-height: 2.1; }
.log { max-height: 340px; overflow: auto; font-size: .75rem; }
.log div { padding: .35rem 0; border-bottom: 1px dashed var(--line); display: grid; gap: .1rem; }
.log code { white-space: pre-wrap; word-break: break-all; }
.trace { font-size: .75rem; color: var(--muted); }

/* ---------------------------------------------------------------- login / setup */
body.no-nav .main { margin: 0 auto; padding-top: 0; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 0; }
.login-card { width: min(420px, 100%); padding: 36px 32px; }
.login-brand { display: flex; gap: .9rem; align-items: center; margin-bottom: 1.6rem; }
.login-brand h1 { font-size: 1.2rem; line-height: 1.3; }
.login-theme { position: fixed; top: 14px; right: 14px; }

/* rule preview */
.rule-preview .card-toolbar { justify-content: space-between; }
.rp-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.rp-tab { font: inherit; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 5px 11px; border-radius: 99px; cursor: pointer; }
.rp-tab b { color: var(--heading); margin-left: .2rem; }
.rp-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rp-tab.on b { color: #fff; }
.rp-note:not(:empty) { padding: 10px 20px 0; }
.rp-table .details { max-width: 520px; }
.rp-arrow { margin-top: .35rem; font-size: .82rem; }
.rp-table tr.rp-manual, .rp-table tr.rp-same { opacity: .7; }
.rp-arrow { display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.rp-table td[data-label="Hasil"] { min-width: 210px; }

/* searchable select */
.ss-native { display: none !important; }
.ss-btn {
  display: flex; align-items: center; gap: .5rem; width: 100%; min-width: 0; font: inherit; text-align: left; cursor: pointer;
  color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: 7px; padding: 9px 34px 9px 12px; position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.ss-btn::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border-right: 1.6px solid var(--faint); border-bottom: 1.6px solid var(--faint); transform: translateY(-70%) rotate(45deg); transition: transform .15s; }
.ss-btn.open::after { transform: translateY(-30%) rotate(-135deg); }
.ss-btn:hover { border-color: var(--primary); }
.ss-btn:focus, .ss-btn.open { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.ss-btn.sm { padding: 6px 30px 6px 10px; font-size: .82rem; }
.ss-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ss-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ss-dot.none { background: transparent; border: 1.5px dashed var(--faint); }
.ss-pop {
  position: fixed; z-index: 100; display: none; flex-direction: column; max-height: 360px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px -8px rgba(15, 23, 42, .25), var(--shadow); overflow: hidden;
}
.ss-pop.show { display: flex; }
.ss-search { padding: 8px; border-bottom: 1px solid var(--line); }
.ss-search input { padding: 7px 10px; font-size: .86rem; }
.ss-list { overflow-y: auto; padding: 4px; overscroll-behavior: contain; }
.ss-group { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 9px 10px 4px; }
.ss-opt { display: flex; align-items: center; gap: .55rem; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .86rem; color: var(--text); }
.ss-opt.hl { background: var(--primary-light); color: var(--primary); }
.ss-opt.sel { font-weight: 700; }
.ss-opt.sel::after { content: "✓"; margin-left: auto; color: var(--primary); }
.ss-opt mark { background: none; color: var(--primary); font-weight: 700; padding: 0; }
.ss-empty { padding: 14px; text-align: center; color: var(--muted); font-size: .85rem; }
.bulk-bar .ss-btn { width: 240px; }
