/* ============ 设计令牌 ============ */
:root {
  --bg: #f3f7f6;
  --bg-grad:
    radial-gradient(900px 520px at -10% -10%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(800px 500px at 110% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(700px 600px at 50% 120%, rgba(167, 139, 250, 0.12), transparent 60%);
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-2: #eef3f2;
  --glass: rgba(255, 255, 255, 0.7);
  --text: #0f1f1a;
  --text-2: #44564f;
  --muted: #7b8c86;
  --border: rgba(15, 40, 30, 0.08);
  --accent: #10b981;
  --accent-2: #06b6d4;
  --accent-soft: #dcf7ec;
  --out: #f43f5e;
  --in: #10b981;
  --warn: #f59e0b;
  --track: rgba(15, 40, 30, 0.07);
  --hero: linear-gradient(135deg, #10b981 0%, #14b8a6 45%, #0ea5e9 100%);
  --shadow: 0 1px 2px rgba(15, 40, 30, 0.04), 0 10px 30px -12px rgba(15, 60, 45, 0.18);
  --shadow-lg: 0 2px 4px rgba(15, 40, 30, 0.04), 0 28px 56px -20px rgba(16, 120, 100, 0.35);
  --r: 16px;
  --r-lg: 24px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Inter, Roboto, sans-serif;
  --num: "SF Pro Display", "DIN Alternate", "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --top-h: 60px;
  --tab-h: 66px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a0f0e;
  --bg-grad:
    radial-gradient(900px 520px at -10% -10%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(800px 500px at 110% 0%, rgba(14, 165, 233, 0.12), transparent 55%),
    radial-gradient(700px 600px at 50% 120%, rgba(139, 92, 246, 0.12), transparent 60%);
  --surface: rgba(22, 30, 29, 0.82);
  --surface-solid: #141c1b;
  --surface-2: #1c2625;
  --glass: rgba(14, 20, 19, 0.72);
  --text: #e6efec;
  --text-2: #b0c0bb;
  --muted: #7f918b;
  --border: rgba(255, 255, 255, 0.07);
  --accent: #34d399;
  --accent-2: #22d3ee;
  --accent-soft: #10302a;
  --out: #fb7185;
  --in: #34d399;
  --track: rgba(255, 255, 255, 0.07);
  --hero: linear-gradient(135deg, #047857 0%, #0f766e 50%, #0369a1 100%);
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 12px 30px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--bg-grad), var(--bg); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--surface-solid); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.out { color: var(--out); }
.in { color: var(--in); }
.muted { color: var(--muted); }

/* ============ 顶栏 & 导航 ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px;
  background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; }
.brand img { border-radius: 9px; }
.tabs { margin-left: auto; display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 14px; transition: all 0.2s var(--ease); }
.tab svg { width: 18px; height: 18px; }
.tab[aria-current="page"] { background: var(--surface-solid); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.tab.fab-slot { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
[data-theme="dark"] .tab.fab-slot { color: #04201a; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--text-2); transition: background 0.2s, transform 0.15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.92); }
#themeBtn .moon { display: none; }
[data-theme="dark"] #themeBtn .sun { display: none; }
[data-theme="dark"] #themeBtn .moon { display: block; }

@media (max-width: 720px) {
  /* backdrop-filter 会让内部 fixed 元素相对顶栏定位，手机上去掉它，底部导航才能贴底 */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface-solid); }
  #themeBtn { margin-left: auto; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom);
    border-radius: 0; justify-content: space-around; align-items: center;
    background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--border);
  }
  .tab { flex: 1; flex-direction: column; gap: 2px; padding: 6px 0; font-size: 11px; background: none !important; box-shadow: none !important; }
  .tab svg { width: 22px; height: 22px; }
  .tab.fab-slot { flex: none; width: 56px; height: 56px; margin-top: -26px; border-radius: 50%; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important; box-shadow: 0 10px 24px -8px var(--accent) !important; color: #fff; }
  .tab.fab-slot span { display: none; }
  .tab.fab-slot svg { width: 26px; height: 26px; stroke-width: 2.4; }
}

/* ============ 布局 ============ */
main { max-width: 960px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); outline: none; }
@media (max-width: 720px) { main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px); } }
.view { animation: fadeUp 0.35s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.panel + .panel, .hero + .panel, .grid + .panel, .panel + .grid, .hero + .grid, .cols + .panel, .panel + .cols, .grid + .cols, .cols + .cols { margin-top: 14px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel h2 .sub { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted); }
.cols { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }
.cols > .panel + .panel { margin-top: 0; }

/* ============ Hero ============ */
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 20px 22px 22px; color: #fff; background: var(--hero); box-shadow: var(--shadow-lg); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { right: -70px; top: -90px; width: 260px; height: 260px; background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 70%); }
.hero::after { left: -60px; bottom: -120px; width: 240px; height: 240px; background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%); }
.hero-top { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; opacity: 0.95; }
.hero-top .nav { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, 0.14); }
.hero-top .nav:disabled { opacity: 0.35; cursor: default; }
.hero-top .nav svg { width: 16px; height: 16px; }
.hero-top .lbl { min-width: 7em; text-align: center; }
.hero .big-lbl { margin-top: 14px; font-size: 13px; opacity: 0.85; }
.hero .big { font-size: 40px; font-weight: 750; line-height: 1.1; margin: 2px 0 14px; }
.hero .big small { font-size: 20px; font-weight: 600; margin-right: 2px; opacity: 0.9; }
.hero .row { display: flex; gap: 26px; flex-wrap: wrap; font-size: 13px; }
.hero .row b { display: block; font-size: 18px; font-weight: 700; }
.hero .row span { opacity: 0.85; }
.budget { margin-top: 16px; position: relative; z-index: 1; }
.budget .bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.budget .bar i { display: block; height: 100%; border-radius: 99px; background: #fff; transition: width 0.7s var(--ease); }
.budget .bar i.over { background: #fecdd3; }
.budget .txt { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 6px; opacity: 0.9; }

/* ============ 通用控件 ============ */
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-2); gap: 2px; }
.seg button { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: all 0.2s var(--ease); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.seg.type button[aria-pressed="true"][data-type="out"] { color: var(--out); }
.seg.type button[aria-pressed="true"][data-type="in"] { color: var(--in); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 650; background: var(--surface-2); transition: transform 0.15s var(--ease), filter 0.2s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 20px -8px var(--accent); }
[data-theme="dark"] .btn.primary { color: #04201a; }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.danger { background: rgba(244, 63, 94, 0.12); color: var(--out); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid transparent;
  font-size: 16px; transition: border-color 0.2s, background 0.2s;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--surface-solid); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.6; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; height: 44px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; }
.search svg { color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid transparent; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .emo { font-size: 40px; display: block; margin-bottom: 8px; }

/* ============ 明细列表 ============ */
.day { margin-top: 14px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.day-head b { color: var(--text-2); font-weight: 650; }
.day-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.rec { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; transition: background 0.15s; }
.rec + .rec { border-top: 1px solid var(--border); }
.rec:hover { background: var(--surface-2); }
.ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; flex: none; background: color-mix(in srgb, var(--c) 16%, transparent); }
.rec .mid { flex: 1; min-width: 0; }
.rec .t { font-weight: 650; display: flex; gap: 6px; align-items: center; }
.rec .t .tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.rec .n { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec .a { font-weight: 700; font-size: 16px; }
.more { text-align: center; margin-top: 14px; }

/* ============ 统计 ============ */
.stat-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.period-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; font-weight: 650; }
.period-nav button { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); }
.period-nav button:disabled { opacity: 0.35; }
.period-nav .lbl { min-width: 8.5em; text-align: center; font-size: 14px; }
@media (max-width: 560px) { .period-nav { margin-left: 0; width: 100%; justify-content: space-between; } }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .grid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 750; margin-top: 2px; }
.kpi .d { font-size: 12px; margin-top: 2px; font-weight: 600; }
.kpi .d.up { color: var(--out); }
.kpi .d.down { color: var(--in); }

.donut-wrap { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: center; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }
.donut { width: 210px; height: 210px; }
.donut .seg { transition: stroke-dasharray 0.8s var(--ease); animation: segIn 0.9s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
@keyframes segIn { from { opacity: 0; } to { opacity: 1; } }
.donut-sub { font-size: 12px; font-weight: 500; fill: var(--muted); }
.donut-num { font-size: 22px; font-weight: 750; fill: var(--text); font-family: var(--num); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; width: 100%; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .pc { color: var(--muted); font-variant-numeric: tabular-nums; width: 3.6em; text-align: right; }
.legend .am { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 5em; text-align: right; }

.bars { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 210px; padding-top: 18px; }
.bars.dense { gap: 2px; }
.bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar i { display: block; width: 100%; max-width: 34px; min-height: 3px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 55%, transparent)); transform-origin: bottom; animation: grow 0.7s var(--ease) both; animation-delay: var(--d); opacity: 0.85; transition: opacity 0.2s; }
.bar.zero i { background: var(--track); }
.bar.now i { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 35%, transparent); }
.bar:hover i, .bar:focus-visible i { opacity: 1; }
.bar span { height: 16px; font-size: 11px; color: var(--muted); white-space: nowrap; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.avg-line { position: absolute; left: 0; right: 0; border-top: 1.5px dashed color-mix(in srgb, var(--text) 25%, transparent); pointer-events: none; }
.avg-line span { position: absolute; right: 0; top: -18px; font-size: 11px; color: var(--muted); background: var(--surface-solid); padding: 0 4px; border-radius: 4px; }
.bar-tip { min-height: 20px; font-size: 13px; color: var(--text-2); text-align: center; margin-top: 6px; }

.rank { display: grid; gap: 4px; }
.rank button { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px; text-align: left; width: 100%; }
.rank button:hover { background: var(--surface-2); }
.rank .mid { flex: 1; min-width: 0; }
.rank .line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.rank .line b { font-weight: 650; }
.rank .pbar { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.rank .pbar i { display: block; height: 100%; border-radius: 99px; background: var(--c); }

/* ============ 弹层 ============ */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(5, 15, 12, 0.45); backdrop-filter: blur(3px); animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 41; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-solid); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg);
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: up 0.35s var(--ease);
}
@media (min-width: 721px) { .sheet { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 26px; animation: pop 0.3s var(--ease); max-height: 88vh; } }
@keyframes up { from { transform: translate(-50%, 100%); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); } }
.grab { width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 10px; }
@media (min-width: 721px) { .grab { display: none; } }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 17px; flex: 1; }
.amt-box { display: flex; align-items: baseline; gap: 6px; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1.5px solid transparent; transition: border-color 0.2s; }
.amt-box:focus-within { border-color: var(--accent); }
.amt-box .cur { font-size: 22px; font-weight: 700; color: var(--muted); }
.amt-box input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 34px; font-weight: 750; font-family: var(--num); }
.amt-box .calc { font-size: 13px; color: var(--muted); white-space: nowrap; }
.amt-box.out input { color: var(--out); }
.amt-box.in input { color: var(--in); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin: 14px 0; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; font-size: 12px; color: var(--text-2); border: 1.5px solid transparent; transition: all 0.15s; }
.cat .ico { width: 42px; height: 42px; font-size: 21px; }
.cat[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--text); font-weight: 650; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pays { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions .primary { flex: 1; }

/* ============ 导入 ============ */
.preview { display: grid; gap: 8px; margin-top: 12px; }
.pv { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.pv input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.pv .info { min-width: 0; }
.pv .info .n { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv select { min-height: 32px; padding: 2px 6px; font-size: 13px; border-radius: 8px; background: var(--surface-solid); border: 1px solid var(--border); max-width: 120px; }
.pv .dup { font-size: 11px; color: var(--warn); font-weight: 650; }
.help { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.help ol { margin: 6px 0 0; padding-left: 20px; }
.help code { font-size: 12.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ============ 设置 ============ */
.set-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-row:first-of-type { padding-top: 0; }
.set-row .lbl { flex: 1; min-width: 150px; }
.set-row .lbl b { display: block; font-weight: 650; }
.set-row .lbl span { font-size: 13px; color: var(--muted); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cat-chips span { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); }
.cat-chips button { color: var(--muted); font-size: 15px; line-height: 1; padding-left: 2px; }

/* ============ Toast ============ */
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); transition: all 0.3s var(--ease); max-width: calc(100vw - 32px); display: flex; gap: 12px; align-items: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent-2); font-weight: 700; }
@media (max-width: 720px) { .toast { bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); } }

@media (max-width: 480px) {
  main { padding-top: 14px; }
  .hero .big { font-size: 34px; }
  .panel { padding: 15px; border-radius: 20px; }
  .cat-grid { grid-template-columns: repeat(5, 1fr); }
  .cat { font-size: 11px; }
  .cat .ico { width: 38px; height: 38px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
