:root {
  --bg: #0B0F14;
  --surface: #121821;
  --surface-raised: #171F2B;
  --line: #242E3B;
  --ink: #E7EBEF;
  --ink-dim: #8A94A3;
  --ink-faint: #5B6472;
  --gold: #D4A054;
  --green: #7FB88A;
  --red: #E0796B;
  --blue: #6EA8D8;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  --mono: ui-monospace, "SF Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
input, button, textarea { font-family: inherit; }
button { cursor: pointer; }
input::placeholder { color: var(--ink-faint); }

#app {
  position: relative;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
}
#app::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(212,160,84,0.08), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(127,184,138,0.05), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.header { position: relative; padding: 18px 16px 10px; z-index: 1; }
.header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--ink-faint); margin-bottom: 4px; }
h1.title { font-family: var(--serif); font-weight: 700; font-size: 25px; margin: 0; }
.balance-pill { background: var(--surface-raised); border: 1px solid rgba(212,160,84,0.35); border-radius: 14px; padding: 8px 14px; text-align: right; min-width: 104px; }
.balance-pill.negative { border-color: rgba(224,121,107,0.4); }
.balance-pill-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: var(--ink-dim); margin-bottom: 2px; }
.balance-pill-value { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--gold); }
.balance-pill.negative .balance-pill-value { color: var(--red); }

.tabs { position: relative; z-index: 1; display: flex; gap: 6px; padding: 4px 16px 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { display: flex; align-items: center; gap: 6px; flex-shrink: 0; background: transparent; border: 1px solid transparent; color: var(--ink-dim); border-radius: 20px; padding: 8px 13px; font-size: 13px; font-weight: 500; }
.tab-btn.active { background: var(--surface-raised); border-color: var(--line); color: var(--ink); }

main { position: relative; z-index: 1; padding: 0 16px 40px; display: flex; flex-direction: column; gap: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card-head { margin-bottom: 12px; }
.card-title { font-family: var(--serif); font-weight: 700; font-size: 17px; margin: 0; }
.card-subtitle { font-size: 12.5px; color: var(--ink-dim); margin: 3px 0 0; }
.card-body { display: flex; flex-direction: column; gap: 10px; }

.mode-row { display: flex; gap: 6px; margin-bottom: 4px; }
.mode-btn { flex: 1; background: var(--surface-raised); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 10px; padding: 8px 10px; font-size: 12px; font-weight: 500; }
.mode-btn.active { background: rgba(212,160,84,0.12); border-color: rgba(212,160,84,0.4); color: var(--gold); }

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-row-compact { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.field-label { font-size: 13px; color: var(--ink-dim); flex-shrink: 0; }

input[type="text"], input[type="number"] {
  background: var(--surface-raised); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; color: var(--ink); font-family: var(--mono); font-size: 14px;
  width: 108px; text-align: right; outline: none;
}
input.wide { width: 100%; text-align: left; }
input.narrow { width: 90px; text-align: right; }
input:focus { border-color: rgba(212,160,84,0.5); }

.divider { height: 1px; background: var(--line); margin: 6px 0; }

.ledger-line { display: flex; align-items: baseline; gap: 6px; }
.ledger-label { font-size: 13.5px; color: var(--ink-dim); white-space: nowrap; }
.ledger-dots { flex: 1; border-bottom: 1px dotted var(--line); margin-bottom: 3px; }
.ledger-value { font-family: var(--mono); font-size: 15px; white-space: nowrap; }
.ledger-value.bold { font-weight: 700; }
.ledger-value.large { font-size: 22px; }
.ledger-value.accent { color: var(--gold); }
.ledger-value.negative { color: var(--red); }

.row-card { position: relative; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.row-card-body { display: flex; flex-direction: column; gap: 8px; padding-right: 22px; }
.row-remove { position: absolute; top: 10px; right: 10px; background: transparent; border: none; color: var(--ink-faint); padding: 4px; }
.two-col { display: flex; gap: 10px; }
.bill-row { display: flex; gap: 10px; align-items: center; }
.micro-note { font-size: 11.5px; color: var(--ink-faint); font-style: italic; }

.add-btn { display: flex; align-items: center; justify-content: center; gap: 6px; background: transparent; border: 1px dashed var(--line); color: var(--ink-dim); border-radius: 10px; padding: 10px; font-size: 13px; margin-top: 2px; width: 100%; }

.callout { background: rgba(212,160,84,0.08); border: 1px solid rgba(212,160,84,0.25); border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.5; }
.empty-state { font-size: 13px; color: var(--ink-dim); padding: 8px 2px; }

.verdict { display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; }
.verdict.ok { background: rgba(127,184,138,0.1); border: 1px solid rgba(127,184,138,0.3); color: var(--green); }
.verdict.no { background: rgba(224,121,107,0.08); border: 1px solid rgba(224,121,107,0.25); color: var(--ink); }
.verdict-sub { color: var(--ink-dim); margin-top: 3px; font-size: 12px; }

/* Calendar */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav-btn { background: var(--surface-raised); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.cal-month-label { font-family: var(--serif); font-weight: 700; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--ink-faint); padding-bottom: 4px; font-family: var(--mono); }
.cal-cell { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-raised); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; position: relative; overflow: hidden; }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.cal-cell.logged { background: rgba(212,160,84,0.08); }
.cal-daynum { font-size: 11px; color: var(--ink-dim); }
.cal-cell.today .cal-daynum { color: var(--gold); font-weight: 700; }
.cal-hours { font-family: var(--mono); font-size: 9.5px; color: var(--ink); font-weight: 600; }
.cal-earn { font-family: var(--mono); font-size: 8px; color: var(--green); }

.day-editor { margin-top: 12px; }
.quick-row { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.quick-btn { background: var(--surface-raised); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 8px; padding: 7px 10px; font-size: 12px; }
.quick-btn.active { border-color: rgba(212,160,84,0.4); color: var(--gold); }
textarea.note {
  width: 100%; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; color: var(--ink); font-family: var(--sans); font-size: 13px; resize: vertical; min-height: 44px;
}

/* Reminder */
.reminder-status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex-shrink: 0; }
.dot.on { background: var(--green); }
.btn-primary { background: rgba(212,160,84,0.15); border: 1px solid rgba(212,160,84,0.4); color: var(--gold); border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600; width: 100%; }
.note-small { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }

.toast { position: fixed; bottom: 56px; left: 50%; transform: translateX(-50%); background: var(--surface-raised); border: 1px solid var(--line); padding: 8px 16px; border-radius: 20px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 5; }

footer { position: relative; z-index: 1; text-align: center; padding: 4px 16px 24px; }
.reset-link { background: none; border: none; color: var(--ink-faint); font-size: 12px; text-decoration: underline; }
.confirm-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.confirm-text { font-size: 12px; color: var(--ink-dim); }
.confirm-yes { background: rgba(224,121,107,0.15); border: 1px solid rgba(224,121,107,0.4); color: var(--red); border-radius: 8px; padding: 5px 10px; font-size: 12px; }
.confirm-no { background: transparent; border: 1px solid var(--line); color: var(--ink-dim); border-radius: 8px; padding: 5px 10px; font-size: 12px; }

svg.icon { flex-shrink: 0; }

/* New: selects, checkboxes, payments, info notes */
select.select {
  background: var(--surface-raised); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; color: var(--ink); font-family: var(--sans); font-size: 13px; width: 100%;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-dim); }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); flex-shrink: 0; }

.info-note { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-dim); line-height: 1.5; }
.info-note svg { margin-top: 2px; color: var(--gold); }

.auto-hint { font-size: 10.5px; color: var(--ink-faint); font-family: var(--mono); display: block; margin-top: 2px; }

.payment-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.payment-row:last-child { border-bottom: none; }
.payment-label { font-size: 13px; color: var(--ink); }
.payment-meta { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }
.payment-amount { font-family: var(--mono); font-size: 13px; color: var(--green); font-weight: 600; white-space: nowrap; margin-left: auto; }
.row-remove-inline { background: transparent; border: none; color: var(--ink-faint); padding: 4px; flex-shrink: 0; }

/* Priority banner (red/amber/green) */
.priority-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.priority-banner .priority-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.priority-banner.red { background: rgba(224,121,107,0.12); border: 1px solid rgba(224,121,107,0.35); color: #F0A99C; }
.priority-banner.red .priority-dot { background: var(--red); box-shadow: 0 0 10px rgba(224,121,107,0.7); }
.priority-banner.amber { background: rgba(212,160,84,0.12); border: 1px solid rgba(212,160,84,0.35); color: var(--gold); }
.priority-banner.amber .priority-dot { background: var(--gold); box-shadow: 0 0 10px rgba(212,160,84,0.7); }
.priority-banner.green { background: rgba(127,184,138,0.12); border: 1px solid rgba(127,184,138,0.35); color: var(--green); }
.priority-banner.green .priority-dot { background: var(--green); box-shadow: 0 0 10px rgba(127,184,138,0.7); }

/* Debt reordering */
.reorder-row { display: flex; align-items: center; gap: 8px; }
.reorder-btns { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.reorder-btn { background: var(--surface); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 5px; padding: 1px; width: 20px; height: 16px; display: flex; align-items: center; justify-content: center; }
.reorder-btn:disabled { opacity: 0.3; }
.paid-off { color: var(--green); font-weight: 600; font-style: normal; }

/* Account balance growth */
.account-delta { font-family: var(--mono); font-size: 12px; font-weight: 600; margin-top: -2px; }
.delta-pos { color: var(--blue); }
.delta-neg { color: var(--red); }
.delta-zero { color: var(--ink-faint); }
.ledger-value.blue { color: var(--blue); }

/* Streak chip */
.streak-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-raised); border: 1px solid rgba(212,160,84,0.3); border-radius: 20px; padding: 6px 12px; font-size: 12.5px; color: var(--gold); margin-bottom: 4px; }
.streak-chip svg { color: var(--gold); }

/* Soft glow accents — subtle nod to the ORION / Amy glow-ring language */
.balance-pill { box-shadow: 0 0 22px rgba(212,160,84,0.08); }
.balance-pill.negative { box-shadow: 0 0 22px rgba(224,121,107,0.1); }

/* Top nav: home button + dropdown */
.topnav { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 4px 16px 14px; }
.home-btn { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex-shrink: 0; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 10px; color: var(--ink-dim); }
.home-btn.active { color: var(--gold); border-color: rgba(212,160,84,0.4); box-shadow: 0 0 12px rgba(212,160,84,0.15); }
.nav-select { flex: 1; }

/* Home screen */
.home-hero { margin-bottom: 4px; }
.home-balance-row { display: flex; flex-direction: column; gap: 8px; }
.home-balance-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.home-balance-card.owed { border-color: rgba(224,121,107,0.35); background: rgba(224,121,107,0.06); }
.home-balance-card.clear { border-color: rgba(127,184,138,0.35); background: rgba(127,184,138,0.06); }
.home-balance-label { font-size: 13px; color: var(--ink-dim); }
.home-balance-value { font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--ink); }
.home-balance-card.owed .home-balance-value { color: var(--red); }
.home-balance-card.clear .home-balance-value { color: var(--green); }
.home-balance-tag { font-size: 10px; color: var(--ink-faint); white-space: nowrap; }
.home-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.home-link { display: flex; align-items: center; gap: 8px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--ink); }

/* Payslip import form */
.payslip-form { display: flex; flex-direction: column; gap: 10px; }
.mode-row-4 { flex-wrap: wrap; }
.mode-row-4 .mode-btn { flex: 1 1 45%; }


