/* 配色沿用「二猫云监察使」iOS 模版（src/styles/tokens.css）：浅色为主，跟随系统深色 */
:root {
  color-scheme: light;
  --surface-0: #f2f2f7;
  --surface-1: #ffffff;
  --surface-2: rgba(118, 118, 128, 0.12);
  --border: rgba(60, 60, 67, 0.12);
  --text-primary: #1c1c1e;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --text-muted: rgba(60, 60, 67, 0.36);
  --series-1: #007aff;   /* 本月 */
  --series-2: #8e8e93;   /* 上月 */
  --good: #34c759;
  --bad: #ff3b30;
  --warn: #ff9500;
  --grid: rgba(60, 60, 67, 0.1);
  --hairline: rgba(60, 60, 67, 0.18);
  --control-hover: rgba(118, 118, 128, 0.2);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.05);
  --bar-bg: rgba(242, 242, 247, 0.78);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) {
    color-scheme: dark;
    --surface-0: #000000;
    --surface-1: #1c1c1e;
    --surface-2: rgba(118, 118, 128, 0.24);
    --border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-muted: rgba(235, 235, 245, 0.32);
    --series-1: #0a84ff;
    --series-2: #8e8e93;
    --good: #30d158;
    --bad: #ff453a;
    --warn: #ff9f0a;
    --grid: rgba(255, 255, 255, 0.08);
    --hairline: rgba(84, 84, 88, 0.6);
    --control-hover: rgba(118, 118, 128, 0.36);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --bar-bg: rgba(0, 0, 0, 0.72);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --surface-0: #000000;
  --surface-1: #1c1c1e;
  --surface-2: rgba(118, 118, 128, 0.24);
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-muted: rgba(235, 235, 245, 0.32);
  --series-1: #0a84ff;
  --series-2: #8e8e93;
  --good: #30d158;
  --bad: #ff453a;
  --warn: #ff9f0a;
  --grid: rgba(255, 255, 255, 0.08);
  --hairline: rgba(84, 84, 88, 0.6);
  --control-hover: rgba(118, 118, 128, 0.36);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --bar-bg: rgba(0, 0, 0, 0.72);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* 别让组件自己的 display 盖掉 hidden */
html, body { margin: 0; height: 100%; }
body {
  background: var(--surface-0);
  color: var(--text-primary);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}
.titlebar { height: 38px; -webkit-app-region: drag; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px 40px; }

header.bar {
  display: flex; align-items: baseline; gap: 12px;
  flex-wrap: wrap; margin-bottom: 18px;
}
header.bar h1 { font-size: 19px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
header.bar .month { color: var(--text-secondary); font-size: 14px; }
header.bar .spacer { flex: 1; }

button {
  -webkit-app-region: no-drag;
  font: inherit; font-size: 13px;
  padding: 6px 12px; border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary);
  cursor: pointer;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: default; }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-secondary);
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--bad); }
.dot.live { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 14px;
}

/* ---- 主数字 ---- */
.hero { display: flex; gap: 32px; align-items: flex-end; flex-wrap: wrap; }
.hero .label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.hero .value {
  font-size: 44px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.hero .sub { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.delta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 3px 9px; border-radius: 7px;
}
.delta.up { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.delta.down { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.delta.flat { color: var(--text-muted); background: var(--surface-2); }

.progress { margin-top: 18px; }
.progress .track { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress .fill { height: 100%; border-radius: 4px; background: var(--series-1); transition: width .4s ease; }
.progress .cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---- 指标格 ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.tile .k { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 7px; }
.tile .v { font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .c { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile .c .up { color: var(--good); font-weight: 600; }
.tile .c .down { color: var(--bad); font-weight: 600; }

/* ---- 图表 ---- */
.chart-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.chart-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.chart-head .hint { font-size: 12px; color: var(--text-muted); }
.legend { display: flex; gap: 14px; margin-left: auto; font-size: 12.5px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.swatch.dashed { background: none; border-top: 3px dashed var(--series-2); height: 0; }
svg { display: block; width: 100%; overflow: visible; }
.tip {
  position: fixed; pointer-events: none; z-index: 50;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); opacity: 0; transition: opacity .1s;
  font-variant-numeric: tabular-nums; min-width: 150px;
}
.tip.on { opacity: 1; }
.tip .t { font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.tip .r { display: flex; justify-content: space-between; gap: 16px; color: var(--text-secondary); }
.tip .r b { color: var(--text-primary); font-weight: 600; }

/* ---- 底部 ---- */
details.panel { margin-top: 6px; }
details.panel > summary {
  cursor: pointer; font-size: 13px; color: var(--text-secondary);
  padding: 9px 0; list-style: none; user-select: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: '▸ '; color: var(--text-muted); }
details.panel[open] > summary::before { content: '▾ '; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--text-secondary); }
input {
  font: inherit; padding: 7px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-0); color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
input:focus { outline: 2px solid var(--series-1); outline-offset: -1px; }
.note { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.note code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--border); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--text-secondary); font-weight: 500; font-size: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13.5px; line-height: 1.8; }

/* ---- 指标切换 ---- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filters button {
  font-size: 12.5px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface-0); color: var(--text-secondary);
}
.filters button[aria-pressed='true'] {
  background: var(--series-1); border-color: var(--series-1); color: #fff; font-weight: 600;
}
.swatch.sq { width: 10px; height: 10px; border-radius: 2px; }

/* ---- 全指标对比表 ---- */
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.cmp th, table.cmp td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: right; }
table.cmp th:first-child, table.cmp td:first-child { text-align: left; color: var(--text-secondary); }
table.cmp thead th { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
table.cmp tbody tr:last-child td { border-bottom: none; }
table.cmp tbody tr.lead td { font-weight: 600; }
table.cmp td.n { color: var(--text-primary); }
table.cmp td.d { font-weight: 600; }
table.cmp td.d.up { color: var(--good); }
table.cmp td.d.down { color: var(--bad); }
table.cmp td.d.flat { color: var(--text-muted); font-weight: 400; }


/* ---- 异常天提示 ---- */
.banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: color-mix(in srgb, var(--warn) 10%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
}
.banner .ico { flex: none; font-size: 15px; line-height: 1.5; }
.banner .body { flex: 1; font-size: 13px; line-height: 1.6; }
.banner .body b { color: var(--text-primary); }
.banner .body .why { color: var(--text-secondary); }
.banner button { flex: none; white-space: nowrap; }
tr.out td { opacity: 0.55; }
tr.out td:first-child::after { content: ' ⚠'; color: var(--warn); opacity: 1; }


/* ---- 最近动态 ---- */
.feed { display: flex; flex-direction: column; }
.feed-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.feed-row:last-child { border-bottom: none; }
.feed-row .amt { font-weight: 600; font-size: 15px; color: var(--good); flex: none; min-width: 96px; }
.feed-row .meta { color: var(--text-secondary); font-size: 13px; flex: 1; }
.feed-row .when { color: var(--text-muted); font-size: 12.5px; flex: none; }
.feed-empty { color: var(--text-muted); font-size: 13px; padding: 6px 0; }
label.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
label.check input { width: 15px; height: 15px; accent-color: var(--series-1); }

/* ---- 每日对比明细的分组表头 ---- */
table.data.pair th { text-align: center; border-bottom: 1px solid var(--border); }
table.data.pair thead tr:first-child th[colspan] { border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text-primary); }
table.data.pair td.muted { color: var(--text-muted); }
table.data td.d.up { color: var(--good); font-weight: 600; }
table.data td.d.down { color: var(--bad); font-weight: 600; }
table.data td.d.flat { color: var(--text-muted); }
.tag {
  font-size: 11px; font-weight: 400; color: var(--text-muted);
  background: var(--surface-2); border-radius: 4px; padding: 1px 6px; margin-left: 6px;
}

/* ---- 主卡片：左今日 / 右本月 ---- */
.hero { display: flex; gap: 40px; align-items: flex-start; flex-wrap: wrap; }
.hero-main { flex: 1 1 340px; min-width: 300px; }
.hero-side { flex: 1 1 320px; min-width: 280px; padding-top: 2px; }
.hero .value-sm {
  font-size: 30px; font-weight: 600; letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums; line-height: 1.15; margin-bottom: 6px;
}
.hero-side .sub { margin-top: 5px; }

/* ---- 今天 vs 昨天 进度条 ---- */
.pace { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.pace-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; margin-bottom: 9px; font-size: 13px; flex-wrap: wrap;
}
.pace-head .t { font-weight: 600; color: var(--text-primary); }
.pace-head .n { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.pace-track {
  position: relative; height: 10px; border-radius: 5px;
  background: var(--surface-2); overflow: visible;
}
.pace-fill {
  height: 100%; border-radius: 5px; background: var(--series-1);
  transition: width .45s ease; max-width: 100%;
}
.pace-fill.over { background: var(--good); }
.pace-mark {
  position: absolute; top: -4px; width: 2px; height: 18px;
  background: var(--text-secondary); border-radius: 1px;
}
.pace-mark::after {
  content: attr(data-label);
  position: absolute; top: 21px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
}
.pace-foot {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 9px; font-size: 12.5px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; flex-wrap: wrap;
}
.pace-foot .lead { color: var(--good); font-weight: 600; }
.pace-foot .lag { color: var(--bad); font-weight: 600; }
.pace-foot .gap { color: var(--text-secondary); }
.pace.has-mark .pace-foot { margin-top: 24px; }

/* 补记：离线期间累积的差值，不是一笔订单 */
.feed-row.catchup .amt { color: var(--text-muted); font-weight: 500; }
.feed-row.catchup .meta { color: var(--text-muted); }

/* ---- 佣金 ---- */
.comm-config { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.comm-config label { font-size: 12.5px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.comm-config input, .comm-config select {
  font-size: 13px; padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-0); color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.comm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.comm-cell .k { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; }
.comm-cell .v { font-size: 30px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.comm-cell .v.big { font-size: 38px; }
.comm-cell .c { font-size: 12.5px; color: var(--text-muted); margin-top: 7px; font-variant-numeric: tabular-nums; }
.comm-cell .c .up { color: var(--good); font-weight: 600; }
.comm-cell .c .down { color: var(--bad); font-weight: 600; }
.comm-empty { font-size: 13.5px; color: var(--text-muted); line-height: 1.8; padding: 4px 0; }
.comm-cell .fx {
  font-size: 13px; color: var(--text-secondary); margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

/* ---- 账号切换 ---- */
.acct-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 14px 0 0; }
.acct-bar .tab {
  font-size: 13px; padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.acct-bar .tab:hover { background: var(--surface-2); }
.acct-bar .tab.on {
  background: var(--series-1); border-color: var(--series-1); color: #fff; font-weight: 600;
}
.acct-bar .tab .dot { width: 6px; height: 6px; }
.acct-bar .tab .amt { font-variant-numeric: tabular-nums; opacity: 0.85; font-size: 12px; }
.acct-bar .add { font-size: 13px; padding: 6px 12px; color: var(--text-muted); }

/* ---- 推广佣金总览 ---- */
.aff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px; }
.aff-cell .k { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; }
.aff-cell .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.aff-cell .v.hero { font-size: 34px; color: var(--series-1); }
.aff-cell .fx { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; font-variant-numeric: tabular-nums; }
.acct-bar .tab-edit {
  font: inherit; font-size: 13px; padding: 0; margin: 0;
  border: none; background: transparent; color: inherit;
  width: 90px; outline: none;
}
.acct-bar .acct-tip { font-size: 11.5px; color: var(--text-muted); margin-left: 6px; }

/* ==================================================================
   以上整份拷自 Mac 端 renderer/style.css，保证两端长得一样。
   以下是网页端独有的部分：登录页、提示条、以及手机适配。
   ================================================================== */

/* 网页里没有 Electron 的标题栏，这条留着只会多出 38px 空白 */
.titlebar { display: none; }
.wrap { padding-top: 20px; }

select {
  font: inherit; padding: 7px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-0); color: var(--text-primary);
}
select:focus { outline: 2px solid var(--series-1); outline-offset: -1px; }

header.bar .who { font-size: 12.5px; color: var(--text-muted); }

/* ---- 登录 / 首次建超管 ---- */
.gate {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-card {
  width: 100%; max-width: 380px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px;
}
.gate-card h1 { font-size: 20px; font-weight: 600; margin: 0 0 16px; letter-spacing: -0.01em; }
.gate-card .field { margin-bottom: 12px; }
.gate-card .field input { width: 100%; }
.gate-card button { width: 100%; padding: 10px; font-size: 14px; margin-top: 6px; }
.gate-card .note { margin: 0 0 18px; }

/* ---- 操作提示 ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  max-width: min(520px, calc(100vw - 32px));
  background: var(--text-primary); color: var(--surface-1);
  padding: 11px 16px; border-radius: 9px; font-size: 13px; line-height: 1.5;
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  z-index: 100;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); color: #fff; }

.tag.err { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }

/* ---- 手机适配 ----
   表格列太多，手机上一定装不下。不缩字号也不隐藏列——那会让人以为数据少了，
   而是让表格自己横向滚动，纵向该看的还是能看。 */
/* ---- 每日到手 ---- */
/* 一个格子里两个数：上面是到手（要一眼看到），下面小灰字是当天流水（给个来处，
   不然「赚了 256」是凭空的）。两个数都给足两位小数，不做「万」这种压缩。 */
.earn-e { font-weight: 600; font-variant-numeric: tabular-nums; }
.earn-r { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.earn-none { color: var(--text-muted); font-weight: 400; }
table.earn td, table.earn th { vertical-align: top; }
table.earn tbody tr.today td { background: color-mix(in srgb, var(--series-1) 7%, transparent); }
table.earn tbody tr.sum td {
  border-top: 2px solid var(--border); border-bottom: none;
  font-weight: 600; padding-top: 12px;
}
table.earn td.day { white-space: nowrap; }
table.earn td.day .wd { color: var(--text-muted); font-weight: 400; margin-left: 5px; font-size: 12px; }
/* 合计列紧跟日期，用右边框和后面的各账号列分开 */
table.earn .total-col { border-right: 1px solid var(--border); padding-right: 14px; }
table.earn th.total-col, table.earn td.total-col { font-weight: 600; }

#overviewBody, #compareTable, #monthTable, #tableWrap, #commAll, #userTable, #zoneTable, #earnBody {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#overviewBody table, #compareTable table, #monthTable table,
#tableWrap table, #commAll table, #userTable table, #zoneTable table {
  min-width: 560px;
}
/* 账号少的时候别硬撑出横滚动条，它的列数跟着账号数走 */
#earnBody table { min-width: 0; }
/* 单元格不换行。表格已经能横向滚了，再允许换行的话窄屏上第一列会被挤成
   一字一行的竖排，比滚动难读得多。 */
#overviewBody th, #overviewBody td, #compareTable th, #compareTable td,
#monthTable th, #monthTable td, #tableWrap th, #tableWrap td,
#commAll th, #commAll td, #userTable th, #userTable td,
#zoneTable th, #zoneTable td, #earnBody th, #earnBody td { white-space: nowrap; }
/* 区域总览有 8 列，560 不够 */
#overviewBody table { min-width: 720px; }
/* 第一列是名字，给个下限，免得被数字列挤没 */
#overviewBody td:first-child, #commAll td:first-child { min-width: 120px; }

@media (max-width: 720px) {
  .wrap { padding: 16px 16px 40px; }
  header.bar { gap: 8px; }
  header.bar h1 { font-size: 17px; }
  header.bar .month { font-size: 12.5px; width: 100%; }
  header.bar .spacer { display: none; }
  header.bar .status { order: 10; width: 100%; }

  .card { padding: 16px; border-radius: 11px; }
  .hero { gap: 20px; }
  .hero .value { font-size: 34px; }
  .hero .value-sm { font-size: 25px; }
  .hero-main, .hero-side { flex-basis: 100%; min-width: 0; }

  .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .tile { padding: 13px 14px; }
  .tile .v { font-size: 21px; }

  .comm-grid { gap: 18px; }
  .comm-cell .v { font-size: 25px; }
  .comm-cell .v.big { font-size: 31px; }

  /* 提成设置挤在标题右边会折得很难看，手机上单独一行 */
  .comm-config { margin-left: 0; width: 100%; }
  .legend { margin-left: 0; width: 100%; }

  /* 表单在手机上每项占满一行，不然输入框被挤成一条缝 */
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row .field, .form-row input, .form-row select, .form-row button { width: 100% !important; }

  /* 异常提示条：窄屏上两个按钮挤在右边，会把正文压成一条缝。让按钮整体换到下一行。 */
  .banner { flex-wrap: wrap; }
  .banner .body { flex: 1 1 100%; }
  .banner button { flex: 1 1 auto; }

  .acct-bar { padding-top: 10px; }
  .pace-head, .pace-foot { font-size: 12px; }

  /* 手机上没有鼠标悬停，图表的 tooltip 跟着手指走，固定到底部更好读 */
  .tip { left: 16px !important; right: 16px; width: auto; top: auto !important; bottom: 76px; }
}

/* ==================================================================
   监察室模版：组件外观对齐「二猫云监察使」（iOS 分组列表风）。
   只改外观，不改结构；颜色全走上面的 token，深浅色自动跟随。
   ================================================================== */
body {
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: color-mix(in srgb, var(--series-1) 24%, transparent); }

/* 顶栏：毛玻璃、吸顶，和监察使的 TopBar 一样 */
header.bar {
  position: sticky; top: 0; z-index: 20;
  align-items: center;
  margin: 0 -20px 16px; padding: 12px 20px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.wrap { padding-top: 0; }
header.bar h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
header.bar .month { font-size: 12px; }

/* 卡片：iOS 分组卡片 */
.card, .tile, .gate-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}
.card { padding: 18px 20px; }

/* 按钮：填充式，无描边 */
button {
  height: 30px; padding: 0 12px;
  font-size: 12px; font-weight: 500;
  border: 1px solid transparent; border-radius: 9px;
  background: var(--surface-2); color: var(--text-primary);
  transition: background-color .12s ease, transform .12s ease;
}
button:hover { background: var(--control-hover); }
button:active { transform: scale(0.97); }
button.primary { background: var(--series-1); border-color: transparent; color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); background: var(--series-1); }

/* 输入框 / 下拉 */
input, select, .comm-config input, .comm-config select {
  border: 1px solid transparent; border-radius: 9px;
  background: var(--surface-2); color: var(--text-primary);
}
input, select { height: 32px; padding: 0 10px; }
input[type=checkbox] { height: auto; }
input:focus, select:focus { outline: none; border-color: var(--series-1); }
input::placeholder { color: var(--text-muted); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}

/* 状态胶囊 */
.status { background: var(--surface-2); border-color: transparent; font-size: 12px; }
.dot { background: var(--series-1); }
.dot.warn { background: var(--warn); }

/* 账号 / 区域切换：胶囊标签 */
.acct-bar { padding-top: 0; margin-bottom: 14px; }
.acct-bar .tab {
  height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); box-shadow: var(--card-shadow);
}
.acct-bar .tab:hover { background: var(--surface-1); filter: brightness(0.97); }
.acct-bar .tab.on {
  background: color-mix(in srgb, var(--series-1) 14%, var(--surface-1));
  border-color: color-mix(in srgb, var(--series-1) 45%, transparent);
  color: var(--text-primary); font-weight: 600;
}
.acct-bar .add { background: transparent; color: var(--text-muted); border: 1px dashed var(--hairline); border-radius: 999px; }

/* 指标切换：iOS 分段控件观感 */
.filters { background: var(--surface-2); padding: 2px; border-radius: 9px; display: inline-flex; gap: 2px; }
.filters button {
  height: 26px; border: none; border-radius: 7px; background: transparent;
  color: var(--text-primary); font-size: 12px;
}
.filters button[aria-pressed='true'] {
  background: var(--surface-1); color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04);
}

/* 主数字 */
.hero .label, .tile .k, .comm-cell .k, .aff-cell .k { font-size: 12px; color: var(--text-secondary); }
.hero .value { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; }
.hero .value-sm { font-weight: 700; letter-spacing: -0.02em; }
.tile .v, .comm-cell .v, .aff-cell .v { font-weight: 700; letter-spacing: -0.02em; }
.delta { font-size: 12px; padding: 2px 8px; border-radius: 999px; }

/* 进度条 */
.pace-track, .progress .track { background: var(--surface-2); height: 8px; border-radius: 999px; }
.pace-fill, .progress .fill { border-radius: 999px; }
.pace { border-top-color: var(--hairline); }

/* 表格：iOS 细分隔线 */
table.data th, table.data td, table.cmp th, table.cmp td, .feed-row { border-bottom-color: var(--hairline); }
table.data th, table.cmp thead th { font-size: 11px; color: var(--text-secondary); text-transform: none; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }

/* 提示条 */
.banner {
  background: color-mix(in srgb, var(--warn) 12%, var(--surface-1));
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
}
.tag { background: var(--surface-2); border-radius: 999px; }

/* tooltip / toast */
.tip { background: var(--surface-1); border-color: var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.toast { border-radius: 12px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); color: var(--text-primary);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border); }
.toast.bad { background: var(--bad); color: #fff; border-color: transparent; }

/* 登录页 */
.gate-card { border-radius: 16px; padding: 28px 24px; }
.gate-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.gate-card button { height: 40px; font-size: 14px; border-radius: 11px; }
.gate-card .field input { height: 40px; border-radius: 10px; font-size: 14px; }

@media (max-width: 720px) {
  header.bar { margin: 0 -16px 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  header.bar .status { order: 0; width: auto; }
  .card { padding: 16px; }
}
/* 状态文案可能很长（抓取失败原因），桌面上截断，悬停看全文，别把顶栏按钮挤到第二行 */
header.bar .status { max-width: 300px; min-width: 0; }
header.bar #statusText { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* 手机上顶栏会折成好几行，吸顶会吃掉小半屏，改成跟着页面滚走 */
@media (max-width: 720px) { header.bar { position: static; } }
