/* === 原版设计风格 1:1 复刻 === */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9ef;
  --text: #1f2937;
  --text-soft: #64748b;
  --text-mute: #94a3b8;

  /* Primary palette */
  --primary: #3b82f6;
  --primary-d: #2563eb;
  --primary-soft: #eff6ff;

  --green: #10b981;
  --green-d: #059669;
  --green-soft: #ecfdf5;

  --red: #ef4444;
  --red-soft: #fef2f2;

  --amber: #f59e0b;
  --amber-soft: #fffbeb;

  --purple: #8b5cf6;
  --purple-soft: #f5f3ff;

  --cyan: #06b6d4;
  --cyan-soft: #ecfeff;

  --orange: #f97316;
  --orange-soft: #fff7ed;

  /* 侧栏：深色（设计稿特征） */
  --sidebar-bg: #1f2a3e;
  --sidebar-bg-2: #2a3650;
  --sidebar-text: #cbd5e1;
  --sidebar-text-soft: #94a3b8;
  --sidebar-hover: #334155;
  --sidebar-active: #3b82f6;

  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);

  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }

/* === 深色侧栏 === */
#sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(59,130,246,0.35);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { font-size: 14px; color: #fff; font-weight: 600; }
.brand-text span { font-size: 11px; color: var(--sidebar-text-soft); }

#nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-group-title {
  font-size: 11px; letter-spacing: .3px;
  color: var(--sidebar-text-soft); padding: 12px 16px 6px; font-weight: 500;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: var(--sidebar-text); font-size: 13px;
  margin: 0; transition: .15s; cursor: pointer; user-select: none;
  border-left: 3px solid transparent;
}
.nav-item .ic { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: rgba(59,130,246,0.18);
  color: #fff;
  border-left-color: var(--primary);
  font-weight: 500;
}

.sidebar-footer { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.06); }
#user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 4px 10px; }
#user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
#user-chip .uname { font-size: 12.5px; color: #fff; font-weight: 500; }
#user-chip .urole { font-size: 11px; color: var(--sidebar-text-soft); }
#logout-btn { color: var(--sidebar-text-soft) !important; }
#logout-btn:hover { color: #fff !important; background: var(--sidebar-hover) !important; }

/* === 主内容区 === */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

/* === 顶部条：左侧标题、右侧操作 === */
#topbar {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
#page-title { font-size: 19px; font-weight: 600; margin: 0; }
#topbar-actions { margin-left: auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#menu-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--text); }
#page-meta { display: flex; flex-direction: column; gap: 2px; }
#page-meta .sub { font-size: 12px; color: var(--text-mute); }

/* 内容区 */
#content { padding: 20px 24px 60px; flex: 1; }
#sidebar-backdrop { display: none; }

/* === 卡片 === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
}
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .sub { font-size: 12px; color: var(--text-mute); font-weight: 400; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.section-gap { margin-top: 16px; }

/* === KPI 统计卡（顶部 4px 彩色边） === */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 14px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
/* 顶部彩色边 — 通过 .stat-top-* 修饰符指定 */
.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary);
}
.stat-top-purple::before  { background: var(--purple); }
.stat-top-blue::before    { background: var(--primary); }
.stat-top-cyan::before    { background: var(--cyan); }
.stat-top-orange::before  { background: var(--orange); }
.stat-top-red::before     { background: var(--red); }
.stat-top-green::before   { background: var(--green); }
.stat-top-amber::before   { background: var(--amber); }
.stat-top-gray::before    { background: #9ca3af; }

.stat .label { font-size: 12.5px; color: var(--text-soft); display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 8px; letter-spacing: .2px; color: var(--text); }
.stat .delta { font-size: 12px; margin-top: 4px; }
.stat .sub-text { font-size: 12px; color: var(--text-soft); margin-top: 4px; }
.stat .ic {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
/* A股习惯：涨/盈利=红，跌/亏损=绿 */
.up { color: var(--red); }
.down { color: var(--green); }
.pos { color: var(--red); }
.neg { color: var(--green); }

/* === 顶部条「资产总值」大字 === */
.topbar-total {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  margin-right: 4px;
}
.topbar-total .label { font-size: 12px; color: var(--text-soft); }
.topbar-total .value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.topbar-total .delta { font-size: 12px; margin-top: 2px; }

/* 「刷新行情」按钮 (顶部条) */
.btn-refresh {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-size: 12.5px; font-weight: 600; border: none;
  box-shadow: 0 2px 6px rgba(59,130,246,0.25);
}
.btn-refresh:hover { background: var(--primary-d); }

/* 「已保存」绿色徽章 */
.saved-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-d);
  font-size: 12.5px; font-weight: 500; border: 1px solid #a7f3d0;
}
.saved-badge::before { content: "✓"; color: var(--green); font-weight: 700; }

/* === 表格 === */
.table-wrap {
  overflow-x: auto; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 13px; text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--surface-2);
  color: var(--text-soft); font-weight: 600; font-size: 12px;
  position: sticky; top: 0;
}
/* 表格条纹 */
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
}
.tag.green { background: var(--green-soft); color: var(--green-d); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.amber { background: var(--amber-soft); color: #b45309; }
.tag.blue { background: var(--primary-soft); color: var(--primary-d); }
.tag.gray { background: #f1f5f9; color: var(--text-soft); }

/* 「删除」按钮 — 原版用绿色而非红色 */
.btn-del {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-d);
  font-size: 12px; font-weight: 500; border: 1px solid #a7f3d0;
}
.btn-del:hover { background: #d1fae5; }

/* === 按钮 === */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 500; font-size: 13px;
  transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* === 表单 === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.field .hint { font-size: 11px; color: var(--text-mute); }
input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%; transition: .15s;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.input-affix { position: relative; }
.input-affix .affix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-mute); font-size: 12px; }

/* === 模态框 === */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 560px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease; margin: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-mute); line-height: 1; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* === Toast === */
#toast-root { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--primary); border-radius: var(--radius-sm);
  padding: 11px 15px; box-shadow: var(--shadow);
  font-size: 13px; min-width: 220px; animation: slidein .2s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* === 认证页 === */
#app.auth-mode { display: block; }
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 70% -10%, #e8edff 0%, transparent 60%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 32px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .logo {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.auth-brand h2 { font-size: 19px; }
.auth-brand p { margin: 0; font-size: 12px; color: var(--text-mute); }
.auth-switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-soft); }
.auth-note { font-size: 12px; color: var(--text-mute); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; margin-top: 14px; }

/* === Misc === */
.empty { text-align: center; padding: 40px 20px; color: var(--text-mute); }
.empty .big { font-size: 38px; margin-bottom: 8px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.muted { color: var(--text-mute); }
.text-sm { font-size: 12.5px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.chart-box { position: relative; width: 100%; }
.chart-box.h-sm { height: 220px; }
.chart-box.h-md { height: 300px; }
.chart-box.h-lg { height: 360px; }
.legend-inline { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-soft); margin-top: 10px; }
.legend-inline .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.kpi-row { display: flex; gap: 14px; flex-wrap: wrap; }
.kpi {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 3px; min-width: 130px; flex: 1 1 auto;
}
.kpi .k, .kpi > span { font-size: 12px; color: var(--text-soft); }
.kpi .v, .kpi > strong { font-size: 16px; font-weight: 700; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
input[type="checkbox"], input[type="radio"] { width: auto; }

/* === 思维导图 (投资计划) 1:1复刻 === */
.plan-mindmap { display: flex; align-items: flex-start; gap: 40px; padding: 20px 10px; min-height: 420px; }
.plan-root {
  flex-shrink: 0; align-self: center;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; font-weight: 700; font-size: 16px;
  padding: 18px 28px; border-radius: 14px;
  box-shadow: 0 8px 20px rgba(59,130,246,0.3);
  display: flex; align-items: center; gap: 8px;
}
.plan-branches { display: flex; flex-direction: column; gap: 16px; flex: 1; max-width: 520px; position: relative; }
.plan-branch { position: relative; }
.plan-branch::before {
  content: ""; position: absolute; left: -28px; top: 20px;
  width: 28px; height: 2px; background: #93c5fd;
}
.plan-branch::after {
  content: ""; position: absolute; left: -28px; top: 0; bottom: 0;
  width: 2px; background: #93c5fd;
}
.plan-branch:first-child::after { top: 20px; }
.plan-branch:last-child::after { bottom: calc(100% - 20px); }
.plan-branch:only-child::after { display: none; }
.plan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow);
}
.plan-card-title {
  display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 8px;
}
.plan-card-actions { margin-left: auto; display: flex; gap: 4px; }
.plan-card-actions span {
  width: 24px; height: 24px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; color: var(--text-soft);
  border: 1px solid var(--border); background: var(--surface-2);
}
.plan-card-actions span:hover { background: var(--primary-soft); color: var(--primary); }
.plan-card-actions span.del:hover { background: var(--red-soft); color: var(--red); }
.plan-card-body { font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.plan-card-body .empty-hint { color: var(--text-mute); font-size: 12.5px; }
.plan-card-body .empty-hint a { color: var(--primary); cursor: pointer; }

/* 现金说明 */
.cash-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; font-size: 13px; color: var(--text-soft); line-height: 1.7; margin-bottom: 16px; }
.cash-note strong { color: var(--text); display: block; margin-bottom: 6px; font-size: 14px; }

/* 流水金额颜色：收入红，支出绿 (A股习惯+截图确认) */
.flow-in { color: var(--red); font-weight: 500; }
.flow-out { color: var(--green); font-weight: 500; }

/* 投资思路表格 */
.idea-table th { background: var(--surface-2); font-size: 12px; color: var(--text-soft); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.idea-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
.idea-table tr:last-child td { border-bottom: none; }
.idea-table .status-done { color: var(--green); font-weight: 500; }
.idea-table .status-todo { color: var(--red); font-weight: 500; }

/* 分类标签色块 */
.cat-tag { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.cat-tag.attack { background: #dbeafe; color: #1e40af; }
.cat-tag.alloc  { background: #f3e8ff; color: #6b21a8; }
.cat-tag.defend { background: #ecfdf5; color: #065f46; }
.cat-tag.closed { background: #f1f5f9; color: #475569; }

/* 股票卡片 — 与总览 stat 卡片同尺寸 */
.stock-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stock-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stock-card.up::before { background: var(--red); }
.stock-card.down::before { background: var(--green); }
.stock-card-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stock-card-name .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.stock-card-price { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: .2px; }
.stock-card-pct { font-size: 13px; margin-top: 3px; }
.stock-card-info { font-size: 12.5px; color: var(--text-soft); margin-top: 6px; line-height: 1.5; }

/* 坏账、外债等状态标签 */
.status-tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
}
.status-tag.pending { background: var(--red-soft); color: var(--red); }
.status-tag.settled { background: var(--green-soft); color: var(--green-d); }
.status-tag.partial { background: var(--amber-soft); color: #b45309; }

/* 行内链接操作 */
.btn-action { color: var(--primary); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.btn-action:hover { text-decoration: underline; }
.btn-action.primary { color: var(--primary); }
.btn-action.danger { color: var(--red); }
.btn-action + .btn-action { margin-left: 6px; }

/* 明细表格操作按钮组 */
.action-group { display: flex; gap: 6px; align-items: center; }
.action-group .btn-sm { padding: 3px 10px; font-size: 11.5px; }

/* 目标提示 */
.target-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--amber); background: var(--amber-soft); padding: 3px 10px; border-radius: 999px; margin-left: 10px; }

/* 设置页面分组 */
.settings-group { margin-bottom: 24px; }
.settings-group-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.settings-row .sl { font-size: 13px; color: var(--text); }
.settings-row .sr { font-size: 12.5px; color: var(--text-soft); }
.settings-row .sr button { margin-left: 8px; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

/* === 响应式 === */
@media (max-width: 1180px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  #sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 50; }
  #menu-toggle { display: block; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  #content { padding: 18px 16px 50px; }
  #topbar { padding: 14px 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stat .value { font-size: 21px; }
  .topbar-total .value { font-size: 17px; }
}