/* ─────────────────────────────────────────────────
   clint·money — design system
   Editorial finance · refined · calm but distinctive
   ───────────────────────────────────────────────── */

:root {
  /* Color palette — deep forest as the anchor, warm cream paper, ink black */
  --paper: #faf7f2;
  --paper-2: #f4efe6;
  --ink: #1a1a1a;
  --ink-2: #2c2c2c;
  --muted: #8a8378;
  --line: #e8e1d4;
  --line-strong: #d4cab9;

  --primary: #1f473c;        /* deep forest */
  --primary-soft: #eaf0ed;
  --primary-dark: #143027;

  --accent: #c84a2b;         /* terracotta accent */
  --gold: #b8893a;
  --pos: #1f473c;
  --neg: #b13b27;

  --warn: #d18030;
  --good: #1f473c;

  /* Type scale */
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Geist', -apple-system, system-ui, sans-serif;
  --mono: 'Geist Mono', 'SF Mono', Menlo, monospace;

  /* Spacing */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(20,15,5,0.04), 0 1px 3px rgba(20,15,5,0.03);
  --shadow-md: 0 2px 8px rgba(20,15,5,0.05), 0 1px 3px rgba(20,15,5,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─── App Shell ─── */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  padding: 0 6px;
  color: var(--primary);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--paper);
  border-radius: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(31, 71, 60, 0.06);
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary);
  color: var(--paper);
}

.nav-item svg { stroke-width: 1.75; }

.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 14px 12px;
}

.sidebar-footer { margin-top: 16px; padding: 0 6px; }
.footer-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ─── Main column ─── */

.main {
  padding: 40px 56px 80px;
  max-width: 1400px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  gap: 24px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px 0;
}

.page-title {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
  line-height: 1.05;
}

.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.month-label {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  padding: 0 8px;
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--paper);
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--ink); background: rgba(0,0,0,0.02); text-decoration: none; }

.btn-x {
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.btn-x:hover { color: var(--neg); border-color: var(--neg); }

/* ─── Cards & grid ─── */

.grid-main {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-spend { grid-column: 1; grid-row: 1; }
.card-accounts { grid-column: 2; grid-row: 1; }
.card-recent { grid-column: 1; grid-row: 2; }
.card-upcoming { grid-column: 2; grid-row: 2; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.card-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
}

.card-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card-link:hover { color: var(--primary); text-decoration: none; }

/* ─── Big numbers (the hero) ─── */

.big-number {
  font-family: var(--serif);
  font-size: 72px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin: 8px 0 16px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.big-number .currency {
  font-size: 36px;
  font-weight: 400;
  color: var(--muted);
  margin-right: 4px;
}

.medium-number {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 4px 0;
}

.medium-number.pos { color: var(--pos); }
.medium-number.neg { color: var(--neg); }

/* ─── Pills & badges ─── */

.pill {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.pill-good {
  background: var(--primary-soft);
  color: var(--primary);
}

.pill-warn {
  background: rgba(209, 128, 48, 0.12);
  color: var(--warn);
}

.cadence-pill {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  background: var(--paper-2);
  border-radius: 4px;
  color: var(--ink-2);
}

.badge-recurring {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ─── Chart ─── */

.chart-wrap {
  height: 180px;
  margin: 8px 0;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}
.dot { display: inline-block; width: 8px; height: 2px; vertical-align: middle; margin-right: 6px; }
.dot-primary { background: var(--primary); }
.dot-muted { background: var(--muted); border-top: 1px dashed var(--muted); height: 0; }

/* ─── Account list ─── */

.account-list { list-style: none; padding: 0; margin: 0; }

.account-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.account-row:last-child { border-bottom: none; }
.account-row.highlight {
  background: linear-gradient(90deg, var(--primary-soft) 0%, transparent 100%);
  margin: 0 -24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--primary-soft);
}

.account-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 14px;
}
.icon-checking { background: #e7f0ee; color: var(--primary); }
.icon-credit { background: #fde9e3; color: var(--accent); }
.icon-cash { background: var(--primary); color: white; }
.icon-savings { background: #f3eee0; color: var(--gold); }
.icon-invest { background: #ebe6f0; color: #5a3f7a; }

.account-name { font-weight: 500; color: var(--ink); }
.account-amount {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink);
}
.account-amount.pos { color: var(--pos); }
.account-amount.neg { color: var(--neg); }

/* ─── Transaction list (dashboard) ─── */

.txn-list { list-style: none; padding: 0; margin: 0; }
.txn-row {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.txn-row:last-child { border-bottom: none; }

.txn-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.txn-merchant { color: var(--ink); font-weight: 500; }
.txn-cat {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.txn-amt {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink);
}
.txn-amt.pos { color: var(--pos); }

/* ─── Upcoming list ─── */

.upcoming-summary {
  font-size: 14px;
  color: var(--ink-2);
  margin: 0 0 14px;
}
.upcoming-list { list-style: none; padding: 0; margin: 0; }
.upcoming-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  font-size: 14px;
}
.upcoming-row:last-child { border-bottom: none; }
.up-date { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.up-merch { color: var(--ink); font-weight: 500; }
.up-amt { font-family: var(--mono); font-weight: 500; }

/* ─── Tables ─── */

.card-table { padding: 0; overflow: hidden; }

.txn-table {
  width: 100%;
  border-collapse: collapse;
}
.txn-table th, .txn-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.txn-table th {
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}
.txn-table tr:last-child td { border-bottom: none; }
.txn-table tr:hover td { background: rgba(31, 71, 60, 0.02); }
.txn-table .right { text-align: right; }
.txn-table .mono { font-family: var(--mono); font-size: 13px; }
.txn-table .muted { color: var(--muted); }
.txn-table .pos { color: var(--pos); }
.txn-table .neg { color: var(--neg); }

.cat-select {
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink-2);
  transition: background 0.3s ease;
}

/* ─── Filter bar ─── */

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--paper-2);
  border-radius: var(--r-md);
  align-items: center;
}
.filter-bar input, .filter-bar select {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  background: white;
  min-width: 140px;
}

/* ─── Forms ─── */

.card-form { padding: 24px; }
.card-form h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 14px;
}
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.form-row input, .form-row select {
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
  background: white;
  flex: 1;
  min-width: 140px;
}
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-stack input, .form-stack select {
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
  background: white;
}
.label-text {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* ─── Tabs ─── */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--paper-2);
  padding: 4px;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 24px;
}
.tab {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.tab.active {
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tab:hover { text-decoration: none; }

/* ─── Calendar ─── */

.card-cal { padding: 24px; }
.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cal-head h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  margin: 0;
}
.cal-nav {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--ink);
  font-size: 18px;
}
.cal-nav:hover { background: var(--paper-2); text-decoration: none; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.cal-dow {
  background: var(--paper-2);
  padding: 10px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.cal-cell {
  background: white;
  min-height: 84px;
  padding: 8px;
  font-size: 13px;
  position: relative;
}
.cal-cell.empty { background: var(--paper-2); }
.cal-cell.has-event { background: #f7f9f8; }
.cal-cell.today {
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  border-radius: 4px;
}
.cal-day-num {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink);
}
.cal-cell.today .cal-day-num { color: var(--primary); font-weight: 600; }
.cal-amt {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  margin-top: 2px;
}
.cal-merchants {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.cal-merchant {
  font-size: 9px;
  background: white;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
}

/* ─── Spending bars ─── */

.spend-summary {
  margin-bottom: 24px;
}
.bar-wrap {
  width: 120px;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

/* ─── Budgets ─── */

.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.budget-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.budget-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.budget-head h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}
.budget-bar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}
.budget-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 999px;
}
.budget-fill.warn { background: var(--warn); }
.budget-fill.over { background: var(--neg); }
.budget-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-family: var(--mono);
  flex-wrap: wrap;
  gap: 6px;
}
.budget-stats .pos { color: var(--pos); }
.budget-stats .neg { color: var(--neg); }

/* ─── Net worth ─── */

.nw-summary {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
  padding: 28px 32px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

/* ─── Misc ─── */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: white;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}
.empty-state h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  margin: 0 0 8px;
}
.empty-state p { color: var(--muted); margin: 0 0 20px; }
.empty-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.muted { color: var(--muted); }
.right { text-align: right; }
.mono { font-family: var(--mono); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.small { font-size: 12px; }
code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-2);
  padding: 1px 5px;
  border-radius: 3px;
}

.result-card {
  margin-top: 24px;
  border-color: var(--primary);
  background: var(--primary-soft);
}
.result-card h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 8px;
}
.errors {
  background: #fde9e3;
  padding: 12px 18px 12px 32px;
  border-radius: 6px;
  margin: 12px 0;
  color: var(--neg);
}

/* ─── Responsive ─── */

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 16px 20px;
    gap: 16px;
  }
  .sidebar-footer { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { padding: 7px 12px; font-size: 13px; }
  .nav-divider { display: none; }
  .main { padding: 24px 20px 60px; }
  .grid-main { grid-template-columns: 1fr; }
  .card-spend, .card-accounts, .card-recent, .card-upcoming { grid-column: 1; grid-row: auto; }
  .page-title { font-size: 28px; }
  .big-number { font-size: 48px; }
  .nw-summary { grid-template-columns: 1fr; }
}
/* ─── v0.2 additions: logout button ─── */

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.logout-btn:hover {
  background: rgba(177, 59, 39, 0.06);
  color: var(--neg);
  border-color: rgba(177, 59, 39, 0.3);
}

.logout-btn svg {
  stroke-width: 2;
}
