/* ==================== CSS 变量默认值（由 themes.js 覆盖） ==================== */
:root {
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --bg-base:      #080d1a;
  --bg-card:      rgba(255,255,255,0.04);
  --bg-input:     rgba(255,255,255,0.07);
  --accent:       #00e5c3;
  --accent-dim:   rgba(0,229,195,0.12);
  --accent-2:     #f5a020;
  --text-1:       #f0f4ff;
  --text-2:       rgba(240,244,255,0.55);
  --text-3:       rgba(240,244,255,0.28);
  --border:       rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --income:       #34d399;
  --expense:      #fb923c;
  --glass:        rgba(255,255,255,0.025);
}

/* ==================== RESET ==================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.5s ease;
}

/* ==================== ZONE 1 — HERO ==================== */
#zone-hero {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 5rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.float-card {
  position: absolute;
  bottom: -120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  animation: floatUp linear infinite;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(var(--rot)); opacity: 0; }
  8%   { opacity: 0.65; }
  88%  { opacity: 0.45; }
  100% { transform: translateY(-110vh) rotate(calc(var(--rot) + 8deg)); opacity: 0; }
}

.float-card .fc-income { color: var(--income);  font-weight: 500; }
.float-card .fc-expense { color: var(--expense); font-weight: 500; }

.hero-glow {
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
}

.hero-header { text-align: center; margin-bottom: 3rem; }

.class-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px solid var(--accent-dim);
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.platform-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  backdrop-filter: blur(16px);
  transition: border-color 0.25s, transform 0.25s;
  cursor: default;
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: color 0.3s;
}

.stat-unit { font-size: 0.8rem; color: var(--text-2); margin-top: 0.4rem; }

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-3);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  animation: hintBounce 2.2s ease-in-out infinite;
  z-index: 1;
  transition: color 0.2s;
}

.scroll-hint:hover { color: var(--text-2); }

@keyframes hintBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(7px); }
}

/* ==================== ZONE 2 — LEDGER ==================== */
#zone-ledger {
  padding: 5rem 1.5rem 4rem;
  max-width: 980px;
  margin: 0 auto;
}

.section-label {
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.75rem 0 1.5rem;
}

.tab {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover  { border-color: var(--border-hover); color: var(--text-1); }
.tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Desktop table */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
}

.ledger-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.ledger-table td {
  padding: 0.9rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-2);
  vertical-align: middle;
}

.ledger-table tbody tr { transition: background 0.15s; }
.ledger-table tbody tr:hover td { background: var(--glass); }

/* Mobile cards */
.ledger-cards { display: none; flex-direction: column; gap: 0.75rem; }

.ledger-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.lc-top  { display: flex; justify-content: space-between; align-items: flex-start; }
.lc-title { font-size: 0.9rem; color: var(--text-1); font-weight: 500; flex: 1; padding-right: 1rem; }
.lc-meta  { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; flex-wrap: wrap; }
.lc-date  { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3); }

/* ==================== SHARED UI ATOMS ==================== */
.type-badge {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 500;
  white-space: nowrap;
}

.tag-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-input);
  font-size: 0.68rem;
  color: var(--text-3);
  margin: 1px;
}

.amount-income  { color: var(--income);  font-family: var(--font-mono); font-weight: 500; }
.amount-expense { color: var(--expense); font-family: var(--font-mono); font-weight: 500; }

.confirmed-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.dot-yes { background: var(--income); }
.dot-no  { background: var(--text-3); }

.empty-hint {
  text-align: center;
  padding: 3rem;
  color: var(--text-3);
  font-size: 0.85rem;
}

/* ==================== ADMIN ENTRY ==================== */
.admin-entry {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
}

.admin-entry-btn {
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: color 0.2s;
}
.admin-entry-btn:hover { color: var(--accent); }

/* ==================== ZONE 3 — ADMIN ==================== */
#zone-admin {
  display: none;
  padding: 3rem 1.5rem 6rem;
  max-width: 800px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}
#zone-admin.open { display: block; }

/* Auth box */
.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  margin: 0 auto 2rem;
}
.auth-box h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

/* Admin panel */
.admin-panel { display: none; }
.admin-panel.open { display: block; }

.admin-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  align-items: center;
}

/* Forms */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.form-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

.field-group { margin-bottom: 1rem; }

.field-label {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-bottom: 0.4rem;
  display: block;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.field-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
.field-input:focus { border-color: var(--accent); }
select.field-input { cursor: pointer; }
textarea.field-input { resize: vertical; min-height: 70px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.col-span-2 { grid-column: 1 / -1; }

.form-actions { display: flex; gap: 0.75rem; margin-top: 0.75rem; }
.form-actions .btn-primary { flex: 1; }

/* Pending list */
.pending-list { display: flex; flex-direction: column; gap: 0.75rem; }

.pending-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border-radius: 8px;
  gap: 1rem;
  flex-wrap: wrap;
}

.pending-info  { flex: 1; min-width: 0; }
.pending-title { font-size: 0.875rem; color: var(--text-1); font-weight: 500; }
.pending-meta  { font-size: 0.72rem; color: var(--text-3); font-family: var(--font-mono); margin-top: 0.25rem; }
.pending-btns  { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ==================== BUTTONS ==================== */
.btn-primary {
  padding: 0.7rem 1.2rem;
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  padding: 0.5rem 1.1rem;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--expense);
  border: 1px solid rgba(251,146,60,0.3);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(251,146,60,0.08); }

.btn-edit {
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-edit:hover { background: var(--accent-dim); }

.btn-confirm {
  padding: 0.4rem 0.9rem;
  background: rgba(52,211,153,0.10);
  color: var(--income);
  border: 1px solid rgba(52,211,153,0.25);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.btn-confirm:hover { background: rgba(52,211,153,0.20); }

/* ==================== ALERTS ==================== */
.alert {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
.alert-success { background: rgba(52,211,153,0.10); color: var(--income);  border: 1px solid rgba(52,211,153,0.20); }
.alert-error   { background: rgba(251,146,60,0.10);  color: var(--expense); border: 1px solid rgba(251,146,60,0.20); }

/* ==================== LOADING STATE ==================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.4s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 36px; height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== MODE INDICATOR ==================== */
.mode-badge {
  position: fixed;
  top: 1rem;
  right: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  z-index: 50;
  letter-spacing: 0.05em;
}

/* ==================== THEME SWITCHER ==================== */
.theme-switcher {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.7rem;
  color: var(--text-3);
  cursor: pointer;
  z-index: 100;
  backdrop-filter: blur(12px);
  transition: all 0.2s;
  letter-spacing: 0.05em;
  font-family: var(--font-body);
}
.theme-switcher:hover { color: var(--accent); border-color: var(--accent); }

/* ==================== SCROLL REVEAL ==================== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ==================== SIDEBAR ADMIN BUTTON ==================== */
.sidebar-admin {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-admin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.6rem;
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: padding 0.2s, opacity 0.2s, box-shadow 0.2s;
  box-shadow: -3px 0 20px rgba(0,0,0,0.3);
  text-decoration: none;
}
.sidebar-admin-btn:hover {
  opacity: 0.9;
  padding: 1rem 0.85rem;
  box-shadow: -6px 0 30px rgba(0,0,0,0.4);
}
.sidebar-admin-btn svg {
  width: 14px; height: 14px;
  writing-mode: horizontal-tb;
  flex-shrink: 0;
}

/* ==================== SITE FOOTER ==================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem 2rem;
  margin-top: 2rem;
}

.footer-inner {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
}

.footer-col-title {
  font-size: 0.68rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  font-family: var(--font-display);
}

.footer-col p, .footer-col a {
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.8;
  display: block;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--accent); }

.footer-divider {
  max-width: 980px;
  margin: 1.5rem auto 0;
  border: none;
  border-top: 1px solid var(--border);
}

.footer-bottom {
  max-width: 980px;
  margin: 1rem auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-bottom span {
  font-size: 0.7rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ==================== ADMIN LOGIN PAGE ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1.5rem;
  position: relative;
}

.login-back {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-3);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
}
.login-back:hover { color: var(--accent); }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(16px);
}

.login-icon {
  width: 44px; height: 44px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

/* ==================== ADMIN DASHBOARD PAGE ==================== */
.admin-page { min-height: 100vh; display: flex; flex-direction: column; }

.admin-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(16px);
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-logo {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-1);
}

.admin-logo span { color: var(--accent); }

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-body {
  flex: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Quick stats strip */
.admin-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.admin-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.admin-stat-label {
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.admin-stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

/* Admin tabs */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.admin-tab {
  padding: 0.5rem 1.1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text-2); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Slide-in form panel */
.form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  animation: slideDown 0.25s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
  .ledger-table    { display: none; }
  .ledger-cards    { display: flex; }
  .form-grid       { grid-template-columns: 1fr; }
  .form-actions    { flex-direction: column; }
  .footer-inner    { grid-template-columns: 1fr; gap: 1.25rem; }
  .footer-bottom   { flex-direction: column; align-items: flex-start; }
  .admin-stats-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid      { grid-template-columns: 1fr; max-width: 340px; margin: 0 auto; }
  .admin-actions   { flex-direction: column; align-items: stretch; }
  .sidebar-admin-btn { padding: 0.75rem 0.5rem; font-size: 0.65rem; }
  .admin-stats-strip { grid-template-columns: 1fr 1fr; }
}
