/* FacetCraft: field-ledger look. Ink header, pale sage ground, blue = organic, amber = paid. */
:root {
  --bg: #F1F3EF; --panel: #FFFFFF; --ink: #16201C; --muted: #56615B; --soft: #3E4843;
  --line: #D9DDD5; --line-soft: #E7E9E3;
  --organic: #2F5BD3; --organic-tint: #DCE4FA; --organic-ink: #1A3A94;
  --paid: #F2B36B; --paid-strong: #C9772A; --paid-tint: #FCE3C6; --paid-ink: #7E440A;
  --good-tint: #D7EEDF; --good-ink: #185E3B; --bad-tint: #F8DAD7; --bad-ink: #8F1F18;
  --note-tint: #FFF6E8; --note-line: #EBCB98; --note-ink: #5A3A0E;
  --sans: 'Schibsted Grotesk', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); }
a { color: var(--organic); } a:hover { color: var(--organic-ink); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.top { background: var(--ink); color: #fff; padding: 12px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.top .logo { font-weight: 800; font-size: 18px; color: #fff; text-decoration: none; }
.top .logo span { color: var(--paid); }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { color: #C9D2CC; text-decoration: none; padding: 8px 12px; border-radius: 4px; font-weight: 500; }
.top nav a:hover, .top nav a.on { color: #fff; background: #2C3B34; }
.top-new { margin-left: auto; min-height: 40px; padding: 8px 14px; background: #fff; color: var(--ink); border-color: #fff; }
.top-new:hover { background: var(--paid); border-color: var(--paid); color: #2A1804; }
.top-search { display: flex; gap: 6px; flex: 1 1 300px; max-width: 520px; min-width: 0; }
@media (max-width: 640px) { .top-search { flex-wrap: wrap; flex-basis: 100%; } .top-search input[type=text] { flex-basis: 60%; } }
.top-search input { flex: 1; min-width: 0; width: auto; min-height: 40px; padding: 8px 12px; border: 1px solid #3A4A42; background: #222E28; color: #fff; border-radius: 4px; }
.top-search input::placeholder { color: #9AA8A0; }
.top-search input:focus-visible { outline: 3px solid var(--paid); outline-offset: 1px; }
.top-search button { min-height: 40px; padding: 8px 14px; background: var(--paid); color: #2A1804; border-color: var(--paid); }
.mkt-switch { display: flex; margin: 0; padding: 2px; min-width: 0; border: 1px solid #3A4A42; background: #222E28; border-radius: 4px; flex: none; }
.mkt-switch label { display: flex; align-items: center; padding: 0 10px; min-height: 34px; border-radius: 3px; color: #C9D2CC; font-weight: 600; font-size: 13px; cursor: pointer; }
.mkt-switch label { position: relative; }
.top-search .mkt-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; flex: none; }
.mkt-switch label:has(input:checked) { background: var(--paid); color: #2A1804; }
.mkt-switch label:has(input:focus-visible) { outline: 3px solid var(--paid); outline-offset: 1px; }
.top-search .country-select { flex: none; min-height: 40px; padding: 6px 8px; border: 1px solid #3A4A42; background: #222E28; color: #fff; font-weight: 600; font-size: 13px; }
.top-search .country-select:focus-visible { outline: 3px solid var(--paid); outline-offset: 1px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Breadcrumbs and page header */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: -8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.page-head .titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 420px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-left: auto; }

/* Tabs: without JS every panel shows in order */
.tabs { display: flex; gap: 2px; box-shadow: inset 0 -2px 0 var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; position: sticky; top: 0; z-index: 4; background: var(--bg); margin-bottom: -8px; }
.tab { padding: 12px 16px; color: var(--soft); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--organic); }
.tab-badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--line-soft); color: var(--soft); }
.tab-badge:empty { display: none; }
.tab-panel { display: flex; flex-direction: column; gap: 20px; }
.js .tab-panel { display: none; }
.js .tab-panel.is-active { display: flex; }
.empty-state { text-align: left; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

main { max-width: 1320px; margin: 0 auto; padding: 28px max(16px, 32px) 64px; display: flex; flex-direction: column; gap: 24px; }
h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
h2 { margin: 0; font-size: 19px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 20px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.kpi .big { font-family: var(--mono); font-size: 28px; font-weight: 600; }
.kpi .big small { font-size: 13px; color: var(--muted); font-weight: 400; }
.kpi p { margin: 0; color: var(--soft); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.note { background: var(--note-tint); border: 1px solid var(--note-line); color: var(--note-ink); border-radius: 6px; padding: 10px 14px; font-size: 13px; }
.error { background: var(--bad-tint); border: 1px solid #E8B4AE; color: var(--bad-ink); border-radius: 6px; padding: 10px 14px; }
.muted { color: var(--muted); }

.scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid #C9CEC5; white-space: nowrap; }
.tbl td { padding: 9px 8px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.tbl .r { text-align: right; }
.tbl .sub { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.c-org { background: var(--organic-tint); color: var(--organic-ink); }
.c-paid { background: var(--paid-tint); color: var(--paid-ink); }
.c-good { background: var(--good-tint); color: var(--good-ink); }
.c-bad { background: var(--bad-tint); color: var(--bad-ink); }
.c-mute { background: #E8EAE5; color: var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.slot { display: flex; flex-direction: column; justify-content: space-between; min-height: 76px; padding: 6px; border-radius: 4px; font-size: 10px; line-height: 1.2; text-decoration: none; }
.slot b { font-family: var(--mono); font-size: 12px; }
.s-organic { background: var(--organic); color: #fff; }
.s-sp { background: var(--paid); color: #3B2105; }
.s-sp_carousel { background: var(--paid); color: #3B2105; outline: 2px dashed var(--paid-ink); outline-offset: -2px; }
.s-sb, .s-sb_video { background: var(--paid-strong); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--soft); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
form.inline label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=email], input[type=password], select { font: inherit; padding: 10px 12px; min-height: 44px; border: 1px solid #C9CEC5; border-radius: 4px; background: #fff; color: var(--ink); min-width: 0; }
input[type=text] { width: 320px; max-width: 100%; }
button, .btn { font: inherit; font-weight: 600; padding: 10px 16px; min-height: 44px; border-radius: 4px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #C9CEC5; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--organic); outline-offset: 2px; }

.kv { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
ul.bullets { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs img { width: 84px; height: 84px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.na { color: var(--muted); font-style: italic; }

/* Busy buttons and the job progress page */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; margin-right: 8px; vertical-align: -2px; flex: none; }
.spinner.big { width: 40px; height: 40px; border-width: 4px; margin: 0; color: var(--organic); }
.is-busy { opacity: .85; cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }

.job { gap: 16px; max-width: 760px; width: 100%; margin: 24px auto 0; }
.job-head { display: flex; align-items: center; gap: 18px; }
.job-timer { margin-left: auto; font-size: 22px; font-weight: 600; color: var(--muted); }
.progress-track { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; position: relative; }
.progress-bar { position: absolute; top: 0; bottom: 0; width: 35%; background: linear-gradient(90deg, var(--organic), var(--paid)); border-radius: 3px; animation: slide 1.6s ease-in-out infinite; }
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }
.job-step { font-size: 16px; font-weight: 600; }
.fade-in { animation: fadein .35s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.job-log { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.job-log li::marker { content: '✓  '; color: var(--good-ink); }
.job.is-done .spinner.big, .job.is-failed .spinner.big { animation: none; border-right-color: currentColor; }
.job.is-done .spinner.big { color: var(--good-ink); }
.job.is-failed .spinner.big { color: var(--bad-ink); }
.job.is-failed .progress-bar, .job.is-done .progress-bar { animation: none; left: 0; width: 100%; }
.job.is-failed .progress-bar { background: var(--bad-ink); }

@media (prefers-reduced-motion: reduce) {
  .spinner, .progress-bar, .fade-in { animation-duration: 3s; }
  .fade-in { animation: none; }
}

/* Quotes, map tooltip, draft tester */
.quote { color: var(--soft); font-style: italic; }
.map-pt { cursor: pointer; outline: none; }
.map-pt:focus circle:nth-child(2), .map-pt:hover circle:nth-child(2) { fill-opacity: 1; stroke: var(--ink); }
.map-tip { position: absolute; z-index: 5; max-width: 320px; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.4; padding: 8px 10px; border-radius: 4px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
textarea { font: inherit; padding: 10px 12px; border: 1px solid #C9CEC5; border-radius: 4px; background: #fff; color: var(--ink); width: 100%; min-height: 160px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.delta-up { color: var(--good-ink); font-weight: 700; }
.delta-down { color: var(--bad-ink); font-weight: 700; }

/* Topic treemap */
.treemap { position: relative; margin: 0; aspect-ratio: 5 / 2; min-height: 240px; border-radius: 6px; overflow: hidden; background: var(--line-soft); }
.tm-cell { position: absolute; box-shadow: inset 0 0 0 1.5px #fff; padding: 6px 8px; display: flex; flex-direction: column; justify-content: space-between; gap: 2px; overflow: hidden; font-size: 12px; line-height: 1.25; }
.tm-name { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tm-n { font-size: 11px; opacity: .8; }
.tm-good { background: #BFE3CC; color: var(--good-ink); }
.tm-part { background: var(--paid-tint); color: var(--paid-ink); }
.tm-bad { background: #F3C6C1; color: var(--bad-ink); }
.tm-hi { background: var(--organic); color: #fff; }
.tm-mid { background: #8FA8EA; color: #0E2466; }
.tm-lo { background: var(--organic-tint); color: var(--organic-ink); }
.legend i.tm-good, .legend i.tm-part, .legend i.tm-bad, .legend i.tm-hi, .legend i.tm-mid, .legend i.tm-lo { box-shadow: none; }

/* Rule check, phone title, since last audit, market */
.rule-block { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.rule-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13px; }
.rule-row .chip { justify-self: start; }
.rule-ok { margin: 0; color: var(--good-ink); font-size: 13px; }
.rule-ok::before { content: '✓  '; font-weight: 700; }
.phone-title { max-width: 300px; border: 8px solid var(--ink); border-radius: 22px; padding: 18px 14px; background: #fff; font-size: 14px; line-height: 1.35; }
.phone-title span { display: block; }
.since-score { display: flex; align-items: baseline; gap: 12px; font-size: 28px; font-family: var(--mono); }
.since-score strong { font-weight: 600; }
.since-score .delta-up, .since-score .delta-down, .since-score .muted:last-child { font-size: 16px; font-family: var(--sans); }
ul.checks { margin: 6px 0 0; padding-left: 18px; }
ul.checks li::marker { content: '✓  '; color: var(--good-ink); }
.tbl tr.you-row td { background: var(--note-tint); }

/* Semantic reads: unique, buried, intent */
.sem-row { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.intent-lede { margin: 0; font-size: 15px; max-width: 80ch; }
.intent-groups { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.intent-group { border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.intent-group.yours { border: 2px solid var(--organic); background: #F6F8FE; }
.intent-bars { display: grid; grid-template-columns: 80px 1fr 40px; gap: 6px 10px; align-items: center; font-size: 12px; }
.intent-bars .track { display: block; height: 8px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.intent-bars .track span { display: block; height: 100%; background: var(--organic); }

/* Print / save as PDF: every tab, no app chrome */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .top, .site-top, .site-foot, .crumbs, .tabs, .no-print, .sample-bar, form, button, .btn, #draft { display: none !important; }
  main { padding: 0; max-width: none; gap: 14px; zoom: .8; }
  .js .tab-panel, .tab-panel { display: flex !important; }
  .panel { border-color: #ccc; }
  h2 { break-after: avoid; }
  main::before { content: 'FacetCraft · Listing audit'; font-weight: 800; font-size: 14px; color: var(--muted); }
  .tbl tr, .tm-cell, .rule-row { break-inside: avoid; }
  .scroll { overflow: visible; }
  .tbl { min-width: 0 !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

/* Google Shopping */
.price-old { font-size: 11px; color: var(--muted); text-decoration: line-through; }
.thumb-sm { width: 44px; height: 44px; object-fit: contain; background: #fff; border: 1px solid var(--line-soft); border-radius: 4px; flex: none; }
.stars { display: grid; grid-template-columns: 28px minmax(0, 1fr) 56px; gap: 6px 10px; align-items: center; font-size: 12px; }
.stars .track { height: 10px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.stars .track span { display: block; height: 100%; background: var(--organic); }
.stars .track span.low { background: var(--paid-strong); }
.bands { display: flex; align-items: flex-end; gap: 8px; height: 160px; border-bottom: 1px solid var(--line); }
.bands .band { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bands .band .all { background: var(--organic-tint); border-radius: 3px 3px 0 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.bands .band .top { background: var(--organic); }
.band-labels { display: flex; gap: 8px; }
.band-labels span { flex: 1; text-align: center; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pick-btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* Share link on the audit page */
.share-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-box input { width: 320px; max-width: 100%; min-height: 44px; font-family: var(--mono); font-size: 12px; }

/* Account pages and header */
.auth-wrap { padding: 56px 16px 72px; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1, .site .auth-card h1 { font-size: 28px; line-height: 1.2; }
.auth-card .sub { color: var(--soft); font-size: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .field input { width: 100%; font-size: 15px; }
.auth-card button[type=submit] { width: 100%; justify-content: center; }
.auth-card .links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; }
.flash { background: var(--good-tint); border: 1px solid #A9D6B9; color: var(--good-ink); border-radius: 6px; padding: 10px 14px; }
.top-acct { color: #C9D2CC; text-decoration: none; font-weight: 600; font-size: 13px; padding: 8px 4px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-acct:hover { color: #fff; }
.verify-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.verify-bar form { margin: 0; }
.top.signed-out .top-search { margin-left: auto; }
.top-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-bal { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 6px 12px; border: 1px solid #3A4A42; border-radius: 999px; background: #222E28; color: #E6ECE8; text-decoration: none; font-size: 13px; white-space: nowrap; }
.top-bal b { font-family: var(--mono); color: #fff; }
.top-bal:hover { border-color: #9AA8A0; color: #fff; }
.top-bal.empty { border-color: var(--paid); color: var(--paid); }
.top-bal.empty b { color: var(--paid); }
.top-buy { min-height: 40px; padding: 8px 14px; background: var(--paid); color: #2A1804; border-color: var(--paid); }
.top-buy:hover { background: #fff; border-color: #fff; color: var(--ink); }
.bal-panel { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.bal-panel .kpi { display: flex; flex-direction: column; gap: 2px; }
.bal-panel .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
