:root {
  --bg: #eef3f0;
  --card: #ffffff;
  --ink: #10231d;
  --muted: #6b7f77;
  --line: #e2ebe6;
  --soft: #f4f8f6;
  --pri: #0f3d33;
  --pri-2: #17614c;
  --acc: #1f9d6b;
  --gold: #f2b84b;
  --in: #16a34a;
  --in-bg: #e7f7ec;
  --out: #e5484d;
  --out-bg: #fdecec;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 35, 29, .04), 0 6px 24px rgba(16, 35, 29, .06);
  --side-w: 240px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; flex: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: linear-gradient(180deg, #0f3d33 0%, #0b2f27 100%);
  color: #d6e9e1; display: flex; flex-direction: column;
  padding: 22px 16px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 26px; color: #fff; font-weight: 800; font-size: 21px; letter-spacing: -.3px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { white-space: nowrap;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 12px; font-weight: 600; color: #b9d3c9; transition: background .15s, color .15s;
}
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: linear-gradient(90deg, #1f7a5c, #1a6a50); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side-quote {
  margin-top: auto; padding: 16px; border-radius: 14px;
  background: rgba(255,255,255,.06); font-size: 13px; line-height: 1.5; color: #e6f2ed;
}
.side-quote p { margin: 6px 0 0; font-weight: 600; }
.side-moon { color: var(--gold); width: 22px; height: 22px; }

.main { margin-left: var(--side-w); padding: 24px 28px 40px; max-width: 1400px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.greet h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.greet p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Month picker ---------- */
.month-picker { position: relative; display: flex; align-items: center; gap: 4px; background: var(--card); border-radius: 14px; padding: 4px; box-shadow: var(--shadow); }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--ink); }
.icon-btn:hover { background: var(--soft); }
.month-label { border: 0; background: transparent; display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 6px 10px; border-radius: 10px; min-width: 150px; justify-content: center; }
.month-label:hover { background: var(--soft); }
.month-label svg { color: var(--acc); width: 18px; height: 18px; }
.month-pop {
  position: absolute; top: calc(100% + 8px); right: 0; width: 280px; background: var(--card);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.15); padding: 12px; z-index: 30;
}
.mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mp-grid button { border: 0; background: var(--soft); padding: 10px 0; border-radius: 10px; font-weight: 600; font-size: 13px; }
.mp-grid button:hover { background: #e3efe9; }
.mp-grid button.active { background: var(--pri-2); color: #fff; }
.mp-now { width: 100%; margin-top: 8px; border: 1px dashed var(--line); background: transparent; padding: 8px; border-radius: 10px; color: var(--acc); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn { border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, #1f8a62, #136047); color: #fff; box-shadow: 0 6px 16px rgba(23, 97, 76, .3); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--soft); color: var(--ink); }
.btn-danger { background: var(--out); color: #fff; }
.btn-danger-ghost { background: var(--out-bg); color: var(--out); }
.btn-block { flex: 1; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.card-head a, .link { color: var(--acc); font-weight: 700; font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.stat-ic svg { width: 24px; height: 24px; }
.stat.in .stat-ic { background: var(--in-bg); color: var(--in); }
.stat.out .stat-ic { background: var(--out-bg); color: var(--out); }
.stat.bal { background: linear-gradient(135deg, #17614c, #0f3d33); color: #fff; position: relative; overflow: hidden; }
.stat.bal::after { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(242,184,75,.18); }
.stat.bal .stat-ic { background: rgba(255,255,255,.14); color: var(--gold); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat.bal .stat-label, .stat.bal .stat-sub { color: #cfe5dc; }
.stat-val { font-size: clamp(17px, 1.9vw, 24px); font-weight: 800; letter-spacing: -.5px; margin: 4px 0; white-space: nowrap; }
.stat > div { min-width: 0; }
.stat-sub { font-size: 12px; color: var(--muted); }
.delta { font-weight: 700; }
.delta.up { color: var(--in); }
.delta.down { color: var(--out); }
.stat.out .delta.up { color: var(--out); }
.stat.out .delta.down { color: var(--in); }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid-main { grid-template-columns: 1.5fr 1fr; }
.grid-half { grid-template-columns: 1fr 1fr; }

.chart-box { position: relative; height: 260px; }
.legend-dots { display: flex; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend-dots i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Donut */
.donut-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }
.donut { position: relative; width: 200px; height: 200px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.donut-center b { font-size: 15px; font-weight: 800; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.legend .pc { font-weight: 800; color: var(--muted); }

/* Transaction rows */
.tx-list { display: flex; flex-direction: column; }
.tx {
  display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-radius: 12px; cursor: pointer;
  border: 0; background: transparent; width: 100%; text-align: left;
}
.tx:hover { background: var(--soft); }
.cat-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; flex: none; }
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tx-amt { font-weight: 800; font-size: 14px; white-space: nowrap; }
.tx-amt.in { color: var(--in); }
.tx-amt.out { color: var(--out); }
.day-head { display: flex; justify-content: space-between; padding: 14px 8px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; border-top: 1px solid var(--line); }
.day-head:first-child { border-top: 0; padding-top: 2px; }

.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty .big { font-size: 42px; display: block; margin-bottom: 6px; }

/* Banner */
.banner {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 22px; min-height: 180px;
  background: linear-gradient(160deg, #fbe7c0 0%, #f6d79a 45%, #8fcfb4 100%);
  color: #0f3d33; display: flex; flex-direction: column; justify-content: flex-start;
}
.banner p { position: relative; z-index: 1; margin: 0; font-weight: 800; font-size: 17px; max-width: 70%; line-height: 1.4; }
.banner small { position: relative; z-index: 1; display: block; margin-top: 6px; font-weight: 600; opacity: .8; }
.banner svg.skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 55%; }

/* Top categories progress */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.bar-top b { font-weight: 700; }
.bar-top span { color: var(--muted); font-weight: 600; white-space: nowrap; }
.track { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 99px; }

/* Segmented / toolbar */
.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 0 12px; box-shadow: var(--shadow); }
.search svg { color: var(--muted); width: 18px; }
.search input { border: 0; outline: 0; background: transparent; padding: 11px 0; width: 100%; }

.sum-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.sum-strip .card { padding: 14px 16px; }
.sum-strip small { color: var(--muted); font-weight: 600; font-size: 12px; }
.sum-strip b { display: block; font-size: 17px; font-weight: 800; margin-top: 2px; word-break: break-word; }

/* Categories page */
.cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--soft); }
.cat-item .nm { flex: 1; min-width: 0; }
.cat-item .nm b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item .nm small { color: var(--muted); font-size: 12px; }
.cat-item .icon-btn { width: 32px; height: 32px; color: var(--muted); }
.cat-item .icon-btn svg { width: 17px; height: 17px; }
.cat-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-grid button { width: 40px; height: 40px; border: 2px solid transparent; border-radius: 10px; background: var(--soft); font-size: 20px; }
.emoji-grid button.active { border-color: var(--acc); background: #e3f3eb; }
.color-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.color-grid button { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.color-grid button.active { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- Form / modal ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; background: #fff; outline: 0; width: 100%;
}
.field input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(31,157,107,.15); }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row .field { flex: 1; }
.date-quick { display: flex; gap: 6px; margin-bottom: 16px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 9px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip:hover { border-color: var(--acc); color: var(--acc); }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9, 30, 24, .5); backdrop-filter: blur(3px); animation: fade .2s; }
.sheet {
  position: relative; background: var(--card); border-radius: 22px; width: 100%; max-width: 520px;
  max-height: calc(100vh - 40px); overflow: auto; padding: 22px; animation: pop .22s ease-out;
}
.sheet-sm { max-width: 380px; }
.sheet h2 { margin: 0; font-size: 19px; font-weight: 800; }
.sheet-sm p { margin: 8px 0 18px; }
.sheet-grip { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 10px; position: sticky; bottom: -22px; background: var(--card); padding: 12px 0 0; margin-top: 4px; }
.sheet-actions .btn { padding: 14px 18px; }
.sheet-sm .sheet-actions .btn { flex: 1; }

.type-seg { display: flex; width: 100%; margin-bottom: 18px; }
.type-seg button { flex: 1; padding: 11px; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.type-seg button svg { width: 17px; height: 17px; }
.type-seg button[data-type="expense"].active { background: var(--out); color: #fff; }
.type-seg button[data-type="income"].active { background: var(--in); color: #fff; }

.amount-box { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 16px; padding: 6px 16px; background: var(--soft); }
.amount-box:focus-within { border-color: var(--acc); background: #fff; }
.amount-box b { font-size: 20px; color: var(--muted); }
.amount-box input { border: 0 !important; box-shadow: none !important; background: transparent !important; font-size: 30px; font-weight: 800; padding: 6px 0 !important; letter-spacing: -.5px; }
.amount-hint { color: var(--acc); font-weight: 700; font-size: 12px; min-height: 16px; }
.quick-keys { display: grid; grid-template-columns: 1.4fr 1.2fr 1fr 1fr 1.1fr .8fr; gap: 6px; }
.qk { border: 0; background: var(--soft); border-radius: 12px; padding: 12px 4px; font-weight: 800; font-size: 13px; user-select: none; }
.qk:active { transform: scale(.95); background: #e3efe9; }
.qk-big { background: linear-gradient(135deg, #f6c25b, #eaa531); color: #3d2a00; font-size: 17px; letter-spacing: 1px; }
.qk-clear { color: var(--out); font-size: 17px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 236px; overflow: auto; padding: 2px; }
.cat-opt { border: 2px solid transparent; background: var(--soft); border-radius: 14px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; line-height: 1.2; text-align: center; }
.cat-opt .cat-ic { width: 38px; height: 38px; font-size: 20px; border-radius: 12px; }
.cat-opt.active { border-color: var(--acc); background: #e3f3eb; }
.form-error { background: var(--out-bg); color: var(--out); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; margin: 0 0 12px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #0f3d33; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 60;
  transition: .25s; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--out); }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes up { from { transform: translateY(100%); } }

.bottom-nav { display: none; }

/* ---------- Responsif ---------- */
@media (max-width: 1200px) {
  .grid-main { grid-template-columns: 1fr 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
}

/* iPad portrait / tablet: sidebar ringkas (ikon saja) */
@media (max-width: 1023px) {
  :root { --side-w: 84px; }
  .sidebar { padding: 18px 12px; align-items: center; }
  .brand span, .side-nav a span, .side-quote { display: none; }
  .brand { padding: 4px 0 22px; }
  .side-nav a { justify-content: center; padding: 14px; }
  .main { padding: 20px 20px 36px; }
  .grid-main, .grid-half { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 200px 1fr; justify-items: start; }
}

/* HP */
@media (max-width: 767px) {
  body { font-size: 14px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 16px; }
  .greet h1 { font-size: 20px; }
  .greet p { font-size: 12.5px; }
  .top-actions { width: 100%; }
  .month-picker { width: 100%; justify-content: space-between; }
  .month-label { flex: 1; }
  .month-pop { left: 0; right: 0; width: auto; }
  .add-desktop { display: none; }

  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat.bal { grid-column: 1 / -1; order: -1; }
  .stat { flex-direction: column; gap: 10px; padding: 16px; }
  .stat.bal { flex-direction: row; align-items: center; }
  .stat-ic { width: 40px; height: 40px; border-radius: 12px; }
  .stat-val { font-size: 16px; }
  .stat.bal .stat-val { font-size: 24px; }
  .card { padding: 16px; }
  .chart-box { height: 220px; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .donut { width: 190px; height: 190px; }
  .sum-strip { gap: 8px; }
  .sum-strip .card { padding: 10px 12px; }
  .sum-strip b { font-size: 14px; }
  .cat-form { grid-template-columns: 1fr; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 6px 0; }
  .bottom-nav a.active { color: var(--pri-2); }
  .bottom-nav svg { width: 22px; height: 22px; }
  .fab {
    justify-self: center; width: 58px; height: 58px; border-radius: 50%; border: 4px solid var(--bg);
    margin-top: -30px; background: linear-gradient(135deg, #1f8a62, #0f3d33); color: #fff;
    display: grid; place-items: center; box-shadow: 0 8px 20px rgba(15,61,51,.35);
  }
  .fab svg { width: 26px; height: 26px; }

  .modal { padding: 0; place-items: end stretch; }
  .sheet { border-radius: 22px 22px 0 0; max-width: none; max-height: 94vh; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); animation: up .25s ease-out; }
  .sheet-sm { border-radius: 22px 22px 0 0; padding-top: 22px; }
  .sheet-grip { display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
  .sheet-actions { bottom: calc(-16px - env(safe-area-inset-bottom)); padding-bottom: 4px; }
  .amount-box input { font-size: 26px; }
  .quick-keys { grid-template-columns: repeat(3, 1fr); }
  .qk { padding: 13px 4px; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ---------- Layar kunci ---------- */
.lock { display: none; }
body.is-locked { overflow: hidden; }
body.is-locked .app, body.is-locked .modal, body.is-locked .toast { visibility: hidden; }
body.is-locked .lock {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 100; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #1f7a5c 0%, #0f3d33 45%, #08241d 100%);
}
.lock-card {
  width: 100%; max-width: 360px; background: rgba(255,255,255,.97); border-radius: 24px;
  padding: 30px 24px 24px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: pop .25s ease-out;
}
.lock-card h2 { margin: 14px 0 6px; font-size: 21px; font-weight: 800; }
.lock-card > p { margin: 0 0 20px; font-size: 13.5px; line-height: 1.5; }
.lock-touch { width: 100%; padding: 15px; font-size: 15px; }
.lock-touch svg { width: 24px; height: 24px; }
.lock-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; margin: 16px 0 12px; }
.lock-or::before, .lock-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#lock-form { display: flex; flex-direction: column; gap: 10px; }
#lock-form input {
  border: 2px solid var(--line); border-radius: 14px; padding: 13px; text-align: center; font-size: 22px;
  letter-spacing: 8px; font-weight: 800; outline: 0; width: 100%; background: var(--soft);
}
#lock-form input::placeholder { letter-spacing: 1px; font-size: 15px; font-weight: 600; }
#lock-form input:focus { border-color: var(--acc); background: #fff; }
#lock-form .btn { padding: 13px; }
.lock-err { background: var(--out-bg); color: var(--out); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; margin: 14px 0 0; }
.lock-card.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.top-btn { background: var(--card); box-shadow: var(--shadow); width: 44px; height: 44px; border-radius: 14px; }
.top-btn svg { color: var(--pri-2); }

/* Halaman keamanan */
.sec-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sec-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--soft); }
.sec-item .nm { flex: 1; min-width: 0; }
.sec-item .nm b { display: block; font-size: 14px; }
.sec-item .nm small { color: var(--muted); font-size: 12px; }
.note { background: #fff7e6; color: #7a5200; border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin: 0 0 14px; }

@media (max-width: 767px) {
  .month-picker { width: auto; flex: 1; min-width: 0; }
  .month-label { min-width: 0; padding: 6px 4px; }
}

/* ---------- Pembayaran wajib, tabungan, otomatis ---------- */
.small { font-size: 12.5px; line-height: 1.5; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-sm svg { width: 16px; height: 16px; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: #e3f3eb; color: var(--pri-2); margin-right: 6px; vertical-align: 1px; }
.badge-warn { background: #fff1d6; color: #9a5b00; }
.nav-badge { font-style: normal; margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--out); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }

.due-strip { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 18px; border: 1.5px solid transparent; }
.due-strip.warn { background: #fff8eb; border-color: #f6d79a; }
.due-strip.ok { background: var(--in-bg); border-color: #bfe8cc; }
.due-strip .due-ic { font-size: 24px; }
.due-strip .due-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.due-strip .due-txt b { font-size: 14.5px; }
.due-strip .due-txt small { color: var(--muted); font-size: 12.5px; }
.due-strip > svg { color: var(--muted); }

.due-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; color: #fff; }
.due-hero.warn { background: linear-gradient(135deg, #b45309, #7c2d12); }
.due-hero.ok { background: linear-gradient(135deg, #17614c, #0f3d33); }
.due-hero small { opacity: .85; font-size: 12.5px; font-weight: 600; }
.due-big { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.6px; margin: 2px 0 4px; }
.due-meta { font-size: 13.5px; opacity: .95; }
.due-after { background: rgba(255,255,255,.12); border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.due-after b { font-size: 20px; font-weight: 800; }
.due-after b.neg { color: #fecaca; }

.pay-row { display: flex; gap: 10px; }
.pay-row select { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; font-weight: 600; }
.due-group { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 12px 4px 6px; }
.due-group:first-of-type { padding-top: 0; }
.due-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.due-row:last-child { border-bottom: 0; }
.due-amt { font-size: 14px; white-space: nowrap; }
.btn-pay { padding: 8px 12px; font-size: 12.5px; background: var(--in-bg); color: var(--in); border-radius: 10px; }
.btn-pay:hover { background: #d3f0dc; }
.due-row .icon-btn { width: 30px; height: 30px; color: var(--muted); font-size: 13px; }

.sec-item.off { opacity: .55; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--acc); }
.field select { border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; outline: 0; width: 100%; }
.my-select { display: flex; gap: 8px; }
.my-select select { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 10px; background: #fff; }
.money { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 12px; padding: 4px 4px 4px 12px; background: #fff; }
.money:focus-within { border-color: var(--acc); }
.money b { color: var(--muted); }
.money input { border: 0 !important; box-shadow: none !important; padding: 8px 0 !important; font-weight: 800; font-size: 17px; flex: 1; min-width: 0; }
.money .qk { padding: 9px 14px; }

.plan-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.plan { background: var(--soft); border-radius: 16px; padding: 14px; }
.plan-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.plan-top b { display: block; font-size: 15px; }
.plan-top small { color: var(--muted); font-size: 12px; }
.plan-meta { margin-top: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.plan-preview { background: #eef7f2; color: var(--pri-2); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin: 0 0 8px; }
.plan-preview:empty { display: none; }

.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 14px; background: var(--soft); font-size: 12.5px; font-weight: 700; text-align: center; }
.menu-grid a.active { background: #e3f3eb; color: var(--pri-2); }
.menu-grid svg { width: 24px; height: 24px; color: var(--pri-2); }
.nav-more { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 6px 0; }

@media (max-width: 1023px) {
  .side-nav a .nav-badge { position: absolute; margin: -22px 0 0 22px; min-width: 18px; height: 18px; font-size: 10px; }
  .side-nav a { position: relative; }
}
@media (max-width: 767px) {
  .bottom-nav a { position: relative; }
  .bottom-nav .nav-badge { position: absolute; top: 0; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; font-size: 10px; }
  .nav-more svg { width: 22px; height: 22px; }
  .due-after { width: 100%; }
  .pay-row { flex-direction: column; }
  .due-row { flex-wrap: wrap; }
  .due-row .tx-main { flex-basis: calc(100% - 56px); }
  .due-row .due-amt { margin-left: 52px; flex: 1; }
}

/* ---------- Rekening ---------- */
.neg { color: var(--out) !important; }
.badge-acc { background: #e0f2fe; color: #0369a1; }
.trf-ic { background: #e0f2fe; color: #0284c7; }
.trf-ic svg { width: 20px; height: 20px; }
.tx-amt.trf { color: #0369a1; }
.btn-light { background: rgba(255,255,255,.95); color: var(--pri); }
.link-btn { border: 0; background: transparent; color: var(--acc); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 0; }
.link-btn svg { width: 16px; height: 16px; }

.acc-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; color: #fff; background: linear-gradient(135deg, #0e7490, #0f3d33); }
.acc-hero small { opacity: .85; font-size: 12.5px; font-weight: 600; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.acc-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; cursor: pointer; border: 2px solid transparent; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; gap: 10px; }
.acc-card:hover { transform: translateY(-2px); }
.acc-card.active { border-color: var(--acc); }
.acc-top { display: flex; align-items: center; gap: 10px; }
.acc-top .nm { min-width: 0; }
.acc-top .nm b { display: block; font-size: 15px; }
.acc-top .nm small { color: var(--muted); font-size: 12px; }
.acc-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #e0f2fe; color: #0369a1; flex: none; }
.acc-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 4px; }
.acc-tags .badge { margin: 0; }
.acc-amt { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.acc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.acc-foot small { color: var(--muted); font-size: 11.5px; }
.acc-detail { margin-bottom: 18px; border: 2px solid var(--acc); }
.acc-detail .card-head { align-items: flex-start; }
.acc-bal { text-align: right; }
.acc-bal small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.acc-bal b { font-size: 24px; font-weight: 800; }
.acc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.acc-mini { display: flex; flex-direction: column; gap: 8px; }
.acc-mini > div { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.acc-mini > div span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-mini-total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 800; }
.rec-box { background: var(--soft); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.rec-box small { color: var(--muted); font-weight: 600; }
.rec-box b { font-size: 18px; }
.type-seg button[data-type="transfer"].active { background: #0284c7; color: #fff; }
@media (max-width: 767px) {
  .acc-detail .card-head { flex-direction: column; }
  .acc-bal { text-align: left; }
  .type-seg button { padding: 10px 4px; font-size: 13px; }
}
@media (max-width: 767px) {
  .acc-sum { grid-template-columns: 1fr; gap: 6px; }
  .acc-sum .card { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
  .acc-sum b { margin: 0; }
}

/* ---------- Ikon garis (pengganti emoji) ---------- */
.cat-ic svg { width: 21px; height: 21px; }
.cat-opt .cat-ic svg { width: 20px; height: 20px; }
.empty .big { display: block; font-size: 0; margin-bottom: 8px; }
.empty .big svg { width: 40px; height: 40px; color: #a6b8b0; }
.due-strip .due-ic { font-size: 0; }
.due-strip .due-ic svg { width: 26px; height: 26px; }
.due-strip.warn .due-ic svg { color: #b45309; }
.due-strip.ok .due-ic svg { color: var(--in); }
.qk-clear svg { width: 20px; height: 20px; vertical-align: middle; }
.emoji-grid button { display: grid; place-items: center; }
.emoji-grid button svg { width: 20px; height: 20px; }
.btn svg + * { margin-left: 0; }
.scope-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; margin: -8px 0 12px; }
.scope-note svg { width: 15px; height: 15px; color: var(--acc); }
.scope-note b { color: var(--ink); }
.emoji-grid button.used { opacity: .3; }

/* ---------- Anggaran & Tujuan ---------- */
.sidebar { overflow-y: auto; }
.bar-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.budget-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; color: #fff; background: linear-gradient(135deg, #17614c, #0f3d33); }
.budget-hero > div:first-child { flex: 1; min-width: 240px; }
.budget-hero small { opacity: .85; font-size: 12.5px; font-weight: 600; }
.budget-hero .of { font-size: .55em; opacity: .75; font-weight: 700; }
.track-light { background: rgba(255,255,255,.2); margin: 6px 0 8px; }
.budget-item { display: flex; align-items: center; gap: 6px; }
.budget-item .bar-row { flex: 1; min-width: 0; }
.budget-item .icon-btn { color: var(--muted); }
.budget-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); font-weight: 600; margin: -6px 0 12px; }
.budget-total b { font-size: 18px; }
.budget-hint { margin: -6px 0 14px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600; background: var(--in-bg); color: #166534; }
.budget-hint.warn { background: #fff4dc; color: #9a5b00; }
.budget-hint.over { background: var(--out-bg); color: var(--out); }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.goal { background: var(--soft); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.goal-top { display: flex; align-items: center; gap: 10px; }
.goal-top .nm { flex: 1; min-width: 0; }
.goal-top .nm b { display: block; font-size: 15px; }
.goal-top .nm small { color: var(--muted); font-size: 12px; }
.goal .bar-top { margin: 0; }
.goal .plan-meta { margin: 0; }
.goal-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-list { display: flex; flex-direction: column; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.hist-row .nm { flex: 1; min-width: 0; }
.hist-row .nm b { display: block; color: var(--in); }
.hist-row .nm small { color: var(--muted); font-size: 12px; }
.hist-row .icon-btn { color: var(--muted); }
.goal .bar-top { flex-wrap: wrap; } .goal .bar-top b { white-space: nowrap; }
.bar-row > div { min-width: 0; }
@media (max-width: 767px) {
  .bar-top { flex-direction: column; gap: 2px; }
  .bar-top span { white-space: normal; }
}
.zakat-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.zakat-cat { background: var(--soft); border-radius: 12px; padding: 8px 10px; margin: 0; font-size: 13px; }
.zakat-cat .cat-ic svg { width: 16px; height: 16px; }
.zakat-cat { display: flex; align-items: center; gap: 8px; }
.zakat-cat .cat-ic { width: 30px; height: 30px; border-radius: 9px; }

/* ---------- Pemilih rekening global ---------- */
.acct-picker { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 14px; padding: 0 10px; box-shadow: var(--shadow); height: 44px; }
.acct-picker svg { width: 17px; height: 17px; color: var(--acc); }
.acct-picker select { border: 0; background: transparent; font-weight: 700; outline: 0; max-width: 190px; padding: 8px 0; cursor: pointer; }

/* ---------- Pembayaran wajib: jatuh tempo ---------- */
.badge-late { background: var(--out-bg); color: var(--out); }
.code-box { background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 10px; font-size: 12px; overflow-x: auto; white-space: pre; margin: 0 0 8px; }

/* ---------- Laporan tahunan ---------- */
.year-nav { display: flex; align-items: center; gap: 4px; background: var(--card); border-radius: 12px; padding: 2px 4px; box-shadow: var(--shadow); }
.year-nav b { min-width: 48px; text-align: center; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.rtable th, .rtable td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.rtable th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 700; }
.rtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.rtable td.in { color: var(--in); }
.rtable td.out { color: var(--out); }
.rtable tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; }
.rtable .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.matrix { font-size: 12px; }
.matrix th, .matrix td { padding: 7px 8px; }
.report-card { margin-bottom: 18px; }
.print-head { display: none; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff !important; font-size: 11px; }
  body.is-locked .app { visibility: visible; }
  .sidebar, .bottom-nav, .topbar, .no-print, .toast, .modal, .lock, .scope-note { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .card { box-shadow: none !important; border: 1px solid #d9e3de; break-inside: avoid; padding: 12px; }
  .report-card { break-inside: auto; }
  .stats { grid-template-columns: repeat(3, 1fr) !important; gap: 8px; }
  .stat { flex-direction: row !important; }
  .stat.bal { background: #fff !important; color: var(--ink) !important; }
  .stat.bal::after { display: none; }
  .stat.bal .stat-label, .stat.bal .stat-sub { color: var(--muted) !important; }
  .stat-val { font-size: 16px !important; }
  .table-scroll { overflow: visible; }
  .rtable { font-size: 10px; }
  .matrix { font-size: 8.5px; }
  .matrix th, .matrix td { padding: 4px 4px; }
  .print-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; border-bottom: 2px solid #0f3d33; padding-bottom: 8px; }
  .print-head h2 { margin: 0; font-size: 18px; }
  .print-head p { margin: 2px 0 0; color: #555; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 767px) {
  .acct-picker { flex: 1; min-width: 0; height: 44px; }
  .acct-picker select { max-width: none; width: 100%; }
  .top-actions { flex-wrap: wrap; }
  .month-picker { order: 2; }
  .acct-picker { order: 1; flex-basis: 100%; }
  .toolbar .year-nav { flex: 1; justify-content: space-between; }
}
@media (max-width: 767px) { .top-actions .top-btn { order: 3; } }
.pay-mode { display: flex; width: 100%; }
.pay-mode button { flex: 1; padding: 10px 6px; }
