/* 中国移动资费公示追踪站 — Achromatic ledger 应用样式
   令牌来自风格表(seed 1175361222):无色账本,品牌蓝只落在数据上。 */

:root {
  --ground: #f2f4f7;
  --surface: #ffffff;
  --raised: #eef1f4;
  --active: #e7ebef;
  --border: #e5e7eb;
  --rule: #f0f2f5;
  --control: #d1d5db;
  --text: #0a0a0a;
  --muted: #5f6368;
  --faint: #6b6b6b;
  --primary: #141414;
  --cmcc: #0086d4;          /* 数据主色:中国移动品牌蓝 */
  --cmcc-ink: #0b6da3;      /* 同色深阶,可作小字(4.5:1) */
  --cmcc-tint: #e3f1fa;
  --positive: #247b50;
  --negative: #c4242a;
  --pill-new-bg: #dcfae5;  --pill-new-ink: #04250e;
  --pill-off-bg: #ffedea;   --pill-off-ink: #831c1e;
  --pill-upd-bg: #e3f1fa;   --pill-upd-ink: #084d75;
  --pill-grey-bg: #eeeeee;  --pill-grey-ink: #3d3d3d;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-chip: 4px;
  --sidebar-w: 240px;
  --gap: 16px;
  --pad: 24px;
  --nav-row: 34px;
  --ctl-h: 32px;
  --row-h: 44px;
  --fs-title: 24px;
  --fs-section: 16px;
  --fs-kpi: 28px;
  --fs-body: 14px;
  --fs-small: 12px;
  --font: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei",
          "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--ground);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}
.num, td.num, .num-t { font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: var(--fs-body);
  color: var(--text); background: var(--surface);
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  height: var(--ctl-h); padding: 0 10px;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--cmcc);
  outline-offset: 1px;
}
::placeholder { color: var(--faint); }

/* ---------- 侧栏(open plane) ---------- */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: var(--sidebar-w); flex: none;
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 6px 10px 18px;
}
.brand-logo { height: 30px; width: auto; display: block; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-group-label {
  font-size: var(--fs-small); color: var(--muted);
  padding: 14px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 8px;
  height: var(--nav-row); padding: 0 10px;
  border-radius: var(--radius-chip);
  color: var(--muted); font-size: var(--fs-body);
}
.nav a:hover { background: var(--active); color: var(--text); }
.nav a.on {
  background: var(--active);
  color: var(--text); font-weight: 500;
}
.nav a .nav-count {
  margin-left: auto; font-size: 11px; color: var(--muted);
}
.sidebar-foot {
  margin-top: auto; padding: 12px 10px 4px;
  font-size: 11px; color: var(--faint); line-height: 16px;
  border-top: 1px solid var(--rule);
}

/* ---------- 画布 ---------- */
#main {
  flex: 1; min-width: 0;
  padding: 32px var(--pad) 64px;
  max-width: 1360px;
}
.grid-main > div { min-width: 0; }
.card { min-width: 0; }
.page-title-row {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 4px;
}
h1 { font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.01em; }
.page-sub { color: var(--muted); font-size: var(--fs-body); margin: 6px 0 0; }
.title-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.fresh {
  color: var(--muted); font-size: var(--fs-small);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
}
.card + .card { margin-top: var(--gap); }
.card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.card-title { font-size: var(--fs-section); font-weight: 600; }
.card-link {
  margin-left: auto; font-size: var(--fs-small); color: var(--muted);
  background: none; border: none;
}
.card-link:hover { color: var(--text); }
.grid-main {
  display: grid; grid-template-columns: 1fr 384px;
  gap: var(--gap); align-items: start;
  margin-top: var(--gap);
}

/* ---------- KPI ---------- */
.kpi-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-top: var(--gap);
}
.kpi {
  padding: 16px 20px 14px;
  border-right: 1px solid var(--rule);
}
.kpi:last-child { border-right: none; }
.kpi-label { font-size: var(--fs-small); color: var(--muted); }
.kpi-value {
  font-size: var(--fs-kpi); font-weight: 500;
  margin: 6px 0 4px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-cap { font-size: var(--fs-small); color: var(--muted); }
.kpi-cap .up { color: var(--positive); }
.kpi-cap .down { color: var(--negative); }
.kpi-cap .zero { color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  height: var(--ctl-h); padding: 0 14px;
  border-radius: var(--radius-control);
  border: 1px solid var(--primary);
  background: var(--primary); color: #fff;
  font-size: var(--fs-body); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: #333; border-color: #333; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--control);
}
.btn-ghost:hover { background: var(--raised); }
.btn-text {
  background: none; border: none; color: var(--muted);
  height: auto; padding: 2px 4px; font-size: var(--fs-small);
}
.btn-text:hover { color: var(--text); }
.btn-sm { height: 26px; padding: 0 10px; font-size: var(--fs-small); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  font-size: var(--fs-small); font-weight: 400; color: var(--muted);
  text-align: left; padding: 8px 10px; white-space: nowrap;
}
th.num, td.num { text-align: right; }
td {
  padding: 10px; border-top: 1px solid var(--rule);
  font-size: var(--fs-body); vertical-align: top;
}
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--raised); }
td .sub { font-size: var(--fs-small); color: var(--muted); margin-top: 2px; }
.name-cell { max-width: 340px; }
.name-cell .n { font-weight: 500; }
.dash { color: var(--faint); }

/* ---------- 状态标记 ---------- */
.pill {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px;
  border-radius: var(--radius-chip);
  font-size: var(--fs-small); font-weight: 500;
  flex: none; white-space: nowrap;
}
.pill-new { background: var(--pill-new-bg); color: var(--pill-new-ink); }
.pill-off { background: var(--pill-off-bg); color: var(--pill-off-ink); }
.pill-upd { background: var(--pill-upd-bg); color: var(--pill-upd-ink); }
.pill-grey { background: var(--pill-grey-bg); color: var(--pill-grey-ink); }
.tag-scope {
  font-size: var(--fs-small); color: var(--muted);
  white-space: nowrap;
}

/* ---------- 变更流 ---------- */
.feed-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 0;
  border-top: 1px solid var(--rule);
}
.feed-row:first-of-type { border-top: none; }
.feed-mark { flex: none; margin-top: 1px; }
.feed-body { min-width: 0; flex: 1; }
.feed-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.feed-title .q { color: var(--muted); font-weight: 400; font-size: var(--fs-small); }
.feed-meta { font-size: 13px; color: var(--muted); margin-top: 2px;
  display: flex; gap: 8px; flex-wrap: wrap; }
.feed-time { margin-left: auto; font-size: 12px; color: var(--faint);
  flex: none; }
.diff-line {
  margin-top: 6px; font-size: 13px; line-height: 19px;
  color: var(--muted);
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
}
.diff-field { flex: none; color: var(--cmcc-ink); }
.diff-old {
  max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: line-through; text-decoration-color: #b3b3b3;
}
.diff-arrow { color: var(--faint); flex: none; }
.diff-new {
  max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text);
}

/* ---------- 图表 ---------- */
.chart-days { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.chart-days .dcol {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; height: 100%; justify-content: flex-end;
}
.chart-days .dbar { width: 100%; max-width: 26px; background: var(--cmcc);
  border-radius: 2px 2px 0 0; min-height: 2px; }
.chart-days .dbar.zero { background: var(--cmcc-tint); }
.chart-days .dnum { font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.chart-days .dlabel { font-size: 11px; color: var(--faint); }

/* ---------- 省份覆盖格 ---------- */
.scope-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px;
}
.scope-cell {
  background: var(--raised);
  border-radius: var(--radius-chip);
  padding: 6px 7px;
  min-width: 0;
  display: block;
  color: var(--text);
}
.scope-cell:hover { background: var(--surface); outline: 1px solid var(--control); }
.scope-cell .sc-name { font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-cell .sc-count { font-size: 14px; font-weight: 500;
  font-variant-numeric: tabular-nums; }
.scope-cell.empty { opacity: .55; }

/* ---------- 筛选行 ---------- */
.filter-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 14px 0 0;
}
.filter-row .spacer { flex: 1; }
.ctl { height: var(--ctl-h); }
input.ctl, select.ctl {
  height: var(--ctl-h); border-radius: var(--radius-control);
  border: 1px solid var(--control); background: var(--surface);
  padding: 0 10px; font-size: var(--fs-body);
}
input.ctl.fee { width: 84px; }
input.ctl.time { width: 70px; }
input.ctl.login-input { width: 100%; }
.ctl-label { font-size: var(--fs-small); color: var(--muted);
  flex: none; }
.seg {
  display: inline-flex; background: var(--raised);
  border-radius: var(--radius-control); padding: 2px;
}
.seg button {
  height: 28px; min-width: 72px; padding: 0 12px; border: none; background: none;
  border-radius: 4px; color: var(--muted); font-size: var(--fs-small);
}
.seg button.on { background: var(--surface); color: var(--text); font-weight: 500;
  box-shadow: 0 0 0 1px var(--border); }
.tabs {
  display: flex; gap: 20px; border-bottom: 1px solid var(--border);
  margin-top: 14px;
}
.tabs button {
  background: none; border: none; color: var(--muted);
  height: 34px; font-size: var(--fs-body);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--text); font-weight: 500;
  border-bottom-color: var(--primary); }
.result-line { font-size: var(--fs-small); color: var(--muted); margin: 10px 0 0; }
label.chk { display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-small); color: var(--muted); cursor: pointer;
  height: var(--ctl-h); }
label.chk input { width: auto; height: auto; }

/* ---------- 登录页 ---------- */
.login-card {
  max-width: 380px; margin: 72px auto 0; padding: 28px 30px;
}
.login-logo { height: 30px; display: block; margin-bottom: 10px; }
.login-title { font-size: 18px; font-weight: 600; margin-bottom: 18px; }
.login-card .field { margin-bottom: 12px; }
.login-card .field > span { display: block; margin-bottom: 6px; }

/* ---------- 可点击信息行 ---------- */
.feed-row.clickable { cursor: pointer; }
.feed-row.clickable:hover .feed-title { text-decoration: underline;
  text-underline-offset: 3px; }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
  margin-top: 14px; font-size: var(--fs-small); color: var(--muted);
}
.pager button {
  height: 28px; padding: 0 12px;
  border: 1px solid var(--control); background: var(--surface);
  border-radius: var(--radius-control); color: var(--text);
}
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- 详情抽屉 ---------- */
#backdrop {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .35);
  display: none; z-index: 40;
}
#backdrop.on { display: block; }
#sheet {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--surface);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .12);   /* 浮层允许投影 */
  z-index: 50; display: none;
  overflow-y: auto; padding: 24px 26px 40px;
}
#sheet.on { display: block; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; }
.sheet-close { margin-left: auto; background: none; border: none;
  color: var(--muted); font-size: 18px; padding: 4px; }
.kv { margin-top: 16px; }
.kv-row {
  display: grid; grid-template-columns: 110px 1fr; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--rule); font-size: var(--fs-body);
}
.kv-row:first-child { border-top: none; }
.kv-k { color: var(--muted); font-size: var(--fs-small); padding-top: 2px; }
.kv-v { min-width: 0; word-break: break-word; }

/* ---------- 设置区(单列) ---------- */
.set-section {
  padding: 24px 0; border-top: 1px solid var(--border);
}
.set-section:first-of-type { border-top: none; padding-top: 8px; }
.set-title { font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.set-panel {
  background: var(--raised); border-radius: 12px; padding: 16px 18px;
}
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-row + .form-row { margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: var(--fs-small); color: var(--muted); }
.field input, .field select { min-width: 120px; }
.field-wide { flex: 1; min-width: 200px; }
.field-wide input { width: 100%; }

/* ---------- 进度 ---------- */
.progress {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.progress i { display: block; height: 100%; background: var(--cmcc); }
.run-state { display: flex; gap: 10px; align-items: center; }
.logbox {
  margin-top: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-control);
  padding: 10px 12px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px; line-height: 17px; color: var(--muted);
  max-height: 260px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}

/* ---------- 空状态 ---------- */
.empty {
  border: 1px dashed var(--control); border-radius: var(--radius-card);
  padding: 18px 20px; color: var(--muted); font-size: var(--fs-body);
}
.empty .hint { font-size: var(--fs-small); color: var(--faint); margin-top: 4px; }
.error-box {
  border: 1px solid #fde68a; background: var(--pill-warning-bg, #fffbeb);
  border-radius: var(--radius-control); color: #92400e;
  padding: 12px 14px; font-size: var(--fs-small);
}

/* ---------- 手机 ---------- */
#topbar { display: none; }
@media (max-width: 900px) {
  #app { display: block; }
  #sidebar {
    display: none; position: fixed; inset: 0; width: 100%;
    background: var(--ground); z-index: 60; padding: 24px;
    overflow-y: auto;
  }
  #sidebar.open { display: flex; }
  #topbar {
    display: flex; align-items: center; gap: 10px;
    height: 48px; padding: 0 16px;
    background: var(--ground);
    position: sticky; top: 0; z-index: 30;
  }
  #topbar .t-name { font-weight: 600; font-size: 15px; }
  #topbar .btn-menu {
    background: none; border: none; font-size: 18px; color: var(--text);
    padding: 6px;
  }
  #main { padding: 20px 16px 48px; }
  .grid-main { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: none; }
  .kpi:nth-child(1), .kpi:nth-child(2) { border-bottom: 1px solid var(--rule); }
  .scope-grid { grid-template-columns: repeat(3, 1fr); }
  .page-title-row { flex-wrap: wrap; }
  .title-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 640px) {
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td {
    display: block; border: none; width: 100%;
  }
  table.responsive thead { display: none; }
  table.responsive tr {
    border-top: 1px solid var(--rule); padding: 12px 0;
  }
  table.responsive td { border: none; padding: 2px 0; }
  table.responsive td .sub { margin-top: 0; }
  .name-cell { max-width: none; }
}
