/* ═══════════════════════════════════════════════════════════
   记账本 · 移动优先样式
   设计目标:手机单手可用(底部 tab、≥44px 触控区、安全区适配),
   桌面端只是同一套布局的加宽版。
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #f4f5f7;
  --bg-elev: #ffffff;
  --bg-sunken: #eceef2;
  --text: #14181f;
  --text-dim: #6b7280;
  --text-faint: #9aa1ad;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --pos: #059669;
  --pos-soft: #e6f6f0;
  --neg: #dc2626;
  --neg-soft: #fdeaea;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 32px rgba(16, 24, 40, .16);
  --radius: 14px;
  --radius-sm: 10px;
  --tabbar-h: 58px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14;
    --bg-elev: #151a23;
    --bg-sunken: #1d232e;
    --text: #e8ecf2;
    --text-dim: #9aa3b2;
    --text-faint: #6b7484;
    --line: #262d39;
    --line-strong: #39414f;
    --accent: #5b8cff;
    --accent-soft: #17233d;
    --pos: #34d399;
    --pos-soft: #10251f;
    --neg: #f87171;
    --neg-soft: #2a1416;
    --warn: #fbbf24;
    --warn-soft: #2a2010;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/*
 * 滚动容器 = 文档本身(不再是 #appPage 100dvh + .app-main overflow:auto 的嵌套滚动)。
 *
 * 原因:iOS Safari 在「内层滚动容器」里的 input/textarea 经常点不出焦点、键盘弹不出来
 * —— 桌面 Chrome 一切正常,所以这个 bug 只在手机上暴露,以前一直查不到。
 * 现在:文档滚动、.app-header 用 sticky 吸顶、.tabbar 本来 fixed,视觉完全不变,
 * 但整类嵌套滚动引起的 iOS 输入问题都绕开了。
 * 注意:.app-main 的 scrollTop 因此恒为 0,switchView() 里改成 window.scrollTo(0,0)。
 */
html { height: 100%; }
body { min-height: 100dvh; }

body { overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
input, select, textarea {
  font-size: 16px;              /* ≥16px 防 iOS 聚焦时自动放大 */
  -webkit-user-select: text;    /* 防御:祖先若设了 user-select:none,iOS 上输入框会直接无法输入 */
  user-select: text;
  touch-action: manipulation;
}

.hidden { display: none !important; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.dim { color: var(--text-dim); }

/* ── 登录页 ─────────────────────────────────── */
#loginPage {
  display: none;
  min-height: 100dvh;
  padding: calc(24px + var(--sat)) 20px calc(24px + var(--sab));
  place-items: center;
}
#loginPage.active { display: grid; }
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 22px 24px;
  box-shadow: var(--shadow);
}
.login-box h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login-box .sub { margin: 0 0 22px; color: var(--text-dim); font-size: 13px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 16px; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700;
}
.login-note { margin-top: 16px; font-size: 12px; color: var(--text-faint); line-height: 1.6; }

/* ── 表单 ───────────────────────────────────── */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 6px; letter-spacing: .01em;
}
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%;
  padding: 12px 14px;
  min-height: 46px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

/* ── 按钮 ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  transition: opacity .15s, transform .06s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--text); color: var(--bg-elev); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-ghost {
  min-height: 34px; padding: 0 12px; font-size: 13px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px;
}
.btn-ghost[disabled] { opacity: .45; }
.btn-danger { background: var(--neg-soft); color: var(--neg); }
.btn-quiet { background: var(--bg-sunken); color: var(--text-dim); }

/* ── 应用骨架 ───────────────────────────────── */
#appPage { display: none; min-height: 100dvh; flex-direction: column; }
#appPage.active { display: flex; }

.app-header {
  position: sticky; top: 0; z-index: 30;   /* 文档滚动,头部吸顶 */
  flex: none;
  padding: calc(10px + var(--sat)) calc(16px + var(--sar)) 10px calc(16px + var(--sal));
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.app-header h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.header-right { display: flex; align-items: center; gap: 10px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-dim);
  background: var(--bg-sunken); padding: 5px 9px; border-radius: 999px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.status-dot.online { background: var(--pos); }
.status-dot.local { background: var(--warn); }
.status-dot.offline { background: var(--neg); }
.status-dot.syncing { background: var(--accent); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}

.app-main {
  flex: 1 1 auto;
  /* 不设 overflow:滚动交给文档(见文件头部说明),避免 iOS 嵌套滚动吃掉输入焦点 */
  padding: 14px calc(14px + var(--sar)) calc(20px + var(--tabbar-h) + var(--sab)) calc(14px + var(--sal));
}

/* ── 底部 tab ───────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex;
  padding: 4px calc(6px + var(--sar)) calc(4px + var(--sab)) calc(6px + var(--sal));
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1 1 0;
  min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-faint); font-size: 10.5px; font-weight: 600;
  border-radius: 12px; transition: color .15s, background .15s;
}
.tab .ico { font-size: 19px; line-height: 1; }
.tab.active { color: var(--accent); }
.tab.active .ico { transform: translateY(-1px); }
.tab-ai .ico { font-size: 21px; }
.tab-ai.active { color: #fff; background: linear-gradient(135deg, var(--accent), #7c3aed); }
.tab-ai.active .ico, .tab-ai.active span { color: #fff; }

/* ── 通用卡片 / 区块 ────────────────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.section { margin-top: 18px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 2px 9px;
}
.section-head h2 { margin: 0; font-size: 13px; font-weight: 700; color: var(--text-dim); letter-spacing: .02em; }
.empty { padding: 26px 14px; text-align: center; color: var(--text-faint); font-size: 13px; line-height: 1.7; }

/* ── 日历 ───────────────────────────────────── */
.month-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px;
}
.month-bar .title {
  flex: 1; text-align: center; font-size: 16px; font-weight: 700;
  padding: 8px; border-radius: var(--radius-sm);
}
.month-bar .nav-btn {
  width: 44px; height: 44px; flex: none;
  border-radius: var(--radius-sm); background: var(--bg-elev);
  border: 1px solid var(--line); font-size: 19px; color: var(--text-dim);
  display: grid; place-items: center;
}
.month-bar .nav-btn:active { background: var(--bg-sunken); }
.month-summary {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.month-summary > div {
  flex: 1; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
.month-summary .k { font-size: 11px; color: var(--text-dim); }
.month-summary .v { font-size: 16px; font-weight: 700; margin-top: 1px; letter-spacing: -.01em; }

.calendar { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg-sunken); }
.weekday { text-align: center; padding: 7px 0; font-size: 11px; font-weight: 700; color: var(--text-dim); }
.weekday.wend { color: var(--neg); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); }
.day {
  position: relative; min-height: 60px; padding: 5px 4px 4px;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1px;
  text-align: center; transition: background .12s;
}
.day:nth-child(7n) { border-right: none; }
.day:active { background: var(--bg-sunken); }
.day.pad { background: color-mix(in srgb, var(--bg-sunken) 55%, transparent); }
.day .d { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.day.today { background: var(--accent-soft); }
.day.today .d { color: var(--accent); font-weight: 800; }
.day .amt { font-size: 10.5px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; }
.day .amt.pos { color: var(--pos); }
.day .amt.neg { color: var(--neg); }
.day .dotmark { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.day .ai-mark { position: absolute; top: 3px; right: 4px; font-size: 8px; }

/* ── 列表行 ─────────────────────────────────── */
.row {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 13px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.row + .row { margin-top: 8px; }
.row .ico-badge {
  width: 36px; height: 36px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px;
  background: var(--bg-sunken);
}
.row .ico-badge.inc { background: var(--pos-soft); }
.row .ico-badge.exp { background: var(--neg-soft); }
.row .mid { flex: 1; min-width: 0; }
.row .t1 { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t2 { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.row .val { font-size: 15px; font-weight: 700; letter-spacing: -.01em; flex: none; }
.row .kill {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  color: var(--text-faint); display: grid; place-items: center; font-size: 15px;
}
.row .kill:active { background: var(--neg-soft); color: var(--neg); }
.ai-tag {
  display: inline-block; font-size: 10px; font-weight: 700; vertical-align: middle;
  padding: 1px 5px; border-radius: 5px; margin-left: 5px;
  background: var(--accent-soft); color: var(--accent);
}

/* ── 月报 ───────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.report-grid .card { padding: 13px; }
/* 上面 `.card + .card { margin-top: 12px }` 是给「纵向堆叠的卡片」留间距的。
   但在网格里,卡片是网格项,浏览器会拿"外边距盒"去撑满行高 —— 于是除第一张外,
   每张卡片都被下压 12px、可见高度也少 12px:总收入比总支出高 12px 且顶部错位
   (移动端 92.3 vs 80.3,桌面 112.5 vs 100.5)。网格里必须清掉这个 margin。 */
.report-grid .card + .card { margin-top: 0; }
.report-grid .full { grid-column: 1 / -1; }
.stat-k { font-size: 11.5px; color: var(--text-dim); font-weight: 600; }
.stat-v { font-size: 22px; font-weight: 800; letter-spacing: -.025em; margin-top: 2px; }
.stat-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.bar { height: 7px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; margin-top: 8px; display: flex; }
.bar span { display: block; height: 100%; }
.bar .b-pos { background: var(--pos); }
.bar .b-neg { background: var(--neg); }
.breakdown { margin-top: 4px; }
.bd-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.bd-row:last-child { border-bottom: none; }
.bd-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-row .c { font-size: 11px; color: var(--text-faint); flex: none; }
.bd-row .a { font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.ai-note { font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; color: var(--text); }

/* ── 理财 ───────────────────────────────────── */
.asset-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff; border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow-lg);
}
@media (prefers-color-scheme: dark) { .asset-card { background: linear-gradient(135deg, #1e2a44, #0d1220); } }
.asset-card .k { font-size: 12px; opacity: .7; }
.asset-card .v { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin: 3px 0 6px; font-variant-numeric: tabular-nums; }
.asset-card .s { font-size: 12.5px; opacity: .85; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.asset-card .s .pos { color: #6ee7b7; }
.asset-card .s .neg { color: #fca5a5; }

.hold-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hold-name { font-size: 14.5px; font-weight: 700; }
.code-pill { font-size: 10.5px; font-weight: 600; color: var(--text-dim); background: var(--bg-sunken); padding: 1px 6px; border-radius: 5px; margin-left: 5px; }
.hold-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.hold-val { font-size: 16px; font-weight: 700; text-align: right; flex: none; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.pill { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bg-sunken); color: var(--text-dim); }
.pill.on { background: var(--pos-soft); color: var(--pos); }
.pill.paused { background: var(--warn-soft); color: var(--warn); }

/* ── AI 记账 ────────────────────────────────── */
.ai-hero {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-lg);
}
.ai-hero h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.01em; }
.ai-hero p { margin: 0; font-size: 12.5px; opacity: .88; line-height: 1.6; }
.ai-hero .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.ai-hero .chip {
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); color: #fff;
}
.ai-hero .chip:active { background: rgba(255, 255, 255, .3); }

.ai-status {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-dim); margin-top: 10px;
}
.ai-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.ai-status .dot.ok { background: var(--pos); }
.ai-status .dot.bad { background: var(--neg); }
.ai-status .dot.busy { background: var(--accent); animation: pulse 1s infinite; }

.shots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.shot { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .x {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 12px; display: grid; place-items: center;
}
/* .add-shot 已删除:那个虚线「＋ 拍照/相册」方块和「📷 小票图片」按钮是同一个 ai-pick,
   重复且空占一行。选图统一走按钮,这里只留缩略图。 */

.ai-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px; background: var(--bg-elev); }
.ai-item + .ai-item { margin-top: 9px; }
.ai-item.lowconf { border-color: var(--warn); background: var(--warn-soft); }
.ai-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.ai-item-head .kind {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
}
.ai-item-head .kind.invest { background: #f3e8ff; color: #7c3aed; }
@media (prefers-color-scheme: dark) { .ai-item-head .kind.invest { background: #241a3a; color: #c4a9ff; } }
.ai-item-head .sp { flex: 1; }
.ai-item-head .conf { font-size: 10.5px; color: var(--text-faint); }
.ai-item .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ai-item .field { margin-bottom: 9px; }
.ai-item .field:last-child { margin-bottom: 0; }
.seg { display: flex; gap: 5px; }
.seg button {
  flex: 1; min-height: 40px; border-radius: 9px; font-size: 13px; font-weight: 600;
  background: var(--bg-sunken); color: var(--text-dim);
}
.seg button.on-inc { background: var(--pos-soft); color: var(--pos); }
.seg button.on-exp { background: var(--neg-soft); color: var(--neg); }
.seg button.on-buy { background: var(--pos-soft); color: var(--pos); }
.seg button.on-sell { background: var(--neg-soft); color: var(--neg); }
.seg button.on-div { background: var(--accent-soft); color: var(--accent); }

.ai-summary {
  font-size: 12.5px; color: var(--text-dim); background: var(--bg-sunken);
  border-radius: var(--radius-sm); padding: 10px 12px; line-height: 1.6;
}
.spinner {
  display: inline-block; width: 13px; height: 13px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.thinking { font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ── 弹层 / 底部抽屉 ────────────────────────── */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8, 11, 18, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px;
  max-height: 92dvh; overflow-y: auto;
  background: var(--bg-elev);
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(18px + var(--sab));
  box-shadow: var(--shadow-lg);
  animation: rise .2s cubic-bezier(.22, .9, .3, 1);
}
@keyframes rise { from { transform: translateY(14px); opacity: .6; } }
@media (min-width: 720px) {
  .sheet-mask { align-items: center; }
  .sheet { border-radius: 20px; margin: 0 16px; padding-bottom: 18px; }
}
.sheet-grab { width: 38px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 2px auto 12px; }
.sheet h3 { margin: 0 0 3px; font-size: 17px; letter-spacing: -.01em; }
.sheet .sub { margin: 0 0 14px; font-size: 12px; color: var(--text-dim); }
.sheet-actions { display: flex; gap: 9px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.toggle2 { display: flex; gap: 7px; margin-bottom: 14px; }
.toggle2 button { flex: 1; min-height: 44px; border-radius: var(--radius-sm); font-weight: 700; background: var(--bg-sunken); color: var(--text-dim); }

/* ── Toast ──────────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--sab) + 18px);
  transform: translate(-50%, 10px);
  z-index: 90; max-width: 88vw;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(20, 24, 31, .94); color: #fff;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow-lg);
}
@media (prefers-color-scheme: dark) { #toast { background: rgba(232, 236, 242, .95); color: #10131a; } }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 桌面端 ─────────────────────────────────── */
@media (min-width: 720px) {
  .tabbar { position: static; border-top: 1px solid var(--line); background: var(--bg-elev); backdrop-filter: none; }
  #appPage { display: none; }
  #appPage.active { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; }
  .app-main { padding-bottom: 24px; }
  .tabbar { order: 2; }
  .app-header, .app-main, .tabbar { max-width: 900px; margin: 0 auto; width: 100%; }
  .report-grid { grid-template-columns: repeat(3, 1fr); }
  .day { min-height: 72px; }
  #toast { bottom: 26px; }
}
