/* Buku Kas UMKM — warna mengikuti Template Keuangan UMKM (navy + emerald) */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f172a;
  --brand-ink: #ffffff;
  --accent: #10b981;
  --accent-ink: #047857;
  --accent-soft: #d1fae5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 4px 16px rgb(15 23 42 / 6%);
  --radius: 14px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #131c2e;
    --surface-2: #182238;
    --ink: #e8edf5;
    --ink-2: #c3cddc;
    --muted: #8b98ad;
    --line: #243049;
    --brand: #0b1120;
    --accent: #34d399;
    --accent-ink: #6ee7b7;
    --accent-soft: rgb(16 185 129 / 16%);
    --warn: #fbbf24;
    --warn-soft: rgb(245 158 11 / 16%);
    --bad: #f87171;
    --bad-soft: rgb(239 68 68 / 16%);
    --info: #7dd3fc;
    --info-soft: rgb(14 165 233 / 16%);
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- layout */
.shell { display: flex; min-height: 100dvh; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.sidenav { display: none; }
#view { max-width: 980px; margin: 0 auto; padding: 16px; outline: none; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand); color: var(--brand-ink);
}
.topbar .page-title { display: none; margin: 0; font-size: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { display: block; font-size: 12px; opacity: .65; }
.brand img { border-radius: 8px; flex: none; }
.brand-mobile { flex: 1; }
.top-actions { display: flex; gap: 4px; margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgb(255 255 255 / 10%); }
.sheet .icon-btn:hover { background: var(--surface-2); }

.bottomnav {
  position: fixed; inset: auto 0 0 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.bottomnav button, .navlist button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.bottomnav button[aria-current="page"] { color: var(--accent-ink); }
.bottomnav button[aria-current="page"] svg { stroke-width: 2.4; }

@media (min-width: 900px) {
  .bottomnav, .brand-mobile, .top-actions { display: none; }
  .main { padding-bottom: 32px; }
  .topbar { background: transparent; color: var(--ink); padding: 22px 28px 4px; position: static; }
  .topbar .page-title { display: block; font-size: 24px; }
  #view { padding: 16px 28px 28px; margin: 0; }
  .sidenav {
    display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100dvh;
    width: 232px; flex: none; padding: 22px 14px; background: var(--brand); color: var(--brand-ink);
  }
  .sidenav .brand { padding: 0 8px; }
  .navlist { display: flex; flex-direction: column; gap: 2px; }
  .navlist button {
    flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: rgb(255 255 255 / 72%); font-size: 14.5px; font-weight: 500;
  }
  .navlist button:hover { background: rgb(255 255 255 / 8%); color: #fff; }
  .navlist button[aria-current="page"] { background: rgb(16 185 129 / 18%); color: #fff; }
  .navlist button[aria-current="page"] svg { color: #34d399; }
  .fab { right: 32px; bottom: 32px; }
}

/* ---------------------------------------------------------------- pieces */
.banner {
  margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--ink); font-size: 14px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
@media (min-width: 900px) { .banner { margin: 12px 28px 0; max-width: 924px; } }
.banner .btn { margin-left: auto; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card + .card, .section + .section { margin-top: 14px; }
.card h3, .section-title { margin: 0 0 10px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.section-title a, .linkbtn { color: var(--accent-ink); text-transform: none; letter-spacing: 0; font-size: 14px; background: none; border: 0; cursor: pointer; font-weight: 600; padding: 0; }

.hero {
  background: linear-gradient(135deg, #0f172a, #1e293b 60%, #064e3b);
  color: #fff; border: 0; padding: 20px;
}
.hero .label { font-size: 13px; opacity: .75; }
.hero .big { font-size: clamp(28px, 8vw, 38px); font-weight: 800; letter-spacing: -.02em; margin: 2px 0 14px; }
.hero .split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero .split div { background: rgb(255 255 255 / 8%); border-radius: 12px; padding: 10px 12px; }
.hero .split small { display: block; font-size: 12px; opacity: .75; }
.hero .split b { font-size: 16px; }
.hero .split .up { color: #6ee7b7; }
.hero .split .down { color: #fca5a5; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { padding: 14px; }
.stat small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat b { display: block; font-size: 18px; margin-top: 4px; overflow-wrap: anywhere; }
.stat em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }

.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.insights li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.insights .ok { background: var(--accent-soft); }
.insights .warn { background: var(--warn-soft); }
.insights .bad { background: var(--bad-soft); }
.insights .info { background: var(--info-soft); }
.insights svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* list rows */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row .dot { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.row .dot svg { width: 18px; height: 18px; }
.dot.in { background: var(--accent-soft); color: var(--accent-ink); }
.dot.out { background: var(--bad-soft); color: var(--bad); }
.dot.neutral { background: var(--info-soft); color: var(--info); }
.row .mid { flex: 1; min-width: 0; }
.row .mid b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .mid small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex: none; }
.row .end b { display: block; font-weight: 700; }
.row .end small { display: block; color: var(--muted); font-size: 12px; }
.amt-in { color: var(--accent-ink); }
.amt-out { color: var(--bad); }
.day-head { padding: 8px 14px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 700; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.pill.ok { background: var(--accent-soft); color: var(--accent-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: var(--surface-2); color: var(--muted); }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* toolbar / filters */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1 1 180px; min-width: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.monthnav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2px; }
.monthnav button { border: 0; background: none; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; }
.monthnav button:hover { background: var(--surface-2); }
.monthnav span { min-width: 118px; text-align: center; font-weight: 700; font-size: 14px; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.summary .card { padding: 10px 12px; box-shadow: none; }
.summary small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.summary b { font-size: 15px; overflow-wrap: anywhere; }

/* forms & buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 650; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #052e1f; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.field > em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 16px;
}
.field input:focus, .field select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .money { position: relative; }
.field .money::before { content: "Rp"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.field .money input { padding-left: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 9px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg input:checked + span.in { background: var(--accent-soft); color: var(--accent-ink); }
.seg input:checked + span.out { background: var(--bad-soft); color: var(--bad); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 14px; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.calc { padding: 12px; border-radius: 12px; background: var(--info-soft); font-size: 14px; margin-bottom: 14px; display: grid; gap: 4px; }
.calc div { display: flex; justify-content: space-between; gap: 10px; }

/* sheet dialog */
.sheet { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100%; margin: auto 0 0; color: var(--ink); }
.sheet::backdrop { background: rgb(15 23 42 / 55%); }
.sheet-inner { background: var(--surface); border-radius: 20px 20px 0 0; max-height: 92dvh; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 18px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-body { padding: 8px 18px 4px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot .btn.primary { flex: 1; }
@media (min-width: 640px) {
  .sheet { width: 520px; margin: auto; }
  .sheet-inner { border-radius: 20px; }
}

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 7;
  width: 58px; height: 58px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--accent); color: #052e1f; box-shadow: 0 8px 24px rgb(16 185 129 / 35%);
  display: grid; place-items: center;
}
.fab svg { width: 26px; height: 26px; stroke-width: 2.6; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s ease;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* report */
.pl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pl td { padding: 9px 2px; border-bottom: 1px solid var(--line); }
.pl td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl tr.sub td { font-weight: 700; background: var(--surface-2); }
.pl tr.total td { font-weight: 800; font-size: 16px; border-bottom: 0; }
.pl tr.indent td:first-child { padding-left: 14px; color: var(--ink-2); }
/* Grafik tidak memakai gaya garis ikon (stroke) supaya teks dan batang tidak bergaris tepi. */
.chart { width: 100%; height: auto; display: block; stroke: none; stroke-width: 1; }
.chart text { fill: var(--muted); stroke: none; font-size: 10px; font-weight: 500; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.settings-list { display: grid; gap: 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.stock-ctrl { display: flex; align-items: center; gap: 6px; }
.stock-ctrl button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 18px; font-weight: 700; line-height: 1; color: var(--ink); }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.warn { background: #f59e0b; }
.bar i.bad { background: #ef4444; }
.btn.primary.danger-primary { background: #ef4444; border-color: #ef4444; color: #fff; }

/* pembaruan & pasang aplikasi */
.banner.banner-update { background: var(--info-soft); }
.install-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.install-card img { border-radius: 12px; flex: none; }
.install-card .grow { flex: 1 1 180px; min-width: 0; }
.install-card b { display: block; }
.install-card span { display: block; font-size: 13.5px; color: var(--muted); }
.howto { margin: 4px 0 12px; padding-left: 20px; display: grid; gap: 8px; }

/* layar aktivasi lisensi */
.lic-overlay {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto;
  display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(60% 45% at 15% 5%, rgb(16 185 129 / 28%), transparent 60%), #0b1220;
}
.lic-card {
  width: min(420px, 100%); background: var(--surface); color: var(--ink);
  border-radius: 20px; padding: 26px 22px; box-shadow: 0 30px 60px -20px rgb(0 0 0 / 60%);
}
.lic-card img { border-radius: 14px; display: block; margin-bottom: 14px; }
.lic-card h1 { font-size: 22px; margin: 0 0 8px; letter-spacing: -.01em; }
.lic-lead { margin: 0 0 18px; color: var(--ink-2); font-size: 14.5px; }
.lic-note { margin: 0 0 18px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.lic-note.warn { background: var(--warn-soft); }
.lic-msg { margin: -4px 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; background: var(--bad-soft); }
.lic-msg ul { margin: 6px 0; padding-left: 18px; }
.lic-msg li span { color: var(--muted); font-size: 12.5px; }
.lic-foot { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.lic-foot a { color: var(--accent-ink); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: progress; }
