:root {
  --paper: #FFFFFF;
  --paper-dim: #F0F0F0;
  --ink: #0A0A0A;
  --ink-soft: #6B6B6B;
  --yellow: #F2C029;
  --line: #E0E0E0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
}

.fin-serif, .fin-brand, .fin-h1, .fin-hero-number, .fin-ledger-value, .fin-section-title {
  font-family: 'Space Grotesk', Arial, sans-serif;
}

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}
.login-card {
  background: var(--paper);
  padding: 40px 36px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 4px solid var(--yellow);
}
.login-brand {
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-size: 22px;
  font-weight: 600;
}
.login-sub { font-size: 13.5px; color: var(--ink-soft); margin: -8px 0 4px; }
.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.login-error { color: var(--ink); background: var(--paper-dim); font-size: 12.5px; padding: 8px 10px; margin: 0; }

/* ---------- App shell ---------- */
.fin-app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.fin-sidebar { background: var(--ink); color: var(--paper); padding: 28px 0; display: flex; flex-direction: column; }
.fin-brand { font-size: 20px; padding: 0 24px 18px; }
.fin-level { padding: 0 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 8px; }
.fin-level-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 7px; }
.fin-level-top svg { color: var(--yellow); }
.fin-level-bar-track { height: 6px; background: rgba(255,255,255,0.15); width: 100%; }
.fin-level-bar-fill { height: 100%; background: var(--yellow); transition: width .3s ease; }
.fin-level-xp { font-size: 10.5px; opacity: 0.6; margin-top: 5px; }
.fin-nav-item { text-align: left; width: 100%; background: none; border: none; color: rgba(255,255,255,0.65); font-family: 'Inter', sans-serif; font-size: 14.5px; padding: 11px 24px; cursor: pointer; border-left: 3px solid transparent; transition: color .15s, border-color .15s; }
.fin-nav-item:hover { color: var(--paper); }
.fin-nav-item.active { color: var(--paper); border-left-color: var(--yellow); background: rgba(255,255,255,0.06); }
.fin-logout { margin-top: auto; text-align: left; background: none; border: none; color: rgba(255,255,255,0.45); font-family: 'Inter', sans-serif; font-size: 13px; padding: 11px 24px; cursor: pointer; }
.fin-logout:hover { color: var(--paper); }

.fin-main { padding: 32px 40px 60px; overflow-x: hidden; }
.fin-h1 { font-size: 26px; margin: 0 0 4px; font-weight: 600; }
.fin-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 8px; }
.fin-streak { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); font-weight: 600; margin-bottom: 20px; }
.fin-hero-number { font-size: 44px; font-weight: 600; line-height: 1; }
.fin-ledger-row { display: flex; border-top: 1px solid var(--line); margin-top: 22px; flex-wrap: wrap; }
.fin-ledger-cell { flex: 1; padding: 14px 18px; border-right: 1px solid var(--line); min-width: 130px; }
.fin-ledger-cell:last-child { border-right: none; }
.fin-ledger-label { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.fin-ledger-value { font-size: 21px; }

.fin-section { margin-top: 40px; }
.fin-section-title { font-size: 19px; margin: 0 0 14px; font-weight: 600; }
.fin-list-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.fin-list-row:last-child { border-bottom: none; }
.fin-empty { color: var(--ink-soft); font-size: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }

.fin-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 18px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.fin-form-preview { font-size: 12.5px; color: var(--ink-soft); padding-bottom: 22px; }
.fin-field { display: flex; flex-direction: column; gap: 5px; }
.fin-field label { font-size: 12px; color: var(--ink-soft); }
.fin-field input, .fin-field select {
  border: none; border-bottom: 1.5px solid var(--line); background: transparent;
  font-family: 'Inter', sans-serif; font-size: 14px; padding: 5px 2px; color: var(--ink); min-width: 130px;
}
.fin-field input:focus, .fin-field select:focus { outline: none; border-bottom-color: var(--ink); }
.fin-check-field { flex-direction: row; align-items: center; gap: 6px; }

.fin-btn {
  background: var(--ink); color: var(--paper); border: none; padding: 9px 16px;
  font-family: 'Inter', sans-serif; font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.fin-btn:hover { background: var(--yellow); color: var(--ink); }
.fin-icon-btn { background: none; border: none; color: var(--ink-soft); cursor: pointer; padding: 6px; display: inline-flex; }
.fin-icon-btn:hover { color: var(--ink); }

.fin-bar-track { background: var(--paper-dim); height: 7px; width: 100%; }
.fin-bar-fill { height: 100%; transition: width .3s ease; background: var(--yellow); }
.fin-bar-fill.complete { background: var(--yellow); }
.fin-bar-fill.in-progress { background: var(--ink); }

.fin-cat-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.fin-cat-name { width: 110px; font-size: 13.5px; }
.fin-cat-bar { flex: 1; height: 8px; background: var(--paper-dim); }
.fin-cat-fill { height: 100%; }
.fin-cat-value { width: 90px; text-align: right; font-size: 13.5px; font-variant-numeric: tabular-nums; }

.fin-freq-tag { font-size: 11px; padding: 2px 8px; border: 1px solid var(--line); color: var(--ink-soft); }

@keyframes finPop { 0% { transform: scale(0.5); opacity: 0.4; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.fin-inst-square {
  width: 22px; height: 22px; border: 1.5px solid var(--line); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  animation: finPop .2s ease; background: var(--paper);
}
.fin-inst-square.paid { background: var(--yellow); border-color: var(--yellow); }
.fin-inst-square svg, .fin-inst-square span { pointer-events: none; }
.fin-inst-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.fin-bill-check {
  width: 18px; height: 18px; border: 1.5px solid var(--line); display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; background: var(--paper); flex-shrink: 0;
}
.fin-bill-check.paid { background: var(--yellow); border-color: var(--yellow); }

.fin-badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 8px; }
.fin-badge-card { border: 1px solid var(--line); padding: 16px; display: flex; gap: 12px; align-items: flex-start; background: var(--paper); }
.fin-badge-card.locked { opacity: 0.45; }
.fin-badge-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--paper-dim); }
.fin-badge-icon.unlocked { background: var(--yellow); }
.fin-badge-icon svg { color: var(--ink-soft); }
.fin-badge-icon.unlocked svg { color: var(--ink); }
.fin-badge-name { font-size: 14px; margin-bottom: 3px; font-weight: 600; }
.fin-badge-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }

.fin-cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

@media (max-width: 760px) {
  .fin-app { grid-template-columns: 1fr; }
  .fin-sidebar { flex-direction: column; padding: 18px 0; }
  .fin-main { padding: 24px 18px 48px; }
  .fin-ledger-cell { flex: 1 1 45%; border-bottom: 1px solid var(--line); }
}
