/* ==========================================================================
   潘晓峰个人财富管理系统 V2.0 · 设计系统
   ========================================================================== */
:root {
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #F1F4F8;
  --border: #E5EAF0;
  --border-strong: #D3DBE4;

  --text: #0F172A;
  --text-2: #475467;
  --text-3: #8A94A6;

  --brand: #123A5F;
  --brand-600: #0D2C49;
  --brand-500: #1B4F7E;
  --brand-soft: #EDF3F9;
  --brand-line: #C9DBEA;

  --gold: #A97C31;
  --gold-soft: #FBF4E6;

  --up: #D93025;      /* 涨 / 净资产增长 */
  --down: #0E9F6E;    /* 跌 / 净资产下降 */
  --income: #0E9F6E;
  --expense: #D93025;
  --income-soft: #E7F6EF;
  --expense-soft: #FDECEA;

  --warn: #B54708;
  --warn-soft: #FEF4E6;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --sh-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --sh: 0 1px 3px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .04);
  --sh-lg: 0 12px 40px rgba(16, 24, 40, .12);

  --sidebar-w: 244px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand); text-decoration: none; }
::selection { background: var(--brand); color: #fff; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.tiny { font-size: 11.5px; }
.sm { font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos { color: var(--up); }
.neg { color: var(--down); }
.inc { color: var(--income); }
.exp { color: var(--expense); }

/* ============ 启动占位 ============ */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--bg); z-index: 999; }
.boot-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
.boot-text { font-size: 13px; color: var(--text-3); }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.88); } }

/* ============ 布局 ============ */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--brand);
  color: #DCE7F2;
  display: flex; flex-direction: column;
  z-index: 60;
}
.sidebar-head { padding: 18px 16px 12px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(140deg, #2C6BA8, #123A5F);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 13.5px; color: #fff; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.brand-text i { font-size: 10.5px; font-style: normal; color: #8FB0CE; letter-spacing: .04em; }
.sidebar-close { display: none; margin-left: auto; color: #9FBBD6; font-size: 24px; line-height: 1; padding: 0 4px; }

.nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; letter-spacing: .08em; color: #6E92B5; padding: 12px 10px 5px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  font-size: 13.5px; color: #C3D6E8; position: relative;
  transition: background .14s, color .14s;
  text-align: left; width: 100%;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; font-weight: 500; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: #7FB2E0; }

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.09); display: flex; flex-direction: column; gap: 8px; }
.networth-mini {
  background: rgba(255,255,255,.08); border-radius: 10px; padding: 9px 12px;
  display: flex; flex-direction: column; gap: 1px;
}
.networth-mini span { font-size: 10.5px; color: #8FB0CE; letter-spacing: .04em; }
.networth-mini b { font-size: 15px; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 9px; width: 100%; text-align: left; transition: background .14s; }
.user-chip:hover { background: rgba(255,255,255,.07); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #2C6BA8; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta b { font-size: 12.5px; color: #fff; font-weight: 500; }
.user-meta i { font-size: 10.5px; font-style: normal; color: #8FB0CE; }
.sidebar-foot .btn-ghost { color: #B9CFE4; border-color: rgba(255,255,255,.16); font-size: 12.5px; }
.sidebar-foot .btn-ghost:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.28); color: #fff; }

.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 55; backdrop-filter: blur(2px); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(245,247,250,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 26px;
  display: flex; align-items: center; gap: 14px;
  min-height: 62px;
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.topbar-title span { font-size: 12px; color: var(--text-3); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.menu-btn { display: none; }

.content { padding: 22px 26px 80px; flex: 1; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--brand-500); color: var(--brand); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--sh-sm); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-soft { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.btn-soft:hover { background: #E2EDF7; color: var(--brand-600); }
.btn-danger { background: var(--surface); border-color: #F0C2BC; color: var(--expense); }
.btn-danger:hover { background: var(--expense-soft); border-color: var(--expense); color: var(--expense); }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 42px; font-size: 14.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); border: 1px solid transparent;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.danger:hover { background: var(--expense-soft); color: var(--expense); }

/* ============ 卡片 ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 11.5px; color: var(--text-3); }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 10px 12px; }
.card.flush .card-head { padding-bottom: 12px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* ============ 统计卡 ============ */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 15px 17px; box-shadow: var(--sh-sm); position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px; min-height: 104px;
}
.stat::after { content: ""; position: absolute; right: -18px; top: -18px; width: 72px; height: 72px; border-radius: 50%; background: var(--surface-3); opacity: .5; }
.stat-label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; z-index: 1; }
.stat-label svg { width: 14px; height: 14px; }
.stat-value { font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; z-index: 1; font-variant-numeric: tabular-nums; }
.stat-value .cur { font-size: 14px; font-weight: 500; color: var(--text-3); margin-right: 2px; }
.stat-foot { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; z-index: 1; margin-top: auto; }
.stat.hero { background: linear-gradient(135deg, #123A5F 0%, #1B4F7E 100%); border-color: transparent; color: #fff; }
.stat.hero::after { background: rgba(255,255,255,.07); }
.stat.hero .stat-label { color: #A9C6E0; }
.stat.hero .stat-value { color: #fff; }
.stat.hero .stat-value .cur { color: #A9C6E0; }
.stat.hero .stat-foot { color: #A9C6E0; }
.stat.hero .delta { background: rgba(255,255,255,.14); color: #fff; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--up); background: #FDECEA; }
.delta.down { color: var(--down); background: var(--income-soft); }
.delta.flat { color: var(--text-3); background: var(--surface-3); }

/* ============ 分段控件 ============ */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { padding: 5px 12px; border-radius: 7px; font-size: 12.5px; color: var(--text-2); transition: all .14s; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--sh-sm); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 500; font-size: 11.5px; color: var(--text-3);
  padding: 9px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; letter-spacing: .02em;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.r, table.tbl th.r { text-align: right; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; transition: opacity .14s; }
table.tbl tr:hover .row-actions { opacity: 1; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.tag.income { background: var(--income-soft); color: var(--income); }
.tag.expense { background: var(--expense-soft); color: var(--expense); }
.tag.gold { background: var(--gold-soft); color: var(--gold); }

/* ============ 表单 ============ */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], select, textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); outline: none;
  transition: border-color .14s, box-shadow .14s;
  font-size: 13.5px;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 74px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(27,79,126,.1); }
input::placeholder, textarea::placeholder { color: #A9B2C0; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' stroke='%238A94A6' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* 金额输入 */
.money-field { position: relative; }
.money-field .cur { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.money-field input { padding-left: 26px; font-variant-numeric: tabular-nums; }

/* ============ 空状态 ============ */
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 40px; height: 40px; opacity: .35; margin-bottom: 10px; }
.empty b { display: block; font-size: 13.5px; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.empty p { font-size: 12.5px; }

/* ============ 弹窗 ============ */
.modal-host { position: fixed; inset: 0; z-index: 200; display: none; }
.modal-host.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,23,42,.42); backdrop-filter: blur(2px); animation: fadeIn .16s ease; }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 60px);
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn .18s cubic-bezier(.2,.8,.3,1);
}
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-size: 15.5px; font-weight: 600; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; background: var(--surface-2); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }

/* ============ Toast ============ */
.toast-host { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #0F172A; color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--sh-lg);
  animation: toastIn .2s ease; max-width: 88vw; text-align: center;
}
.toast.ok { background: #0E7A55; }
.toast.err { background: #B42318; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ============ 图表 ============ */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 20;
  background: #0F172A; color: #fff; font-size: 12px; line-height: 1.6;
  padding: 7px 10px; border-radius: 8px; box-shadow: var(--sh);
  white-space: nowrap; opacity: 0; transition: opacity .12s;
}
.chart-tip.show { opacity: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.legend-item .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-item b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; margin-left: 2px; }
.legend-item i { font-style: normal; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 排行条 */
.rank-list { display: flex; flex-direction: column; gap: 12px; }
.rank-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 10px; align-items: baseline; }
.rank-name { font-size: 13px; display: flex; align-items: center; gap: 7px; min-width: 0; }
.rank-name .swatch { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.rank-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 3px; }
.rank-meta { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-3); display: flex; gap: 10px; }

/* ============ 其它组件 ============ */
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.section-title h2 { font-size: 15px; font-weight: 600; }
.section-title .rule { flex: 1; height: 1px; background: var(--border); }

.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--text-2); }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }

.banner { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); font-size: 12.5px; line-height: 1.65; border: 1px solid; }
.banner svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.banner.info { background: var(--brand-soft); border-color: var(--brand-line); color: #1B4F7E; }
.banner.warn { background: var(--warn-soft); border-color: #F5D6A8; color: var(--warn); }
.banner.gold { background: var(--gold-soft); border-color: #EEDCBB; color: #7C5A17; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; color: var(--text-2); transition: all .14s; }
.chip:hover { border-color: var(--brand-500); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.ai-output { white-space: pre-wrap; font-size: 13.5px; line-height: 1.85; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; max-height: 460px; overflow-y: auto; }
.chat-log { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.chat-msg { display: flex; gap: 9px; }
.chat-msg .who { width: 26px; height: 26px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; }
.chat-msg.me .who { background: var(--brand); color: #fff; }
.chat-msg.ai .who { background: var(--brand-soft); color: var(--brand); }
.chat-msg .bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 13px; font-size: 13.5px; line-height: 1.75; white-space: pre-wrap; max-width: 100%; }
.chat-msg.me .bubble { background: var(--brand-soft); border-color: var(--brand-line); }

/* ============ 响应式 ============ */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-21, .grid-12 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 268px;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.3,1);
  }
  .sidebar.open { transform: none; }
  .sidebar-mask.show { display: block; }
  .sidebar-close { display: block; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; min-height: 56px; }
  .topbar-title h1 { font-size: 16px; }
  .content { padding: 14px 14px 96px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .stat { min-height: 92px; padding: 13px 14px; }
  .stat-value { font-size: 21px; }
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .bottomnav { display: grid; }
  .modal { width: calc(100vw - 24px); max-height: calc(100vh - 40px); }
}
@media (max-width: 620px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { gap: 10px; }
  .stat-value { font-size: 19px; }
  table.tbl { font-size: 12.5px; }
  table.tbl th, table.tbl td { padding: 9px 10px; }
  .topbar-actions .btn span { display: none; }
}

/* 底部导航 */
.bottomnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px; color: var(--text-3); font-size: 10.5px; border-radius: 9px; }
.bottomnav button svg { width: 20px; height: 20px; }
.bottomnav button.active { color: var(--brand); }
.bottomnav button.active svg { stroke-width: 2; }

/* ============ 登录页 ============ */
.login-body { background: var(--bg); }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-side {
  background: linear-gradient(150deg, #123A5F 0%, #1B4F7E 55%, #2C6BA8 100%);
  color: #fff; padding: 48px 52px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.login-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(255,255,255,.05); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 56px; position: relative; z-index: 1; }
.login-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; background: rgba(255,255,255,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.login-brand .brand-mark svg { width: 24px; height: 24px; }
.login-brand b { display: block; font-size: 15.5px; font-weight: 600; }
.login-brand i { font-style: normal; font-size: 11px; color: #9DC0DE; letter-spacing: .06em; }
.login-side h2 { font-size: 30px; line-height: 1.5; font-weight: 600; letter-spacing: -.01em; position: relative; z-index: 1; }
.login-points { list-style: none; margin: 40px 0 auto; display: flex; flex-direction: column; gap: 13px; position: relative; z-index: 1; }
.login-points li { font-size: 13.5px; color: #C9DDF0; display: flex; align-items: center; gap: 9px; }
.login-points li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #7FB2E0; flex: none; }
.login-foot { font-size: 11.5px; color: #7FA3C4; position: relative; z-index: 1; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.login-form { width: 100%; max-width: 340px; }
.login-form h1 { font-size: 23px; font-weight: 600; letter-spacing: -.01em; }
.login-sub { font-size: 13px; color: var(--text-3); margin: 5px 0 26px; }
.login-form .field { margin-bottom: 15px; }
.field-with-icon { position: relative; display: block; }
.field-with-icon input { padding-right: 42px; }
.eye {
  --eye-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Cpath d='M2 12s3.6-6.5 10-6.5S22 12 22 12s-3.6 6.5-10 6.5S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='2.6'/%3E%3C/svg%3E");
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 7px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}
.eye:hover { background: var(--surface-3); }
.eye::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--eye-icon) center/contain no-repeat; mask: var(--eye-icon) center/contain no-repeat; }
.eye.on { --eye-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M3 3l18 18M10.6 10.6a2.6 2.6 0 0 0 3.5 3.6'/%3E%3Cpath d='M6.7 6.8C4 8.4 2 12 2 12s3.6 6.5 10 6.5c1.6 0 3-.4 4.2-1M17.9 16.2c1.6-1.1 2.7-2.4 3.4-3.2 0 0-3.6-6.5-10-6.5-.6 0-1.1 0-1.6.1'/%3E%3C/svg%3E"); }
.login-form .check { margin: 4px 0 18px; }
.login-error { background: var(--expense-soft); color: var(--expense); font-size: 12.5px; padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 14px; border: 1px solid #F5CCC7; }
.login-tip { margin-top: 20px; font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
.login-tip code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 11px; }

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-panel { padding: 40px 20px; align-items: flex-start; padding-top: 12vh; }
}

/* 打印 */
@media print {
  .sidebar, .topbar, .bottomnav, .row-actions { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
