:root {
  --bg: #eef1f7; --panel: #ffffff; --panel-2: #f6f8fc;
  --line: #e4e8f0; --text: #121723; --muted: #66708a;
  --pos: #12a150; --pos-soft: #def5e6; --neg: #e5384f; --neg-soft: #fde7ea;
  --accent: #5b5ef0; --accent-soft: #ecedfe; --accent2: #f59e0b;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --radius: 16px;
}
[data-theme="dark"] {
  --bg: #0a0c11; --panel: #14181f; --panel-2: #1a1f29;
  --line: #232934; --text: #eef1f7; --muted: #8d99ad;
  --pos: #2dd47e; --pos-soft: #08361f; --neg: #fb6f86; --neg-soft: #3a0e17;
  --accent: #8b8efb; --accent-soft: #1d2030; --accent2: #fbbf24;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 12px; color: var(--muted); margin: 0 0 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
input, select, button { font-family: inherit; }
input, select { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 8px 10px; font-size: 13px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button { border: 0; border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--text); background: transparent; transition: background .12s; }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.05); }
button.ghost { background: var(--panel); border: 1px solid var(--line); }
button.ghost:hover { background: var(--panel-2); }
.error { color: var(--neg); font-size: 12px; min-height: 16px; margin: 0; }

.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card { width: 330px; display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

main.app-shell { max-width: none; margin: 0; padding: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 16px; height: 16px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.actions { display: flex; gap: 8px; align-items: center; }
.clock { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; }
.clock.subtle { background: transparent; border: 0; color: var(--muted); opacity: .8; }

.pagetabs { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 18px; box-shadow: var(--shadow); }
.pagetabs button { padding: 8px 18px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.pagetabs button.active { background: var(--accent); color: #fff; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; box-shadow: var(--shadow); }
.seg button { border-radius: 0; padding: 9px 14px; color: var(--muted); }
.seg button:hover { background: var(--panel-2); }
.seg button.active { background: var(--accent); color: #fff; font-weight: 600; }
.seg.small button { padding: 7px 13px; font-size: 12px; }
.ctl { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.status { color: var(--muted); font-size: 12px; margin-left: auto; align-self: center; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.summary-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.summary-card .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.summary-card .value { font-size: 26px; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary-card .sub { color: var(--muted); font-size: 11px; margin-top: 4px; }

.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.canvas-box { position: relative; height: 240px; }
.canvas-box.tall { height: 330px; }

.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
/* 名字 column (2nd) left-aligned in the new-registrations table */
#reg-table th:nth-child(2), #reg-table td:nth-child(2) { text-align: left; }
thead th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--panel-2); }
tfoot th { background: var(--panel-2); font-size: 14px; font-weight: 700; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.cnt-dep { color: var(--pos); background: var(--pos-soft); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; }
.cnt-wd { color: var(--neg); background: var(--neg-soft); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; }
.arrow-up { color: var(--pos); font-weight: 700; }
.arrow-down { color: var(--neg); font-weight: 700; }
.arrow-flat { color: var(--muted); }

/* compare */
.compare-controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin-bottom: 16px; max-width: 100%; }
.cmp-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* “对比单位”独占一行，下面才放 Period A / B，
   不然四组控件排一行会把版面顶出容器。 */
.cmp-col.cmp-unit { flex: 0 0 100%; align-items: flex-start; }
.cmp-label { font-size: 12px; font-weight: 700; }
.cmp-a { color: var(--accent); } .cmp-b { color: var(--accent2); }
.cmp-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmp-row .dash { color: var(--muted); }
.cmp-row input[type="date"], .cmp-row input[type="month"], .cmp-row input[type="week"] { width: 160px; }
.cmp-row input[type="time"] { width: 112px; }
.cmp-row select { width: 118px; }
.cmp-range { font-size: 12px; font-weight: 700; color: var(--muted); min-height: 16px; }
/* align the Compare button with the date/time input row (columns have a range line below) */
#cmp-run { margin-bottom: 22px; }
#cmp-hint { margin-bottom: 24px; }
@media (max-width: 980px) {
  .cmp-col { flex: 1 1 100%; }
  .cmp-row input[type="date"], .cmp-row input[type="month"], .cmp-row input[type="week"] { flex: 1 1 140px; width: auto; }
}
.hint { color: var(--muted); font-size: 12px; }
.cmp-cards { grid-template-columns: repeat(3, 1fr); }
.cmp-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.cmp-card .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.cmp-card .ab { display: flex; gap: 14px; margin-top: 8px; }
.cmp-card .ab div { font-size: 12px; color: var(--muted); }
.cmp-card .ab b { display: block; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.cmp-card .delta { margin-top: 8px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) { .summary, .cmp-cards { grid-template-columns: 1fr; } }

.nomargin { margin: 0; }
.head-right { display: flex; gap: 8px; flex-wrap: wrap; }
.grp-a { background: var(--accent-soft); }
[data-theme="dark"] .grp-a { background: rgba(139,142,251,.08); }
#cmp-table th.grp-b { color: var(--accent2); }
#cmp-table th.grp-a { color: var(--accent); }

.ud-lbl { color: var(--muted); font-size: 10px; margin: 0 3px 0 8px; }
.ud-lbl:first-child { margin-left: 0; }
#period-table td:last-child { white-space: nowrap; }

/* Compare table A/B column tinting (header + body + footer) */
#cmp-table th.grp-a, #cmp-table td.grp-a { background: rgba(91,94,240,.12); }
#cmp-table th.grp-b, #cmp-table td.grp-b { background: rgba(245,158,11,.16); }
[data-theme="dark"] #cmp-table th.grp-a, [data-theme="dark"] #cmp-table td.grp-a { background: rgba(139,142,251,.16); }
[data-theme="dark"] #cmp-table th.grp-b, [data-theme="dark"] #cmp-table td.grp-b { background: rgba(251,191,36,.16); }

/* ===== Compare table: excel-style gridlines, no A/B tint, thick A|B divider ===== */
#cmp-table th, #cmp-table td { border: 1px solid var(--line); }
/* remove the A/B background tint */
#cmp-table th.grp-a, #cmp-table td.grp-a,
#cmp-table th.grp-b, #cmp-table td.grp-b { background: transparent; }
/* neutral header colour (no blue/amber) */
#cmp-table th.grp-a, #cmp-table th.grp-b { color: var(--muted); }
/* thick divider between A block and B block (col 6 = B DEPOSIT) */
#cmp-table th:nth-child(6), #cmp-table td:nth-child(6) { border-left: 3px solid var(--text); }

/* divider between D and W groups inside Δ Amount / Up-Down cells */
.dw-sep { display: inline-block; width: 1px; align-self: stretch; height: 14px; background: var(--line); margin: 0 8px; vertical-align: middle; }
#cmp-table td .ud-lbl:first-child { margin-left: 0; }

/* thick divider between B block and the Δ (diff) block (col 10 = Δ Dep) */
#cmp-table th:nth-child(10), #cmp-table td:nth-child(10) { border-left: 3px solid var(--text); }

/* compare diff tab: show only the active diff group */
#cmp-table.show-amt .diff-cnt { display: none; }
#cmp-table.show-cnt .diff-amt { display: none; }
/* thick divider before whichever diff group is shown (col 10 = ΔDep, col 12 = Dep±) */
#cmp-table th:nth-child(12), #cmp-table td:nth-child(12) { border-left: 3px solid var(--text); }

/* Repair panel */
.repair-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 0; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.repair-panel.hidden { display: none; }
.repair-panel .rp-title { font-weight: 600; color: var(--text); }
.repair-panel label { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.repair-panel input[type="date"], .repair-panel select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.repair-panel button.small { padding: 6px 14px; font-size: 13px; }
.repair-panel .rp-status { font-size: 13px; color: var(--muted); margin-left: 4px; }

/* ===== Sidebar layout ===== */
:root { --side: #ffffff; }
[data-theme="dark"] { --side: #0e1218; }
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar { width: 220px; flex: 0 0 220px; background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.side-brand b { display: block; font-size: 16px; line-height: 1.1; }
.side-sub { display: block; font-size: 11px; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; text-align: left; width: 100%; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-ico { width: 18px; display: inline-block; text-align: center; opacity: .9; }
.side-foot { margin-top: auto; padding-top: 12px; }
.ghost.full { width: 100%; }
.side-co { font-size: 12px; font-weight: 700; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin-bottom: 8px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-switch { display: flex; gap: 6px; margin-bottom: 8px; }
.lang-switch button { flex: 1; padding: 6px 0; font-size: 12px; font-weight: 600; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--muted); cursor: pointer; }
.lang-switch button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.content { flex: 1 1 auto; min-width: 0; padding: 18px 28px 60px; width: 100%; }
.page-title { font-size: 20px; font-weight: 700; }

/* ===== Top players table ===== */
#tp-table.grid { width: 100%; border-collapse: collapse; }
#tp-table.grid th, #tp-table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
#tp-table.grid th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
#tp-table.grid td.num, #tp-table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
#tp-table.grid td.rank { color: var(--muted); font-weight: 700; width: 40px; }
#tp-table.grid td.strong { font-weight: 700; }
#tp-table.grid tbody tr:hover { background: var(--panel-2); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* ===== Mobile: same left sidebar, but as a slide-in drawer via ☰ ===== */
.nav-toggle { display: none; }
.nav-backdrop { position: fixed; inset: 0; background: rgba(15,23,41,.45); z-index: 150; }
.nav-backdrop.hidden { display: none; }
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--panel); color: var(--text); font-size: 20px; cursor: pointer; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 260px; z-index: 200;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 2px 0 24px rgba(0,0,0,.18); }
  .sidebar.open { transform: none; }
  .content { padding: 12px 12px 48px; width: 100%; }
  .page-title { font-size: 18px; }
}
@media (min-width: 821px) { .nav-backdrop { display: none !important; } }

/* ===== Phones ===== */
@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .actions { width: 100%; flex-wrap: wrap; gap: 6px; row-gap: 8px; }
  .company-switch { flex: 1 1 130px; min-width: 0; }
  .actions .clock { font-size: 11px; }
  .actions .ghost { padding: 7px 10px; }
  .summary, .cmp-cards { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .head-tools { flex-wrap: wrap; }
  .repair-panel { flex-wrap: wrap; gap: 8px; }
  .repair-panel input[type="date"] { min-width: 0; }
  .modal { padding: 16px 8px; }
  .modal-box { padding: 16px; max-width: 100%; }
  .setting-hub { grid-template-columns: 1fr 1fr !important; }
  .gw-share { gap: 16px; justify-content: center; }
  .seg { flex-wrap: wrap; }
}

/* ===== Top players table — polished ===== */
#page-top .table-scroll { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
#tp-table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
#tp-table.grid thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
#tp-table.grid td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
#tp-table.grid tbody tr:last-child td { border-bottom: 0; }
#tp-table.grid tbody tr:nth-child(even) { background: color-mix(in srgb, var(--panel-2) 45%, transparent); }
#tp-table.grid tbody tr:hover { background: var(--accent-soft); }
#tp-table.grid td.num, #tp-table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
#tp-table.grid td.mono { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
#tp-table.grid td.pname { font-weight: 600; }
#tp-table.grid td.dim { color: var(--muted); opacity: .5; }
#tp-table.grid td.amt { font-weight: 800; color: var(--accent); font-size: 15px; }
#tp-table.grid td.rank { width: 44px; text-align: center; font-weight: 800; color: var(--muted); }
#tp-table.grid td.rank.medal { color: #fff; }
#tp-table.grid td.rank.medal::before { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; }
#tp-table.grid td.medal-1 { color: #b8860b; } #tp-table.grid td.medal-1::before { content: "1"; background: linear-gradient(135deg,#ffd700,#f0a500); color:#5c3d00; }
#tp-table.grid td.medal-2 { } #tp-table.grid td.medal-2::before { content: "2"; background: linear-gradient(135deg,#e2e8f0,#b0bac9); color:#38404d; }
#tp-table.grid td.medal-3 { } #tp-table.grid td.medal-3::before { content: "3"; background: linear-gradient(135deg,#e0a878,#c07b45); color:#4a2a12; }
#tp-table.grid td.medal { font-size: 0; } /* collapse the cell number; badge ::before shows it */
/* force the badge number to render even though the cell font-size is 0 */
#tp-table.grid td.rank.medal::before { font-size: 13px !important; font-weight: 800; line-height: 1; }
/* prominent Excel download button */
.btn-export { background: #12a150; color: #fff; border: none; border-radius: 9px; padding: 9px 16px; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(18,161,80,.28); }
.btn-export:hover { background: #0e8a44; }
.btn-export:disabled { opacity: .6; cursor: default; }
/* toolbar segs match the finance toggle: snug, selected fills edge-to-edge */
.toolbar .seg { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 0; box-shadow: var(--shadow); overflow: hidden; }
.toolbar .seg button { border-radius: 0; }
/* per-row Excel download button — clearly a download */
.dl-row { display: inline-flex; align-items: center; gap: 4px; background: #eaf7f0; color: #12a150; border: 1px solid #bfe6cf; border-radius: 7px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.dl-row:hover { background: #12a150; color: #fff; border-color: #12a150; }

/* ===== Live strip ===== */
.live-strip { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.live-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.live-item b { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.live-item b.warn { color: var(--neg); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 25%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.live-updated { margin-left: auto; font-size: 11px; color: var(--muted); }

/* ===== Gateway balance cards ===== */
.gw-total { margin-left: auto; font-weight: 800; font-size: 16px; color: var(--accent); }
.gw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gw-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.gw-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.gw-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; }
.gw-dot.on { background: var(--pos); } .gw-dot.off { background: var(--neg); }
.gw-bal { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gw-acc { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===== Modern light theme polish ===== */
:root {
  --bg: #f4f6fb; --panel: #ffffff; --panel-2: #f7f9fc;
  --line: #e8ecf3; --text: #0f1729; --muted: #6b7688;
  --accent: #5b5ef0; --accent-soft: #eef0fe;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.05);
}
body { -webkit-font-smoothing: antialiased; }
.sidebar { box-shadow: 1px 0 0 var(--line); }
.nav-item { transition: background .15s, color .15s; }
.nav-item.active { box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent); }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-title { font-size: 16px; font-weight: 700; }
.panel-sub { font-size: 12px; color: var(--muted); margin-left: 8px; }
.head-tools { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* Gateway performance bars */
.gw-bars { display: flex; flex-direction: column; gap: 12px; }
.gw-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 14px; }
.gw-rank { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-track { height: 22px; background: var(--panel-2); border-radius: 8px; overflow: hidden; }
.gw-fill { height: 100%; border-radius: 8px; transition: width .8s cubic-bezier(.22,1,.36,1); }
.gw-meta { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gw-meta b { color: var(--text); }
@media (max-width: 640px) { .gw-row { grid-template-columns: 110px 1fr; } .gw-meta { grid-column: 2; } }

/* Gateway: tax table combined under the bars in the same panel */
.gw-tax-head { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
/* Promotion report toolbar polish */
#page-promo .panel-head { flex-wrap: wrap; gap: 12px; align-items: center; }
.promo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 14px; }
.promo-toolbar .promo-sep { flex: 1 1 0; min-width: 0; }
#page-promo .ctl { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
#page-promo .ctl input[type="date"] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; }
#promo-status { font-size: 12px; color: var(--muted); font-weight: 600; }
#promo-table td:first-child, #promo-table th:first-child { text-align: left; }
#promo-table tfoot th { border-top: 2px solid var(--line); font-size: 14px; font-weight: 700; color: var(--text); }

/* Gateway tax / fee table */
#gw-tax-table { width: 100%; border-collapse: collapse; font-size: 14px; }
#gw-tax-table th { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
#gw-tax-table td:first-child, #gw-tax-table th:first-child { text-align: left; font-weight: 600; }
#gw-tax-table tfoot th { border-top: 2px solid var(--line); color: var(--text); font-size: 14px; font-weight: 700; }
#gw-tax-table td.dim { color: var(--muted); opacity: .6; }
.gw-fee { opacity: .85; }
.gw-tax-inp { width: 72px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; text-align: right; }
.gw-tax-inp:focus { outline: none; border-color: var(--accent); }

/* Gateway donut + legend */
.gw-share { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.gw-donut-wrap { width: 240px; height: 240px; }
.gw-legend { display: flex; flex-direction: column; gap: 10px; min-width: 160px; }
.lg-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.lg-item b { color: var(--text); margin-left: auto; }
.lg-dot { width: 12px; height: 12px; border-radius: 4px; }

/* Domains */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-ico { font-size: 40px; opacity: .3; margin-bottom: 12px; }
.empty-sub { font-size: 12px; margin-top: 8px; }
.empty-sub code { background: var(--panel-2); padding: 2px 6px; border-radius: 6px; }
.pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill.ok { background: var(--pos-soft); color: var(--pos); }
.pill.bad { background: var(--neg-soft); color: var(--neg); }

/* Count-up values shouldn't jump layout */
.summary-card .value, .live-item b { font-variant-numeric: tabular-nums; }

/* Domains add row + icon buttons */
.dom-add { display: flex; gap: 10px; margin-bottom: 16px; }
.dom-add input { flex: 1; max-width: 360px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; }
.icon-btn { padding: 4px 8px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--neg-soft); color: var(--neg); }
#dom-table td:last-child, #reg-table td { white-space: nowrap; }

/* ===== Supply admin ===== */
.supply-gate { max-width: 440px; }
.form-row { margin-bottom: 20px; }
.form-row > label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.form-row input[type="text"], .form-row input[type="password"] { width: 100%; max-width: 480px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); padding: 5px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.chip-x { background: none; color: var(--accent); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; }
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.toggle { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dom-add { display: flex; gap: 8px; margin: 10px 0; }
.dom-add input { flex: 1; max-width: 360px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; }

/* ===== Notice bar ===== */
.notice-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: 12px; background: var(--pos-soft); color: var(--pos); font-size: 14px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--pos) 25%, transparent); }
.notice-bar.warn { background: var(--neg-soft); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 25%, transparent); }
.notice-ico { font-weight: 800; }

/* ===== Month to date ===== */
.mtd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 24px; }
.mtd-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mtd-label { color: var(--muted); font-size: 13px; }
.mtd-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.mtd-val.pos { color: var(--pos); } .mtd-val.neg { color: var(--neg); }

/* staff table reuse grid styles */
#staff-table.grid td.mono { font-variant-numeric: tabular-nums; color: var(--muted); }

/* ===== Paste import ===== */
.paste-import { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.paste-import textarea { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; resize: vertical; }

.pill.warn-pill { background: color-mix(in srgb, var(--accent2) 18%, transparent); color: var(--accent2); }
.mini-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.mini-toggle input { width: 15px; height: 15px; accent-color: var(--accent); }
.notice-bar.warn-soft { background: color-mix(in srgb, var(--accent2) 12%, transparent); color: var(--accent2); border-color: color-mix(in srgb, var(--accent2) 30%, transparent); }

/* ===== Dark theme override (must come LAST to beat the light :root above) ===== */
[data-theme="dark"] {
  --bg: #0a0c11; --panel: #14181f; --panel-2: #1a1f29; --side: #0e1218;
  --line: #232934; --text: #eef1f7; --muted: #8d99ad;
  --pos: #2dd47e; --pos-soft: #08361f; --neg: #fb6f86; --neg-soft: #3a0e17;
  --accent: #8b8efb; --accent-soft: #1d2030; --accent2: #fbbf24;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.4);
}

/* ===== Company switcher + management ===== */
.company-switch { padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.company-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.company-form input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; flex: 1; min-width: 140px; }
#co-table td.mono { font-variant-numeric: tabular-nums; }
.co-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.co-actions .chip-x { padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }

/* ===== Backfill progress banner ===== */
.bf-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 14px; font-weight: 600; }
.bf-banner .bf-sub { margin-left: auto; font-size: 12px; font-weight: 500; opacity: .75; }
.bf-spin { width: 14px; height: 14px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: bfspin 0.9s linear infinite; flex: 0 0 auto; }
@keyframes bfspin { to { transform: rotate(360deg); } }
.promo-loading { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-weight: 600; padding: 30px 0 !important; }

/* ===== Multi-bot cards ===== */
.bot-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 10px; }
.bot-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel-2); display: flex; flex-direction: column; gap: 10px; }
.bot-head { display: flex; gap: 8px; align-items: center; }
.bot-name { flex: 1; max-width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-weight: 700; }
.bot-token { width: 100%; max-width: 520px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; }
.bot-head .chip-x { padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }

/* ===== Setting hub + modals ===== */
.setting-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.hub-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.hub-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); background: var(--accent-soft); }
.hub-card b { font-size: 15px; color: var(--text); }
.hub-ico { font-size: 22px; }
.hub-sub { font-size: 12px; color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 41, .45); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-box { background: var(--panel); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 22px 24px; width: 100%; max-width: 860px; }
.modal-box.modal-sm { max-width: 440px; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; line-height: 1; padding: 0; }
.modal-close:hover { color: var(--text); background: var(--neg-soft); }

/* ===== Bot numbered rows ===== */
.bot-row { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); overflow: hidden; }
.bot-row-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.bot-num { color: var(--muted); font-weight: 800; }
.bot-title { font-size: 14px; }
.bot-meta { color: var(--muted); font-size: 12px; }
.bot-row-btns { margin-left: auto; display: flex; gap: 6px; }
.bot-row-btns .chip-x { padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; background: var(--panel); }
.bot-row.open { border-color: var(--accent); }
.bot-editor { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line); }
.bot-editor .bot-name, .bot-editor .bot-token { width: 100%; max-width: 520px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; }

/* ===== Current-company badge ===== */
.co-badge { margin-left: 10px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.co-badge.single { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ===== Company switching overlay ===== */
.switch-overlay { position: fixed; inset: 0; z-index: 2000; background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; }
.switch-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 40px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  font-size: 15px; font-weight: 700; color: var(--text); }
.bf-spin.big { width: 26px; height: 26px; border-width: 3px; color: var(--accent); }
.sw-bar { width: 220px; height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
#switch-bar-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #8b8efb); transition: width .35s ease; }
.sw-pct { font-size: 13px; color: var(--muted); font-weight: 700; }
.sw-head { font-size: 15px; font-weight: 700; }
/* A / B 用两栏 grid：整块居中，但栏位内部靠左，
   这样 A 和 B 的标籤、日期会垂直对齐，长短不同也不会歪。 */
.sw-subs { display: grid; grid-template-columns: auto auto; column-gap: 12px; row-gap: 4px;
  justify-content: center; align-items: baseline; margin-top: 10px; text-align: left; }
.sw-k, .sw-v { font-size: 12.5px; font-weight: 700; letter-spacing: .2px; }
.sw-v { font-variant-numeric: tabular-nums; }
.sw-k-a, .sw-v-a { color: var(--accent); }
.sw-k-b, .sw-v-b { color: var(--accent2); }
.isp-row td { padding-top: 2px; padding-bottom: 10px; font-size: 12px; color: var(--muted); }
.isp-row .pill { margin-right: 6px; }

/* ===== Domains cards ===== */
.dom-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.dom-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dom-card-top { display: flex; align-items: center; justify-content: space-between; }
.dom-name { font-size: 15px; font-weight: 700; word-break: break-all; }
.dom-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.dom-meta b { color: var(--text); font-weight: 600; }
.dom-blocked { font-size: 13px; font-weight: 700; color: var(--neg); background: var(--neg-soft); padding: 6px 10px; border-radius: 8px; }
.isp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.isp-chip { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.isp-chip.ok { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 30%, transparent); }
.isp-chip.bad { color: var(--neg); background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }
.isp-chip.unk { color: var(--muted); }
.dom-actions { display: flex; gap: 8px; margin-top: 2px; }
.dom-actions .icon-btn { flex: 1; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12.5px; cursor: pointer; }
.dom-actions .icon-btn.danger:hover { color: var(--neg); background: var(--neg-soft); }
.dom-co-tag { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.dom-tag { font-size: 10px; font-weight: 800; letter-spacing: .5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.dom-tag.primary { color: var(--accent2); border-color: color-mix(in srgb, var(--accent2) 40%, transparent); background: color-mix(in srgb, var(--accent2) 12%, transparent); }
.dom-lander { font-size: 13px; font-weight: 600; }
.lander-live { color: var(--pos); }
.lander-stub { color: var(--accent2); }
.lander-down { color: var(--neg); }
.lander-unk { color: var(--muted); }
.dom-grid td, .dom-grid th { padding: 10px 12px; }
.dom-td-host { font-weight: 700; }
.dom-td-act { white-space: nowrap; text-align: right; }
.dom-td-act .icon-btn { padding: 4px 8px; margin-left: 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); cursor: pointer; font-size: 12px; }
.dom-td-act .icon-btn.danger:hover { color: var(--neg); background: var(--neg-soft); }
.isp-row td { padding: 2px 12px 10px; font-size: 12px; color: var(--muted); border-top: none; }
.isp-row .isp-chip { margin-right: 5px; }
.dom-blocked-inline { color: var(--neg); font-weight: 700; margin-right: 8px; }


/* ===== Domains table — compact, clean ===== */
.dom-grid { border-collapse: collapse; width: 100%; }
.dom-grid thead th { font-size: 11px; letter-spacing: .4px; color: var(--muted); text-transform: uppercase; padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.dom-grid tbody td { padding: 11px 12px; border-bottom: none; vertical-align: middle; }
.dom-grid tbody tr:not(.isp-row):hover { background: var(--panel-2); }
.dom-td-host { font-weight: 700; font-size: 14px; }
.dom-tag { font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 2px 8px; border-radius: 5px; }
.dom-tag.primary { color: var(--accent2); background: color-mix(in srgb, var(--accent2) 15%, transparent); }
.dom-tag:not(.primary) { color: var(--muted); background: var(--panel-2); }
.dom-grid .pill { font-size: 11px; padding: 2px 9px; }
.lander-live { color: var(--pos); font-weight: 600; font-size: 13px; }
.lander-stub { color: var(--accent2); font-weight: 600; font-size: 13px; }
.lander-down { color: var(--neg); font-weight: 600; font-size: 13px; }
.lander-unk { color: var(--muted); font-size: 13px; }
.dom-td-act { text-align: right; white-space: nowrap; }
.dom-td-act .icon-btn { padding: 4px 7px; margin-left: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; font-size: 12px; color: var(--muted); }
.dom-td-act .icon-btn:hover { color: var(--text); background: var(--panel-2); }
.dom-td-act .icon-btn.danger:hover { color: var(--neg); background: var(--neg-soft); }
.isp-row td { padding: 0 12px 12px !important; border-bottom: 1px solid var(--line) !important; }
.isp-mini { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-right: 12px; }
.isp-mini .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--muted); }
.isp-mini.ok .dot { background: var(--pos); }
.isp-mini.ok { color: var(--pos); }
.isp-mini.bad .dot { background: var(--neg); }
.isp-mini.bad { color: var(--neg); font-weight: 700; }
.isp-mini.unk .dot { background: color-mix(in srgb, var(--muted) 40%, transparent); }
.dom-blocked-inline { color: var(--neg); font-weight: 700; font-size: 11px; margin-right: 12px; }
.dom-co-tag { font-size: 10px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 5px; margin-left: 6px; }

/* ===== Domains table clean ===== */
.dom-grid { width: 100%; }
.dom-grid td, .dom-grid th { padding: 11px 12px; vertical-align: middle; white-space: nowrap; }
.dom-td-host { font-weight: 700; }
.dom-co-sel { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.dom-tag.clickable { cursor: pointer; }
.dom-tag.clickable:hover { filter: brightness(1.1); }
.dom-isp-cell { display: flex; align-items: center; gap: 5px; }
.isp-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.isp-dot.ok { background: var(--pos); }
.isp-dot.bad { background: var(--neg); box-shadow: 0 0 0 2px color-mix(in srgb, var(--neg) 30%, transparent); }
.isp-dot.unk { background: var(--line); }
.dom-blk-mini { font-size: 11px; color: var(--neg); font-weight: 700; }
.dom-dim { color: var(--muted); }
.dom-reason { margin-top: 2px; font-size: 10.5px; font-weight: 500; color: var(--neg); line-height: 1.25; white-space: normal; }
.dom-grid th, .dom-grid td { padding-top: 12px; padding-bottom: 12px; }
.dom-grid td:nth-child(4) { min-width: 92px; }
.dom-td-act { text-align: right; }
.dom-td-act .icon-btn { padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); cursor: pointer; }
.dom-td-act .icon-btn.danger:hover { color: var(--neg); background: var(--neg-soft); }

/* ===== Domains table alignment + readable ISP ===== */
.dom-grid { table-layout: fixed; }
.dom-grid th, .dom-grid td { text-align: left; overflow: hidden; text-overflow: ellipsis; }
.dom-grid col.c-host { width: 22%; }
.dom-grid col.c-co { width: 12%; }
.dom-grid col.c-tag { width: 9%; }
.dom-grid col.c-status { width: 8%; }
.dom-grid col.c-lander { width: 9%; }
.dom-grid col.c-isp { width: 16%; }
.dom-grid col.c-resp { width: 8%; }
.dom-grid col.c-ssl { width: 11%; }
.dom-grid col.c-act { width: 5%; }
.isp-all-ok { color: var(--pos); font-weight: 600; font-size: 13px; }
.isp-blocked-label { color: var(--neg); font-weight: 700; font-size: 13px; background: var(--neg-soft); padding: 3px 8px; border-radius: 6px; }
.dom-grid .num, .dom-grid td.dom-td-act { text-align: right; }
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--accent); }
.th-sort.sorted { color: var(--accent); }
.sort-arr { font-size: 10px; }

/* Finance report */
.fin-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 8px; }
.fin-kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.fin-kpi-l { font-size: 12px; color: var(--muted); font-weight: 600; }
.fin-kpi-v { font-size: 22px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.fin-kpi-d { font-size: 12px; font-weight: 700; margin-top: 2px; }
.fin-kpi-d.pos { color: var(--pos); } .fin-kpi-d.neg { color: var(--neg); }
.fin-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .fin-kpis { grid-template-columns: 1fr 1fr; } .fin-charts { grid-template-columns: 1fr; } }
/* Per-chart insight note (below each finance chart) */
.fin-note { margin-top: 12px; padding: 9px 12px 9px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); border-left-width: 4px; color: var(--text); min-height: 18px; }
.fin-note.fin-hl-g { border-left-color: var(--pos); background: color-mix(in srgb, var(--pos) 8%, transparent); }
.fin-note.fin-hl-r { border-left-color: var(--neg); background: color-mix(in srgb, var(--neg) 8%, transparent); }
.fin-note.fin-hl-y { border-left-color: #f59e0b; background: color-mix(in srgb, #f59e0b 8%, transparent); }
.fin-highlights { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 16px; }
.fin-hl { padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); }
.fin-hl-g { background: color-mix(in srgb, var(--pos) 12%, transparent); border-color: color-mix(in srgb, var(--pos) 35%, var(--line)); color: var(--text); }
.fin-hl-r { background: color-mix(in srgb, var(--neg) 12%, transparent); border-color: color-mix(in srgb, var(--neg) 35%, var(--line)); color: var(--text); }
.fin-hl-y { background: color-mix(in srgb, #f59e0b 12%, transparent); border-color: color-mix(in srgb, #f59e0b 35%, var(--line)); color: var(--text); }
#fin-table td:first-child, #fin-table th:first-child { text-align: left; font-weight: 600; }
#fin-table tr.fin-current { background: var(--accent-soft); }
#fin-table tr.fin-current td { font-weight: 700; }

/* Finance: calculation-method disclosure */
.fin-formula-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.fin-formula-list li { font-size: 13px; color: var(--text); padding: 9px 13px; background: var(--panel-2); border-radius: 8px; border-left: 3px solid var(--accent); font-variant-numeric: tabular-nums; }

/* Finance: worked-out formula line under each chart */
.fin-eq { margin-top: 8px; padding: 7px 12px; border-radius: 8px; font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.fin-eq:empty { display: none; }
.fin-eq { line-height: 1.6; }
.fin-eq .eq-x { color: var(--muted); }
.fin-eq .eq-r { color: var(--accent); font-weight: 700; white-space: nowrap; }

/* ─── 客服聊天质检 ─────────────────────────────────────────────────────── */
#staff-table tbody tr { cursor: pointer; }
#staff-table tbody tr.cq-clickable:hover { background: var(--accent-soft); }
#staff-table tbody tr.cq-none { cursor: default; }
.cq-col { white-space: nowrap; }
.score-pill { padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; display: inline-block; min-width: 34px; text-align: center; }
.score-pill.s-good { background: var(--pos-soft); color: var(--pos); }
.score-pill.s-ok   { background: color-mix(in srgb, var(--accent2) 18%, transparent); color: var(--accent2); }
.score-pill.s-bad  { background: var(--neg-soft); color: var(--neg); }

.cq-box { max-width: 980px; }
.cq-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cq-list { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.cq-day { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin: 6px 0 -4px; }
.cq-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel-2); }
.cq-card.v-bad { border-left: 3px solid var(--neg); }
.cq-card.v-good { border-left: 3px solid var(--pos); }
.cq-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.cq-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.cq-line { display: flex; gap: 8px; margin: 4px 0; font-size: 13px; line-height: 1.5; }
.cq-who { flex: 0 0 auto; font-weight: 700; color: var(--muted); min-width: 3.2em; }
.cq-body { flex: 1 1 auto; word-break: break-word; white-space: pre-wrap; }
.cq-line.ask .cq-body { color: var(--muted); }
.cq-reason { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--text); }
.cq-tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.cq-tag.t-good { background: var(--pos-soft); color: var(--pos); }
.cq-tag.t-bad { background: var(--neg-soft); color: var(--neg); }
.cq-empty { text-align: center; color: var(--muted); padding: 28px 0; font-size: 13px; }
@media (max-width: 720px) {
  .cq-list { max-height: 70vh; }
  .cq-who { min-width: 2.6em; }
}

.cqs-score { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-size: 13px; line-height: 1.7; }
.cqs-score b { font-variant-numeric: tabular-nums; }
.cqs-warn { color: var(--neg); font-weight: 600; }

/* ─── 玩家投诉页 ──────────────────────────────────────────────────────── */
.iss-kpi { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.iss-kpi .k { flex: 1 1 150px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.iss-kpi .k b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.iss-kpi .k span { font-size: 12px; color: var(--muted); }
.iss-peak { margin-top: 12px; font-size: 13px; color: var(--text); line-height: 1.9; }
.iss-peak .hl { font-weight: 700; color: var(--neg); }
.iss-hours { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 8px 0 0; overflow-x: auto; }
.iss-hours .hb { flex: 1 1 0; min-width: 20px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; cursor: pointer; }
.iss-hours .hb .bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; transition: background .15s; }
.iss-hours .hb.peak .bar { background: var(--neg); }
.iss-hours .hb:hover .bar { background: var(--accent2); }
.iss-hours .hb.sel .bar { outline: 2px solid var(--text); }
.iss-hours .hb .lbl { font-size: 10px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.iss-hours .hb .cnt { font-size: 10px; color: var(--muted); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.iss-split { display: flex; gap: 22px; flex-wrap: wrap; }
.iss-col { flex: 1 1 280px; min-width: 0; }
.iss-bars { display: flex; flex-direction: column; gap: 7px; }
.iss-bar { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.iss-bar:hover .track { outline: 1px solid var(--accent); }
.iss-bar .nm { flex: 0 0 118px; color: var(--muted); }
.iss-bar .track { flex: 1 1 auto; background: var(--panel-2); border-radius: 6px; height: 20px; position: relative; overflow: hidden; }
.iss-bar .fill { height: 100%; background: var(--accent); border-radius: 6px; }
.iss-bar .fill.ang { background: var(--neg); }
.iss-bar .vv { flex: 0 0 62px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.iss-empty { color: var(--muted); font-size: 13px; padding: 14px 0; }
@media (max-width: 720px) { .iss-bar .nm { flex-basis: 88px; font-size: 12px; } }
