/* 好品多门店日销看板 */
:root {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text-1: #191919;
  --text-2: #666666;
  --text-3: #8a8a8a;
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  --border: rgba(11, 11, 11, 0.08);
  --border-strong: rgba(11, 11, 11, 0.16);
  --ghost: rgba(11, 11, 11, 0.045);
  --accent: #257de0;
  --accent-hover: #1b64be;
  --accent-soft: rgba(37, 125, 224, 0.10);
  --danger: #d23a3b;
  --danger-hover: #b52d2e;
  --good: #006c10;
  --bad: #c43233;
  --warn-bg: #fff6df;
  --warn-fg: #6b4a00;
  --warn-border: #f2d38a;
  --error-bg: #fdeeee;
  --error-fg: #8e1f20;
  --ok-bg: #e9f6ec;
  --ok-fg: #14532d;
  --deemph: #c9ccd1;
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600;
  --s5: #ee7fac; --s6: #008a17; --s7: #6a4ce2; --s8: #ec4647;
  --seq-100: #cce3fd; --seq-200: #9dc8f7; --seq-300: #6aabf1; --seq-400: #338ced;
  --seq-500: #2370cd; --seq-600: #1757ac; --seq-700: #0e3d7e;
  --pair-a: #84b9f3;
  --pair-b: #1b64be;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-pop: 0 12px 40px rgba(16, 24, 40, 0.18);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface: #191919;
    --surface-2: #202020;
    --text-1: #efefef;
    --text-2: #9c9c9c;
    --text-3: #7a7a7a;
    --grid: #303030;
    --axis: #474747;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --ghost: rgba(255, 255, 255, 0.06);
    --accent: #338ced;
    --accent-hover: #519ced;
    --accent-soft: rgba(51, 140, 237, 0.16);
    --danger: #e24d4e;
    --danger-hover: #eb6263;
    --good: #53c556;
    --bad: #eb6263;
    --warn-bg: #2b2210;
    --warn-fg: #f3d27a;
    --warn-border: #5a4513;
    --error-bg: #2d1515;
    --error-fg: #f2a3a3;
    --ok-bg: #12261a;
    --ok-fg: #8fdca5;
    --deemph: #3b3e44;
    --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05;
    --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
    --pair-a: #1757ac;
    --pair-b: #6aabf1;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0b; --surface: #191919; --surface-2: #202020;
  --text-1: #efefef; --text-2: #9c9c9c; --text-3: #7a7a7a;
  --grid: #303030; --axis: #474747;
  --border: rgba(255, 255, 255, 0.08); --border-strong: rgba(255, 255, 255, 0.16); --ghost: rgba(255, 255, 255, 0.06);
  --accent: #338ced; --accent-hover: #519ced; --accent-soft: rgba(51, 140, 237, 0.16);
  --danger: #e24d4e; --danger-hover: #eb6263; --good: #53c556; --bad: #eb6263;
  --warn-bg: #2b2210; --warn-fg: #f3d27a; --warn-border: #5a4513;
  --error-bg: #2d1515; --error-fg: #f2a3a3; --ok-bg: #12261a; --ok-fg: #8fdca5;
  --deemph: #3b3e44;
  --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05;
  --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
  --pair-a: #1757ac; --pair-b: #6aabf1;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--text-1);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-1);
  cursor: pointer; white-space: nowrap; font-weight: 500; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--ghost); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--ghost); color: var(--text-1); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* ---- 分段选择 ---- */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; background: var(--surface); }
.seg button {
  border: 0; background: transparent; height: 28px; padding: 0 10px; border-radius: 6px;
  color: var(--text-2); cursor: pointer; white-space: nowrap; font-weight: 500;
}
.seg button:hover { color: var(--text-1); background: var(--ghost); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.seg-sm button { height: 24px; padding: 0 8px; font-size: 12px; }

/* ---- 顶栏 ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar-inner, .filters-inner, .main, .status-inner { max-width: 1480px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; min-width: 0; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--s6); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex: none;
}
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }

/* ---- 筛选 ---- */
.filters { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 56px; z-index: 20; }
.filters-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 10px; padding-bottom: 10px; }
.field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field > .field-label { color: var(--text-2); font-size: 13px; }
select, input[type="date"], input[type="text"], input[type="password"] {
  height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px;
  background: var(--surface); color: var(--text-1); min-width: 0;
}
select { padding-right: 28px; }
input[type="date"] { width: 148px; }
.range { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.status-bar { padding: 10px 0 0; }
.status-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--text-2); font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; border: 1px solid var(--border); background: var(--surface);
}
.chip-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-border); }
.chip-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; }
.chip svg { width: 14px; height: 14px; }

/* ---- 主体 ---- */
.main { padding-top: 16px; padding-bottom: 40px; transition: opacity .2s; }
.main.is-loading .card, .main.is-loading .kpis { opacity: .55; pointer-events: none; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 650; margin: 0; }
.card-head .sub { margin: 2px 0 0; color: var(--text-2); font-size: 12.5px; }
.card-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.span-2 { grid-column: span 2; }
.chart { width: 100%; height: var(--h, 300px); }
.chart-table { max-height: var(--h, 300px); overflow: auto; }
.empty-chart { display: flex; align-items: center; justify-content: center; height: var(--h, 300px); color: var(--text-3); }

/* ---- KPI ---- */
.kpis { display: grid; gap: 16px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: center; padding: 18px 22px; }
.hero-label { color: var(--text-2); font-size: 13.5px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.hero-scope { color: var(--text-3); font-size: 12.5px; }
.hero-value { font-size: 48px; font-weight: 650; letter-spacing: -0.5px; line-height: 1.15; margin: 4px 0 6px; white-space: nowrap; }
.hero-value .cur { font-size: 28px; font-weight: 600; margin-right: 2px; color: var(--text-2); }
.hero-sub { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 13px; }
.hero-spark { width: 100%; height: 92px; }
.hero-spark-wrap { min-width: 0; }
.hero-spark-cap { display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.seg-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin: 4px 0 10px; }
.seg-bar span { min-width: 3px; }
.seg-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.seg-legend li { display: inline-flex; align-items: center; gap: 6px; }
.seg-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.seg-legend b { color: var(--text-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.tile { padding: 14px 16px; }
.tile-label { color: var(--text-2); font-size: 13px; }
.tile-value { font-size: 22px; font-weight: 650; margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { color: var(--text-2); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.delta { font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--text-2); }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }

/* ---- 表格 ---- */
.tables-card { margin-top: 16px; padding-bottom: 8px; }
.tabs { display: inline-flex; gap: 4px; border-bottom: 0; }
.tabs button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-2); font-weight: 600; font-size: 14px;
}
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.table-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: 10px; }
table.data { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12.5px; }
table.data th, table.data td { padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data thead th {
  position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-weight: 600;
  color: var(--text-2); text-align: center; border-bottom: 1px solid var(--axis);
}
table.data thead tr:nth-child(2) th { top: 33px; }
table.data thead th.grp { border-top: 3px solid var(--grp, var(--axis)); color: var(--text-1); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.num.zero { color: var(--text-3); }
table.data td.num.neg { color: var(--bad); }
table.data th.computed, table.data td.computed { background: var(--ghost); }
table.data td.total-col { font-weight: 650; }
table.data .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.data thead .sticky-col { z-index: 3; background: var(--surface-2); }
table.data tbody tr:hover td { background-color: var(--ghost); }
table.data tbody tr:hover td.sticky-col { background: var(--surface-2); }
table.data tr.child td { background: var(--surface-2); color: var(--text-2); font-size: 12px; }
table.data tr.child td.sticky-col { background: var(--surface-2); }
table.data tfoot td {
  position: sticky; bottom: 0; background: var(--surface-2); font-weight: 650;
  border-top: 1px solid var(--axis); border-bottom: 0; z-index: 1;
}
table.data tfoot td.sticky-col { z-index: 2; background: var(--surface-2); }
table.data td.event { white-space: normal; min-width: 120px; max-width: 260px; font-size: 12px; color: var(--text-2); }
.expander {
  border: 0; background: transparent; cursor: pointer; color: var(--text-2); width: 20px; height: 20px;
  border-radius: 4px; margin-right: 4px; vertical-align: middle; padding: 0; line-height: 20px;
}
.expander:hover { background: var(--ghost); color: var(--text-1); }
.mini-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.mini-table th, .mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: left; }
.mini-table th { color: var(--text-2); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- 说明 ---- */
.defs { margin-top: 16px; color: var(--text-2); font-size: 13px; }
.defs summary { cursor: pointer; color: var(--text-1); font-weight: 600; }
.defs ul { margin: 10px 0 0; padding-left: 18px; }
.defs li { margin: 4px 0; }

/* ---- 空状态 ---- */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state h2 { margin: 0 0 8px; font-size: 18px; }
.empty-state p { margin: 0 0 18px; color: var(--text-2); }

/* ---- 弹窗 ---- */
dialog {
  border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text-1);
  box-shadow: var(--shadow-pop); width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
}
dialog::backdrop { background: rgba(10, 12, 16, 0.42); }
.dialog-sm { width: min(460px, calc(100vw - 32px)); }
.dialog-xl { width: min(1080px, calc(100vw - 32px)); }
.dialog-xl .dialog-inner { height: min(720px, calc(100vh - 48px)); }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.dialog-body { padding: 16px 18px; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.dialog-foot .spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px 14px; align-items: center; }
.form-grid > label, .form-grid > .label { color: var(--text-2); font-size: 13px; }
.form-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.form-row select { min-width: 180px; }
.hint { color: var(--text-3); font-size: 12.5px; }
.file-pick {
  display: flex; align-items: center; gap: 10px; border: 1.5px dashed var(--border-strong); border-radius: 10px;
  padding: 12px 14px; cursor: pointer; min-width: 0; background: var(--surface-2);
}
.file-pick:hover, .file-pick.drag { border-color: var(--accent); background: var(--accent-soft); }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.notice { border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 14px; }
.notice h3 { margin: 0 0 4px; font-size: 13.5px; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.notice-error { background: var(--error-bg); color: var(--error-fg); }
.notice-warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-border); }
.notice-info { background: var(--surface-2); color: var(--text-2); }
.preview { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.preview-head { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; padding: 12px 14px; background: var(--surface-2); }
.preview-head .big { font-size: 22px; font-weight: 650; }
.preview-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0; }
.preview-group { padding: 10px 14px; border-top: 1px solid var(--border); }
.preview-group h4 { margin: 0 0 4px; font-size: 12.5px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.preview-group h4 i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 1px 0; }
.kv span:last-child { font-variant-numeric: tabular-nums; }
.kv.computed span:last-child { font-weight: 650; }
.add-store { margin-top: 8px; }
.manage-tabs { margin-bottom: 12px; }
.coverage td.cell { text-align: center; padding: 0; }
.coverage .cell-btn {
  width: 100%; min-width: 92px; border: 0; background: transparent; padding: 6px 8px; cursor: pointer;
  font-variant-numeric: tabular-nums; color: var(--text-1); border-radius: 0;
}
.coverage .cell-btn:hover { background: var(--accent-soft); }
.coverage .cell-btn.missing { color: var(--warn-fg); background: var(--warn-bg); }
.coverage .cell-btn.missing:hover { filter: brightness(0.97); }
.store-name-input { width: 140px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; background: var(--ghost); color: var(--text-2); }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-danger { background: var(--error-bg); color: var(--error-fg); }
.confirm-msg { margin: 0; white-space: pre-line; }
.confirm-details { margin: 10px 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; max-height: 220px; overflow: auto; font-size: 12.5px; }
.confirm-details div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; font-variant-numeric: tabular-nums; }

/* ---- 提示 ---- */
.toasts { position: fixed; top: 68px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); color: var(--text-1); border: 1px solid var(--border-strong); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow-pop); font-size: 13.5px;
  animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--good); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- 图表提示框 ---- */
.tt { min-width: 180px; font-size: 12px; line-height: 1.55; }
.tt-title { color: var(--text-2); margin-bottom: 4px; }
.tt-total { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.tt-total b { font-size: 15px; }
.tt-total span, .tt-row span { color: var(--text-2); }
.tt-row { display: flex; align-items: center; gap: 8px; }
.tt-row i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tt-row b { min-width: 86px; text-align: right; font-variant-numeric: tabular-nums; }
.tt-note { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--grid); color: var(--text-2); max-width: 280px; white-space: normal; }

/* ---- 登录页 ---- */
.login-page { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-pop); padding: 28px 26px 22px;
}
.login-card h1 { font-size: 20px; margin: 22px 0 14px; font-weight: 650; }
.login-card input[type="password"] { width: 100%; height: 42px; font-size: 15px; margin-bottom: 12px; }
.login-card .btn { height: 42px; font-size: 15px; }
.form-error { background: var(--error-bg); color: var(--error-fg); border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; font-size: 13px; }
.login-foot { color: var(--text-3); font-size: 12px; margin: 16px 0 0; text-align: center; }

/* ---- 响应式 ---- */
@media (max-width: 1280px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .filters { position: static; }
}
@media (max-width: 640px) {
  .topbar-inner, .filters-inner, .main, .status-inner { padding-left: 16px; padding-right: 16px; }
  .topbar-inner { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 10px; }
  .top-actions { width: 100%; gap: 6px; }
  .top-actions .btn { padding: 0 10px; }
  .top-actions .btn:not(.btn-primary) { width: 38px; padding: 0; }
  .top-actions .btn:not(.btn-primary) .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .seg button { padding: 0 7px; }
  .range input[type="date"] { width: 140px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-value { font-size: 36px; }
  .hero-value .cur { font-size: 22px; }
  .tile-value { font-size: 18px; }
  .card { padding: 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .form-grid > label { margin-top: 6px; }
  .seg { flex-wrap: wrap; }
  .toasts { top: 12px; }
  .topbar { position: static; }
}
@media print {
  .topbar, .filters, .top-actions, .card-tools, dialog, .toasts { display: none !important; }
  body { background: #fff; }
}
