@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #0D1F2D;
  --panel: #15303F;
  --panel-light: #1C3B4C;
  --gold: #C9A227;
  --gold-soft: #E4C766;
  --parchment: #EDE6D8;
  --parchment-dim: #B9B0A0;
  --sage: #6FA287;
  --rust: #C1613F;
  --hairline: #2C4A5C;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--parchment);
  font-family: 'IBM Plex Sans', sans-serif;
  padding-bottom: 40px;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

.topbar {
  border-bottom: 1px solid var(--hairline);
  padding-top: 28px;
}
.brand-row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-name { font-family: 'Fraunces', serif; font-weight: 700; font-size: 30px; letter-spacing: -0.01em; }
.brand-tag { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--gold); letter-spacing: 0.08em; text-transform: uppercase; }

.tabs { display: flex; gap: 4px; margin-top: 22px; flex-wrap: wrap; }
.tabs a {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--parchment-dim);
  border-bottom: 2px solid transparent;
}
.tabs a.active { color: var(--parchment); font-weight: 600; border-bottom-color: var(--gold); }

.month-nav { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 22px 0 6px; }
.month-nav a {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: 6px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--parchment-dim);
}
.month-label { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; min-width: 150px; text-align: center; }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; }
.stat-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: 8px; padding: 16px 18px; flex: 1; min-width: 150px; }
.stat-card .label { font-size: 11px; color: var(--parchment-dim); text-transform: uppercase; letter-spacing: 0.06em; font-family: 'IBM Plex Mono', monospace; margin-bottom: 8px; }
.stat-card .value { font-family: 'IBM Plex Mono', monospace; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .value.positive { color: var(--sage); }
.stat-card .value.negative { color: var(--rust); }

.stamp {
  display: inline-block;
  border: 1.5px dashed var(--sage);
  border-radius: 10px;
  padding: 10px 18px;
  transform: rotate(-1.2deg);
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 20px;
}
.stamp.negative { border-color: var(--rust); }
.stamp .stamp-label { font-size: 10px; letter-spacing: 0.08em; color: var(--parchment-dim); text-transform: uppercase; display: block; }
.stamp .stamp-value { font-size: 20px; font-weight: 600; color: var(--sage); }
.stamp.negative .stamp-value { color: var(--rust); }

.grid-2 { display: flex; gap: 20px; flex-wrap: wrap; }
.panel { flex: 1 1 280px; background: var(--panel); border: 1px solid var(--hairline); border-radius: 8px; padding: 18px; }
.section-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); font-family: 'IBM Plex Mono', monospace; margin-bottom: 12px; }
.empty-note { color: var(--parchment-dim); font-size: 13px; padding: 20px 0; text-align: center; }

.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.cat-swatch { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.cat-name { color: var(--parchment-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-amount { font-family: 'IBM Plex Mono', monospace; }
.cat-bar-track { background: var(--ink); border-radius: 4px; height: 6px; margin-top: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 4px; }

.trend-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.trend-table th, .trend-table td { padding: 6px 8px; text-align: right; border-bottom: 1px dashed var(--hairline); font-family: 'IBM Plex Mono', monospace; }
.trend-table th:first-child, .trend-table td:first-child { text-align: left; font-family: 'IBM Plex Sans', sans-serif; color: var(--parchment-dim); }
.trend-table .inc { color: var(--sage); }
.trend-table .exp { color: var(--rust); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gold); color: var(--ink); border: none; border-radius: 6px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn.ghost { background: transparent; border: 1px solid var(--hairline); color: var(--parchment-dim); font-weight: 500; }
.btn.danger { background: transparent; border: 1px solid var(--rust); color: var(--rust); }

.row-between { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 14px; flex-wrap: wrap; gap: 10px; }

.tx-list { background: var(--panel); border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; }
.tx-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px dashed var(--hairline); }
.tx-row:last-child { border-bottom: none; }
.tx-date { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--parchment-dim); width: 46px; flex-shrink: 0; }
.tx-main { flex: 1; min-width: 0; }
.tx-desc { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: 11.5px; color: var(--parchment-dim); margin-top: 1px; }
.tx-amount { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; flex-shrink: 0; min-width: 96px; text-align: right; }
.tx-amount.inc { color: var(--sage); }
.tx-amount.exp { color: var(--rust); }
.tx-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 5px; color: var(--parchment-dim); font-size: 13px; }
.icon-btn:hover { color: var(--parchment); }

.empty-box { background: var(--panel); border: 1px dashed var(--hairline); border-radius: 8px; padding: 40px 20px; text-align: center; }

.form-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: 10px; padding: 22px; max-width: 480px; margin: 18px auto; }
.form-title { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600; margin-bottom: 18px; }
.type-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.type-toggle label {
  flex: 1; padding: 9px 0; border-radius: 6px; cursor: pointer; text-align: center;
  border: 1px solid var(--hairline); color: var(--parchment-dim); font-size: 13px; font-weight: 600;
}
.type-toggle input { display: none; }
.type-toggle input:checked + span { color: var(--gold); }
.type-toggle label.checked { border-color: var(--gold); background: rgba(201,162,39,0.12); color: var(--gold); }

.field-label { font-size: 11px; color: var(--parchment-dim); text-transform: uppercase; letter-spacing: 0.05em; font-family: 'IBM Plex Mono', monospace; margin: 12px 0 5px; }
.field-input, select.field-input, input.field-input {
  width: 100%; background: var(--ink); border: 1px solid var(--hairline); border-radius: 6px;
  padding: 9px 10px; color: var(--parchment); font-size: 13.5px; outline: none;
}
.field-input:focus { border-color: var(--gold); }

.nw-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--hairline); }
.nw-row label { font-size: 13px; color: var(--parchment-dim); }
.nw-row input { background: transparent; border: none; border-bottom: 1px solid var(--hairline); color: var(--parchment);
  font-family: 'IBM Plex Mono', monospace; font-size: 13.5px; width: 130px; text-align: right; outline: none; padding: 3px 2px; }
.nw-row input:focus { border-bottom-color: var(--gold); }

.toast { background: var(--panel-light); border: 1px solid var(--gold); border-radius: 6px; padding: 8px 14px; font-size: 12.5px; margin: 14px 0; }
.error-toast { border-color: var(--rust); }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: flex; align-items: center; gap: 6px; background: var(--ink); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 4px 6px 4px 10px; font-size: 12px;
}
.chip form { margin: 0; }
.chip button { background: none; border: none; color: var(--parchment-dim); cursor: pointer; font-size: 12px; padding: 0 2px; }
