:root { --bg:#f6f7f9; --card:#fff; --ink:#1c2430; --muted:#6b7684; --line:#e5e8ec; --accent:#3b82f6; --over:#e74c3c; --good:#12a150; }
* { box-sizing: border-box; }
body { margin:0; font:15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,sans-serif; background:var(--bg); color:var(--ink); }
.wrap { max-width:1100px; margin:0 auto; padding:24px 16px; }
.topbar { display:flex; align-items:center; gap:14px; margin-bottom:18px; }
.topbar h1 { font-size:20px; margin:0; flex:1; }
.brand { color:inherit; text-decoration:none; }
.logout { color:var(--muted); text-decoration:none; font-size:14px; }
.theme-toggle { border:0; background:transparent; cursor:pointer; font-size:17px; padding:4px 6px; border-radius:8px; }
.login { max-width:320px; margin:12vh auto; background:var(--card); padding:28px; border-radius:14px; box-shadow:0 1px 3px rgba(0,0,0,.08); }
.login h1 { margin:0 0 16px; font-size:20px; }
.login input { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:9px; font-size:15px; margin-bottom:12px; }
.login button { width:100%; padding:10px; border:0; border-radius:9px; background:var(--accent); color:#fff; font-size:15px; cursor:pointer; }
.error { color:var(--over); font-size:14px; }
.muted { color:var(--muted); }
.small { font-size:12.5px; }
.card { background:var(--card); border-radius:14px; box-shadow:0 1px 3px rgba(0,0,0,.06); padding:18px 20px; margin-bottom:16px; }
.card-title { margin:0 0 12px; font-size:16px; }
.card-title a { color:inherit; text-decoration:none; }
.card-title a:hover { color:var(--accent); }
.back-link { color:var(--muted); text-decoration:none; font-size:14px; }

.kpi-row { display:grid; grid-template-columns:repeat(4,1fr); gap:.6rem; margin-bottom:16px; }
.kpi { background:var(--card); border-radius:10px; padding:.6rem .8rem; display:flex; flex-direction:column; gap:.15rem; box-shadow:0 1px 3px rgba(0,0,0,.06); min-width:0; }
.kpi-lbl { font-size:.72rem; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }
.kpi-val { font-size:1.05rem; font-weight:800; overflow-wrap:anywhere; }
.kpi-pos { color:var(--good); }
.kpi-neg { color:var(--over); }
@media (max-width:640px) { .kpi-row { grid-template-columns:repeat(2,1fr); } }

.month-block { margin-bottom:12px; }
.month-h { font-weight:700; font-size:14px; margin-bottom:6px; }
.due-row { display:flex; gap:12px; padding:5px 0; border-bottom:1px solid var(--line); font-size:14px; }
.due-row:last-child { border-bottom:0; }
.due-date { width:52px; color:var(--muted); font-variant-numeric:tabular-nums; }
.due-name { flex:1; }
.due-amt { font-variant-numeric:tabular-nums; font-weight:600; }

.debt-head { display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.debt-nums { display:flex; gap:16px; flex-wrap:wrap; font-size:14px; margin:8px 0; }
.bar { height:8px; border-radius:999px; background:var(--line); overflow:hidden; margin:6px 0 4px; }
.bar-fill { height:100%; background:var(--good); border-radius:999px; }
.paidoff { color:var(--good); font-weight:700; }

.plan-form, .rate-form { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:10px; }
.plan-form input[type=number], .rate-form input[type=number] { width:90px; padding:7px 9px; border:1px solid var(--line); border-radius:8px; font-size:14px; background:var(--card); color:var(--ink); }
/* select/text inputs had no rule anywhere → raw white OS-default boxes clashing with the dark
   theme (2026-09-23, Ott: "white boxes are ugly as hell"). Global, not scoped to one card, since
   every form in the app (fund apply, vehicle cost log, KM log…) uses select/text inputs. */
select, input[type=text] {
  padding:7px 30px 7px 10px; border:1px solid var(--line); border-radius:8px; font-size:14px;
  background-color:var(--card); color:var(--ink); font-family:inherit;
}
select {
  appearance:none; -webkit-appearance:none; -moz-appearance:none; cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a2b3'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 11px center;
}
select:focus, input[type=text]:focus, input[type=number]:focus, input[type=date]:focus {
  outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(59,130,246,.15);
}
select option { background:var(--card); color:var(--ink); }
.btn { border:0; border-radius:9px; background:var(--accent); color:#fff; font-size:14px; padding:8px 14px; cursor:pointer; }
.btn-sm { border:0; border-radius:7px; padding:5px 10px; font-size:13px; cursor:pointer; background:var(--line); color:var(--ink); }
.plan-result { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:12px 0 6px; }
@media (max-width:560px) { .plan-result { grid-template-columns:1fr; } }
.plan-col { border:1px solid var(--line); border-radius:10px; padding:10px 12px; font-size:14px; }
.plan-h { font-size:12px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); margin-bottom:4px; }
.plan-better { border-color:var(--accent); }
.plan-save { border-color:var(--good); background:rgba(18,161,80,.07); }
.save-amt { color:var(--good); font-weight:800; }

table { width:100%; border-collapse:collapse; font-size:13.5px; }
th, td { text-align:left; padding:6px 8px; border-bottom:1px solid var(--line); }
th { color:var(--muted); font-weight:500; font-size:12.5px; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }
.past-row td { opacity:.45; }
.tablewrap { overflow-x:auto; max-height:480px; overflow-y:auto; }

[data-theme="dark"] {
  --bg:#0f1419; --card:#1a212b; --ink:#e6e9ee; --muted:#94a2b3; --line:#2b3441; --accent:#3b82f6; --over:#f0676c; --good:#2ea36b;
}
[data-theme="dark"] .card, [data-theme="dark"] .kpi { box-shadow:0 1px 3px rgba(0,0,0,.4); }
.cur-row td { font-weight: 700; }
.chart-box { position: relative; height: 240px; min-width: 0; }
.topbar h1 { flex: 0; }
.nav { display: flex; gap: 6px; flex: 1; }
.navlink { color: var(--muted); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.navlink:hover { color: var(--ink); background: var(--line); }
.navlink.active { color: var(--accent); font-weight: 600; background: rgba(59,130,246,.10); }
.pocket-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.pocket-row:last-of-type { border-bottom: 0; }
.bar-fill.cap-ok { background: var(--good); }
.bar-fill.cap-warn { background: #f1c40f; }
.bar-fill.cap-over { background: #e74c3c; }
.km-form { margin: 8px 0 4px; }
.km-form input[type=number] { width: 110px; }
.km-form input[type=date] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: var(--card); color: var(--ink); }
.km-deltas span { margin-right: 12px; }
.km-history { margin-top: 8px; }
.inline-form { display: inline; }
/* Mobile: tap targets ≥ 40px, 16px inputs (no iOS zoom) */
@media (max-width:640px) {
  .btn-sm, .btn { min-height:40px; padding:8px 14px; }
  .plan-form input, .rate-form input, .km-form input { min-height:40px; font-size:16px; }
  .km-form input[type=number] { width:130px; }
  .inline-form .btn-sm { min-width:40px; }
  .nav { flex-wrap:wrap; }
}
.due-row.due-candidate { border-left: 3px solid var(--accent, #3b82f6); padding-left: 8px; }

.fund-paused { margin:10px 0 0; padding:8px 12px; border:1px solid var(--line); border-radius:10px; font-size:14px; }
