/* Warna: kertas dingin, tinta navy, satu aksen biru kobalt. Kuning hanya untuk penanda "hari ini". */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #14213d;
  --ink-soft: #55607a;
  --line: #e2e6f0;
  --primary: #3b5bff;
  --primary-ink: #ffffff;
  --primary-soft: #e8ecff;
  --today: #ffb703;
  --good: #14966a;
  --bad: #d93a43;
  --radius: 14px;
  --nav-h: 64px;
  --top-h: 56px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 6px 18px rgba(20, 33, 61, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1424; --surface: #171f33; --ink: #eef1fa; --ink-soft: #9aa6c4; --line: #26304a;
    --primary: #6f88ff; --primary-ink: #0e1424; --primary-soft: #222d57; --good: #3ccf9b; --bad: #ff7a82;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1424; --surface: #171f33; --ink: #eef1fa; --ink-soft: #9aa6c4; --line: #26304a;
  --primary: #6f88ff; --primary-ink: #0e1424; --primary-soft: #222d57; --good: #3ccf9b; --bad: #ff7a82;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.5;
  padding: var(--top-h) 0 calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* Kerangka */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-soft); text-decoration: none; font-size: .72rem; font-weight: 600; min-width: 0;
}
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--primary); }
.nav a[aria-current="page"] svg { stroke-width: 2.4; }

main { padding: 20px 16px 32px; max-width: 760px; margin: 0 auto; outline: none; }

body.is-login { padding: 0; }
body.is-login .topbar, body.is-login .nav { display: none; }
body.is-login main { max-width: 420px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }

/* Komponen dasar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; cursor: pointer;
  font-weight: 700; background: var(--primary); color: var(--primary-ink); text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-quiet { background: transparent; color: var(--ink-soft); }
.btn-quiet:hover { background: var(--primary-soft); color: var(--ink); filter: none; }
.btn-block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 1.2rem;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea {
  min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.form-error { color: var(--bad); font-weight: 600; margin: 0 0 14px; min-height: 1.4em; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--ink-soft); }
.page-head { margin-bottom: 20px; }
.page-head p { color: var(--ink-soft); margin-top: 4px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-soft); }

.login-card h1 { margin-bottom: 6px; }
.login-card > p { color: var(--ink-soft); margin-bottom: 24px; }

/* Layar lebar: menu pindah ke samping */
@media (min-width: 900px) {
  body { padding: 0 0 0 220px; }
  .topbar { left: 220px; background: transparent; border-bottom: 0; justify-content: flex-end; }
  .topbar .brand { display: none; }
  .nav {
    inset: 0 auto 0 0; width: 220px; height: auto; flex-direction: column; justify-content: flex-start;
    padding: 24px 12px; gap: 4px; border-top: 0; border-right: 1px solid var(--line);
  }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: .95rem; }
  .nav a[aria-current="page"] { background: var(--primary-soft); }
  .nav::before { content: "Planner"; font-weight: 800; font-size: 1.25rem; padding: 0 14px 18px; letter-spacing: -.02em; }
  main { padding: 56px 32px 48px; }
  body.is-login { padding: 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Tugas */
.task-form { padding: 12px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.task-form input, .task-form select {
  min-height: 46px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); width: 100%;
}
.task-form input:focus, .task-form select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.task-form-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
@media (max-width: 420px) { .task-form-row { grid-template-columns: 1fr 1fr; } .task-form-row .btn { grid-column: 1 / -1; } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  min-height: 36px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--ink-soft); font-weight: 600; font-size: .88rem; cursor: pointer;
}
.chip[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.group { margin-bottom: 24px; }
.group h2, .group summary { margin-bottom: 8px; cursor: default; }
.group summary { cursor: pointer; font-weight: 700; font-size: 1.1rem; }
.group-title { display: inline-flex; align-items: center; gap: 8px; }
.count { font-size: .8rem; font-weight: 700; color: var(--ink-soft); background: var(--primary-soft); border-radius: 999px; padding: 1px 9px; }
.is-overdue h2 { color: var(--bad); }
.is-today h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--today); display: inline-block; margin-right: 8px; }
.is-today .group-title { display: inline-flex; }

.task-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.task { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.check {
  flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer;
  color: var(--primary-ink); font-weight: 800; position: relative;
}
.check::before {
  content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink-soft); background: transparent; z-index: 0;
}
.check[aria-checked="true"]::before { background: var(--good); border-color: var(--good); }
.check { z-index: 0; }
.check > * { position: relative; }
.task-body { flex: 1; min-width: 0; text-align: left; background: transparent; border: 0; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-meta { font-size: .82rem; color: var(--ink-soft); }
.task.is-done .task-title { text-decoration: line-through; color: var(--ink-soft); }
.prio { font-weight: 700; }
.prio-high { color: var(--bad); }
.prio-medium { color: var(--primary); }
.prio-low { color: var(--ink-soft); }

/* Pesan singkat dan dialog */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: 12px; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-weight: 600;
}
.toast-action { background: transparent; border: 0; color: var(--today); font-weight: 800; cursor: pointer; min-height: 32px; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dialog::backdrop { background: rgba(10, 16, 30, .55); }
.dialog h2 { margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Jadwal */
:root { --lbl-kuliah: #3b5bff; --lbl-kerja: #0f9d76; --lbl-pribadi: #c2458a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --lbl-kuliah: #8ea0ff; --lbl-kerja: #3ccf9b; --lbl-pribadi: #f08ac0; } }
:root[data-theme="dark"] { --lbl-kuliah: #8ea0ff; --lbl-kerja: #3ccf9b; --lbl-pribadi: #f08ac0; }

.schedule-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.range-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.range-nav { display: flex; align-items: center; }
.range-nav .icon-btn { font-size: 1.6rem; }
.seg { display: inline-flex; background: var(--primary-soft); border-radius: 12px; padding: 3px; }
.seg-btn { min-height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.seg-btn[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.range-title { margin-bottom: 14px; font-size: 1.2rem; }

.day-block { margin-bottom: 20px; }
.day-block h3 { font-size: .95rem; color: var(--ink-soft); margin-bottom: 6px; }
.day-block.is-today h3 { color: var(--ink); }
.day-block.is-today h3::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--today); margin-right: 8px; }
.day-empty { padding: 6px 0; }
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.event {
  width: 100%; display: flex; gap: 14px; text-align: left; cursor: pointer; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--lbl); border-radius: 12px;
}
.event.lbl-kuliah { --lbl: var(--lbl-kuliah); }
.event.lbl-kerja { --lbl: var(--lbl-kerja); }
.event.lbl-pribadi { --lbl: var(--lbl-pribadi); }
.event-time { flex: 0 0 7.4rem; font-size: .92rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.event-main { display: flex; flex-direction: column; min-width: 0; }
.event-title { font-weight: 700; overflow-wrap: anywhere; }
.event-meta { font-size: .82rem; color: var(--lbl); font-weight: 600; }
.repeat-mark { color: var(--ink-soft); }
.btn-danger { background: transparent; color: var(--bad); margin-right: auto; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); filter: none; }
.dialog form { max-height: 80vh; overflow-y: auto; }

/* Keuangan */
.pos { color: var(--good); }
.neg { color: var(--bad); }
.fin-summary { margin-bottom: 20px; }
.fin-balance { display: flex; flex-direction: column; margin-bottom: 12px; }
.fin-balance strong { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fin-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.fin-flow div { display: flex; flex-direction: column; }
.fin-flow strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.bars { margin-bottom: 22px; }
.bars h3 { font-size: .95rem; color: var(--ink-soft); margin-bottom: 8px; }
.bars ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: .92rem; }
.bar-track { height: 8px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); }

.fin-filters { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 8px 0 12px; }
.fin-filters input, .fin-filters select { min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.tx-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tx { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 60px; }
.tx-main { display: flex; flex-direction: column; min-width: 0; }
.tx-title { font-weight: 700; overflow-wrap: anywhere; }
.tx-meta { font-size: .8rem; color: var(--ink-soft); }
.tx-amount { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }

.seg-wide { display: flex; margin-bottom: 20px; }
.seg-wide .seg-btn { flex: 1; }
.amount-wrap { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 14px; }
.amount-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.amount-wrap span { font-weight: 700; color: var(--ink-soft); }
.field .amount-wrap input { border: 0; box-shadow: none; padding: 0; min-height: 56px; font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; background: transparent; }
.btn-danger-text { color: var(--bad); margin-top: 8px; }

/* Pengaturan */
.settings { display: flex; flex-direction: column; gap: 16px; }
.settings-card { padding: 18px; }
.settings-card h2 { margin-bottom: 12px; }
.cat-block { margin-bottom: 18px; }
.cat-block h3 { font-size: .95rem; color: var(--ink-soft); margin-bottom: 6px; }
.cat-list { list-style: none; margin: 0 0 10px; padding: 0; }
.cat-list li { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.cat-actions { display: flex; }
.cat-actions .btn { min-height: 40px; padding: 0 10px; font-size: .88rem; }
.cat-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.cat-add input { min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); min-width: 0; }

/* Bukti pembayaran */
.receipt-link { display: block; align-self: flex-start; }
.receipt-preview { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; border: 1px solid var(--line); }
.receipt-status { min-height: 1.4em; font-size: .9rem; }
.field input[type="file"] { padding: 8px 10px; min-height: 0; }
.field .btn-quiet { align-self: flex-start; }

/* Hari Ini */
.today-head { margin-bottom: 18px; }
.today-head h1 { font-size: clamp(3rem, 14vw, 4.5rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; margin: 2px 0 6px; }
.today-date { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 600; }
.today-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--today); flex: 0 0 auto; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.quick .btn { border: 1.5px solid var(--line); min-height: 40px; }
.today-section { margin-bottom: 28px; }
.today-section h2 { margin-bottom: 10px; }
.today-empty { padding: 4px 0; }
a.event, a.task-body, a.today-finance { text-decoration: none; color: inherit; }
.today-finance { display: block; padding: 4px 0; }
.today-finance .fin-balance strong { font-size: 1.9rem; }
.today-finance .fin-flow { padding-top: 10px; margin-top: 10px; }
.today .check { margin-left: -6px; }

/* Pintasan iPhone */
.settings-card input[readonly] { width: 100%; min-height: 46px; padding: 8px 12px; margin: 10px 0 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.steps { margin-top: 14px; }
.steps summary { cursor: pointer; font-weight: 700; }
.steps ol { padding-left: 20px; color: var(--ink-soft); }
.steps li { margin-top: 8px; overflow-wrap: anywhere; }

/* Chip filter berupa tautan */
a.chip { display: inline-flex; align-items: center; text-decoration: none; }

/* Tombol segmen berupa tautan */
a.seg-btn { display: inline-flex; align-items: center; text-decoration: none; }
.danger-zone { margin-top: 12px; }

/* Pilihan jenis transaksi berupa radio bergaya segmen */
label.seg-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.seg-btn input[type="radio"] { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-btn:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-btn:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check-line input { width: auto; min-height: 0; }

/* Navigasi bulan/tanggal berupa tautan; tombol terapkan filter selebar baris */
a.icon-btn { text-decoration: none; }
.fin-filters .btn { grid-column: 1 / -1; }
.cat-rename summary { list-style: none; cursor: pointer; }
.cat-rename summary::-webkit-details-marker { display: none; }
.cat-rename[open] { flex-basis: 100%; }
.cat-list li { flex-wrap: wrap; }

/* Pintasan iPhone */
.shortcut-intro { margin-bottom: 12px; }
.token-box { margin-bottom: 14px; }
.token-box input { width: 100%; min-height: 46px; padding: 8px 12px; margin: 8px 0; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.steps { margin-top: 14px; }
.steps summary { cursor: pointer; font-weight: 700; }
.steps ol { padding-left: 20px; color: var(--ink-soft); }
.steps li { margin-top: 8px; overflow-wrap: anywhere; }
.steps code { background: var(--primary-soft); padding: 0 4px; border-radius: 4px; }

.restore-form { margin-top: 18px; }

.backup-size { margin-bottom: 12px; }
