/* Theme colors and type follow the installed Dzen Studio v162 WebUI. */
:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --canvas: #f6f5f1;
  --surface: #fffefb;
  --raised: #fbfaf7;
  --surface-muted: #efede7;
  --surface-hover: #e8e6df;
  --ink: #1b1a17;
  --text-secondary: #4f4c45;
  --muted: #6b675e;
  --line: #e4e1d9;
  --line-strong: #cfcbc0;
  --accent: #2448c8;
  --accent-text: #2041b5;
  --accent-soft: #e8ecfa;
  --on-ink: #fbfaf7;
  --ink-hover: #36342f;
  --good: #2d6a46;
  --good-soft: #e5efe7;
  --warn: #8a5a00;
  --warn-soft: #f6eedb;
  --bad: #b3261e;
  --chart-stroke: #2448c8;
  --series-1: var(--chart-stroke);
  --series-2: #2d6a46;
  --series-3: #9b5900;
  --series-4: #7950a8;
  --series-5: #a73c69;
  --series-6: #137385;
  --series-7: #765b36;
  --series-8: #666b78;
  --overlay: rgba(27, 26, 23, .38);
  --shadow: 0 12px 32px -12px rgba(27, 26, 23, .28), 0 0 0 1px rgba(27, 26, 23, .06);
  --radius: 6px;
  --radius-l: 8px;
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px rgba(36, 72, 200, .55);
  --safe-top: max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-bottom: max(env(safe-area-inset-bottom), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --studio-mark: url("/studio-icon.png?v=6f79cc966615");
  accent-color: var(--accent);
  font-family: var(--font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #16171a;
  --surface: #1c1d21;
  --raised: #202125;
  --surface-muted: #27282d;
  --surface-hover: #2f3036;
  --ink: #ecebe6;
  --text-secondary: #b4b2ab;
  --muted: #9a988f;
  --line: #2c2d32;
  --line-strong: #3d3e44;
  --accent: #5b78e6;
  --accent-text: #9db0ff;
  --accent-soft: rgba(110, 138, 240, .14);
  --on-ink: #16171a;
  --ink-hover: #d6d4cd;
  --good: #7cc497;
  --good-soft: rgba(124, 196, 151, .12);
  --warn: #dcb062;
  --warn-soft: rgba(220, 176, 98, .12);
  --bad: #f08a80;
  --chart-stroke: #8ea6ff;
  --series-2: #7cc497;
  --series-3: #dcb062;
  --series-4: #c3a0ef;
  --series-5: #ee9dc0;
  --series-6: #74c5d6;
  --series-7: #ceb48d;
  --series-8: #afb5c3;
  --overlay: rgba(0, 0, 0, .55);
  --shadow: 0 14px 36px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px rgba(157, 176, 255, .6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #16171a;
    --surface: #1c1d21;
    --raised: #202125;
    --surface-muted: #27282d;
    --surface-hover: #2f3036;
    --ink: #ecebe6;
    --text-secondary: #b4b2ab;
    --muted: #9a988f;
    --line: #2c2d32;
    --line-strong: #3d3e44;
    --accent: #5b78e6;
    --accent-text: #9db0ff;
    --accent-soft: rgba(110, 138, 240, .14);
    --on-ink: #16171a;
    --ink-hover: #d6d4cd;
    --good: #7cc497;
    --good-soft: rgba(124, 196, 151, .12);
    --warn: #dcb062;
    --warn-soft: rgba(220, 176, 98, .12);
    --bad: #f08a80;
    --chart-stroke: #8ea6ff;
    --overlay: rgba(0, 0, 0, .55);
    --shadow: 0 14px 36px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
    --ring: 0 0 0 2px var(--surface), 0 0 0 4px rgba(157, 176, 255, .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  padding-inline: max(env(safe-area-inset-left), var(--tg-safe-area-inset-left, 0px)) max(env(safe-area-inset-right), var(--tg-safe-area-inset-right, 0px));
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

button, select { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, canvas:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius);
}
a { color: var(--accent-text); }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.3; }
dl, dd { margin: 0; }
.visually-hidden, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 10px; background: var(--raised); }

.studio-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
  padding-top: var(--safe-top);
}
.studio-sidebar {
  position: sticky;
  z-index: 2;
  top: var(--safe-top);
  display: flex;
  flex-direction: column;
  align-self: start;
  min-width: 0;
  height: calc(100vh - var(--safe-top));
  height: calc(100dvh - var(--safe-top));
  gap: 4px;
  padding: 18px 12px max(12px, var(--safe-bottom));
  border-inline-end: 1px solid var(--line);
  background: var(--surface);
}
.sidebar-top { display: flex; padding: 2px 10px 14px; }
.wordmark { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  display: inline-block;
  flex: none;
  width: 22px;
  height: 22px;
  background: center / contain no-repeat var(--studio-mark);
}
.shell {
  min-width: 0;
  width: 100%;
  padding: 32px max(40px, calc((100% - 1040px) / 2)) calc(64px + var(--safe-bottom));
}
.shell:focus { outline: none; }
.heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.heading-title { min-width: 0; }
h1 { font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 15px; font-weight: 600; }
.channel-heading { margin-top: 5px; color: var(--muted); font-family: var(--font); font-size: 14px; font-weight: 400; }
.sidebar-foot { position: relative; display: flex; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.channel-control { display: flex; position: relative; align-items: center; width: 100%; min-width: 0; }
.channel-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
.channel-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.channel-avatar.studio-avatar { background: center / contain no-repeat var(--studio-mark); }
.channel-control > .channel-avatar { position: absolute; inset-inline-start: 4px; }
.channel-control select, #channel-picker {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 24px 0 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
}
#channel-picker { overflow: hidden; text-align: start; white-space: nowrap; }
.channel-control select:hover:not(:disabled), #channel-picker:hover:not(:disabled) { background: var(--raised); }
.channel-menu {
  position: absolute;
  z-index: 25;
  inset-inline-start: 0;
  inset-block-end: calc(100% + 5px);
  display: grid;
  gap: 1px;
  width: min(300px, calc(100vw - 32px));
  max-height: min(45dvh, 380px);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.channel-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  text-align: start;
}
.channel-menu-item:hover, .channel-menu-item[aria-current="true"] { background: var(--surface-muted); }
.channel-menu-item span:last-child { overflow-wrap: anywhere; }
select option { background: var(--surface); color: var(--ink); }
.channel-caret { position: absolute; inset-inline-end: 6px; width: 12px; height: 12px; pointer-events: none; color: var(--muted); }
.nav-icon, .channel-caret {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-icon { width: 19px; height: 19px; }
.field-select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.icon { display: inline-block; position: relative; flex: none; }
.channel-caret.icon { position: absolute; }
.icon-refresh { width: 14px; height: 14px; border: 1.5px solid; border-right-color: transparent; border-radius: 50%; }
.icon-refresh::after { position: absolute; content: ""; top: -.5px; right: -2px; border: 3px solid transparent; border-bottom-color: currentColor; transform: rotate(-46deg); }
.icon-external { width: 11px; height: 11px; border-top: 1.5px solid; border-right: 1.5px solid; align-self: center; }
.icon-external::after { content: ""; position: absolute; bottom: 0; left: 0; width: 14px; height: 1.5px; background: currentColor; transform: rotate(-45deg); transform-origin: 0 50%; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 4px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}
.button-outline { border-color: var(--line-strong); background: var(--surface); }
.button-accent { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.button-accent:hover:not(:disabled) { border-color: var(--ink-hover); background: var(--ink-hover); }
.button-quiet { border-color: transparent; background: transparent; color: var(--text-secondary); }
.button-quiet:hover:not(:disabled), .button-outline:hover:not(:disabled) { background: var(--surface-muted); color: var(--ink); }
.sync-button { padding-inline: 8px; }
.view-switch {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.view-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: start;
}
.view-button .nav-icon { flex: none; opacity: .75; }
.view-button:hover, .view-button[aria-pressed="true"] { background: var(--surface-muted); color: var(--ink); }
.view-button[aria-pressed="true"] { font-weight: 600; }
.view-button[aria-pressed="true"] .nav-icon { color: var(--accent-text); opacity: 1; }
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; margin: 0 0 18px; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: var(--radius-l); }
.segmented button { min-height: 36px; padding: 0 16px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-secondary); font-size: 14px; font-weight: 600; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.segmented button:focus-visible { box-shadow: var(--ring); }
.period-range { font-size: 13px; color: var(--muted); }
#period-action { margin-inline-start: auto; }
.panel-content { min-width: 0; }
.panel-content[aria-busy="true"] { cursor: progress; }
.panel-content.management { margin-top: 20px; }
.notice {
  margin: 0 0 14px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}
.notice[data-tone="error"] { color: var(--warn); background: var(--warn-soft); }
.notice[data-tone="success"] { color: var(--good); background: var(--good-soft); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.panel-pad { padding: 18px; }
.stack { display: grid; gap: 14px; min-width: 0; align-content: start; }
.dashboard-grid { display: grid; gap: 14px; align-items: start; grid-template-columns: minmax(0, 1fr); }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.section-note, .muted, .data-stamps { color: var(--muted); font-size: 13px; }
.section-note { margin-top: 6px; }
.data-stamps { display: grid; gap: 4px; padding-block: 4px; }
.data-stamps [data-tone="error"] { color: var(--warn); }
.welcome { padding: clamp(30px, 9vw, 72px) 22px; max-width: 520px; text-align: center; margin: min(8vh, 55px) auto; }
.welcome h1 { margin: 16px 0 10px; font-size: 26px; }
.welcome p { max-width: 350px; margin: 0 auto; color: var(--muted); }
.welcome .button { margin-top: 18px; }
.welcome-mark { width: 44px; height: 44px; }
.empty-panel { min-height: 120px; }
.empty-panel p { margin-top: 7px; }
.empty-panel .button { margin-top: 13px; }

.statistics-layout { display: grid; min-width: 0; gap: 14px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-block: 19px;
  border-top: 1px solid var(--line);
}
.metric { min-width: 0; padding: 0 20px; border-inline-start: 1px solid var(--line); }
.metric:first-child { padding-inline-start: 0; border-inline-start: 0; }
.metric dt { color: var(--text-secondary); font-size: 13.5px; overflow-wrap: anywhere; }
.metric dd { margin-top: 4px; font-family: var(--font-display); font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-secondary dd { font-size: 22px; line-height: 1.4; }
.metric-foot { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.mini-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.mini-metrics > div { border-top: 1px solid var(--line); padding: 9px 0 4px; }
.mini-metrics dt { color: var(--text-secondary); font-size: 13px; }
.mini-metrics dd { margin-top: 3px; font-weight: 600; overflow-wrap: anywhere; }
.period-totals { margin-bottom: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.period-totals .metric { padding: 8px 0 2px; border-inline-start: 0; }
.period-totals .metric dd { font-size: 22px; }
.chart-panel { padding: 20px 0 8px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.chart-panel h2 { font-size: 18px; }
.chart-panel .section-heading { margin-bottom: 6px; }
.chart-panel .field-select { width: auto; max-width: 100%; }
.chart-reading { min-height: 24px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.chart-reading strong { color: var(--ink); font-weight: 600; }
.chart { display: block; width: 100%; height: clamp(170px, 25vw, 275px); margin: 4px 0; touch-action: pan-y; }
.chart-empty { display: grid; place-items: center; text-align: center; min-height: 180px; color: var(--muted); }
.statistics-layout .dashboard-grid .panel, .article-layout .panel {
  padding-inline: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.disclosure { border-top: 1px solid var(--line); }
.disclosure:not(:first-child) { margin-top: 9px; }
.disclosure summary { min-height: 40px; padding: 10px 2px; font-size: 14px; font-weight: 600; }
.disclosure summary:hover { color: var(--accent-text); }
.disclosure[open] summary { margin-bottom: 4px; }
.scroll-table { overflow: auto; max-height: 340px; }
.scroll-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scroll-table :is(th, td) { padding: 8px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: start; }
.scroll-table th { font-size: 12px; color: var(--muted); }
.scroll-table td { font-size: 13px; }
.scroll-table :is(td, th):not(:first-child) { text-align: end; }

.status-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 24px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}
.status-chip::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; }
.status-chip[data-tone="good"] { color: var(--good); }
.status-chip[data-tone="warn"] { color: var(--warn); }
.status-chip[data-tone="accent"] { color: var(--accent-text); }
.status-rows { display: grid; margin-bottom: 10px; }
.status-rows > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.status-rows dt { font-size: 13px; color: var(--muted); }
.status-rows dd { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.action-stack { display: grid; gap: 8px; }
.action-stack .button { justify-content: flex-start; }
.issues { margin: 11px 0; padding: 8px 10px 8px 26px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.issues li + li { margin-top: 4px; }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list > li + li { border-top: 1px solid var(--line); }
.top-row { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; align-items: baseline; gap: 9px; padding: 10px 0; }
.top-rank { color: var(--accent); font-size: 12px; font-weight: 720; }
.row-title { min-width: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
a.row-title { text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a.row-title:hover { color: var(--accent-text); text-decoration-color: currentColor; }
a.row-title .icon { margin-inline-start: 7px; color: var(--accent-text); }
.article-row { padding-block: 13px; }
.article-row-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.article-row-head h3 { flex: 1 1 240px; }
.article-row .mini-metrics { margin-top: 10px; }
.article-row .mini-metrics > div { padding-top: 5px; }
.row-stats { display: flex; flex-wrap: wrap; gap: 3px 13px; margin-top: 7px; font-size: 13px; color: var(--muted); }
.row-stats strong { color: var(--ink); }
.list-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 9px 0 6px; }
.list-filters select { width: auto; max-width: 100%; }
.list-more { margin-top: 10px; }
.queue-row { padding-block: 10px; }
.queue-row-head { display: grid; gap: 5px; }
.queue-row-head h3 { min-width: 0; font-size: 15px; }
.queue-row .muted { margin-top: 5px; }
.queue-reason { margin-top: 5px; color: var(--text-secondary); font-size: 13px; }
.queue-editor-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 44px;
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 650;
  text-underline-offset: 3px;
}
.queue-field { color: var(--muted); font-size: 12px; font-weight: 550; }
.queue-disclosure summary { overflow-wrap: anywhere; }
.queue-calendar { padding-inline-start: 12px; }
.queue-calendar .queue-disclosure { margin-top: 0; }
.queue-day-hours { display: block; margin-top: 3px; font-size: 12px; font-weight: 550; color: var(--muted); }
.queue-slot { padding-block: 8px; font-variant-numeric: tabular-nums; }
.queue-slot time { font-weight: 650; }
.queue-slot .muted { margin-top: 3px; }
.notification-setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.notification-setting:last-child { border-bottom: 0; padding-bottom: 0; }
.notification-setting p { margin-top: 3px; }
.breakdown-grid { display: grid; gap: 14px; }
.bar-list { display: grid; gap: 8px; margin-top: 6px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.bar-list progress { display: block; margin-top: 3px; width: 100%; height: 6px; }
.dialog { width: min(calc(100% - 32px), 420px); max-width: none; padding: 22px; border: 1px solid var(--line-strong); border-radius: var(--radius-l); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: var(--overlay); }
.dialog p { margin-top: 10px; color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.all-coverage { display: grid; gap: 4px; }
.all-reach-panel { display: grid; grid-template-columns: minmax(180px, 26%) minmax(0, 1fr); }
.all-audience { min-width: 0; padding: 24px; border-inline-end: 1px solid var(--line); }
.overline { color: var(--muted); font-size: 12px; font-weight: 600; }
.audience-total { display: block; margin-block: 8px 2px; font-family: var(--font-display); font-size: 38px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.audience-change { margin-top: 14px; color: var(--muted); font-size: 13px; }
.audience-change strong { color: var(--ink); font-size: 18px; }
.all-reach { min-width: 0; padding: 24px; }
.all-reach .section-heading { margin-bottom: 4px; }
.all-primary-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; }
.all-primary-metrics .metric { padding-inline: 18px; }
.all-primary-metrics .metric:first-child { padding-inline-start: 0; }
.all-quality-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px 0; }
.all-quality-metrics .metric { padding-inline: 16px; }
.all-quality-metrics .metric:first-child { padding-inline-start: 0; }
.all-quality-metrics dd { font-size: 22px; }
.all-quality-metrics .metric:last-child dd { font-size: 17px; line-height: 1.35; }
.all-overview .section-note { line-height: 1.5; }
.chart-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chart-tools .field-select { width: auto; max-width: 100%; }
.chart-modes button { min-height: 30px; padding-inline: 12px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 7px 20px; margin-block: 8px; font-size: 12px; color: var(--text-secondary); }
.chart-legend-item::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-inline-end: 7px; vertical-align: middle; background: var(--series-color); }
.chart-channel-reading { display: inline-block; margin-inline-end: 12px; }
.channel-table-name { display: grid; gap: 3px; max-width: 270px; white-space: normal; }
.channel-link.button { display: inline-flex; justify-content: flex-start; min-height: 36px; padding: 3px 0; color: var(--accent-text); text-align: start; font-weight: 600; }
.channel-link .channel-avatar { width: 25px; height: 25px; }
.channel-shortcuts { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.all-overview .top-row .channel-link { display: flex; font-size: 12px; }

@media (max-width: 1019px) {
  .all-reach-panel { grid-template-columns: minmax(0, 1fr); }
  .all-audience { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .all-quality-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .all-quality-metrics .metric:nth-child(3) { padding-inline-start: 0; border-inline-start: 0; }
}
@media (max-width: 480px) {
  .all-audience, .all-reach { padding: 18px 16px; }
  .all-primary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; }
  .all-primary-metrics .metric { padding-inline: 10px; }
  .all-primary-metrics .metric:nth-child(3) { padding-inline-start: 0; border-inline-start: 0; }
  .all-primary-metrics dd { font-size: 26px; }
  .all-quality-metrics .metric { padding-inline: 10px; }
  .all-quality-metrics dd { font-size: 20px; }
  .all-quality-metrics .metric:last-child dd { font-size: 15px; }
  .chart-tools { width: 100%; }
  .chart-tools .chart-modes { flex: 1; }
  .chart-tools .field-select { flex: 1; min-width: 120px; }
  .chart-legend { gap: 6px 12px; }
}

@media (min-width: 650px) {
  .mini-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .period-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdown-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1020px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) minmax(252px, 29%); }
}
@media (max-width: 1019px) {
  .shell { padding-inline: 24px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 0; }
  .metrics .metric:nth-child(4) { padding-inline-start: 0; border-inline-start: 0; }
}
@media (max-width: 760px) {
  .studio-layout { display: block; }
  .studio-sidebar {
    position: static;
    height: auto;
    padding: 8px 16px 6px;
    gap: 2px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-top { padding: 4px 0; }
  .sidebar-foot { order: 1; margin: 0; padding: 0; border-top: 0; }
  .channel-control { max-width: 360px; }
  .channel-control select, #channel-picker { min-height: 44px; }
  .channel-menu { inset-block: calc(100% + 5px) auto; }
  .view-switch { order: 2; flex-direction: row; gap: 4px; margin-top: 3px; }
  .view-button { flex: 1 1 0; justify-content: center; gap: 5px; width: auto; min-height: 44px; padding-inline: 5px; font-size: 13px; }
  .view-button .nav-icon { width: 16px; height: 16px; }
  .view-button span { white-space: nowrap; }
  .shell { padding: 20px 16px calc(40px + var(--safe-bottom)); }
  h1, .welcome h1 { font-size: 22px; }
  .heading { gap: 10px 12px; }
  .panel-pad { padding: 16px; }
  .chart-panel { padding: 16px 0 8px; }
  .button { min-height: 44px; }
  .disclosure summary { min-height: 44px; }
  .segmented { flex: 1 1 100%; }
  .segmented button { flex: 1; min-height: 44px; padding: 0 5px; font-size: 13px; }
  #period-action { margin-inline-start: 0; }
}
@media (max-width: 480px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics .metric { padding: 0 12px 0 0; border-inline-start: 0; }
  .metric dd { font-size: 24px; }
  .metric-secondary dd { font-size: 21px; }
  .sync-button { padding-inline: 4px; font-size: 13px; }
  .sync-button .nav-icon { width: 16px; height: 16px; }
}
@media (max-width: 350px) {
  .view-button { gap: 4px; padding-inline: 3px; }
}
