/* ============================================
   财富自由指南灯 · 全局样式
   设计哲学：cinematic dark · ritual aesthetic
   ============================================ */

/* ---------- Design tokens ---------- */
:root {
  /* surfaces */
  --bg-0: #07070b;
  --bg-1: #0a0a12;
  --bg-2: #11111c;
  --bg-3: #15162a;
  --bg-card: rgba(22, 22, 36, 0.72);
  --bg-card-strong: rgba(28, 28, 46, 0.88);
  --bg-input: rgba(255, 255, 255, 0.04);

  /* gold light system */
  --gold-core: #ffd166;
  --gold-warm: #ff8b3d;
  --gold-soft: rgba(255, 209, 102, 0.22);
  --gold-faint: rgba(255, 209, 102, 0.10);
  --gold-bloom: #fff4d6;

  /* state colors */
  --unlit: #2a2a3a;
  --ember: #ff5e3a;
  --ash: #5a4030;
  --income: #ffd166;
  --expense: #ff7a7a;

  /* text */
  --text-1: #f5f1e8;
  --text-2: #b9b6a8;
  --text-3: #7b7a8a;
  --text-4: #50505f;

  /* lines */
  --line-1: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.10);
  --line-focus: rgba(255, 209, 102, 0.55);

  /* fonts */
  --ff-serif-cn: 'Noto Serif SC', 'Cormorant Garamond', serif;
  --ff-serif-en: 'Cormorant Garamond', 'Noto Serif SC', serif;
  --ff-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ff-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 209, 102, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(108, 86, 255, 0.05), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 50%, var(--bg-0));
  background-attachment: fixed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--gold-soft); color: var(--gold-bloom); }

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
input { background: none; border: 0; outline: 0; }

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------- Starfield ---------- */
#starfield {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none;
  opacity: 0.55;
}

/* ---------- Layout ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(380px, 1fr) 2fr;
  height: 100vh; height: 100dvh;
  gap: 0;
}

/* ============================================
   左 · 账本面板
   ============================================ */
.ledger {
  display: flex; flex-direction: column;
  padding: 28px 26px 22px;
  gap: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--line-1);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015), transparent 30%),
    rgba(10, 10, 18, 0.55);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.ledger::-webkit-scrollbar { width: 6px; }
.ledger::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

/* Brand */
.brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}
.brand__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-faint), transparent 70%);
  filter: drop-shadow(0 0 12px rgba(255, 209, 102, 0.25));
  animation: pulse-glow 4s var(--ease-in-out) infinite;
}
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.22)); }
  50%      { filter: drop-shadow(0 0 16px rgba(255, 209, 102, 0.38)); }
}
.brand__title {
  font-family: var(--ff-serif-cn);
  font-size: 19px;
  letter-spacing: 0.02em;
  color: var(--text-1);
}
.brand__sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--text-3);
  transition: color .2s var(--ease-out), background .2s var(--ease-out);
}
.icon-btn:hover { color: var(--gold-core); background: var(--gold-faint); }
.icon-btn:focus-visible { outline: 2px solid var(--line-focus); outline-offset: 2px; }

/* ============================================
   Progress card · v2 · 水平双段 + 大数字 + 双段分项
   ============================================ */
.progress-card {
  position: relative;
  display: flex; flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.progress-card::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 100% 0%, rgba(255, 209, 102, 0.10), transparent 65%);
  pointer-events: none;
}

.progress-card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  z-index: 1;
}
.progress-card__title {
  font-family: var(--ff-serif-cn);
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 0.08em;
}
.progress-card__pct {
  font-family: var(--ff-mono);
  font-feature-settings: "tnum";
  display: inline-flex; align-items: baseline; gap: 1px;
}
.progress-card__pct #ring-pct {
  font-size: 20px;
  font-weight: 500;
  color: var(--gold-bloom);
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.35);
}
.progress-card__pct-sym {
  font-size: 11px;
  color: var(--text-3);
  margin-left: 2px;
  letter-spacing: 0.04em;
}

.progress-card__hero {
  display: flex; align-items: baseline; gap: 6px;
  line-height: 0.95;
  margin-top: 4px;
}
.progress-card__big {
  font-family: var(--ff-mono);
  font-size: 52px;
  font-weight: 500;
  font-feature-settings: "tnum";
  color: var(--gold-bloom);
  letter-spacing: -0.02em;
  text-shadow: 0 0 24px rgba(255, 244, 214, 0.12);
}
.progress-card__big-unit {
  font-family: var(--ff-serif-cn);
  font-size: 18px;
  color: var(--text-2);
  margin-left: 4px;
}
.progress-card__hero-sub {
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.progress-card__hero-sub em {
  font-style: normal;
  font-family: var(--ff-mono);
  font-feature-settings: "tnum";
  color: var(--text-2);
}

.dual-bar {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--r-pill);
  overflow: hidden;
  display: flex;
}
.dual-bar__asset, .dual-bar__income {
  height: 100%;
  width: 0%;
  transition: width .9s var(--ease-out);
}
.dual-bar__asset {
  background: linear-gradient(90deg, #7fb3e6, #9cc3ff);
  box-shadow: 0 0 8px rgba(156, 195, 255, 0.45);
}
.dual-bar__income {
  background: linear-gradient(90deg, var(--gold-warm), var(--gold-core));
  box-shadow: 0 0 8px var(--gold-soft);
}

.breakdown {
  display: flex; flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line-1);
}
.breakdown__row {
  display: flex; align-items: baseline;
  gap: 8px;
  font-size: 12px;
}
.breakdown__icon {
  width: 8px; height: 8px;
  border-radius: 50%;
  align-self: center;
  flex-shrink: 0;
}
.breakdown__icon--asset {
  background: #9cc3ff;
  box-shadow: 0 0 6px rgba(156, 195, 255, 0.55);
}
.breakdown__icon--income {
  background: var(--gold-core);
  box-shadow: 0 0 6px var(--gold-soft);
}
.breakdown__label {
  color: var(--text-2);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.breakdown__value {
  font-family: var(--ff-mono);
  font-feature-settings: "tnum";
  font-size: 15px;
  color: var(--text-1);
  font-weight: 500;
  margin-left: 2px;
}
.breakdown__unit {
  color: var(--text-3);
  font-size: 11px;
}
.breakdown__hint {
  margin-left: auto;
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--ff-mono);
  font-feature-settings: "tnum";
  text-align: right;
}
.breakdown__hint em {
  font-style: normal;
  color: var(--text-2);
}

/* Tx form */
.tx-form {
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  display: flex; flex-direction: column; gap: 12px;
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-input);
  border-radius: var(--r-md);
  padding: 3px;
  border: 1px solid var(--line-1);
}
.seg__btn {
  position: relative;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-3);
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: color .2s var(--ease-out), background .25s var(--ease-out);
}
.seg__btn:hover { color: var(--text-2); }
.seg__btn.is-active {
  background: rgba(255, 209, 102, 0.08);
  color: var(--gold-bloom);
  box-shadow: inset 0 0 0 1px var(--gold-soft), 0 0 18px rgba(255, 209, 102, 0.08);
}
.seg__btn[data-type="expense"].is-active {
  background: rgba(255, 122, 122, 0.08);
  color: #ffd1d1;
  box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.4), 0 0 18px rgba(255, 122, 122, 0.06);
}
.seg__dot { width: 6px; height: 6px; border-radius: 50%; }
.seg__dot--income  { background: var(--gold-core); box-shadow: 0 0 6px var(--gold-core); }
.seg__dot--expense { background: #ff7a7a; box-shadow: 0 0 6px #ff7a7a; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field__row {
  display: flex; align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  padding: 0 12px;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.field__row:focus-within {
  border-color: var(--line-focus);
  background: rgba(255, 209, 102, 0.04);
}
.field__prefix, .field__suffix {
  color: var(--text-3);
  font-family: var(--ff-mono);
  font-size: 13px;
  user-select: none;
}
.field__row input, .field input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  font-family: var(--ff-mono);
  font-size: 14px;
  color: var(--text-1);
}
.field--amount .field__row input {
  font-size: 22px;
  font-weight: 500;
  font-family: var(--ff-mono);
}
.field--amount .field__prefix { font-size: 16px; }
.field > input {
  padding: 11px 12px;
  background: var(--bg-input);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-family: var(--ff-mono);
  font-size: 13px;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.field > input:focus-visible {
  border-color: var(--line-focus);
  background: rgba(255, 209, 102, 0.04);
}
input::placeholder { color: var(--text-4); }
input::-webkit-calendar-picker-indicator { filter: invert(0.7) sepia(0.3) saturate(2) hue-rotate(-15deg); cursor: pointer; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

/* ============================================
   Date Picker · cinematic dark calendar
   ============================================ */
.date-input { position: relative; }
.date-input__trigger {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-family: var(--ff-mono);
  font-size: 13px;
  text-align: left;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.date-input__trigger:hover { border-color: var(--line-2); }
.date-input__trigger:focus-visible { outline: 2px solid var(--line-focus); outline-offset: 2px; }
.date-input__trigger svg { color: var(--text-3); flex-shrink: 0; }
.date-input__value {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.date-input.is-empty .date-input__value { color: var(--text-3); }
.date-input.is-open .date-input__trigger {
  border-color: var(--line-focus);
  background: rgba(255, 209, 102, 0.04);
}

.date-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: 280px;
  padding: 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255,255,255,0.04);
  animation: dpRise .22s var(--ease-out);
}
.date-popover[hidden] { display: none; }
@keyframes dpRise {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.date-popover__head {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 10px;
}
.date-popover__title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-family: var(--ff-serif-cn);
  font-size: 14px;
  color: var(--text-1);
  letter-spacing: 0.04em;
}
.date-popover__select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-family: var(--ff-sans);
  font-size: 11px;
}
.date-popover__select {
  appearance: none;
  min-width: 58px;
  height: 26px;
  padding: 0 8px;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  outline: 0;
  font-family: var(--ff-mono);
  font-size: 12px;
}
.date-popover__select:focus {
  border-color: var(--line-focus);
}
.date-popover__nav {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 13px;
  transition: color .15s var(--ease-out), background .15s var(--ease-out);
}
.date-popover__nav:hover { color: var(--gold-core); background: var(--gold-faint); }

.date-popover__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}
.date-popover__weekdays span {
  text-align: center;
  font-size: 10px;
  color: var(--text-4);
  letter-spacing: 0.06em;
  padding: 4px 0;
}
.date-popover__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-day {
  height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--text-2);
  transition: background .12s var(--ease-out), color .12s var(--ease-out), box-shadow .12s var(--ease-out);
}
.date-day:hover {
  background: rgba(255, 209, 102, 0.10);
  color: var(--text-1);
}
.date-day.is-other { color: var(--text-4); }
.date-day.is-today {
  color: var(--gold-core);
  box-shadow: inset 0 0 0 1px var(--gold-soft);
}
.date-day.is-selected {
  background: linear-gradient(135deg, var(--gold-warm), var(--gold-core));
  color: #2a1a02;
  font-weight: 600;
  box-shadow: 0 0 12px var(--gold-soft);
}
.date-day.is-disabled {
  color: var(--text-4);
  opacity: .45;
  cursor: not-allowed;
}
.date-day.is-disabled:hover {
  background: transparent;
  color: var(--text-4);
}
.date-popover__foot {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-1);
}
.date-popover__btn {
  padding: 5px 10px;
  font-size: 11.5px;
  color: var(--text-3);
  border-radius: var(--r-sm);
  transition: color .15s var(--ease-out), background .15s var(--ease-out);
}
.date-popover__btn:hover { color: var(--gold-core); background: var(--gold-faint); }

.field__hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--text-3);
}
.field__hint--error {
  color: var(--expense);
}

.scenario-presets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.scenario-presets__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.scenario-presets__hint {
  color: var(--text-3);
  font-size: 11px;
}
.scenario-presets__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.scenario-btn {
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  text-align: left;
  transition: border-color .18s var(--ease-out), background .18s var(--ease-out), transform .18s var(--ease-out);
}
.scenario-btn strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
}
.scenario-btn span {
  font-size: 11px;
  color: var(--text-3);
}
.scenario-btn:hover {
  border-color: var(--line-focus);
  background: rgba(255, 209, 102, 0.04);
  transform: translateY(-1px);
}

/* 设置面板里的 date picker · popover 上抛而非下落（避免被 modal 截断） */
.modal .date-popover { top: auto; bottom: calc(100% + 6px); }

/* Toggle (switch) · 设置面板用 */
.toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.toggle:hover { border-color: var(--line-2); }
.toggle__head { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toggle__title {
  font-size: 13px;
  color: var(--text-1);
  letter-spacing: 0.02em;
}
.toggle__hint {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.toggle input[type=checkbox] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}
.toggle__track {
  position: relative;
  width: 44px; height: 24px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
  transition: background .25s var(--ease-out), border-color .25s var(--ease-out), box-shadow .25s var(--ease-out);
  flex-shrink: 0;
}
.toggle__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform .25s var(--ease-out), background .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.toggle input:checked + .toggle__track {
  background: linear-gradient(135deg, var(--gold-warm), var(--gold-core));
  border-color: var(--gold-core);
  box-shadow: 0 0 14px var(--gold-soft);
}
.toggle input:checked + .toggle__track .toggle__thumb {
  transform: translateX(20px);
  background: #2a1a02;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle input:focus-visible + .toggle__track {
  outline: 2px solid var(--line-focus);
  outline-offset: 2px;
}

/* Primary button */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-family: var(--ff-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: transform .15s var(--ease-out), box-shadow .25s var(--ease-out);
  overflow: hidden;
}
.btn:focus-visible { outline: 2px solid var(--line-focus); outline-offset: 2px; }
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: linear-gradient(135deg, var(--gold-warm), var(--gold-core));
  color: #2a1a02;
  font-weight: 600;
  box-shadow:
    0 6px 24px rgba(255, 139, 61, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.btn--primary:hover {
  box-shadow:
    0 10px 32px rgba(255, 139, 61, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn--primary[disabled] { opacity: .6; cursor: not-allowed; }
.btn__shimmer {
  position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: shimmer 3.6s ease-in-out infinite;
}
@keyframes shimmer { 0%, 60% { left: -100%; } 100% { left: 160%; } }

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--line-2);
}
.btn--ghost:hover { color: var(--text-1); border-color: var(--line-focus); }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
}
.stat__label {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.stat__value {
  margin-top: 4px;
  font-family: var(--ff-mono);
  font-size: 18px;
  font-weight: 500;
  font-feature-settings: "tnum";
  color: var(--text-1);
}
.stat__value--income  { color: var(--gold-core); }
.stat__value--expense { color: #ff9c9c; }

/* Tx list */
.tx-list {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  padding: 12px;
}
.tx-list__head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px 6px 12px;
}
.tx-list__head h2 {
  font-family: var(--ff-serif-cn);
  font-size: 14px;
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.tx-list__count {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text-4);
}
.tx-list__items {
  flex: 1; min-height: 0;
  margin: 0; padding: 0;
  list-style: none;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 4px;
}
.tx-list__items::-webkit-scrollbar { width: 4px; }
.tx-list__items::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }
.tx-list__empty {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  flex: 1; padding: 30px 10px;
  text-align: center;
  color: var(--text-3);
}
.tx-list__empty p { margin: 0; font-size: 13px; }
.tx-list__hint { color: var(--text-4); font-size: 11.5px; margin-top: 6px !important; }
.tx-list.is-empty .tx-list__items { display: none; }
.tx-list.is-empty .tx-list__empty { display: flex; }

.tx-item {
  display: grid;
  grid-template-columns: 3px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 10px 0;
  border-radius: var(--r-sm);
  transition: background .2s var(--ease-out);
}
.tx-item:hover { background: rgba(255, 255, 255, 0.025); }
.tx-item__bar { width: 3px; height: 26px; border-radius: 2px; }
.tx-item--income  .tx-item__bar { background: linear-gradient(180deg, var(--gold-core), var(--gold-warm)); box-shadow: 0 0 6px var(--gold-soft); }
.tx-item--expense .tx-item__bar { background: linear-gradient(180deg, #ff9c9c, #ff5e3a); box-shadow: 0 0 6px rgba(255, 94, 58, 0.25); }
.tx-item__main { min-width: 0; }
.tx-item__note {
  font-size: 13px;
  color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-item__date {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-4);
  letter-spacing: 0.04em;
  margin-top: 1px;
}
.tx-item__amount {
  font-family: var(--ff-mono);
  font-size: 14px;
  font-weight: 500;
  font-feature-settings: "tnum";
}
.tx-item--income  .tx-item__amount { color: var(--gold-core); }
.tx-item--expense .tx-item__amount { color: #ff9c9c; }
.tx-item__del {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--text-4);
  border-radius: var(--r-sm);
  opacity: 0;
  transition: opacity .2s var(--ease-out), color .15s var(--ease-out), background .15s var(--ease-out);
}
.tx-item:hover .tx-item__del,
.tx-item:focus-within .tx-item__del { opacity: 1; }
.tx-item__del:hover { color: #ff7a7a; background: rgba(255, 122, 122, 0.10); }

/* ============================================
   右 · 人生方格 stage
   ============================================ */
.stage {
  position: relative;
  display: flex; flex-direction: column;
  height: 100%;
  padding: 22px 28px 16px;
  min-width: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 209, 102, 0.06), transparent 50%),
    transparent;
}
.stage__chrome {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  padding: 4px 2px;
}
.stage__title {
  display: flex; align-items: baseline; gap: 10px;
}
.stage__title-cn {
  font-family: var(--ff-serif-cn);
  font-size: 20px;
  color: var(--text-1);
  letter-spacing: 0.04em;
}
.stage__title-en {
  font-family: var(--ff-serif-en);
  font-size: 13px;
  font-style: italic;
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.stage__legend {
  display: flex; align-items: center; gap: 18px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.legend-swatch--lit   { background: var(--gold-core); box-shadow: 0 0 8px var(--gold-soft); }
.legend-swatch--unlit { background: var(--unlit); }
.legend-swatch--over  { background: var(--gold-bloom); box-shadow: 0 0 10px var(--gold-bloom); }

.stage__canvas-wrap {
  position: relative;
  flex: 1; min-height: 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-1);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 209, 102, 0.04), transparent 65%),
    linear-gradient(180deg, rgba(8, 8, 16, 0.5), rgba(4, 4, 12, 0.5));
  overflow: hidden;
  box-shadow:
    inset 0 0 1px var(--line-2),
    inset 0 0 60px rgba(0, 0, 0, 0.5);
}
.stage__canvas-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 80px, rgba(255,255,255,0.012) 80px 81px),
    repeating-linear-gradient(90deg,  transparent 0 80px, rgba(255,255,255,0.012) 80px 81px);
  pointer-events: none;
  mix-blend-mode: screen;
}
#grid { display: block; width: 100%; height: 100%; }
.stage__hint {
  position: absolute; left: 16px; bottom: 12px;
  font-family: var(--ff-serif-en);
  font-style: italic;
  font-size: 12px;
  color: var(--text-4);
  pointer-events: none;
  letter-spacing: 0.06em;
}
.stage__footer {
  margin-top: 10px;
  padding: 2px 4px;
  font-size: 11px;
  color: var(--text-4);
  letter-spacing: 0.06em;
}

/* ============================================
   Overlay & Modal
   ============================================ */
.overlay {
  position: fixed; inset: 0;
  z-index: 100;
  display: grid; place-items: center;
  background: rgba(4, 4, 10, 0.7);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  animation: fade .35s var(--ease-out);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay[hidden] { display: none; }
.modal {
  width: min(440px, calc(100% - 32px));
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line-2);
  box-shadow:
    0 20px 80px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: rise .55s var(--ease-out) both;
  /* overflow visible 以便 date picker popover 浮出 */
}
.modal__head {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.modal__head {
  padding: 26px 26px 8px;
  background: radial-gradient(ellipse at 80% 0%, var(--gold-faint), transparent 60%);
}
.modal__head h2 {
  font-family: var(--ff-serif-cn);
  font-size: 22px;
  color: var(--text-1);
  letter-spacing: 0.02em;
}
.modal__head p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}
.modal__head strong { color: var(--gold-core); font-weight: 500; }
.modal__body {
  padding: 18px 26px 6px;
  display: flex; flex-direction: column; gap: 14px;
}
.modal__foot {
  padding: 16px 26px 22px;
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ============================================
   Freedom Banner (彩蛋) · 多层波纹 + 中央光辉 + 子标题
   ============================================ */
.freedom-banner {
  position: fixed; inset: 0;
  z-index: 200;
  display: grid; place-items: center;
  pointer-events: none;
  overflow: hidden;
}
.freedom-banner[hidden] { display: none; }

.freedom-banner__veil {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255, 209, 102, 0.22), rgba(6, 4, 0, 0.88) 60%);
  opacity: 0;
  animation: veil-in 1.2s var(--ease-out) forwards;
}
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }

.freedom-banner__ripple {
  position: absolute; top: 50%; left: 50%;
  width: 6px; height: 6px;
  border: 1.5px solid rgba(255, 209, 102, 0.55);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  will-change: transform, opacity;
  animation: ripple-out 5.5s var(--ease-out) forwards;
}
.freedom-banner__ripple:nth-of-type(1) { animation-delay: 0.20s; }
.freedom-banner__ripple:nth-of-type(2) { animation-delay: 0.70s; }
.freedom-banner__ripple:nth-of-type(3) { animation-delay: 1.20s; }
.freedom-banner__ripple:nth-of-type(4) { animation-delay: 1.85s; }
.freedom-banner__ripple:nth-of-type(5) { animation-delay: 2.60s; }
@keyframes ripple-out {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0; border-width: 1.8px; }
  10%  { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(360); opacity: 0; border-width: 0.4px; }
}

.freedom-banner__inner {
  position: relative; z-index: 1;
  text-align: center;
  animation: free-rise 1.6s var(--ease-out) both;
  animation-delay: 0.55s;
}
@keyframes free-rise {
  from { opacity: 0; transform: translateY(22px) scale(0.93); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    filter: blur(0); }
}

.freedom-banner__eyebrow {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.7em;
  color: rgba(255, 209, 102, 0.78);
  margin-bottom: 18px;
  text-shadow: 0 0 16px var(--gold-soft);
  text-indent: 0.7em;
}
.freedom-banner__word {
  font-family: var(--ff-serif-en);
  font-size: 200px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--gold-bloom);
  line-height: 1;
  /* 用 filter: drop-shadow 而非 text-shadow · 可走 GPU compositing 避免重 paint */
  filter:
    drop-shadow(0 0 18px var(--gold-core))
    drop-shadow(0 0 48px rgba(255, 139, 61, 0.45));
  animation: word-glow 3.6s ease-in-out infinite;
  will-change: opacity;
}
@keyframes word-glow {
  0%, 100% { opacity: 0.92; }
  50%      { opacity: 1.0;  }
}
.freedom-banner__zh {
  margin-top: 14px;
  font-family: var(--ff-serif-cn);
  font-size: 24px;
  color: var(--text-1);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  text-shadow: 0 0 14px var(--gold-faint);
}
.freedom-banner__sub {
  margin-top: 26px;
  font-family: var(--ff-serif-cn);
  font-size: 14px;
  color: var(--text-2);
  letter-spacing: 0.18em;
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  .freedom-banner__ripple { animation: none; display: none; }
  .freedom-banner__word { animation: none; }
}

/* ============================================
   Responsive / motion safety
   ============================================ */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ledger { max-height: 50vh; border-right: 0; border-bottom: 1px solid var(--line-1); }
  .stage { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .05s !important;
  }
  .brand__mark { animation: none; }
  .btn__shimmer { display: none; }
}
