:root {
  color-scheme: dark;
  --bg: #101723;
  --rail: #111b2b;
  --nav: #151f30;
  --surface: #172233;
  --surface-alt: #1b293c;
  --input-bg: #111c2b;
  --line: #2a394f;
  --line-soft: #24334a;
  --text: #edf3fc;
  --muted: #a5b5cc;
  --muted-strong: #c5d1e3;
  --accent: #4edcc7;
  --accent-ink: #082d2c;
  --accent-soft: #193b42;
  --accent-line: #2a595b;
  --blue: #75aaff;
  --violet: #bba7ff;
  --gold: #f2be7d;
  --danger: #ff9b9b;
  --chart-grid: #2b3b51;
  --chart-width: 1.9;
  --shadow: 0 12px 36px rgb(5 12 23 / 32%);
  --sans: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eff4f9;
  --rail: #eaf0f7;
  --nav: #f7faff;
  --surface: #fff;
  --surface-alt: #eff4f9;
  --input-bg: #f6f9fc;
  --line: #cedbea;
  --line-soft: #dde7f1;
  --text: #18283e;
  --muted: #506681;
  --muted-strong: #3e526e;
  --accent: #087a6d;
  --accent-ink: #f0fffc;
  --accent-soft: #dcefeb;
  --accent-line: #b5dcd4;
  --blue: #2168c8;
  --violet: #6e4ec0;
  --gold: #946014;
  --danger: #a82937;
  --chart-grid: #dce5ef;
  --chart-width: 2.15;
  --shadow: 0 12px 36px rgb(45 65 105 / 14%);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .54; cursor: default; }
button, a, input, select { transition: background-color 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; z-index: 10; top: 8px; left: 8px; padding: 8px 12px; transform: translateY(-160%); background: var(--surface); }
.skip-link:focus { transform: translateY(0); }
[data-icon] { flex: none; display: inline-flex; align-items: center; justify-content: center; }
.glyph { display: block; width: 17px; height: 17px; flex: none; }

.shell { display: grid; grid-template-columns: 214px 177px minmax(0, 1fr); min-height: 100vh; }
.version-panel, .nav-panel { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; min-width: 0; }
.version-panel { background: var(--rail); border-inline-end: 1px solid var(--line); padding: 0 16px; }
.brand { min-height: 81px; display: flex; align-items: center; gap: 12px; padding-inline: 4px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; color: #092d30; background: #4edcc7; }
.brand-mark .glyph { width: 23px; height: 23px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; line-height: 23px; font-weight: 700; white-space: nowrap; }
.brand small { font-size: 12px; line-height: 18px; color: var(--muted); }
.version-header { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-inline: 4px; margin-bottom: 12px; color: var(--muted); }
.version-header h2 { font-size: 12px; font-weight: 650; }
.version-count { font-size: 12px; font-variant-numeric: tabular-nums; }
.project-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 56vh; padding: 2px; margin: -2px; }
.project-button { position: relative; display: flex; align-items: center; width: 100%; text-align: left; gap: 10px; padding: 8px; min-height: 55px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); }
.project-button:hover { background: var(--surface-alt); }
.project-button.active, .project-button[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.project-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-alt); color: var(--muted-strong); font-size: 14px; font-weight: 700; }
.project-button.active .project-icon { color: var(--accent); background: color-mix(in srgb, var(--accent), var(--accent-soft) 84%); }
.project-text { flex: 1; min-width: 0; }
.project-text strong, .project-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-text strong { font-size: 13px; line-height: 20px; font-weight: 650; }
.project-text small { font-size: 12px; color: var(--muted); }
.project-state { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--muted); margin-inline-end: 2px; }
.project-state.active, .project-state.connected { background: var(--accent); }
.project-list > p { padding: 8px 4px; }
.add-version { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; width: 100%; margin-top: 16px; border: 1px dashed var(--line); border-radius: 8px; background: transparent; color: var(--muted-strong); font-size: 13px; }
.add-version:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.nav-panel { background: var(--nav); border-inline-end: 1px solid var(--line); padding-inline: 12px; }
.nav-heading { display: flex; align-items: center; min-height: 62px; padding-inline: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav button { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; color: var(--muted-strong); border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; background: transparent; text-align: left; white-space: nowrap; }
.nav button:hover { background: var(--surface-alt); color: var(--text); }
.nav button.active, .nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav button.active::after { position: absolute; inset-block: 11px; left: -12px; content: ""; display: block; width: 2px; border-radius: 1px; background: var(--accent); }
.publisher-nav-short { display: none; }
.nav-divider { height: 1px; margin: 13px 7px 8px; background: var(--line-soft); }
.nav-caption { color: var(--muted); padding: 2px 10px 6px; font-size: 12px; font-weight: 600; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 4; min-height: 62px; padding: 8px 28px; background: var(--bg); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.breadcrumb, .top-actions, .account-action { display: flex; align-items: center; gap: 10px; }
.breadcrumb { color: var(--muted); white-space: nowrap; }
.breadcrumb strong { color: var(--text); font-weight: 650; }
.crumb-arrow .glyph, .account-arrow .glyph { width: 13px; height: 13px; }
.top-actions { gap: 13px; }
.top-separator { width: 1px; height: 24px; background: var(--line); }
.icon-btn { width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; padding: 0; color: var(--muted-strong); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.icon-btn:hover, .icon-btn:active { background: var(--surface-alt); color: var(--accent); }
.theme-toggle { background: transparent; border-color: transparent; }
.project-toggle { display: none; }
.account { position: relative; }
.account-action { border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); padding: 5px; font-weight: 600; }
.account-action:hover { background: var(--surface-alt); }
#account-name { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-avatar { width: 29px; height: 29px; display: grid; place-items: center; flex: none; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-size: 12px; }
.account-avatar .glyph { width: 15px; height: 15px; }
.account-menu { position: absolute; inset: calc(100% + 8px) 0 auto auto; min-width: 142px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.account-menu button { display: flex; align-items: center; gap: 8px; min-height: 38px; width: 100%; border: 0; border-radius: 5px; color: var(--muted-strong); background: transparent; padding: 6px 10px; white-space: nowrap; }
.account-menu button:hover { color: var(--text); background: var(--surface-alt); }

.content { max-width: 1720px; margin-inline: auto; padding: 27px 28px 40px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 21px; }
.page-identity { min-width: 0; }
.title-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-line h1 { font-size: 30px; font-weight: 700; line-height: 1.28; letter-spacing: -.025em; overflow-wrap: anywhere; }
.project-context { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 7px; }
.project-context .glyph { width: 14px; height: 14px; }
#project-context { overflow-wrap: anywhere; }
.project-indicator, .badge { display: inline-flex; width: fit-content; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: var(--muted-strong); background: var(--surface-alt); font-size: 12px; white-space: nowrap; }
.project-indicator { font-size: 12px; }
.project-indicator::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.project-indicator.connected, .badge.ok, .badge.connected, .badge-website { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.badge-download { color: var(--blue); }
.badge-launcher { color: var(--violet); }
.page-actions, .code-actions, .dialog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; border: 1px solid transparent; border-radius: 8px; padding: 7px 12px; text-decoration: none; white-space: nowrap; font-size: 14px; font-weight: 650; }
.btn-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.btn-primary:not(:disabled):hover, .btn-primary:not(:disabled):active { color: var(--accent-ink); background: color-mix(in srgb, var(--accent), var(--accent-ink) 12%); }
.btn-quiet { color: var(--muted-strong); background: var(--surface); border-color: var(--line); }
.btn-quiet:not(:disabled):hover, .btn-quiet:not(:disabled):active { color: var(--text); background: var(--surface-alt); border-color: var(--muted); }
.btn-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 32%, var(--line)); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 15%, var(--surface)); }
.btn .glyph { width: 16px; height: 16px; }
.link-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 0; color: var(--accent); background: transparent; border: 0; white-space: nowrap; font-size: 13px; font-weight: 650; }
.link-button:hover { text-decoration: underline; }
.link-button .glyph { width: 14px; height: 14px; }
.filters { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.filter-controls, .report-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.segmented { padding: 3px; display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); }
.segmented button { display: block; min-height: 29px; color: var(--muted-strong); padding: 3px 10px; border: 1px solid transparent; border-radius: 5px; background: transparent; font-size: 13px; white-space: nowrap; }
.segmented button:hover { color: var(--text); background: var(--surface-alt); }
.segmented button.active, .segmented button[aria-pressed="true"] { color: var(--accent); background: var(--surface-alt); border-color: var(--line); font-weight: 650; }
.select-control { position: relative; min-height: 37px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted-strong); }
.select-control > [data-icon] { pointer-events: none; position: absolute; }
.select-control > [data-icon]:first-child { left: 9px; }
.select-control > [data-icon]:last-child { right: 7px; }
.select-control .glyph { width: 14px; height: 14px; }
.select-control select { width: 100%; height: 35px; max-width: 256px; appearance: none; border: 0; border-radius: 8px; padding: 4px 26px 4px 29px; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; text-overflow: ellipsis; }
.select-control option { background: var(--surface); }
.report-actions { color: var(--muted); font-size: 12px; }

.view { display: grid; gap: 16px; }
.card { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.metric { --series: var(--accent); min-height: 132px; padding: 15px 16px 13px; }
.metric-download { --series: var(--blue); }
.metric-launcher { --series: var(--violet); }
.metric-visitors { --series: var(--gold); }
.metric-top { display: flex; align-items: center; gap: 9px; }
.metric-top h2 { color: var(--muted-strong); font-size: 13px; font-weight: 600; white-space: nowrap; }
.metric-icon { width: 30px; height: 30px; background: color-mix(in srgb, var(--series) 12%, var(--surface)); color: var(--series); border: 1px solid color-mix(in srgb, var(--series) 18%, var(--surface)); border-radius: 8px; }
.metric-icon .glyph { width: 16px; height: 16px; }
.metric-value { display: block; margin-top: 7px; font-size: 31px; line-height: 41px; font-variant-numeric: tabular-nums; font-weight: 690; letter-spacing: -.035em; overflow-wrap: anywhere; }
.metric p { color: var(--muted); font-size: 12px; margin-top: 1px; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr); gap: 16px; }
.trend-panel, .channel-panel { position: relative; min-height: 337px; padding: 16px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.panel-head h2, .panel-head h3 { color: var(--text); font-size: 16px; line-height: 23px; font-weight: 650; }
.panel-head p { color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 4px; }
.panel-glyph { padding: 5px; color: var(--muted); }
.chart-legend { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin: 14px 0 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--muted-strong); font-size: 12px; }
.chart-legend i { width: 13px; height: 2px; border-radius: 1px; background: var(--accent); }
.chart-legend span[data-chart-series="download"] i { background: var(--blue); }
.chart-legend span[data-chart-series="launcher"] i { background: var(--violet); }
.trend-panel { display: flex; flex-direction: column; }
.trend-stage { position: relative; flex: 1; min-height: 230px; }
#trend-chart { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.chart-tooltip { position: absolute; z-index: 1; pointer-events: none; min-width: 118px; white-space: nowrap; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; color: var(--muted-strong); background: var(--input-bg); box-shadow: var(--shadow); font-size: 12px; }
.chart-tooltip strong { display: block; color: var(--text); margin-bottom: 3px; }
.chart-tooltip div { display: flex; justify-content: space-between; gap: 9px; }
.channel-stage { display: grid; place-items: center; padding: 14px 0 11px; }
.donut { width: 146px; height: 146px; display: grid; place-items: center; padding: 16px; border-radius: 50%; background: var(--line-soft); }
.donut-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 114px; height: 114px; border-radius: 50%; background: var(--surface); }
.donut-inner strong { font-size: 25px; line-height: 31px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.donut-inner span { color: var(--muted); font-size: 12px; }
.channel-legend { display: grid; gap: 2px; }
.channel-row { width: 100%; display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 5px; min-height: 24px; color: var(--muted-strong); background: transparent; border: 1px solid transparent; border-radius: 5px; font-size: 12px; text-align: left; }
.channel-legend button:hover { color: var(--text); background: var(--surface-alt); }
.channel-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-row strong { font-variant-numeric: tabular-nums; font-weight: 650; }
.channel-row i { width: 7px; height: 7px; border-radius: 50%; }
.chart-empty { text-align: center; color: var(--muted); font-size: 12px; margin-top: 4px; }

.table-panel { overflow: hidden; }
.table-panel .panel-head { padding: 16px; align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 520px; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th { color: var(--muted-strong); background: var(--surface-alt); font-size: 12px; font-weight: 650; white-space: nowrap; }
th, td { padding: 10px 16px; }
td { border-top: 1px solid var(--line-soft); color: var(--muted-strong); font-size: 13px; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-alt), var(--surface) 48%); }
table:not(.events-table) :is(td, th):not(:first-child) { text-align: right; }
table:not(.events-table) td:last-child { color: var(--text); font-weight: 650; }
table:not(.events-table) td:first-child { max-width: 280px; overflow-wrap: anywhere; }
.events-table { min-width: 605px; }
.events-table td:first-child { white-space: nowrap; }
.events-table td:last-child { max-width: 340px; overflow-wrap: anywhere; }
.events-table td:nth-child(3) { max-width: 210px; overflow-wrap: anywhere; }
.event-page { color: var(--muted-strong); }
.event-page:hover { color: var(--accent); }
.source-cell { color: var(--text); }
.source-mark { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; }
.source-mark[data-tone="1"] { background: var(--blue); }
.source-mark[data-tone="2"] { background: var(--violet); }
.source-mark[data-tone="3"] { background: var(--gold); }
.source-mark[data-tone="4"] { background: var(--muted); }
td button[data-source] { max-width: 100%; white-space: normal; text-align: left; overflow-wrap: anywhere; }
td.empty-table, table:not(.events-table) td.empty-table:last-child { text-align: center; font-weight: 400; color: var(--muted); padding: 28px 16px; }
.publisher-totals { display: grid; grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); margin: 0; }
.publisher-totals > div { min-width: 0; padding: 18px 16px; }
.publisher-totals > div + div { border-inline-start: 1px solid var(--line-soft); }
.publisher-totals dt { color: var(--muted-strong); font-size: 13px; font-weight: 600; }
.publisher-totals dd { margin: 4px 0 0; font-size: 28px; line-height: 1.25; font-weight: 690; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.publisher-totals .publisher-period { font-size: 17px; line-height: 1.45; padding-top: 3px; }
.publisher-entries dd { color: var(--accent); }
.publisher-ranking-note { padding: 11px 16px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
#publisher-ranking-status { min-width: 0; color: var(--muted); font-size: 12px; text-align: end; }
#publisher-ranking-status.is-error { color: var(--danger); }
.publisher-ranking-table { min-width: 0; table-layout: fixed; }
.publisher-ranking-table th:not(:first-child) { width: 17%; padding-block: 0; }
.publisher-ranking-table td { overflow-wrap: anywhere; }
.publisher-ranking-table th button { display: inline-flex; align-items: center; gap: 4px; min-height: 42px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: inherit; font: inherit; }
.publisher-ranking-table th button:hover:not(:disabled), .publisher-ranking-table th[aria-sort] button { color: var(--accent); }
.publisher-ranking-table th button:focus-visible { outline-offset: -2px; }
.publisher-ranking-table th button .glyph { width: 12px; height: 12px; }
.publisher-ranking-table th:not([aria-sort]) button .glyph { opacity: .5; }
.publisher-ranking-table th[aria-sort="ascending"] .glyph { transform: rotate(180deg); }
.publisher-ranking-table td.publisher-entry-count { color: var(--accent); font-weight: 650; }
.publisher-source { display: flex; align-items: baseline; gap: 10px; color: var(--text); }
.publisher-source > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.publisher-position { flex: none; color: var(--muted); font-size: 12px; min-width: 2ch; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.pagination-meta { color: var(--muted); font-size: 12px; }
.pagination-actions { display: flex; gap: 8px; }
#workspace.report-loading { opacity: .7; }

.empty-state { padding: 48px 24px; display: flex; align-items: center; flex-direction: column; gap: 11px; text-align: center; }
.empty-state h2 { font-size: 20px; }
.empty-state p { max-width: 56ch; color: var(--muted); text-wrap: pretty; }
.empty-state .btn { margin-top: 8px; }
.empty-icon { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 12px; width: 48px; height: 48px; }
.empty-icon .glyph { width: 25px; height: 25px; }
#code-content, #settings-content, .code-grid, .settings-grid { display: grid; gap: 14px; }
.code-heading, .code-summary, .code-card, .settings-grid > .card, .settings-danger { padding: 17px 18px; }
.code-heading h2, .code-summary h2, .settings-grid h2 { font-size: 17px; }
.code-heading p, .code-summary p, .settings-grid p, .code-card p { color: var(--muted); margin-top: 5px; }
.code-card .panel-head { margin-bottom: 9px; }
.code-card .panel-head > div { display: flex; align-items: center; gap: 8px; }
.code-card .panel-head .glyph { width: 19px; height: 19px; color: var(--accent); }
.code-card .code-symbol { padding: 5px; }
.code-card .badge-download .glyph { color: var(--blue); }
.code-card .badge-launcher .glyph { color: var(--violet); }
.code-address { overflow-wrap: anywhere; }
.code-address .mono { color: var(--muted-strong); margin-left: 4px; }
.code-display { position: relative; margin: 13px 0; overflow: auto; border: 1px solid var(--line); border-radius: 7px; padding: 11px 13px; background: var(--input-bg); color: var(--accent); }
.code-display pre { margin: 0; overflow: auto; }
.code-display code, .code-display pre { font: 12px/1.7 var(--mono); }
.settings-details { display: grid; grid-template-columns: minmax(94px, auto) minmax(0, 1fr); gap: 10px 18px; margin: 16px 0; }
.settings-details dt { font-weight: 650; color: var(--muted-strong); }
.settings-details dd { margin: 0; overflow-wrap: anywhere; }
.settings-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.settings-danger .btn { margin-top: 13px; }

.dialog { width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 28px); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.dialog::backdrop { background: rgb(6 12 23 / 72%); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); padding: 16px 18px; }
.dialog-head h2 { font-size: 19px; }
.dialog-head p { color: var(--muted); margin-top: 4px; }
.dialog-close { margin-left: auto; }
.dialog-body { display: grid; gap: 13px; padding: 16px 18px; }
.dialog-body > form, .dialog form { display: grid; gap: 12px; }
.dialog-actions { justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.dialog-body .dialog-actions { margin: 5px -18px -16px; }
.dialog-switch { color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field > span:first-child { font-size: 13px; font-weight: 650; }
.field-optional, .form-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.input, .dialog input:not([type="checkbox"]) { min-height: 39px; width: 100%; padding: 7px 10px; color: var(--text); border: 1px solid var(--line); border-radius: 7px; background: var(--input-bg); caret-color: var(--accent); }
.input::placeholder, .dialog input::placeholder { color: var(--muted); opacity: 1; }
.form-error, .is-error { color: var(--danger); }
.form-error { font-size: 13px; }
.toast-region { position: fixed; z-index: 8; bottom: 16px; right: 16px; display: grid; gap: 8px; max-width: min(380px, calc(100% - 32px)); pointer-events: none; }
.toast { width: fit-content; margin-left: auto; padding: 9px 12px; background: var(--surface); border: 1px solid var(--accent-line); border-radius: 8px; color: var(--text); box-shadow: var(--shadow); }
.toast.is-error { border-color: var(--danger); color: var(--danger); }
.noscript { position: fixed; inset: auto 16px 16px 16px; z-index: 8; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

@media (max-width: 1350px) {
  .shell { grid-template-columns: 197px 156px minmax(0, 1fr); }
  .topbar, .content { padding-inline: 24px; }
  .metric { padding-inline: 13px; }
}
@media (max-width: 1180px) {
  .shell { grid-template-columns: 180px 138px minmax(0, 1fr); }
  .version-panel { padding-inline: 12px; }
  .nav-panel { padding-inline: 9px; }
  .nav button.active::after { left: -9px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .metric-entry-rate { grid-column: span 2; }
  .metric-top { gap: 7px; }
  .metric-top h2 { white-space: normal; }
  .topbar, .content { padding-inline: 18px; }
}
@media (max-width: 1000px) {
  .shell { grid-template-columns: 176px 58px minmax(0, 1fr); }
  .nav-panel { padding-inline: 7px; }
  .nav-heading { font-size: 0; }
  .nav button { justify-content: center; padding-inline: 6px; }
  .nav button > span:not([data-icon]), .nav-caption { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .nav button.active::after { left: -7px; }
  .chart-grid { gap: 12px; }
  .chart-legend { gap: 8px; }
}
@media (max-width: 780px) {
  .shell { grid-template-columns: 58px minmax(0, 1fr); }
  .version-panel { display: none; position: fixed; z-index: 6; top: 63px; left: 0; bottom: 0; height: auto; box-shadow: var(--shadow); width: min(260px, calc(100vw - 36px)); }
  .version-panel.open, .version-panel.is-open, .version-panel[data-open="true"], .shell:has(#project-toggle[aria-expanded="true"]) .version-panel { display: flex; }
  .project-toggle { display: inline-grid; }
}
@media (max-width: 620px) {
  .shell { display: block; padding-bottom: 72px; }
  .nav-panel { position: fixed; z-index: 5; inset: auto 0 0; height: auto; padding: 5px 5px max(5px, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); }
  .nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
  .nav:has([data-view="ranking"]:not([hidden])) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .nav-heading, .nav-divider { display: none; }
  .nav button { flex-direction: column; gap: 3px; min-height: 44px; text-align: center; }
  .nav button.active::after { display: none; }
  .nav button > span:not([data-icon]) { position: static; width: auto; height: auto; clip-path: none; font-size: 11px; }
  .nav .publisher-nav-label { display: none; }
  .nav .publisher-nav-short { display: inline; }
  .topbar { min-height: 56px; }
  .version-panel { top: 56px; bottom: 53px; }
  .topbar, .content { padding-inline: 13px; }
  .content { padding-top: 18px; }
  .page-header { gap: 11px; flex-wrap: wrap; margin-bottom: 15px; }
  .title-line h1 { font-size: 24px; }
  .page-actions { margin-top: 2px; }
  .filter-controls { display: contents; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; margin-bottom: 12px; }
  .filters .segmented { grid-column: 1 / -1; justify-self: start; }
  .filters .select-control { justify-self: start; }
  .filters #source-filter-wrap { grid-column: 1 / -1; grid-row: 3; }
  .report-actions { grid-column: 2; grid-row: 2; justify-content: flex-end; }
  .publisher-filters { display: flex; }
  .publisher-filters .report-actions { flex: 1 1 auto; }
  .publisher-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .publisher-totals > div { padding: 12px; }
  .publisher-totals > div:nth-child(odd) { border-inline-start: 0; }
  .publisher-totals > div:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
  .publisher-totals dd { font-size: 24px; }
  .publisher-totals .publisher-period { font-size: 14px; }
  .publisher-ranking-note { padding-inline: 12px; }
  .publisher-ranking-table th:not(:first-child) { width: 20%; }
  .publisher-ranking-table :is(th, td) { padding-inline: 7px; }
  .publisher-ranking-table .publisher-source { gap: 5px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 108px; padding: 10px 11px; }
  .metric-value { font-size: 26px; line-height: 33px; }
  .chart-grid { grid-template-columns: 1fr; }
  .trend-panel, .channel-panel { min-height: 300px; }
  .trend-stage { min-height: 210px; }
  .channel-legend { max-width: 300px; margin: auto; }
  .toast-region { bottom: 66px; }
}
@media (max-width: 390px) {
  .crumb-section, .crumb-arrow, .top-separator { display: none; }
  .top-actions { gap: 5px; }
  .top-actions, .account { min-width: 0; }
  .account-action { max-width: 100%; }
  #account-name { max-width: 11ch; }
  .metric-top h2 { font-size: 12px; }
  .publisher-ranking-table :is(th, td) { padding-inline: 5px; }
  .publisher-ranking-table td { font-size: 12px; }
  .publisher-ranking-table th button { font-size: 11px; gap: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
