:root {
  --bg: #0F1B17;
  --bg-panel: #16261F;
  --paper: #F6F1E6;
  --paper-dim: #EFE8D8;
  --gold: #C9A24B;
  --gold-bright: #DAB868;
  --ink: #1F2A24;
  --ink-soft: rgba(31,42,36,0.6);
  --cream-text: #ECE7DA;
  --green-ok: #3F6B52;
  --red: #E2452C;
  --red-soft: #ffb3a3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--cream-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; }
input { font-family: inherit; }

/* ---------- Header / Brand ---------- */
.brandbar {
  padding: 28px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(201,162,75,0.15);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg-panel);
  border: 1px solid rgba(201,162,75,0.35);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-text { line-height: 1.15; }
.brand-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--paper);
}
.brand-hebrew {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 13px;
  color: var(--gold);
  direction: rtl;
  margin-top: 1px;
}
.brand-actions { display: flex; gap: 14px; align-items: center; }
.icon-btn {
  background: transparent;
  color: rgba(236,231,218,0.55);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  transition: color 0.15s;
}
.icon-btn:hover { color: rgba(236,231,218,0.9); }
.icon-btn.active { color: var(--gold); }

/* ---------- Layout ---------- */
.screen { max-width: 480px; margin: 0 auto; padding-bottom: 48px; }
.section { margin: 18px 20px 0; }
.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(236,231,218,0.4);
  margin: 0 0 8px 2px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-panel);
  border: 1px solid rgba(201,162,75,0.12);
  border-radius: 14px;
  padding: 18px;
}
.paper-card {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-dim) 100%);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.55);
  position: relative;
  color: var(--ink);
}

/* ---------- Balance ---------- */
.balance-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 6px;
}
.balance-amount {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 44px;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
}
.balance-amount.negative { color: var(--red); }
.balance-bar-track {
  height: 6px;
  background: rgba(31,42,36,0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 16px;
}
.balance-bar-fill { height: 100%; border-radius: 99px; transition: width 0.5s ease; background: var(--green-ok); }
.balance-bar-fill.low { background: var(--gold); }
.balance-bar-fill.negative { background: var(--red); }
.balance-meta {
  display: flex; justify-content: space-between;
  margin-top: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--ink-soft);
}
.seal-stamp {
  position: absolute; top: 16px; right: 16px;
  transform: rotate(-8deg);
  border: 2px solid var(--gold);
  color: #8a6d2f;
  border-radius: 6px;
  padding: 5px 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}
.seal-stamp.negative { border-color: var(--red); color: var(--red); }

.warning-banner {
  margin-top: 12px;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px;
  line-height: 1.4;
}
.warning-banner.low { background: rgba(201,162,75,0.14); color: #e8cf98; }
.warning-banner.negative { background: rgba(226,69,44,0.14); color: var(--red-soft); }
.warning-banner svg { flex-shrink: 0; margin-top: 2px; }

/* ---------- Profile ---------- */
.profile-badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.profile-badge.spender { background: rgba(226,69,44,0.18); color: #ff9d8a; }
.profile-badge.budgeter { background: rgba(63,107,82,0.28); color: #a8d9bd; }
.profile-body { font-size: 14px; color: rgba(236,231,218,0.75); margin: 0 0 10px; line-height: 1.45; }
.profile-stats { display: flex; gap: 16px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: rgba(236,231,218,0.4); }
.profile-empty { font-size: 14px; color: rgba(236,231,218,0.4); line-height: 1.5; }

/* ---------- Notif banner ---------- */
.notif-nudge {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-panel);
  border: 1px solid rgba(201,162,75,0.15);
  border-radius: 12px;
  padding: 12px 14px;
  color: rgba(236,231,218,0.7);
  font-size: 13px;
  text-align: left;
}

/* ---------- Action buttons ---------- */
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-btn {
  border-radius: 12px;
  padding: 16px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: transform 0.1s, background 0.15s;
}
.action-btn:active { transform: scale(0.97); }
.action-btn.primary { background: var(--gold); color: var(--bg); }
.action-btn.primary:hover { background: var(--gold-bright); }
.action-btn.secondary { background: var(--bg-panel); color: var(--cream-text); border: 1px solid rgba(236,231,218,0.12); }

/* ---------- Transactions ---------- */
.tx-empty {
  text-align: center; padding: 22px 10px;
  border: 1px dashed rgba(236,231,218,0.15);
  border-radius: 12px;
  color: rgba(236,231,218,0.35);
  font-size: 14px;
}
.tx-list { background: linear-gradient(180deg, var(--paper) 0%, var(--paper-dim) 100%); border-radius: 14px; overflow: hidden; }
.tx-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px dashed rgba(31,42,36,0.15);
}
.tx-row:last-child { border-bottom: none; }
.tx-note { color: var(--ink); font-size: 14px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace; font-size: 10px; margin: 3px 0 0; }
.tx-amount { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: 12px; }
.tx-amount span { font-family: 'IBM Plex Mono', monospace; font-size: 14px; color: var(--red); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 20px; right: 20px; bottom: 24px;
  max-width: 440px; margin: 0 auto;
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,0.5);
  z-index: 40;
}
.toast.ok { background: var(--paper); color: var(--ink); }
.toast.warning { background: var(--gold); color: var(--ink); }
.toast.danger { background: var(--red); color: white; }

/* ---------- Onboarding ---------- */
.onboard-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.onboard-inner { width: 100%; max-width: 400px; }
.onboard-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 28px; }
.onboard-logo .brand-mark { width: 52px; height: 52px; font-size: 24px; }
.onboard-logo .brand-title { font-size: 20px; text-align: center; }
.onboard-logo .brand-hebrew { font-size: 16px; }
.field { margin-bottom: 18px; }
.field label {
  display: block; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 6px;
}
.field-input {
  display: flex; align-items: center;
  border-bottom: 2px solid rgba(31,42,36,0.15);
}
.field-input:focus-within { border-color: var(--gold); }
.field-input .prefix { font-family: 'Fraunces', serif; font-size: 22px; color: var(--ink); padding-right: 4px; }
.field-input input {
  width: 100%; background: transparent; border: none; outline: none;
  font-family: 'IBM Plex Mono', monospace; font-size: 20px; color: var(--ink); padding: 8px 0;
}
.field-input input::placeholder { color: rgba(31,42,36,0.3); }
.btn-primary-full {
  width: 100%; background: var(--ink); color: var(--paper);
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 14px; border-radius: 10px; margin-top: 6px;
}
.btn-primary-full:disabled { opacity: 0.3; }

/* ---------- Modal / wizard ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-sheet {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-dim) 100%);
  border-radius: 16px 16px 0 0; width: 100%; max-width: 440px; padding: 24px 24px 32px;
  color: var(--ink);
}
.modal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.step-dots { display: flex; gap: 6px; }
.step-dot { width: 30px; height: 4px; border-radius: 99px; background: rgba(31,42,36,0.1); }
.step-dot.active { background: var(--gold); }
.wizard-question { font-family: 'Fraunces', serif; font-size: 17px; margin: 0 0 20px; line-height: 1.35; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-btn {
  border-radius: 10px; padding: 16px; text-align: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em;
  border: 2px solid rgba(31,42,36,0.15); color: rgba(31,42,36,0.7); background: transparent;
}
.choice-btn.selected.good { background: var(--green-ok); border-color: var(--green-ok); color: white; }
.choice-btn.selected.bad { background: var(--red); border-color: var(--red); color: white; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.btn-back {
  padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(31,42,36,0.15);
  color: rgba(31,42,36,0.6); font-family: 'IBM Plex Mono', monospace; font-size: 12px; text-transform: uppercase; background: transparent;
}
.btn-next {
  flex: 1; background: var(--ink); color: var(--paper); border-radius: 10px; padding: 13px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-next:disabled { opacity: 0.3; }
.btn-next.confirm { background: var(--gold); color: var(--bg); }
.scan-status { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.scan-status.loading { color: rgba(31,42,36,0.6); }
.scan-status.ok { color: var(--green-ok); }
.scan-status.error { color: var(--red); }
.retake-link {
  background: none; color: rgba(31,42,36,0.5); font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; text-transform: uppercase; text-decoration: underline; padding: 0; margin-bottom: 12px;
}
textarea.note-input, input.note-input {
  width: 100%; background: rgba(255,255,255,0.5); border-radius: 8px; border: none; outline: none;
  padding: 12px; font-family: 'Inter', sans-serif; font-size: 14px; color: var(--ink); margin-bottom: 16px;
}
input.note-input::placeholder { color: rgba(31,42,36,0.3); }

/* ---------- Settings modal ---------- */
.settings-body { font-size: 13px; color: rgba(31,42,36,0.7); line-height: 1.5; margin-bottom: 14px; }
.settings-body b { color: var(--ink); }

@media (max-width: 360px) {
  .balance-amount { font-size: 36px; }
}

.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
