/* The page is always pure white. Colour comes from the signed-in client's brand
   (--brand, --accent and their readable partners, set per theme below). The defaults
   here are June Apple's own black and June yellow, used only where there is no
   client yet: the sign-in screens. Greens and reds are reserved for up and down. */
:root {
  --brand:#000000; --on-brand:#FFFFFF; --brand-ink:#000000; --accent:#D4C95E; --on-accent:#000000; --mark:#D4C95E; --on-mark:#000000;
  --page:#FFFFFF; --surface:#FFFFFF; --ink-display:#111111; --ink-body:#262626; --ink-muted:#5F6368;
  --hairline:#E5E5E7; --wash:#F4F4F5; --up:#1A7F37; --down:#C5221F;
  --radius:14px; --radius-sm:9px; --radius-pill:999px;
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px; --sp-6:32px; --sp-7:48px; --flow:24px;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; color:var(--ink-body); background:var(--page); font-synthesis:none;
}
* { box-sizing:border-box; }
/* Client themes: generated by scripts/build-themes.mjs from server/brands.mjs. Do not edit by hand. */
.theme-b1 { --brand:#3E5548; --on-brand:#FFFFFF; --brand-ink:#3E5548; --accent:#B8863F; --on-accent:#111111; --mark:#B8863F; --on-mark:#111111; }
.theme-b2 { --brand:#103566; --on-brand:#FFFFFF; --brand-ink:#103566; --accent:#E30A17; --on-accent:#FFFFFF; --mark:#103566; --on-mark:#FFFFFF; }
.theme-b3 { --brand:#111111; --on-brand:#FFFFFF; --brand-ink:#111111; --accent:#D5AC63; --on-accent:#111111; --mark:#D5AC63; --on-mark:#111111; }
.theme-b4 { --brand:#556243; --on-brand:#FFFFFF; --brand-ink:#556243; --accent:#D6B45F; --on-accent:#111111; --mark:#D6B45F; --on-mark:#111111; }
.theme-b5 { --brand:#5252B5; --on-brand:#FFFFFF; --brand-ink:#5252B5; --accent:#7B7BE8; --on-accent:#111111; --mark:#7B7BE8; --on-mark:#111111; }
/* End client themes */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body { margin:0; font-size:15px; line-height:1.55; background:var(--page); -webkit-font-smoothing:antialiased; }
button,input,select,textarea { font:inherit; }
button,a,input,select,summary { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { cursor:not-allowed; opacity:.48; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible { outline:3px solid var(--brand); outline-offset:4px; }
h1,h2,h3,p { margin:0; }
h1,h2,h3 { color:var(--ink-display); line-height:1.16; letter-spacing:-.035em; }
h1 { font-size:clamp(24px,2.4vw,32px); font-weight:650; max-width:850px; }
h2 { font-size:21px; font-weight:630; }
h3 { font-size:17px; font-weight:650; }
p { max-width:75ch; }
a { color:inherit; text-underline-offset:4px; }
small { font-size:12px; }
svg { display:block; }
.icon { width:20px; height:20px; flex-shrink:0; }
.sr-only { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.skip { position:fixed; top:-80px; left:20px; z-index:100; padding:12px; color:var(--on-accent); background:var(--accent); opacity:0; }
.skip:focus { top:10px; opacity:1; }
.eyebrow { font-size:10px; font-weight:750; letter-spacing:.15em; text-transform:uppercase; color:var(--ink-muted); }
.muted,.note { color:var(--ink-muted); }
.note { font-size:12px; line-height:1.55; }
.btn { display:inline-flex; justify-content:center; align-items:center; gap:8px; min-height:44px; padding:10px 17px; border:1px solid transparent; border-radius:var(--radius-sm); font-weight:600; font-size:13px; text-decoration:none; }
.btn-dark { color:var(--on-brand); background:var(--brand); }
.btn-dark:hover { filter:brightness(.9); }
.btn-secondary { color:var(--ink-display); background:transparent; border-color:var(--hairline); }
.btn-secondary:hover { background:var(--wash); }
.btn-ghost { color:inherit; background:transparent; padding:9px 12px; }
.btn-ghost:hover { background:var(--wash); }

/* Shell. Header: the client's logo and name, with June Apple in words. Nothing else.
   From 641px the six tabs are a left rail; on phones they are the bottom bar. */
.shell { display:grid; grid-template-columns:216px minmax(0,1fr); grid-template-rows:auto 1fr; min-height:100vh; }
.topbar { grid-column:1 / -1; display:flex; flex-direction:row-reverse; align-items:center; justify-content:space-between; gap:24px; padding:16px 44px 16px 30px; border-bottom:1px solid var(--hairline); }
.header-note { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:0 16px; max-width:none; color:var(--ink-muted); font-size:12px; line-height:1.5; }
.header-note label { display:inline; font-weight:inherit; }
.client-identity { display:flex; align-items:center; gap:14px; min-width:0; }
.client-logo { width:auto; height:44px; max-width:132px; object-fit:contain; object-position:left center; flex-shrink:0; }
/* Ham Heritage's mark is a fine line drawing, so it gets a little more height. Two logo files carry a wide
   white margin and one a clear one; on the white page that margin may overlap so the mark is about 44px tall. */
.theme-b1 .client-logo { height:58px; }
.theme-b2 .client-logo { width:70px; height:70px; max-width:none; margin:-11px -13px; filter:brightness(1.01); } /* its near-white (254) margin becomes pure white */
.theme-b3 .client-logo { width:151px; height:46px; max-width:none; margin:-5px -11px; }
.theme-b5 .client-logo { height:50px; margin:-3px -7px; }
.client-control { position:relative; display:flex; align-items:center; min-width:0; min-height:44px; }
.client-name { min-width:0; color:var(--ink-display); font-size:19px; font-weight:650; line-height:1.25; letter-spacing:-.015em; overflow-wrap:anywhere; text-wrap:balance; }
.client-picker { display:flex; align-items:center; gap:10px; min-width:0; }
.client-picker > .icon { width:28px; height:28px; padding:6px; border-radius:50%; background:var(--wash); color:var(--ink-display); }
/* The native picker covers the name and its chevron, so the whole name can show and wrap. */
select { max-width:100%; min-height:36px; color:var(--ink-display); background:transparent; border:0; font-weight:650; padding:2px 22px 2px 0; text-overflow:ellipsis; }
.client-control select { position:absolute; inset:0; width:100%; height:100%; max-width:none; min-height:0; padding:0; opacity:0; font-size:16px; cursor:pointer; -webkit-appearance:none; appearance:none; }
.client-control:has(select:focus-visible) { outline:3px solid var(--brand); outline-offset:4px; border-radius:var(--radius-sm); }
.navigation { grid-column:1; align-self:start; position:sticky; top:0; display:grid; gap:4px; padding:24px 16px; }
.navigation a { display:flex; gap:12px; align-items:center; min-height:44px; padding:10px 14px; color:var(--ink-body); text-decoration:none; font-size:14px; font-weight:550; border-radius:var(--radius-sm); }
.navigation a[aria-current="page"] { background:var(--brand); color:var(--on-brand); }
.navigation a:hover:not([aria-current]) { background:var(--wash); }
.nav-icon { display:flex; }
main.report { grid-column:2; width:100%; max-width:1180px; padding:36px 44px 48px; margin:0 auto; }
.report > * + * { margin-top:var(--flow); }
.report > .footer { margin-top:40px; }
.footer { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:0 24px; padding-top:10px; border-top:1px solid var(--hairline); color:var(--ink-muted); font-size:12px; }
.footer-actions { display:flex; flex-wrap:wrap; align-items:center; gap:0 24px; }
.footer-link { display:inline-flex; align-items:center; gap:6px; min-height:44px; padding:0; border:0; background:none; color:var(--ink-body); font-size:13px; font-weight:600; text-decoration:underline; text-underline-offset:4px; }
.footer-link .icon { width:15px; }
.owner-workspace { display:flex; align-items:center; gap:8px; }

/* Overview top: the period's headline number, its chart, the dates, then the other numbers. */
.intro p { margin-top:8px; color:var(--ink-muted); font-size:14px; max-width:60ch; }
.headline { display:grid; gap:6px; }
.headline-label { color:var(--ink-display); font-size:14px; font-weight:600; }
.headline-label span { margin-left:6px; color:var(--ink-muted); font-weight:400; }
.headline-figure { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 14px; max-width:none; }
.headline-number { color:var(--brand-ink); font-size:clamp(60px,6.4vw,84px); line-height:1; font-weight:680; letter-spacing:-.045em; font-variant-numeric:tabular-nums; }
.headline-number.unknown { color:var(--ink-muted); font-size:44px; font-weight:500; line-height:1.3; }
.delta { font-size:18px; font-weight:650; white-space:nowrap; color:var(--ink-muted); }
.delta.up { color:var(--up); }
.delta.down { color:var(--down); }
.headline-context { color:var(--ink-muted); font-size:13px; }
.overview-chart > * + * { margin-top:10px; }
.figures { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:var(--sp-5) var(--sp-5); margin:0; }
.figure { min-width:0; }
.figure dt { color:var(--ink-body); font-size:13px; font-weight:600; }
.figure dd { margin:4px 0 0; color:var(--ink-display); font-size:28px; line-height:1.15; font-weight:650; letter-spacing:-.03em; font-variant-numeric:tabular-nums; }
.figure dd.unknown { font-size:19px; line-height:1.7; letter-spacing:-.02em; }
.figure dd.figure-hint { margin-top:5px; color:var(--ink-muted); font-size:12px; line-height:1.45; font-weight:400; letter-spacing:0; text-wrap:pretty; }
.overview-figures > * + * { margin-top:var(--sp-4); }
.overview-figures .action-link { margin-top:var(--sp-1); }

.period { display:grid; gap:10px; }
.pill { display:inline-flex; align-items:center; gap:6px; padding:4px 9px; border-radius:var(--radius-pill); background:var(--wash); color:var(--ink-body); font-size:10px; font-weight:650; white-space:nowrap; }
.pill.yellow { background:var(--mark); color:var(--on-mark); }
.date-tools { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.segments { display:inline-flex; gap:2px; background:var(--surface); padding:3px; border:1px solid var(--hairline); border-radius:12px; }
.segments button { border:0; border-radius:9px; background:transparent; color:var(--ink-body); min-height:38px; padding:6px 14px; font-size:13px; font-weight:600; }
.segments button[aria-pressed="true"] { background:var(--brand); color:var(--on-brand); }
.segments button:disabled { color:var(--ink-muted); opacity:.45; }
.custom-range { display:flex; align-items:end; gap:12px; padding-top:2px; }
.custom-range[hidden] { display:none; }
.period-note { font-size:12px; color:var(--ink-muted); }
.period-note strong { color:var(--ink-body); font-weight:600; }
label { display:grid; gap:6px; font-size:12px; font-weight:600; }
input { min-height:42px; border:1px solid var(--hairline); border-radius:var(--radius-sm); padding:8px 10px; color:var(--ink-body); background:var(--surface); min-width:0; max-width:100%; }
.stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.stat { background:var(--surface); border:1px solid var(--hairline); border-radius:var(--radius); padding:23px; min-width:0; display:flex; flex-direction:column; gap:12px; }
.stat.highlight { border-color:var(--brand); }
.stat.highlight .stat-number { color:var(--brand-ink); }
.stat-top { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; color:var(--ink-body); }
.stat-top .icon { width:17px; height:17px; }
.stat-number { font-size:38px; line-height:1.05; font-weight:650; letter-spacing:-.045em; color:var(--ink-display); }
.stat-number.unknown { font-size:23px; line-height:1.45; letter-spacing:-.025em; }
.stat-foot { font-size:11px; line-height:1.5; color:var(--ink-muted); margin-top:auto; }
.panel { padding:27px; border:1px solid var(--hairline); border-radius:var(--radius); background:var(--surface); min-width:0; }
.panel > * + * { margin-top:18px; }
.panel-header { display:flex; align-items:start; justify-content:space-between; gap:18px; }
.panel-header p { margin-top:7px; color:var(--ink-muted); font-size:12px; }
.equal-columns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--flow); }
.chart { width:100%; height:auto; max-height:285px; overflow:visible; }
.chart text { font-family:inherit; font-size:10px; fill:var(--ink-muted); }
.chart .grid { stroke:var(--hairline); stroke-width:1; stroke-dasharray:3 5; }
.chart .area { fill:var(--brand); fill-opacity:.07; stroke:none; }
.chart .line { stroke:var(--brand); stroke-width:2.2; fill:none; stroke-linejoin:round; stroke-linecap:round; }
.chart .point { fill:var(--brand); }
.chart-footer { display:flex; align-items:center; gap:14px; justify-content:space-between; font-size:11px; color:var(--ink-muted); }
.legend { display:flex; align-items:center; gap:7px; }
.legend-dot { width:8px; height:8px; background:var(--brand); border-radius:50%; }
.insight { background:var(--wash); padding:16px; border-radius:var(--radius-sm); border-left:3px solid var(--mark); }
.insight p { font-size:12px; }
.insight strong { display:block; color:var(--ink-display); font-size:13px; margin-bottom:4px; }
.source-list { display:grid; }
.source-row { padding:14px 0; display:flex; align-items:flex-start; justify-content:space-between; gap:14px; border-bottom:1px solid var(--hairline); font-size:13px; }
.source-row:first-child { padding-top:0; }
.source-row:last-child { border-bottom:0; padding-bottom:0; }
.source-row small { display:block; margin-top:4px; color:var(--ink-muted); font-size:11px; }
.source-row strong { color:var(--ink-display); font-size:16px; }
.action-link { display:inline-flex; align-items:center; gap:8px; min-height:44px; color:var(--brand-ink); text-decoration:none; font-size:13px; font-weight:650; }
.action-link .icon { width:15px; }
.section-title { display:flex; align-items:center; justify-content:space-between; gap:20px; }
.section-title p { font-size:12px; color:var(--ink-muted); margin-top:8px; }
.check-list { padding:0; list-style:none; display:grid; gap:17px; }
.check-list li { display:flex; gap:12px; font-size:13px; }
.check-list .icon { width:17px; height:17px; color:var(--brand-ink); }
.check-list p { font-size:12px; color:var(--ink-muted); margin-top:4px; }
.banner { border:1px solid var(--hairline); border-radius:var(--radius-sm); background:var(--wash); padding:14px 18px; display:flex; align-items:start; gap:12px; font-size:12px; }
.banner .icon { width:17px; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; text-align:left; font-size:12px; }
th { font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-muted); font-weight:650; padding:12px 10px; border-bottom:1px solid var(--hairline); }
td { padding:14px 10px; border-bottom:1px solid var(--hairline); vertical-align:top; }
th:first-child,td:first-child { padding-left:0; }
th:last-child,td:last-child { padding-right:0; }
tbody tr:last-child td { border-bottom:0; }
td.num,th.num { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
td small { display:block; font-size:10px; color:var(--ink-muted); margin-top:4px; }
tr[hidden] { display:none; }
details { font-size:12px; }
summary { cursor:pointer; min-height:44px; display:flex; align-items:center; gap:8px; font-weight:650; }
summary::before { content:'+'; font-size:19px; font-weight:400; }
details[open] > summary::before { content:'−'; }
.methodology { border-top:1px solid var(--hairline); padding-top:7px; }
.panel > .methodology:first-child { border:0; padding-top:0; }
.methodology[open] > p { padding-top:7px; }
.maps-list { display:grid; }
.maps-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(180px,.8fr); column-gap:24px; padding:21px 0; border-bottom:1px solid var(--hairline); }
.maps-row:first-child { padding-top:0; }
.maps-row:last-child { border-bottom:0; padding-bottom:0; }
.maps-keyword h3 { font-size:15px; line-height:1.4; letter-spacing:-.015em; overflow-wrap:anywhere; }
.maps-keyword p { margin-top:6px; }
.maps-ranks { display:grid; grid-template-columns:1fr 1fr; gap:18px; margin:0; }
.maps-ranks dt { font-size:12px; color:var(--ink-muted); }
.maps-ranks dd { margin:3px 0 0; color:var(--ink-display); font-size:22px; font-weight:650; font-variant-numeric:tabular-nums; }
.maps-grid-details { grid-column:1 / -1; margin-top:6px; }
.maps-grid-details dl { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:6px 0 10px; }
.maps-grid-details dt { color:var(--ink-muted); }
.maps-grid-details dd { margin:4px 0 0; overflow-wrap:anywhere; }
.empty { padding:36px 20px; background:var(--wash); border-radius:var(--radius-sm); text-align:center; }
.empty .icon { margin:0 auto 12px; width:27px; height:27px; }
.empty p { font-size:12px; color:var(--ink-muted); margin:8px auto 0; max-width:45ch; }
.work-item { padding:22px 0; border-bottom:1px solid var(--hairline); }
.work-item:first-child { padding-top:0; }
.work-item:last-child { border-bottom:0; padding-bottom:0; }
.work-item h3 { margin:9px 0; }
.work-item p { font-size:13px; }
.work-item .note { margin-top:10px; font-size:11px; }
.narrative { white-space:pre-wrap; font-size:13px; line-height:1.75; padding-top:12px; overflow-wrap:anywhere; }
.login { width:min(460px,calc(100% - 40px)); margin:9vh auto; display:grid; gap:22px; }
.login img { object-fit:contain; width:120px; height:100px; margin-bottom:12px; }
.login form { display:grid; gap:16px; padding:25px; background:var(--surface); border:1px solid var(--hairline); border-radius:var(--radius); }
.login p { color:var(--ink-muted); font-size:14px; }
/* Sign-in screens: June Apple's own black and June yellow (there is no client yet).
   The form stays a white card so fields remain easy to read. */
html:has(main.login),body:has(main.login) { background:#0B0B0B; }
body:has(main.login) { min-height:100dvh; display:flow-root; }
.login img { width:150px; height:auto; object-fit:contain; margin-bottom:4px; }
.login h1 { color:#FFFFFF; }
.login .eyebrow { color:var(--accent); }
.login > p,.login > div > p:not(.eyebrow),.login > .note { color:#C9C9C4; }
.login > .error { color:var(--ink-body); }
.login form p { color:var(--ink-muted); }
.login .btn-dark { color:#111111; background:var(--accent); }
.login > .btn-ghost { color:#E9E9E4; justify-self:center; }
.login > .btn-ghost:hover { background:#1E1E1E; }
.login button:focus-visible,.login input:focus-visible { outline-color:var(--accent); }
.error { padding:13px 16px; border:1px solid var(--ink-muted); border-radius:var(--radius-sm); background:var(--surface); font-size:13px; }
.loading { min-height:50vh; display:grid; place-content:center; gap:13px; }
.loading p { color:var(--ink-muted); font-size:13px; }

.keyword-focus { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--sp-3); }
.keyword-choice { display:grid; gap:var(--sp-2); text-align:left; min-width:0; padding:var(--sp-4); border:1px solid var(--hairline); border-radius:var(--radius-sm); color:var(--ink-body); background:var(--surface); }
.keyword-choice > span:first-child { font-size:14px; font-weight:650; overflow-wrap:anywhere; }
.keyword-choice[aria-pressed="true"] { border-color:var(--brand); box-shadow:inset 3px 0 var(--accent); background:var(--wash); }
.keyword-choice:hover { background:var(--wash); }
.keyword-endpoints { display:flex; align-items:center; gap:var(--sp-3); font-size:23px; font-weight:650; color:var(--ink-display); font-variant-numeric:tabular-nums; }
.keyword-endpoints > span { font-size:16px; font-weight:400; color:var(--ink-muted); }
.keyword-choice small { color:var(--ink-muted); font-size:12px; }
.keyword-picker { border-top:1px solid var(--hairline); padding-top:var(--sp-4); }
.keyword-picker select { width:100%; min-height:44px; border:1px solid var(--hairline); border-radius:var(--radius-sm); background:var(--surface); font-size:14px; padding:var(--sp-3); }
.keyword-detail { border-top:1px solid var(--hairline); padding-top:var(--sp-5); }
.keyword-detail > * + * { margin-top:var(--sp-5); }
.keyword-detail h3 { font-size:23px; line-height:1.35; overflow-wrap:anywhere; }
.keyword-detail .eyebrow { font-size:12px; margin:0 0 var(--sp-2); }
.rank-summary { display:grid; grid-template-columns:1fr 1fr 1.4fr; gap:var(--sp-4); margin:var(--sp-5) 0 0; }
.rank-summary dt { font-size:12px; color:var(--ink-muted); }
.rank-summary dd { margin:var(--sp-2) 0 0; font-size:30px; line-height:1.2; color:var(--ink-display); font-weight:650; font-variant-numeric:tabular-nums; }
.rank-summary dd.rank-change { font-size:17px; line-height:1.5; }
.rank-summary small { display:block; margin-top:var(--sp-2); color:var(--ink-muted); }
.rank-chart { max-height:300px; }
.rank-chart text { font-size:12px; }
.history-months,.maps-scan-list { display:grid; gap:var(--sp-3); }
.history-month { border:1px solid var(--hairline); border-radius:var(--radius-sm); padding:var(--sp-4); }
.history-month h4 { margin:0; font-size:14px; font-weight:650; color:var(--ink-display); }
.history-month p { margin-top:var(--sp-2); font-size:12px; color:var(--ink-muted); overflow-wrap:anywhere; }
.history-month dl { margin:var(--sp-4) 0 0; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--sp-3); }
.history-month dt { font-size:12px; color:var(--ink-muted); }
.history-month dd { font-size:18px; font-weight:650; margin:var(--sp-1) 0 0; color:var(--ink-display); font-variant-numeric:tabular-nums; }
.coverage-warning { padding:var(--sp-3) var(--sp-4); background:var(--wash); border-left:3px solid var(--ink-muted); font-size:12px; border-radius:var(--radius-sm); }
.maps-history details > * + * { margin-top:var(--sp-4); }
.maps-history summary { overflow-wrap:anywhere; }

.delivery-item { display:flex; gap:var(--sp-3); padding:var(--sp-4) 0; border-bottom:1px solid var(--hairline); }
.delivery-item h3 { font-size:16px; line-height:1.4; letter-spacing:-.015em; }
.delivery-item p:not(.eyebrow) { color:var(--ink-muted); font-size:12px; margin-top:var(--sp-2); }
.delivery-item .eyebrow { font-size:10px; line-height:1.6; }
.delivery-check { display:grid; place-items:center; color:var(--on-mark); background:var(--mark); border-radius:var(--radius-pill); flex:0 0 28px; height:28px; }
.delivery-check .icon { width:16px; height:16px; }
.contact-strip { display:flex; justify-content:space-between; align-items:center; gap:var(--sp-5); border:1px solid var(--hairline); border-radius:var(--radius); padding:var(--sp-5) var(--sp-6); background:var(--wash); }
.contact-strip h2 { font-size:20px; }
.contact-strip p { margin-top:var(--sp-2); font-size:13px; color:var(--ink-muted); }
.contact-strip .btn { flex-shrink:0; }
.request-form { display:grid; gap:var(--sp-5); }
.request-form label { font-size:13px; }
.request-form textarea,.request-form select { color:var(--ink-body); background:var(--surface); border:1px solid var(--hairline); border-radius:var(--radius-sm); padding:var(--sp-3); width:100%; min-width:0; }
.request-form textarea { resize:vertical; min-height:160px; }
.request-form select { min-height:44px; }
.request-form .btn { justify-self:start; }
.optional { color:var(--ink-muted); font-size:12px; font-weight:400; }
.request-details { white-space:pre-wrap; overflow-wrap:anywhere; }
.saved-notice { background:var(--wash); border-left:4px solid var(--mark); border-radius:var(--radius-sm); padding:var(--sp-5); }
.saved-notice p { margin-top:var(--sp-2); font-size:13px; }
.support-mark { display:grid; place-items:center; width:58px; height:58px; border-radius:var(--radius); color:var(--on-mark); background:var(--mark); }
.support-mark .icon { width:26px; height:26px; }
.email-panel > p { font-size:14px; }
.email-panel .note { overflow-wrap:anywhere; font-size:12px; }
.bar-list { display:grid; gap:var(--sp-4); padding:0; list-style:none; }
.bar-row { display:grid; gap:var(--sp-2); }
.bar-label { display:flex; justify-content:space-between; gap:var(--sp-4); font-size:13px; overflow-wrap:anywhere; }
.bar-track { height:10px; border-radius:var(--radius-pill); background:var(--wash); overflow:hidden; }
.bar-track svg { width:100%; height:10px; display:block; }
.bar-track rect { fill:var(--brand); }
.bar-track .engaged { fill:var(--accent); }
.request-form [hidden],.error[hidden] { display:none; }

@media(min-width:1600px) { .topbar { padding-right:60px; } main.report { padding-inline:60px; } }
@media(min-width:901px) { .history-months { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:1150px) { .shell { grid-template-columns:190px minmax(0,1fr); } .topbar { padding:14px 28px 14px 26px; } .navigation { padding:20px 12px; } main.report { padding:30px 28px 44px; } .stat { padding:18px; } .stat-number { font-size:32px; } .panel { padding:22px; } .stats { gap:10px; } .figures { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:900px) { .stats { grid-template-columns:repeat(2,minmax(0,1fr)); } .equal-columns { grid-template-columns:1fr; } }
@media(prefers-reduced-motion:no-preference) { .btn,.navigation a,.segments button { transition:background-color .15s; } }

/* Phone layout (up to 640px). One side gutter; a quiet header (June Apple in words,
   then the client's logo and full name); the headline number in the first screen; an
   evenly spaced bottom bar in the client's colour. Safe areas cover Safari and Home
   Screen use. */
@media(max-width:640px) {
  :root { --gutter:clamp(16px,4.8vw,20px); --card:18px; --flow:20px; --bar:68px; --edge-l:max(var(--gutter),env(safe-area-inset-left)); --edge-r:max(var(--gutter),env(safe-area-inset-right)); }
  html { scroll-padding-bottom:calc(var(--bar) + 24px + env(safe-area-inset-bottom)); }
  body { font-size:14px; }
  input,select,textarea { font-size:16px; }
  input { min-height:44px; }
  h2 { font-size:18px; }
  h3 { font-size:16px; }

  /* Header */
  .shell { display:block; }
  .topbar { flex-direction:column; align-items:stretch; gap:10px; padding:calc(12px + env(safe-area-inset-top)) var(--edge-r) 2px var(--edge-l); border-bottom:0; }
  .header-note { justify-content:space-between; }
  .client-control { flex:1; }
  .client-picker { flex:1; justify-content:space-between; }

  /* Page frame */
  main.report { padding:18px var(--edge-r) calc(var(--bar) + 28px + env(safe-area-inset-bottom)) var(--edge-l); }
  main.report:focus { outline:none; }
  .report > .footer { margin-top:32px; }
  .footer { display:block; padding-top:14px; }
  .footer-actions { gap:0 28px; }
  .intro h1 { font-size:24px; line-height:1.15; text-wrap:balance; }
  .intro p { font-size:14px; line-height:1.5; text-wrap:pretty; }

  /* Overview top */
  .headline { gap:4px; }
  .headline-number { font-size:clamp(60px,17vw,72px); }
  .headline-number.unknown { font-size:40px; }
  .headline-context { text-wrap:pretty; }
  .figures { grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px 20px; }
  .figure:last-child:nth-child(odd) { grid-column:1 / -1; }

  /* Dates: presets as one row of equal buttons, the calendar beside them. */
  .date-tools { flex-wrap:nowrap; }
  .segments { flex:1; display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); padding:4px; }
  .segments button { min-height:44px; padding:0 2px; }
  #custom-toggle { flex:0 0 52px; gap:0; height:54px; padding:0; font-size:0; border-radius:12px; }
  .custom-range { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:14px; border:1px solid var(--hairline); border-radius:12px; }
  .custom-range input { width:100%; min-height:44px; }
  .custom-range .btn,.custom-range .error { grid-column:1 / -1; }
  .period-note { line-height:1.5; }

  /* Cards */
  .panel { padding:20px var(--card); }
  .panel > * + * { margin-top:16px; }
  .panel-header { gap:10px; }
  .panel-header p,.stat-foot,.note { text-wrap:pretty; }
  .panel-header:has(> div):has(> .pill) { flex-wrap:wrap; gap:10px; }
  .panel-header:has(> div):has(> .pill) > div { flex:1 1 100%; }
  .pill,.panel-header .pill { font-size:12px; }
  .panel-header .pill { padding:3px 7px; }
  .stats { gap:10px; }
  .stat { padding:16px; gap:10px; }
  .stat-top .icon { display:none; }
  .stat-number { font-size:32px; }
  .stat-number.unknown { font-size:20px; line-height:1.65; }
  .stat-foot { font-size:12px; }
  .panel > .stats > .stat:last-child:nth-child(odd) { grid-column:1 / -1; }
  .chart { min-height:180px; }
  .chart text { font-size:12px; }
  .chart-footer { flex-wrap:wrap; gap:7px; font-size:12px; }
  .source-row small,.work-item .note,td small { font-size:12px; }
  .source-row > span + span,.source-row > strong { flex-shrink:0; max-width:58%; text-align:right; }
  table { font-size:12px; }
  th { font-size:12px; letter-spacing:0; }
  th,td { padding:12px 7px; }
  .keyword-table th:first-child { width:40%; }
  .keyword-table th.num { white-space:normal; }
  .keyword-table td:first-child { overflow-wrap:anywhere; }
  .maps-row { grid-template-columns:minmax(0,1fr); row-gap:14px; }
  .maps-grid-details { margin-top:0; }
  .maps-grid-details dl { grid-template-columns:1fr 1fr; }
  .keyword-focus { grid-template-columns:1fr; }
  .keyword-choice { grid-template-columns:minmax(0,1fr) auto; gap:var(--sp-2) var(--sp-4); }
  .keyword-choice > span:first-child { align-self:center; }
  .keyword-choice small { grid-column:1 / -1; }
  .keyword-picker select { font-size:16px; }
  .rank-summary { grid-template-columns:1fr 1fr; }
  .rank-summary > div:last-child { grid-column:1 / -1; border-top:1px solid var(--hairline); padding-top:var(--sp-3); }
  .rank-summary dd { font-size:27px; }
  .keyword-detail h3 { font-size:21px; }
  .rank-chart { min-height:0; }
  #keyword-history .panel-header { flex-wrap:wrap; }
  .empty { padding:28px 18px; }
  .delivery-item .eyebrow { font-size:11px; }
  .contact-strip { flex-direction:column; align-items:start; gap:var(--sp-4); padding:20px var(--card); }
  .contact-strip .btn { align-self:stretch; }
  .request-form input,.request-form textarea,.request-form select { font-size:16px; }
  .request-form .btn { justify-self:stretch; }
  .login { margin:max(32px,6vh) auto; padding-top:env(safe-area-inset-top); }
  .login form { padding:20px; }

  /* Bottom bar: six evenly spaced tabs; the current one gets a capsule in the client's colour. */
  .navigation { position:fixed; top:auto; left:0; right:0; bottom:0; z-index:30; display:flex; justify-content:space-between; gap:0; padding:6px max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left)); background:var(--page); border-top:1px solid var(--hairline); }
  .navigation a { flex:1 1 auto; flex-direction:column; justify-content:center; gap:3px; min-width:44px; min-height:56px; padding:4px 0; color:var(--ink-muted); font-size:12px; font-weight:560; line-height:1.2; letter-spacing:-.01em; white-space:nowrap; border-radius:12px; }
  .navigation a[aria-current="page"] { color:var(--brand-ink); background:transparent; }
  .navigation a:hover:not([aria-current]) { background:transparent; }
  .nav-icon { justify-content:center; align-items:center; width:44px; height:28px; border-radius:var(--radius-pill); }
  .navigation a[aria-current="page"] .nav-icon { color:var(--on-brand); background:var(--brand); }
  .navigation .icon { width:21px; height:21px; }
}
/* Very narrow phones and Display Zoom (under 360px): keep six labelled tabs apart. */
@media(max-width:359px) {
  .navigation { padding-left:max(2px,env(safe-area-inset-left)); padding-right:max(2px,env(safe-area-inset-right)); }
  .navigation a { font-size:11px; letter-spacing:-.015em; }
  .nav-icon { width:40px; }
  .segments button { font-size:12px; }
}
