/* ==================================================================
   YNAB RFC — design system v1
   Donker, kalm, geld-serieus. Mobile-first (393px), amber-goud accent —
   bewust een ander gezicht dan rpstrength (volt) en freshrss (cyaan).
   ================================================================== */

:root {
  --bg: #0b0d11;
  --surface: #14171d;
  --surface-2: #1c2028;
  --surface-3: #272c36;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --text: #f2f4f7;
  --text-2: #9aa3b0;
  --text-3: #5f6875;

  --accent: #f0b429;
  --accent-2: #de911d;
  --accent-ink: #1d1502;
  --accent-dim: rgba(240, 180, 41, 0.14);

  --green: #3ecf72;
  --green-dim: rgba(62, 207, 114, 0.13);
  --red: #ff6259;
  --red-dim: rgba(255, 98, 89, 0.14);
  --blue: #5aabff;

  --radius: 16px;
  --radius-sm: 12px;
  --tabbar-h: 58px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  background:
    radial-gradient(110% 40% at 50% 0%, rgba(240, 180, 41, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
}

.page { max-width: 660px; margin: 0 auto; padding: 22px 16px 0; }

.overline {
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
h1.title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 4px; }
.subtitle { color: var(--text-2); font-size: 15px; margin-bottom: 18px; }
h3.group-label {
  font-size: 12px; font-weight: 800; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.1em; margin: 22px 6px 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

/* ---------- lijsten / rijen ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.rowitem {
  display: flex; align-items: center; gap: 12px;
  min-height: 54px; padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.rowitem:last-child { border-bottom: none; }
a.rowitem:active { background: var(--surface-2); }
.rowitem .grow { flex: 1; min-width: 0; }
.rowitem .value { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.rowitem .sub { font-size: 12.5px; color: var(--text-3); }
.chevron { color: var(--text-3); }

.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--text-2); font-size: 15px; }
.small { font-size: 13px; color: var(--text-3); }

/* ---------- register ---------- */
.txn { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.txn:last-child { border-bottom: none; }
.txn-date { width: 52px; flex: none; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.txn-main { flex: 1; min-width: 0; }
.txn-payee { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-cat { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-amount { font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
.txn-sub { padding-left: 64px; }
.txn-sub .txn-payee { font-weight: 500; font-size: 13.5px; color: var(--text-2); }

/* ---------- knoppen / formulieren ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; width: 100%; padding: 0 20px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-weight: 800; font-size: 16px;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none;
}
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn-sm { min-height: 44px; width: auto; font-size: 15px; padding: 0 18px; }
.btn-ghost { background: none; border: none; color: var(--text-2); font-size: 14px; cursor: pointer; min-height: 44px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
  width: 100%; min-height: 50px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 60; display: grid; gap: 8px; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; font-weight: 600;
  animation: toast-out 0.4s ease 3.6s forwards;
}
.toast.success { border-color: rgba(62, 207, 114, 0.4); }
.toast.warning { border-color: rgba(240, 180, 41, 0.5); }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); visibility: hidden; } }

/* ---------- 2FA ---------- */
.qr-wrap { display: flex; justify-content: center; margin: 12px 0; }
.qr-wrap img { width: 200px; height: 200px; border-radius: 10px; background: #fff; padding: 8px; }
.totp-secret { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }
.code-input { text-align: center; font-size: 22px !important; letter-spacing: 0.35em; font-variant-numeric: tabular-nums; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.status-dot.on { background: var(--green); }
.status-dot.off { background: var(--text-3); }
.status-dot.pending { background: var(--accent); }

/* ---------- login ---------- */
.login-wrap { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; max-width: 400px; margin: 0 auto; }
.login-title { text-align: center; font-size: 27px; font-weight: 800; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-2); font-size: 14px; margin-bottom: 26px; }
.login-error { color: var(--red); font-size: 14px; text-align: center; margin-bottom: 12px; }

/* ---------- pagineren ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; margin: 14px 2px; color: var(--text-3); font-size: 14px; }
.pager a { color: var(--accent); text-decoration: none; font-weight: 700; padding: 8px 10px; }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex;
  background: rgba(16, 18, 23, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; color: var(--text-3); text-decoration: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--accent); }
.tabbar a.disabled { opacity: 0.35; pointer-events: none; }

.back-link { display: inline-block; color: var(--accent); text-decoration: none; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.back-link::before { content: "‹ "; }

/* ---------- transactieformulier ---------- */
.kind-chip { flex: 1; }
.kind-chip input { position: absolute; opacity: 0; pointer-events: none; }
.kind-chip span {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 10px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-weight: 700; font-size: 14px;
  cursor: pointer; color: var(--text-2);
}
.kind-chip input:checked + span { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.split-row { display: flex; gap: 8px; margin-bottom: 8px; }
.split-row select[name="split_cat"] { flex: 1; min-width: 0; }
.split-row input[name="split_amount"] { width: 96px; flex: none; text-align: right; }
.split-row select.split-dir { width: 74px; flex: none; }

/* + knop in registerkop */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.add-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-size: 26px; font-weight: 800; line-height: 1;
  text-decoration: none;
}
