/* analytics.css — Analytics tab styles */

#view-analytics { flex: 1; overflow-y: auto; background: var(--bg); }

.an-wrap { max-width: 1400px; margin: 0 auto; padding: 24px; }

.an-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.an-header h2 { font-size: 20px; font-weight: 700; margin: 0 0 2px; }
.an-sub { font-size: 12px; color: var(--text-dim); margin: 0; }
.an-sub span { font-family: var(--font); font-weight: 600; color: var(--text); }

/* Funnel/analytics filter row — Orders .pv2-filters + .io-fg pattern (desktop inline).
   One line: controls that don't fit collapse into the "N more" dropdown (reflowAnFilters).
   overflow:visible so the date-picker calendar isn't clipped by the row; the priority+
   reflow keeps the row to one line on its own (items shrink, then move to "N more"). */
#an-filters { align-items: flex-end; flex-wrap: nowrap; overflow: visible; margin-bottom: 16px; }
/* Scope filters grow to fill the row (no squished, left-bunched look); they still shrink
   to min-width, at which point the reflow moves trailing controls into "N more". */
#an-filters > .io-fg { flex: 1 1 auto; min-width: 104px; }
#an-filters > .io-fg select, #an-filters > .io-fg input { width: 100%; }
#an-filters .io-fg #an-datepick-mount, #an-filters .io-fg .mmdp, #an-filters .io-fg .mmdp-trigger { width: 100%; }
#an-filters > .an-fg-chk { flex: 0 0 auto; }
.an-fg-chk { align-self: flex-end; }
.an-fg-more { position: relative; flex: 0 0 auto; align-self: flex-end; }
.an-more-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.an-more-btn:hover { border-color: var(--green); color: var(--text); }
.an-more-btn svg { flex: none; }
/* Fixed (not absolute) so it anchors to the viewport regardless of ancestors; JS sets top/right. */
.an-overflow-pop { display: none; position: fixed; z-index: 120; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 12px; flex-direction: column; gap: 12px; }
.an-fg-more.open .an-overflow-pop { display: flex; }
.an-overflow-pop > .io-fg, .an-overflow-pop > .an-fg-chk { flex: 0 0 auto; width: 100%; }
.an-overflow-pop .io-fg select, .an-overflow-pop .io-fg input, .an-overflow-pop #an-datepick-mount { width: 100%; }
#an-filters-btn, #an-filter-overlay { display: none; }
#an-filter-sheet .ifs-head, #an-filter-sheet .ifs-actions { display: none; }
.an-ctrl { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.an-ctrl select { padding: 6px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 13px; outline: none; }
.an-ctrl select:focus { border-color: var(--accent); }
.an-ctrl-chk { flex-direction: row; align-items: center; gap: 6px; text-transform: none; letter-spacing: normal; font-size: 12px; color: var(--text); font-weight: 500; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.an-ctrl-chk input { cursor: pointer; }

/* "Include ATX" switch — off by default (Austin excluded). */
.an-toggle { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 2px; cursor: pointer; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--text-dim); user-select: none; }
.an-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.an-toggle-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--border); transition: background .15s; }
.an-toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.an-toggle input:checked + .an-toggle-track { background: var(--green); }
.an-toggle input:checked + .an-toggle-track .an-toggle-thumb { transform: translateX(14px); }
.an-toggle input:focus-visible + .an-toggle-track { box-shadow: 0 0 0 2px rgba(45,106,79,.35); }
.an-toggle input:checked ~ .an-toggle-txt { color: var(--text); }

/* Device multi-select (reuses Orders' .io-seg/.io-seg-btn). Sized to content so it
   doesn't stretch like the grow-to-fill selects beside it. */
#an-filters > .an-device-fg { flex: 0 0 auto; }
.an-device-seg .an-dev-ico { width: 15px; height: 15px; flex: none; }
@media (max-width: 1180px) { .an-device-seg .io-seg-btn span { display: none; } .an-device-seg .io-seg-btn { padding: 0 9px; } }

/* Compare-segment head: split-by pills + Expand button. */
.an-cmp-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-cmp-expand { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .12s, color .12s; }
.an-cmp-expand:hover { border-color: var(--green); color: var(--text); }
.an-cmp-expand svg { flex: none; }
.an-hidden { display: none !important; }
/* "Top N of M regions — Expand for all" note under the inline compare matrix. */
.an-cmp-note { margin-top: 10px; font-size: 11.5px; color: var(--text-faint); }
.an-cmp-note-link { border: 0; background: none; padding: 0; font: inherit; font-size: inherit; font-weight: 600; color: var(--green); cursor: pointer; text-decoration: underline; }
.an-cmp-note-link:hover { color: var(--green-2); }

/* Region expand modal — full region × funnel-stage table with axes/value switches. */
body.an-modal-lock { overflow: hidden; }
.an-modal-overlay { display: none; position: fixed; inset: 0; z-index: 240; background: rgba(20, 16, 8, .44); align-items: center; justify-content: center; padding: 24px; }
.an-modal-overlay.open { display: flex; }
.an-modal { display: flex; flex-direction: column; width: min(960px, 100%); max-height: calc(100vh - 48px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 70px rgba(20, 16, 8, .3); overflow: hidden; }
.an-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.an-modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.an-modal-sub { font-weight: 500; color: var(--text-faint); font-size: 13px; }
.an-modal-tools { display: flex; align-items: center; gap: 8px; }
.an-modal-seg { display: inline-flex; border: 1px solid var(--line-strong); background: var(--bg-2); border-radius: 8px; padding: 2px; gap: 2px; }
.an-modal-seg button { height: 28px; padding: 0 12px; border: 0; background: transparent; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; color: var(--text-dim); cursor: pointer; }
.an-modal-seg button.on { background: var(--green-bg); color: var(--green-2); }
.an-modal-swap { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.an-modal-swap:hover { border-color: var(--green); color: var(--text); }
.an-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-dim); cursor: pointer; }
.an-modal-close:hover { border-color: var(--red); color: var(--red); }
.an-modal-body { padding: 0; overflow: auto; }
.an-mx-scroll { overflow: auto; }
.an-mx-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.an-mx-table th, .an-mx-table td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.an-mx-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-2); color: var(--text-dim); font-weight: 700; }
.an-mx-table .an-mx-corner, .an-mx-table .an-mx-rowhead { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface); font-weight: 600; color: var(--text); }
.an-mx-table thead .an-mx-corner { z-index: 3; background: var(--bg-2); }
.an-mx-table tbody tr:hover td, .an-mx-table tbody tr:hover .an-mx-rowhead { background: var(--green-bg); }
.an-mx-foot { padding: 12px 18px; font-size: 11.5px; color: var(--text-faint); border-top: 1px solid var(--border); }

/* KPI cards (6 on Home tab: Total Sessions / Mobile Sessions / Mobile PDP / ATC / Checkout / Purchases) */
.an-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 20px; }
.an-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.an-kpi-label { font-size: 11px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.an-kpi-value { font-family: var(--font); font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; }
.an-kpi-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; font-family: var(--font); }

/* Compare-to-prior bar (sits between section head and table) */
.an-compare-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 12px; margin: 0 0 12px 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}
.an-compare-toggle { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); cursor: pointer; }
.an-compare-toggle input { cursor: pointer; }
.an-compare-metric { display: flex; align-items: center; gap: 6px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; font-size: 11px; }
.an-compare-metric select { padding: 4px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 12px; outline: none; }
.an-compare-window { color: var(--text-dim); font-size: 11px; font-family: var(--font); }
.an-compare-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.an-legend-label { font-size: 10px; color: var(--text-faint); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }

/* ELI5 significance chips (used in legend + table tooltips) */
.an-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  vertical-align: middle;
}
.an-chip[data-code="strong"] { background: rgba(92,168,92,0.20);  color: #2e7a2e; }
.an-chip[data-code="likely"] { background: rgba(92,168,92,0.10);  color: #5CA85C; }
.an-chip[data-code="maybe"]  { background: rgba(184,134,11,0.16); color: #9b7211; }
.an-chip[data-code="noise"]  { background: rgba(120,120,120,0.12); color: #7d7d7d; }
.an-chip[data-code="na"]     { background: rgba(120,120,120,0.08); color: #a0a0a0; }

/* Compare Δ column cells (background washes by significance code, set inline) */
.an-cmp { font-family: 'SF Mono', Menlo, monospace; }
.an-cmp-head { background: rgba(92,168,92,0.04); }

/* Section blocks (chart + table) */
.an-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.an-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.an-section-head h3 { font-size: 14px; font-weight: 700; margin: 0; color: var(--text); }
.an-section-head input[type="text"] { padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 12px; outline: none; width: 180px; }
.an-section-head input[type="text"]:focus { border-color: var(--accent); }
.an-section-head input[type="number"] { padding: 6px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 12px; font-family: var(--font); outline: none; width: 72px; }
.an-section-head input[type="number"]:focus { border-color: var(--accent); }
.an-section-note { font-size: 11px; color: var(--text-faint); font-weight: 500; }

/* Per-table header controls: filter input + limit dropdown + CSV button */
.an-head-ctrls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.an-limit-select { padding: 6px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 12px; font-family: var(--font); outline: none; cursor: pointer; }
.an-limit-select:focus { border-color: var(--accent); }

/* Info/caveat banner on Home tab */
.an-note-banner { background: var(--yellow-dim); border-left: 4px solid var(--yellow); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 12px; color: var(--text); line-height: 1.5; }
.an-note-banner strong { color: var(--yellow); font-weight: 700; }

/* ── Funnel sub-tab (contribution-per-visitor + serviceability) ── */
/* Topline KPI band — Revenue / Orders / Conversion / AOV / Visitors, equal weight */
.an-ns { margin-bottom: 16px; }
.an-ns-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.an-ns-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.an-ns-window { color: var(--text-faint); font-weight: 600; text-transform: none; letter-spacing: 0; }
.an-ns-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; flex: none; }
.an-ns-seg { border: none; border-left: 1px solid var(--border); background: transparent; padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--text-dim); cursor: pointer; }
.an-ns-seg:first-child { border-left: none; }
.an-ns-seg.on { background: var(--green); color: #fff; }
.an-ns-seg:hover:not(.on) { background: var(--bg-2, rgba(60,42,18,.06)); }
.an-fn-devtag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--green-bg, rgba(34,139,69,.12)); color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .3px; vertical-align: middle; }
.an-ns-band { display: grid; grid-template-columns: repeat(6, 1fr); }
.an-ns-kpi { padding: 0 16px; border-left: 1px solid var(--border); }
.an-ns-kpi:first-child { padding-left: 0; border-left: none; }
.an-ns-kpi-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.an-ns-kpi-val { font-size: 27px; font-weight: 800; line-height: 1.05; color: var(--text); letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: 7px 0 5px; }
.an-ns-kpi-delta { font-size: 11.5px; min-height: 15px; }
.an-ns-dl { font-weight: 700; }
.an-ns-dl.up { color: var(--green); }
.an-ns-dl.dn { color: var(--red); }
.an-ns-muted { color: var(--text-faint); }
.an-ns-flat { color: var(--text-faint); font-weight: 600; }
.an-ns-bandnote { font-size: 11px; color: var(--text-faint); margin-top: 14px; }
/* Topline footnote callouts sit side-by-side on wide cards, wrap to stacked when narrow. */
.an-ns-notes { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; align-items: stretch; }
.an-ns-notes > .an-ns-warn { flex: 1 1 280px; min-width: 0; margin-top: 0; }
.an-ns-notes > .an-ns-callout { flex: 1 1 280px; min-width: 0; }
.an-ns-notes > .an-ns-callout:empty { display: none; }
.an-ns-notes .an-ns-callout-box { margin-top: 0; height: 100%; box-sizing: border-box; }
.an-ns-warn { margin-top: 12px; font-size: 11.5px; line-height: 1.45; color: #b07a2e; background: #faf3e4; border: 1px solid #ecdcb8; border-radius: 8px; padding: 9px 12px; }
.an-ns-callout-box { margin-top: 12px; background: #fcf3f0; border: 1px solid #e2bcb0; border-radius: 9px; padding: 9px 12px; }
.an-ns-callout-tag { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--red, #c8553d); margin-bottom: 3px; }
.an-ns-callout-body { font-size: 11.5px; line-height: 1.45; color: var(--text); }
@media (min-width: 769px) and (max-width: 1180px) {
  .an-ns-band { grid-template-columns: repeat(4, 1fr); row-gap: 18px; }
  .an-ns-kpi:nth-child(4n+1) { padding-left: 0; border-left: none; }
}

.an-fn-funnel { display: flex; flex-direction: column; gap: 6px; }
.an-fn-row { display: grid; grid-template-columns: 220px 1fr 170px 64px; align-items: center; gap: 12px; }
.an-fn-stage { font-size: 12px; font-weight: 600; color: var(--text); }
.an-fn-src { font-size: 9px; font-weight: 500; color: var(--text-faint); text-transform: uppercase; letter-spacing: .3px; }
.an-fn-track { background: var(--bg, rgba(0,0,0,.04)); border-radius: 4px; height: 22px; overflow: hidden; }
.an-fn-bar { height: 100%; background: linear-gradient(90deg, var(--green), var(--green)); opacity: .8; border-radius: 4px; }
.an-fn-num { font-size: 12px; font-weight: 700; color: var(--text); text-align: right; }
.an-fn-pct { display: block; font-size: 10px; font-weight: 500; color: var(--text-faint); }
.an-fn-step { font-size: 11px; font-weight: 600; color: var(--text-dim); text-align: right; }

/* ── Funnel + leakage leaderboard (side-by-side on desktop, stacked on mobile) ── */
.an-fl-row { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: stretch; }
.an-loading-sm { font-size: 12px; color: var(--text-faint); padding: 8px 0; }
/* compact funnel rows */
.an-sd-funnel .an-fn-row { grid-template-columns: 116px 1fr 92px 46px; gap: 10px; padding: 4px 6px; border-radius: 6px; }
.an-sd-funnel .an-fn-track { height: 18px; }
/* split-by pills (compare matrix) */
.an-pill { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; }
.an-pill.on { background: var(--green); color: #fff; border-color: var(--green); }
.an-pill:hover:not(.on) { border-color: var(--green); color: var(--text); }
.an-pill.is-disabled { opacity: .5; cursor: default; }
/* leakage leaderboard */
.an-leak-list { display: flex; flex-direction: column; gap: 4px; }
.an-leak-row { display: grid; grid-template-columns: 20px 1fr 64px 52px 44px; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; }
.an-leak-row.is-top { background: #fcf3f0; }
.an-leak-rank { font-size: 11px; font-weight: 700; color: var(--text-faint); text-align: center; }
.an-leak-row.is-top .an-leak-rank { color: #c8553d; }
.an-leak-label { font-size: 12px; color: var(--text); }
.an-leak-track { height: 12px; background: var(--bg, rgba(0,0,0,.05)); border-radius: 3px; overflow: hidden; }
.an-leak-bar { height: 100%; background: #d98b5f; border-radius: 3px; }
.an-leak-row.is-top .an-leak-bar { background: #c8553d; }
.an-leak-amt { font-size: 12px; font-weight: 700; color: #c8553d; text-align: right; font-variant-numeric: tabular-nums; }
.an-leak-pct { font-size: 11px; font-weight: 600; color: var(--text-faint); text-align: right; font-variant-numeric: tabular-nums; }
.an-leak-foot { font-size: 10px; color: var(--text-faint); margin-top: 10px; line-height: 1.4; }
/* compare matrix */
.an-cmp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.an-cmp-splitby { display: flex; gap: 6px; flex: none; }
.an-cmp-grid { display: grid; grid-template-columns: 148px repeat(var(--n, 3), minmax(0, 1fr)); gap: 8px; align-items: stretch; margin-top: 4px; }
.an-cmp-colhead { font-size: 11.5px; font-weight: 700; color: var(--text); text-align: center; padding: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-cmp-colvis { display: block; font-size: 10px; font-weight: 500; color: var(--text-faint); }
.an-cmp-rowhead { font-size: 11.5px; font-weight: 600; color: var(--text-dim); display: flex; align-items: center; }
.an-cmp-cell { font-size: 12px; font-weight: 600; color: var(--text); text-align: center; padding: 9px 4px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font-variant-numeric: tabular-nums; }
.an-cmp-cell.is-worst { border-color: #c8553d; background: #fcf3f0; color: #c8553d; }
/* trend over time (section 5) */
.an-tp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.an-tp-metric { font-size: 11.5px; font-weight: 600; color: var(--text-dim); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px; cursor: pointer; flex: none; }
.an-trend-chart { position: relative; height: 200px; margin-top: 6px; }
.an-trend-cap { font-size: 10.5px; color: var(--text-faint); margin-top: 8px; line-height: 1.4; }

@media (max-width: 768px) {
  /* Funnel + leaderboard stack; keep the funnel's horizontal bars (drop the step-% column for room). */
  .an-fl-row { grid-template-columns: 1fr; }
  .an-sd-funnel .an-fn-row { grid-template-columns: 78px 1fr 56px; }
  .an-sd-funnel .an-fn-step { display: none; }
}

/* Today's partial data card */
.an-today { background: var(--surface); border: 1px dashed var(--yellow); border-radius: var(--radius-lg); padding: 14px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.an-today:empty { display: none; }
.an-today-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.an-today-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--yellow); background: var(--yellow-dim); padding: 3px 8px; border-radius: 100px; }
.an-today-date { font-size: 11px; color: var(--text-dim); font-family: var(--font); }
.an-today-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.an-today-cell { padding: 0; }
.an-today-label { font-size: 10px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.an-today-value { font-family: var(--font); font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.1; }
.an-today-sub { font-size: 10px; color: var(--text-dim); font-family: var(--font); margin-top: 2px; }

@media (max-width: 600px) {
  .an-today-grid { grid-template-columns: repeat(2, 1fr); }
}

.an-chart-wrap { position: relative; height: 320px; }
.an-chart-wrap-sm { height: 200px; }

/* 2x2 chart grid */
.an-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.an-chart-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.an-chart-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; display: flex; align-items: baseline; gap: 6px; }
.an-chart-sub { font-size: 10px; color: var(--text-faint); font-weight: 500; font-family: var(--font); }

/* Custom date range picker */
.an-ctrl-custom span:first-child { display: block; }
.an-ctrl-custom input[type="date"] { padding: 6px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 12px; font-family: var(--font); outline: none; }
.an-ctrl-custom input[type="date"]:focus { border-color: var(--accent); }

/* Muted table cell (prefix, zip counts) */
.an-table td.an-muted, .an-table th.an-muted { color: var(--text-faint); font-size: 11px; }

/* Orders-style page header: title + subtitle (left), folder tabs (right), docked
   on the header's 1px baseline. The pagehead carries the rail; tabs dip -1px. */
#view-analytics .pv2-pagehead { border-bottom: 1px solid var(--line-strong); padding-bottom: 0; }
#view-analytics .pv2-pagehead > div:first-child { padding-bottom: 14px; }
#view-analytics .pv2-pagehead .pv2-sub { max-width: 460px; }


/* Folder page-tabs (Orders io-subnav mechanic). The header owns the 1px baseline;
   each tab dips -1px over it with no bottom border. Active = --green-bg fill, which
   paints over the rail so the line is "cut" under the tab. Six tabs stay on one row
   (wrapping would break the baseline); on mobile the pagehead stacks and the strip
   scrolls horizontally. */
.an-subtabs {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  margin-bottom: -1px;
}
.an-subtab { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 10px 18px 12px; border-radius: 11px 11px 0 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-2); text-decoration: none; cursor: pointer; white-space: nowrap; margin-bottom: -1px; transition: background .14s, color .14s, border-color .14s; }
.an-subtab svg { width: 16px; height: 16px; flex: none; }
.an-subtab:hover { color: var(--ink); }
.an-subtab.active { background: var(--green-bg); color: var(--green-2); border-color: var(--line-strong); }

/* Geographic sub-tab layout */
.an-geo-layout { display: grid; grid-template-columns: 200px 1fr; gap: 14px; }
.an-geo-map-wrap { position: relative; height: 620px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
#an-geo-map { width: 100%; height: 100%; background: var(--surface2); }

.an-geo-legend { padding: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 11px; }
.an-geo-legend-title { font-size: 11px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.an-geo-legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.an-geo-legend-swatch { width: 18px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.1); flex-shrink: 0; }
.an-geo-legend-val { font-family: var(--font); font-size: 11px; color: var(--text); flex: 1; }
.an-geo-legend-count { font-family: var(--font); font-size: 10px; color: var(--text-faint); text-align: right; min-width: 32px; }
.an-geo-legend-sub { font-size: 10px; color: var(--text-faint); margin-bottom: 8px; font-style: italic; }
.an-geo-legend-note { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 10px; color: var(--text-faint); line-height: 1.4; }

/* Lifecycle note */
.an-lc-note { margin-top: 16px; padding: 10px 14px; background: var(--surface2); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.an-lc-note code { font-family: var(--font); background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 11px; color: var(--text); border: 1px solid var(--border); }

/* Lifecycle now runs 12 KPIs (headline + cohort + cadence rows). Still 4 per row. */
#an-lc-kpis { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { #an-lc-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { #an-lc-kpis { grid-template-columns: 1fr; } }

/* Clickable cohort cards — hint + hover + selected states */
.an-kpi-clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; position: relative; }
.an-kpi-clickable:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(60,42,18,.08); }
.an-kpi-clickable.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(92,168,92,.22); }
.an-kpi-hint { font-size: 10px; color: var(--accent); font-weight: 600; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.an-kpi-clickable:hover .an-kpi-hint, .an-kpi-clickable.selected .an-kpi-hint { opacity: 1; }

/* Cohort detail panel — appears below the KPI grid when a cohort card is clicked */
.an-cohort-detail { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.an-cohort-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.an-cohort-detail-head h4 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.an-cohort-detail-head p { margin: 0; font-size: 13px; color: var(--text-dim); }
.an-cohort-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-faint); padding: 4px 10px; border-radius: 6px; line-height: 1; transition: background .12s, color .12s; }
.an-cohort-close:hover { background: var(--surface2); color: var(--text); }

.an-cohort-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.an-cohort-stat { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.an-cohort-stat-lbl { font-size: 10px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.an-cohort-stat-val { font-family: var(--font); font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
@media (max-width: 700px) { .an-cohort-stats { grid-template-columns: repeat(2, 1fr); } }

.an-cohort-buckets { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.an-cohort-buckets-title { font-size: 10px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.an-cohort-bucket { display: grid; grid-template-columns: 90px 1fr 50px; gap: 12px; align-items: center; padding: 4px 0; font-family: var(--font); }
.an-cohort-bucket-label { font-size: 11px; color: var(--text-dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.an-cohort-bucket-bar { background: var(--bg); border-radius: 4px; overflow: hidden; height: 14px; }
.an-cohort-bucket-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .35s ease-out; }
.an-cohort-bucket-count { font-size: 12px; color: var(--text); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* SEO sub-tab */
.an-seo-movers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.an-seo-mover-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.an-seo-kw { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.3; }
.an-seo-kw-loc { font-size: 10px; color: var(--text-faint); font-family: var(--font); margin-top: 2px; }

@media (max-width: 900px) {
  .an-seo-movers-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .an-geo-layout { grid-template-columns: 1fr; }
  .an-geo-map-wrap { height: 480px; }
}

/* Leaderboard table */
.an-table-wrap { overflow-x: auto; }
.an-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.an-table th, .an-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.an-table th { font-size: 10px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; background: var(--surface2); cursor: pointer; user-select: none; white-space: nowrap; }
.an-table th:hover { background: var(--border); color: var(--text); }
.an-table th.sorted-asc, .an-table th.sorted-desc { color: var(--accent); }
.an-table td.num, .an-table th.num { text-align: right; font-family: var(--font); }
.an-table td.mono { font-family: var(--font); font-weight: 600; }
.an-table tbody tr:hover { background: var(--surface2); }
.an-table-meta { font-size: 11px; color: var(--text-faint); margin-top: 8px; text-align: right; font-family: var(--font); }

/* States */
.an-loading { padding: 40px; text-align: center; color: var(--text-dim); font-size: 13px; }
.an-loading .spinner { margin-right: 8px; vertical-align: middle; }
.an-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 12px; }
.an-error { background: var(--red-dim); border: 1px solid rgba(192,57,43,.3); border-radius: var(--radius); padding: 14px 16px; font-size: 13px; color: var(--red); grid-column: 1 / -1; }
.an-error strong { display: block; margin-bottom: 4px; }
.an-error-hint { font-size: 11px; color: var(--text-dim); margin-top: 8px; line-height: 1.5; font-weight: normal; }
.an-error-hint code { font-family: var(--font); background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 11px; color: var(--text); border: 1px solid var(--border); }

/* Mobile */
@media (max-width: 1100px) {
  .an-kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .an-kpis { grid-template-columns: repeat(2, 1fr); }
  .an-chart-wrap { height: 260px; }
  .an-chart-grid { grid-template-columns: 1fr; }
  .an-chart-wrap-sm { height: 180px; }
}
@media (max-width: 600px) {
  .an-kpis { grid-template-columns: 1fr; }
  .an-wrap { padding: 12px; }
  .an-section { padding: 12px; }
}

/* ───── SEO rank tracker + keyword research ───── */
.seo-pills { display: flex; gap: 6px; margin-bottom: 14px; }
.seo-pill { padding: 6px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.seo-pill:hover { border-color: var(--accent); color: var(--text); }
.seo-pill.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.seo-toolbar { flex-wrap: wrap; gap: 6px; }

/* ── Core SEO expansion map (city table) ─────────────────────────────────── */
.seo-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 14px; }
.seo-kpi { flex: 1 1 120px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.seo-kpi-v { font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.15; }
.seo-kpi-l { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Selection bar is sticky: picking regions across several filtered pages means
   the action must stay reachable without scrolling back up. */
.seo-selbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 9px 12px; margin-bottom: 10px; border: 1px solid var(--accent);
  border-radius: var(--radius); background: var(--surface); font-size: 12.5px; color: var(--text); }
.seo-selbar-actions { display: inline-flex; gap: 6px; }

.seo-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.seo-badge-region  { background: rgba(34,197,94,.16);  color: #16a34a; }
.seo-badge-llp     { background: rgba(59,130,246,.16); color: #2563eb; }
.seo-badge-unbuilt { background: rgba(148,163,184,.18); color: var(--text-dim); }

/* Marks a value apportioned from a state baseline rather than measured. */
.seo-est { color: var(--text-dim); font-size: 10px; margin-left: 1px; cursor: help; }
.seo-lock { color: var(--text-dim); cursor: help; }
.an-table tr.row-sel { background: rgba(34,197,94,.10); }
.an-table-wrap { overflow-x: auto; }

.seo-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--text-dim); }
.seo-pager button[disabled] { opacity: .45; cursor: default; }

@media (max-width: 720px) {
  .seo-kpi { flex-basis: calc(50% - 5px); }
  .seo-selbar { position: static; }
}

.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: var(--bg); }
.btn-xs { padding: 2px 8px; font-size: 10.5px; border-radius: 5px; }

/* ── Build modal ── */
.seo-modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.seo-modal { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; width: min(520px, 90vw); max-height: 85vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.seo-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.seo-modal-header h3 { margin: 0; font-size: 16px; }
.seo-modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-dim); padding: 0 4px; }
.seo-modal-body { padding: 16px 20px; }
.seo-modal-footer { padding: 12px 20px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.seo-modal-btns { display: flex; gap: 8px; }
.seo-modal-draft { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.seo-modal-cities { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.seo-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(34,197,94,.12); color: #16a34a; }
/* An LLP being promoted is a different operation from a new build — the chip
   should not read as just another new region. */
.seo-chip.is-promo { background: rgba(37,99,235,.12); color: #2563eb; }
.seo-chip.is-promo em { font-style: normal; opacity: .75; }
.seo-modal-est { width: 100%; font-size: 13px; border-collapse: collapse; }
.seo-modal-est td { padding: 4px 0; }
.seo-modal-est .num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.seo-modal-cost td { border-top: 1px solid var(--border); padding-top: 8px; font-weight: 700; }
.seo-modal-note { font-size: 11px; color: var(--text-dim); margin-top: 8px; }
.seo-modal-warn { font-size: 12px; color: #d97706; margin-top: 10px; }

/* ── Build progress panel ── */
.seo-build-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; background: var(--surface); }
.seo-build-header { font-size: 13px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.seo-build-overall { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-dim); font-weight: 600; }
.seo-build-keepopen { font-size: 11px; color: #d97706; margin: 2px 0 8px; }

/* Each job is a stacked block: a header row, then its own progress bar. */
.seo-job { display: flex; flex-direction: column; gap: 4px; padding: 7px 0; font-size: 12.5px; border-bottom: 1px solid rgba(0,0,0,.06); }
.seo-job:last-of-type { border-bottom: none; }
.seo-job.is-queued { opacity: .6; }
.seo-job-head { display: flex; align-items: center; gap: 8px; }
.seo-job-icon { width: 18px; text-align: center; flex-shrink: 0; }
.seo-job-city { font-weight: 600; min-width: 120px; }
.seo-job-step { color: var(--text-dim); flex: 1; }
.seo-job-stage { color: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.seo-job-time { color: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.seo-job-pct { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.seo-job-err { color: #dc2626; font-size: 11px; }
.seo-job-warn { color: #d97706; font-size: 11px; }
.seo-job-result { color: #16a34a; font-size: 11px; font-weight: 600; }
.seo-job-queued-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
/* Paste-ready jsrates line. Selectable and scrollable — it exists to be copied. */
.seo-job-snippet { display: block; font-family: ui-monospace, monospace; font-size: 11px;
  background: rgba(0,0,0,.05); border-radius: 4px; padding: 4px 6px; margin-top: 2px;
  overflow-x: auto; white-space: pre; user-select: all; }

.seo-bar { height: 5px; border-radius: 3px; background: rgba(0,0,0,.08); overflow: hidden; }
.seo-bar-overall { height: 7px; margin-bottom: 8px; }
.seo-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s ease; }
.seo-bar-fill.is-done { background: #16a34a; }
.seo-bar-fill.is-failed { background: #dc2626; }
.seo-bar-fill.is-stale { background: #d97706; }
.seo-job-completed .seo-job-icon { color: #16a34a; }
.seo-job-failed .seo-job-icon { color: #dc2626; }
.seo-build-done { display: flex; gap: 8px; margin-top: 10px; }
@keyframes seo-spin { to { transform: rotate(360deg); } }
.seo-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: seo-spin .7s linear infinite; }

.an-seo-kw { font-weight: 600; color: var(--text); }
.seo-kw-row { cursor: pointer; }
.seo-kw-row:hover { background: var(--bg-2, rgba(0,0,0,.03)); }

.seo-rs-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 8px; }
.seo-rs-col { display: flex; flex-direction: column; gap: 6px; }
.seo-rs-label { font-size: 12px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.seo-rs-loc-actions { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; }
.seo-rs-import { font-size: 10.5px; color: var(--accent); cursor: pointer; font-weight: 600; }
.seo-rs-col textarea, #an-seo-rs-loc-filter { width: 100%; box-sizing: border-box; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-family: var(--font); font-size: 12.5px; resize: vertical; }
.seo-rs-loc-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; background: var(--surface); }
.seo-rs-loc-item { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: 12px; color: var(--text); cursor: pointer; }
.seo-rs-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
@media (max-width: 760px) { .seo-rs-controls { grid-template-columns: 1fr; } }

/* ════════════════════ Funnel page — mobile (≤768px) ════════════════════ */
@media (max-width: 768px) {
  /* Topline band: 2-up KPI tiles on phones */
  .an-ns-band { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .an-ns-kpi { padding-right: 0; }
  .an-ns-kpi:nth-child(odd) { padding-left: 0; border-left: none; }
  .an-ns-kpi:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--border); }
  .an-ns-kpi-val { font-size: 26px; }

  /* Compare matrix: horizontal scroll, sticky first column */
  #an-compare { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .an-cmp-grid { grid-template-columns: 112px repeat(var(--n, 3), 90px); }
  .an-cmp-corner, .an-cmp-rowhead { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .an-tp-head { flex-wrap: wrap; }

  /* Sub-tab strip scrolls; page header stacks */
  .an-subtabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Filter row → bottom sheet (Orders/Suppliers pattern) */
  #an-filters-btn { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 16px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
  #an-filters-btn svg { flex: none; }
  #an-filter-overlay.open { display: block; position: fixed; inset: 0; z-index: 199; background: rgba(15,23,42,.42); }
  #view-analytics #an-filter-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200; background: var(--surface);
    border-radius: 18px 18px 0 0; box-shadow: 0 -8px 32px rgba(0,0,0,.18);
    padding: 0 16px calc(16px + env(safe-area-inset-bottom)); max-height: 85vh; overflow-y: auto;
    transform: translateY(100%); transition: transform .25s ease;
  }
  #view-analytics #an-filter-sheet.open { transform: translateY(0); }
  #view-analytics #an-filter-sheet .ifs-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); padding: 16px 0 10px; z-index: 1; }
  #view-analytics .ifs-grab { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 2px; background: var(--border); }
  #view-analytics .ifs-title { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: var(--text); }
  #view-analytics .ifs-title-ico { flex: none; color: var(--text-faint); }
  #view-analytics .ifs-close { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; padding: 4px; }
  #an-fg-more { display: none !important; }
  #view-analytics #an-filters { display: flex; flex-wrap: wrap; overflow: visible; align-items: flex-end; gap: 16px 10px; padding: 6px 0 4px; border: 0; background: transparent; border-radius: 0; margin-bottom: 0; }
  #view-analytics #an-filters .io-fg { flex: 1 1 calc(50% - 5px); min-width: 0; }
  #view-analytics #an-filters .io-fg select, #view-analytics #an-filters .io-fg input { width: 100%; height: 42px; font-size: 16px; }
  #view-analytics #an-filters #an-datepick-mount, #view-analytics #an-filters #an-datepick-mount .mmdp, #view-analytics #an-filters #an-datepick-mount .mmdp-trigger { width: 100%; }
  #view-analytics #an-filters .an-fg-chk { flex: 1 1 100%; }
  /* Device multi-select: full-width row of three equal labelled buttons in the sheet. */
  #view-analytics #an-filters .an-device-fg { flex: 1 1 100%; }
  #view-analytics #an-device-seg { width: 100%; height: 44px; }
  #view-analytics #an-device-seg .io-seg-btn { flex: 1 1 0; justify-content: center; height: 100%; }
  #view-analytics #an-device-seg .io-seg-btn span { display: inline; }
  #view-analytics #an-filters .io-refresh-btn { flex: 1 1 100%; height: 44px; }
  #view-analytics #an-filter-sheet .ifs-actions { display: flex; align-items: center; gap: 12px; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); position: sticky; bottom: 0; }
  #view-analytics .ifs-clear { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); font-size: 15px; font-weight: 700; padding: 13px 18px; border-radius: 12px; cursor: pointer; }
  #view-analytics .ifs-clear svg { width: 18px; height: 18px; flex: none; }
  #view-analytics .ifs-apply { flex: 1; border: 1px solid var(--green); background: var(--green); color: #fff; font-size: 15px; font-weight: 700; padding: 13px 18px; border-radius: 12px; cursor: pointer; }
  body.an-filter-open #mobile-tabbar { display: none !important; }
}
