:root {
  --ink: #102a43;
  --ink-soft: #486581;
  --muted: #829ab1;
  --line: #d9e2ec;
  --paper: #f7f9fb;
  --surface: #ffffff;
  --teal: #0f766e;
  --teal-soft: #d9f3ef;
  --coral: #c05640;
  --amber: #b7791f;
  --amber-soft: #fff3d6;
  --shadow: 0 12px 30px rgba(16, 42, 67, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 22px clamp(20px, 4vw, 64px); color: #fff; background: var(--ink); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.45); border-radius: 9px; color: #b8f0e7; font-weight: 800; }
.eyebrow, .section-kicker { margin: 0 0 6px; font-size: 11px; letter-spacing: .14em; font-weight: 700; text-transform: uppercase; }
.topbar .eyebrow { color: #9fb3c8; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(19px, 2vw, 25px); letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: 0; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: #d9e2ec; font-size: 13px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #61d7c8; box-shadow: 0 0 0 4px rgba(97,215,200,.14); }
.meta-divider { width: 1px; height: 15px; background: rgba(255,255,255,.3); }

.page-shell { width: min(1440px, 100%); margin: 0 auto; padding: 36px clamp(20px, 4vw, 64px) 64px; }
.toolbar, .panel-heading, .toolbar-actions, .coverage-meta { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.toolbar { margin-bottom: 22px; }
.section-kicker { color: var(--teal); }
.toolbar h2 { color: var(--ink); }
.toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.date-control { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 10px 11px; color: var(--ink); background: var(--surface); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.13); }
.date-control input { width: auto; }
.button { border: 1px solid transparent; border-radius: 7px; padding: 10px 14px; font-weight: 700; }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { background: #0b625c; }
.button-quiet { color: var(--ink-soft); border-color: var(--line); background: var(--surface); }
.platform-tabs { display: flex; align-items: center; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.platform-tabs + .platform-tabs { padding-top: 12px; }
.filter-label { flex: 0 0 auto; margin-right: 3px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tab { border: 0; border-radius: 999px; padding: 8px 14px; color: var(--ink-soft); background: transparent; white-space: nowrap; }
.tab:hover { background: #e8f0f5; }
.tab.is-active { color: var(--ink); background: #d9e2ec; font-weight: 800; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 24px 0 30px; }
.date-range-badge { display: inline-block; margin-top: 8px; padding: 4px 9px; border-radius: 999px; background: #e6fffb; color: #0f766e; font-size: 12px; font-weight: 700; }
.api-warning { margin: -14px 0 20px; padding: 10px 14px; border: 1px solid #f0c36d; border-radius: 10px; background: #fff8e6; color: #7a4d00; font-size: 13px; }
.metric-card { min-height: 138px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card .metric-label { color: var(--ink-soft); font-size: 13px; }
.metric-value { margin: 10px 0 7px; font-size: clamp(25px, 3vw, 36px); line-height: 1; font-weight: 800; letter-spacing: 0; }
.metric-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.metric-foot .calculated { color: var(--teal); }
.metric-foot .unavailable { color: var(--amber); }

.trend-panel { margin-bottom: 18px; overflow: hidden; }
.platform-badge:has(.brand-logo) { display: inline-flex; width: auto; min-width: 70px; height: 40px; gap: 6px; flex-shrink: 0; background: transparent; border: 0; }
.platform-badge img.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.platform-badge:has(.brand-logo) img.platform-logo { width: 26px; height: 26px; object-fit: contain; border-radius: 6px; }
.trend-list { display: block; overflow-x: auto; background: var(--surface); }
.growth-comparison { width: 100%; min-width: 760px; }
.growth-comparison th { text-align: right; white-space: nowrap; }
.growth-comparison th:nth-child(-n+2), .growth-comparison th:last-child { text-align: left; }
.growth-comparison .growth-rate { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.growth-rank { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.growth-comparison td.positive { color: var(--teal); }
.growth-comparison td.negative { color: var(--coral); }
.trend-account { min-width: 0; padding: 18px 20px 16px; background: var(--surface); }
.trend-account-name { display: flex; align-items: center; gap: 10px; }
.trend-account-name strong, .trend-account-name small { display: block; }.trend-account-name small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.trend-account ol { display: grid; gap: 7px; margin: 16px 0 0; padding: 0; list-style: none; }
.trend-account li { display: grid; grid-template-columns: 38px minmax(62px, 1fr) 60px 54px; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 11px; }
.trend-date { color: var(--muted); }.trend-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e8f0f5; }.trend-fill { display: block; height: 100%; border-radius: inherit; background: var(--teal); }.trend-account li strong { color: var(--ink); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }.trend-account li small { color: var(--teal); text-align: right; }.trend-account li small.negative { color: var(--coral); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.account-panel { margin-bottom: 18px; overflow: hidden; }
.weekly-account-panel { margin-bottom: 18px; overflow: hidden; }
.weekly-account-table { min-width: 840px; }
.manual-audit-panel { margin-bottom: 18px; overflow: hidden; }
.manual-audit-table { min-width: 820px; }.manual-reason { max-width: 320px; overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; }
.panel-note { margin: 0; padding: 0 20px 16px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.account-table { min-width: 650px; }
.account-cell { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.account-name { color: var(--ink); font-weight: 700; }
.account-name a { color: inherit; text-decoration: none; }
.account-name a:hover { color: var(--teal); text-decoration: underline; }
.growth-cell strong { font-variant-numeric: tabular-nums; }
.growth-cell small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; }
.positive { color: var(--teal); }.negative { color: var(--coral); }.unavailable-number { color: var(--muted); }
.empty-cell { padding: 28px 20px; color: var(--muted); text-align: center; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.panel-wide { min-width: 0; }
.panel-heading { padding: 20px 20px 16px; border-bottom: 1px solid var(--line); }
.panel-heading.compact { border-bottom: 0; padding-bottom: 8px; }
.result-count { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 14px 20px; border-bottom: 1px solid #edf2f7; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.content-cell { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.platform-badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: #fff; font-size: 11px; font-weight: 800; }
.platform-badge { background: transparent; flex: 0 0 30px; overflow: hidden; }
.platform-badge img { display: block; width: 30px; height: 30px; object-fit: contain; }
.content-title { max-width: 290px; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 700; }
.content-subtitle { margin-top: 3px; color: var(--muted); font-size: 11px; }
.number-cell { font-variant-numeric: tabular-nums; font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 700; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-verified { color: var(--teal); background: var(--teal-soft); }.pill-review { color: var(--amber); background: var(--amber-soft); }.pill-unavailable { color: var(--coral); background: #fde8e3; }
.side-stack { display: grid; gap: 18px; }
.status-list { padding: 0 20px 18px; }
.source-run-list { padding: 0 20px 18px; }
.source-run-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.source-run-row:first-child { border-top: 0; padding-top: 0; }
.source-run-message { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--muted); max-width: 270px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid #edf2f7; }
.status-row:first-child { border-top: 0; }
.status-name { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.status-name::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.status-name.is-muted::before { background: var(--amber); }
.status-detail { color: var(--muted); font-size: 12px; }
.accent-panel { padding: 20px; background: #edf9f6; }
.accent-panel h2 { margin-bottom: 8px; }
.muted { margin-bottom: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.coverage-bar { height: 8px; margin: 18px 0 10px; overflow: hidden; border-radius: 999px; background: #c9e8e3; }
.coverage-bar span { display: block; width: 82%; height: 100%; border-radius: inherit; background: var(--teal); }
.coverage-meta { color: var(--ink-soft); font-size: 12px; }.coverage-meta strong { color: var(--teal); font-size: 16px; }
.discovery-panel { overflow: hidden; }
.discovery-list { padding: 0 20px 16px; }
.discovery-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid #edf2f7; }
.discovery-row:first-child { border-top: 0; }
.discovery-row.is-alert { margin: 0 -8px; padding: 12px 8px; background: #fff8ed; border-top-color: #f7dfb2; }
.discovery-main { min-width: 0; }
.discovery-title { display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.discovery-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.is-alert .discovery-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(183,121,31,.15); }
.candidate-link { display: inline-block; margin-top: 5px; color: var(--teal); font-size: 11px; text-decoration: none; }
.candidate-link:hover { text-decoration: underline; }
.empty-copy { margin: 0; padding: 0 0 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.manual-dialog { width: min(580px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 10px; color: var(--ink); box-shadow: 0 25px 70px rgba(16,42,67,.25); }
.manual-dialog::backdrop { background: rgba(16,42,67,.5); }
.manual-dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 8px; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 7px; color: var(--ink-soft); background: #edf2f7; font-size: 22px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.form-grid label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.full-span { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.form-result { min-height: 20px; margin-top: 12px; color: var(--teal); font-size: 12px; }
.weekly-preview { max-height: 260px; margin: 14px 0 0; overflow: auto; padding: 12px; border-radius: 7px; color: #d9f3ef; background: var(--ink); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

@media (max-width: 980px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .content-grid { grid-template-columns: 1fr; } .side-stack { grid-template-columns: 1fr 1fr; } .trend-list { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .topbar { align-items: flex-start; flex-direction: column; padding: 18px 20px; } .topbar-meta { font-size: 12px; } .page-shell { padding: 26px 16px 46px; } .toolbar { align-items: flex-start; flex-direction: column; } .toolbar-actions { width: 100%; justify-content: space-between; } .metric-grid, .side-stack { grid-template-columns: 1fr; } .metric-card { min-height: 122px; } .form-grid { grid-template-columns: 1fr; } .full-span { grid-column: auto; } .platform-tabs { margin-right: -16px; padding-right: 16px; } .panel-heading { padding-left: 16px; padding-right: 16px; } .panel-note, .discovery-list, .status-list, .source-run-list { padding-left: 16px; padding-right: 16px; } .discovery-row.is-alert { margin-left: -4px; margin-right: -4px; padding-left: 4px; padding-right: 4px; } .trend-account { padding-left: 16px; padding-right: 16px; } }
