:root {
  --bg: #EDF1F6;
  --surface: #FFFFFF;
  --surface-2: #F5F7FA;
  --ink: #1B2440;
  --muted: #58627A;
  --line: #D8DFE8;
  --accent: #2E4FD8;
  --accent-ink: #FFFFFF;
  --pass: #15815A;
  --fail: #C43333;
  --warn: #A86F00;
  --info: #58627A;
  --pass-bg: #E1F3EA;
  --fail-bg: #FBE6E6;
  --warn-bg: #FBF0D6;
  --info-bg: #E9EDF3;
  --tick-off: #D8DFE8;
  --side: #1B2440;
  --side-ink: #E6EBF5;
  --side-muted: #98A3BD;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10162A;
    --surface: #182039;
    --surface-2: #1D2644;
    --ink: #E6EBF5;
    --muted: #9AA5BE;
    --line: #2B3656;
    --pass: #3CC48B;
    --fail: #FF6E6E;
    --warn: #F0B43C;
    --info: #9AA5BE;
    --pass-bg: rgba(60, 196, 139, .14);
    --fail-bg: rgba(255, 110, 110, .14);
    --warn-bg: rgba(240, 180, 60, .14);
    --info-bg: rgba(154, 165, 190, .12);
    --tick-off: #2B3656;
    --side: #0B1122;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.55 var(--body); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.015em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }

/* ================= Buttons ================= */
.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 600 .95rem var(--body); padding: .6rem 1.05rem; border-radius: 9px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn { background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; }
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-ghost.is-on { border-color: var(--accent); color: var(--accent); }
.btn-ghost.sm, .btn.sm { padding: .35rem .7rem; font-size: .85rem; }

/* ================= App shell ================= */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side); color: var(--side-ink);
  padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 2rem;
}
.brand {
  display: flex; align-items: center; gap: .65rem; padding: 0 .5rem;
  color: var(--side-ink); text-decoration: none;
  font: 700 1.15rem/1.15 var(--display); letter-spacing: -.01em;
}
.brand-mark { flex: none; width: 32px; height: 32px; display: grid; place-items: center; }
.brand-mark svg { width: 32px; height: 32px; }
.brand-mark rect { fill: var(--side-ink); }
.brand-mark .b-arc { fill: none; stroke: var(--side); stroke-width: 3; stroke-linecap: round; }
.brand-mark .b-needle { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.brand-mark.has-logo { width: auto; max-width: 150px; height: 36px; background: #fff; border-radius: 7px; padding: 3px 6px; }
.brand-mark.has-logo img { height: 30px; width: auto; min-width: 30px; max-width: 138px; object-fit: contain; object-position: left center; display: block; }
.brand-mark.has-logo + .brand-name { display: none; }

.nav { display: grid; gap: .2rem; }
.nav a {
  display: flex; align-items: center; gap: .7rem;
  color: var(--side-muted); text-decoration: none; font-weight: 500;
  padding: .6rem .7rem; border-radius: 9px;
}
.nav a:hover { color: var(--side-ink); background: rgba(255, 255, 255, .06); }
.nav a[aria-current="page"] { color: var(--side-ink); background: rgba(255, 255, 255, .1); }
.nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-count { margin-left: auto; font-size: .8rem; color: var(--side-muted); }

.side-label { font-size: .82rem; color: var(--side-muted); margin: 0 0 .5rem; padding: 0 .7rem; }
.side-recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.side-recent button {
  width: 100%; display: flex; align-items: center; gap: .6rem;
  background: none; border: 0; cursor: pointer; text-align: left;
  color: var(--side-muted); padding: .45rem .7rem; border-radius: 8px; font-size: .9rem;
}
.side-recent button:hover { color: var(--side-ink); background: rgba(255, 255, 255, .06); }
.side-host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mini-score {
  flex: none; display: inline-grid; place-items: center;
  min-width: 2.2rem; height: 1.6rem; padding: 0 .35rem; border-radius: 6px;
  font: 700 .85rem var(--display);
}
.mini-score.tone-pass { background: var(--pass-bg); color: var(--pass); }
.mini-score.tone-warn { background: var(--warn-bg); color: var(--warn); }
.mini-score.tone-fail { background: var(--fail-bg); color: var(--fail); }
.side .mini-score.tone-pass { background: rgba(60, 196, 139, .18); color: #5DD6A0; }
.side .mini-score.tone-warn { background: rgba(240, 180, 60, .18); color: #F2BF55; }
.side .mini-score.tone-fail { background: rgba(255, 110, 110, .18); color: #FF8A8A; }

.main { padding: 2rem clamp(1rem, 3vw, 2.75rem) 4rem; min-width: 0; }
.view { max-width: 1180px; margin: 0 auto; }

/* ================= Start / form ================= */
.start { padding: 3.5rem 0 2rem; max-width: 800px; }
.start h1 { font-weight: 800; font-size: clamp(2.2rem, 5vw, 3.7rem); line-height: 1.03; letter-spacing: -.035em; margin: 0 0 1.2rem; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 60ch; margin: 0 0 2rem; }
.start.compact { padding: 0 0 1.25rem; }
.start.compact h1, .start.compact .lede { display: none; }
.start.compact .checkbar { max-width: 560px; border-width: 1px; padding: 4px; }
.start.compact .checkbar input { font-size: 1rem; padding: .55rem .8rem; }
.start.compact .checkbar button { padding: .55rem 1rem; }
.start.compact .form-error:empty { display: none; }

.checkbar {
  display: flex; background: var(--surface); border: 2px solid var(--ink);
  border-radius: 14px; padding: 6px; max-width: 680px;
}
.checkbar:focus-within { border-color: var(--accent); }
.checkbar input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 500 1.12rem var(--body); padding: .8rem 1rem; }
.checkbar input:focus { outline: none; }
.checkbar input::placeholder { color: var(--muted); opacity: .75; }
.checkbar button { border: 0; cursor: pointer; background: var(--accent); color: var(--accent-ink); font: 600 1rem var(--body); padding: .8rem 1.4rem; border-radius: 9px; white-space: nowrap; }
.checkbar button:hover { filter: brightness(1.08); }
.checkbar button[disabled] { opacity: .6; cursor: progress; }
.form-error { color: var(--fail); font-weight: 500; min-height: 1.5em; margin: .7rem 0 0; }

/* ================= Loading ================= */
.loading { padding: 4rem 0; text-align: center; }
.pulse-dial { width: 140px; height: 70px; margin: 0 auto 1.5rem; border: 10px solid var(--tick-off); border-bottom: 0; border-radius: 140px 140px 0 0; position: relative; overflow: hidden; }
.pulse-dial::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 4px; height: 58px; margin-left: -2px; background: var(--accent); border-radius: 2px; transform-origin: 50% 100%; animation: sweep 1.6s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: rotate(-75deg); } to { transform: rotate(75deg); } }
.loading-title { font: 700 1.3rem var(--display); margin: 0 0 .3rem; word-break: break-all; }
.loading-step { color: var(--muted); margin: 0; }

/* ================= Report ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem 1.5rem; min-width: 0; }
.card h2 { font-size: 1.12rem; margin: 0 0 1rem; }

.rpt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.rpt-state { margin: 0; color: var(--muted); font-size: .92rem; }
.rpt-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }

.edit-bar {
  display: grid; grid-template-columns: 1fr auto; gap: .9rem 1.5rem; align-items: center;
  background: var(--surface); border: 2px solid var(--accent); border-radius: 16px;
  padding: 1.1rem 1.4rem; margin-bottom: 1rem;
  position: sticky; top: .75rem; z-index: 5;
}
.edit-title { font: 700 1.05rem var(--display); margin: 0 0 .15rem; }
.edit-copy p:last-child { margin: 0; color: var(--muted); font-size: .92rem; }
.edit-score { margin: 0; text-align: right; color: var(--muted); }
.edit-score strong { font: 800 2rem var(--display); color: var(--ink); vertical-align: -3px; margin-left: .3rem; }
.edit-score span { display: block; font-size: .85rem; }
.edit-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
.edit-actions .btn { margin-left: auto; }

.rpt-cover {
  display: flex; gap: 1.5rem 2.5rem; align-items: flex-start; flex-wrap: wrap;
  padding: 1.6rem 0 1.4rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line);
}
.cover-brand { flex: none; }
.cover-brand img { height: 52px; width: auto; min-width: 52px; max-width: 240px; display: block; object-fit: contain; object-position: left center; }
.cover-name { font: 800 1.35rem var(--display); color: var(--accent); }
.cover-main { flex: 1; min-width: 260px; }
.cover-main h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.1; margin: 0 0 .4rem; letter-spacing: -.025em; }
.cover-for { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.cover-for a { color: var(--ink); font-weight: 600; text-decoration: none; }
.cover-for a:hover { text-decoration: underline; }
.cover-intro { margin: .8rem 0 0; max-width: 70ch; }

.grid-top { display: grid; grid-template-columns: minmax(250px, .95fr) minmax(260px, 1fr) minmax(300px, 1.35fr); gap: 1rem; }
.grid-mid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; margin-top: 1rem; }

/* Score card: the one dark, inverted panel */
.score-card {
  background: var(--side); color: var(--side-ink); border-color: var(--side);
  --tick-off: rgba(255, 255, 255, .13); --ink: var(--side-ink); --muted: var(--side-muted);
  --pass: #3CC48B; --warn: #F0B43C; --fail: #FF7474;
  display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center;
}
.dial { width: 100%; max-width: 270px; }
.dial svg { width: 100%; height: auto; display: block; }
.dial .tick { stroke: var(--tick-off); stroke-width: 4.5; stroke-linecap: round; }
.dial.tone-pass .tick.on { stroke: var(--pass); }
.dial.tone-warn .tick.on { stroke: var(--warn); }
.dial.tone-fail .tick.on { stroke: var(--fail); }
.dial .tick.on { animation: light .35s both; animation-delay: calc(var(--i) * 22ms); }
.dial.still .tick.on { animation: none; }
@keyframes light { from { stroke: var(--tick-off); } }
.dial-num { font: 800 66px var(--display); fill: var(--ink); letter-spacing: -2px; }
.score-cap { margin: .1rem 0 .7rem; color: var(--muted); font-size: .88rem; }
.verdict { font: 700 1.18rem/1.25 var(--display); margin: 0; max-width: 24ch; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.donut { width: 140px; height: 140px; flex: none; }
.donut circle { fill: none; stroke-width: 16; transform: rotate(-90deg); transform-origin: 70px 70px; }
.seg-track { stroke: var(--surface-2); }
.seg-pass { stroke: var(--pass); }
.seg-warn { stroke: var(--warn); }
.seg-fail { stroke: var(--fail); }
.donut-num { font: 800 28px var(--display); fill: var(--ink); }
.donut-cap { font: 500 12px var(--body); fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; flex: 1; min-width: 150px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto 3rem; align-items: center; gap: .6rem; }
.legend span { width: 12px; height: 12px; border-radius: 3px; }
.legend b { font: 700 1.05rem var(--display); }
.legend em { font-style: normal; color: var(--muted); text-align: right; font-size: .88rem; }
.l-pass span { background: var(--pass); }
.l-warn span { background: var(--warn); }
.l-fail span { background: var(--fail); }

/* Metric tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin: 0; }
.tile { position: relative; background: var(--surface-2); border-radius: 10px; padding: .75rem .85rem; min-width: 0; }
.tile dt { font-size: .82rem; color: var(--muted); }
.tile dd { margin: .1rem 0 0; font: 700 1.3rem/1.2 var(--display); overflow-wrap: anywhere; }
.tile-sub { display: block; font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.tile-dot { position: absolute; top: .8rem; right: .8rem; width: 8px; height: 8px; border-radius: 50%; }
.d-pass { background: var(--pass); }
.d-warn { background: var(--warn); }
.d-fail { background: var(--fail); }
.d-none, .d-info { background: var(--line); }

/* Category cards */
.cat-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.cat-card {
  display: flex; align-items: center; gap: .8rem; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem;
}
.cat-card:hover { border-color: var(--muted); }
.cat-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ring { width: 52px; height: 52px; flex: none; }
.ring circle { fill: none; stroke-width: 5; transform: rotate(-90deg); transform-origin: 28px 28px; stroke-linecap: round; }
.ring-track { stroke: var(--surface-2); }
.ring.tone-pass .ring-val { stroke: var(--pass); }
.ring.tone-warn .ring-val { stroke: var(--warn); }
.ring.tone-fail .ring-val { stroke: var(--fail); }
.ring text { font: 700 15px var(--display); fill: var(--ink); }
.cat-text { min-width: 0; }
.cat-name { display: block; font-weight: 600; line-height: 1.25; }
.cat-sub { display: block; font-size: .82rem; color: var(--muted); margin-top: .15rem; }

/* Priorities */
.prio { list-style: none; margin: 0; padding: 0; display: grid; }
.prio li { display: grid; grid-template-columns: 24px 1fr auto; gap: .75rem; align-items: start; padding: .7rem 0; }
.prio li + li { border-top: 1px solid var(--line); }
.prio button { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.prio-title { display: block; font-weight: 600; }
.prio button:hover .prio-title { text-decoration: underline; }
.prio-msg { display: block; color: var(--muted); font-size: .9rem; }
.prio-cat { font-size: .78rem; color: var(--muted); background: var(--surface-2); padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }

/* SERP */
.serp-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.serp-head h2 { margin: 0; }
.seg-toggle { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.seg-toggle button { border: 0; background: none; cursor: pointer; padding: .3rem .75rem; border-radius: 7px; font-size: .85rem; color: var(--muted); }
.seg-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.serp-card { background: #fff; border-radius: 12px; padding: 1rem 1.15rem; font-family: Arial, Helvetica, sans-serif; border: 1px solid #E3E6EA; }
.serp-card.is-mobile { max-width: 380px; border-radius: 16px; }
.serp-site { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; }
.serp-fav { width: 26px; height: 26px; border-radius: 50%; background: #F1F3F4; color: #5F6368; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.serp-name { display: block; color: #202124; font-size: 14px; }
.serp-url { display: block; color: #4D5156; font-size: 12px; overflow-wrap: anywhere; }
.serp-title { color: #1A0DAB; font-size: 20px; line-height: 1.3; margin: 0 0 .3rem; }
.is-mobile .serp-title { font-size: 18px; }
.serp-desc { color: #4D5156; font-size: 14px; line-height: 1.58; margin: 0; }
.serp-missing { color: #C43333; font-style: italic; }

/* Checklist */
.checklist { margin-top: 1rem; }
.cl-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.cl-head h2 { margin: 0; }
.cl-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.cl-tools input, .cl-tools select, .field input, .field textarea, .color-row input[type=text] {
  font: 400 .95rem var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; padding: .55rem .8rem;
}
.cl-tools input { width: 220px; max-width: 100%; }
.cl-tools input:focus, .cl-tools select:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

.status-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.1rem; }
.status-tabs button {
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  padding: .35rem .8rem; border-radius: 999px; font-size: .88rem; font-weight: 500;
}
.status-tabs button span { color: var(--muted); margin-left: .15rem; }
.status-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.status-tabs button[aria-pressed="true"] span { color: inherit; opacity: .75; }

.cl-group + .cl-group { margin-top: 1.4rem; }
.cl-group h3 { font-size: 1rem; margin: 0 0 .5rem; color: var(--muted); font-weight: 600; font-family: var(--body); letter-spacing: 0; }
.rows { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: stretch; background: var(--surface); }
.row + .row { border-top: 1px solid var(--line); }
.row .check { flex: 1; min-width: 0; }
.row.is-excluded .check { opacity: .45; }
.ex-tag { font-style: normal; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); padding: .1rem .45rem; border-radius: 5px; margin-left: .3rem; vertical-align: 1px; }
.inc { display: flex; align-items: flex-start; padding: 1.05rem 0 0 1rem; cursor: pointer; }
.inc input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }

.check summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 28px minmax(140px, 230px) 1fr 20px;
  gap: 1rem; align-items: start; padding: .9rem 1.1rem;
}
.check summary::-webkit-details-marker { display: none; }
.check summary:hover { background: var(--surface-2); }
.check-title { font-weight: 600; }
.check-msg { color: var(--muted); }
.chev { width: 20px; height: 20px; margin-top: 2px; color: var(--muted); transition: transform .2s; }
.check[open] .chev { transform: rotate(180deg); }

.badge { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.badge.sm { width: 24px; height: 24px; }
.badge svg { width: 15px; height: 15px; }
.s-pass .badge { background: var(--pass-bg); color: var(--pass); }
.s-fail .badge { background: var(--fail-bg); color: var(--fail); }
.s-warn .badge { background: var(--warn-bg); color: var(--warn); }
.s-info .badge { background: var(--info-bg); color: var(--info); }

.check-body { padding: 0 1.1rem 1.2rem calc(28px + 2.1rem); }
.det { margin: 0 0 1rem; padding: 0; list-style: none; display: grid; gap: .3rem; }
.det li { background: var(--surface-2); border-radius: 6px; padding: .4rem .7rem; font-size: .9rem; overflow-wrap: anywhere; }
.fix { border-left: 3px solid var(--accent); padding: .15rem 0 .15rem .9rem; margin: 0; }
.fix strong { display: block; font-size: .9rem; margin-bottom: .15rem; }
.kw { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .5rem; padding: 0; list-style: none; }
.kw li { background: var(--surface-2); border-radius: 999px; padding: .3rem .75rem; font-size: .9rem; }
.kw b { color: var(--accent); margin-left: .3rem; }
.empty { padding: 1rem 0; margin: 0; }

.rpt-foot { margin-top: 1.5rem; padding: 1.25rem 0 0; border-top: 1px solid var(--line); display: grid; gap: .35rem; font-size: .92rem; }
.rpt-foot p { margin: 0; }
.foot-company { display: flex; flex-wrap: wrap; gap: .35rem 1rem; align-items: baseline; }
.foot-company span { color: var(--muted); }
.sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--line); margin: 0 .55rem; vertical-align: middle; }

/* ================= Pages: history & white label ================= */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 1rem 0 1.5rem; }
.page-head h1 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); margin: 0 0 .25rem; letter-spacing: -.025em; }
.page-head p { margin: 0; }

.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state p { max-width: 46ch; margin: 0 auto 1.25rem; color: var(--muted); }

.table-card { padding: 0; }
.table-scroll { overflow-x: auto; }
.htable { width: 100%; border-collapse: collapse; font-size: .93rem; }
.htable th { text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.htable td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.htable tr:last-child td { border-bottom: 0; }
.h-open { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; max-width: 340px; }
.h-host { display: block; font-weight: 600; }
.h-open:hover .h-host { text-decoration: underline; }
.h-url { display: block; color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.h-actions { white-space: nowrap; text-align: right; }
.h-actions .btn-ghost + .btn-ghost { margin-left: .35rem; }
.delta { font-weight: 700; }
.delta.up { color: var(--pass); }
.delta.down { color: var(--fail); }
.pill { display: inline-block; min-width: 1.8rem; text-align: center; padding: .1rem .4rem; border-radius: 6px; font-weight: 600; font-size: .85rem; }
.p-fail { background: var(--fail-bg); color: var(--fail); }
.p-warn { background: var(--warn-bg); color: var(--warn); }
.p-pass { background: var(--pass-bg); color: var(--pass); }

.auth-card { max-width: 440px; display: grid; gap: .9rem; }
.auth-card h2 { margin: 0; }
.auth-card p { margin: 0; }
.auth-card .btn { justify-self: start; }

.brand-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .9fr); gap: 1.5rem; align-items: start; }
.brand-form { display: grid; gap: 1.5rem; }
.brand-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.brand-form fieldset > * + * { margin-top: 1rem; }
.brand-form fieldset > legend + * { margin-top: 0; }
.brand-form fieldset > .muted.small { margin-bottom: 0; }
.brand-form legend { float: left; width: 100%; font: 700 1.1rem var(--display); margin: 0 0 1rem; padding: 0; }
.brand-form legend + * { clear: both; }
.brand-form fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 1.4rem; }
.field { display: grid; gap: .35rem; }
.field > span { font-weight: 600; font-size: .92rem; }
.field small, .logo-row small { color: var(--muted); font-size: .82rem; }
.field textarea { resize: vertical; min-height: 4.5rem; line-height: 1.5; }
.logo-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.logo-row > div:last-child { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.logo-row small { flex-basis: 100%; }
.logo-box { width: 150px; height: 72px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; background: #fff; padding: 8px; }
.logo-box img { width: 100%; height: 100%; object-fit: contain; }
.file-btn { position: relative; }
.color-row { display: flex; gap: .5rem; align-items: center; }
.color-row input[type=color] { width: 46px; height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--surface); cursor: pointer; }
.color-row input[type=text] { width: 120px; text-transform: uppercase; }

.switch { display: flex; align-items: center; gap: .75rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: none; width: 40px; height: 23px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(17px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--accent); outline-offset: 2px; }

.pw-change summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.pw-change[open] { display: grid; gap: .8rem; }
.pw-change .btn-ghost { justify-self: start; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.form-foot .form-error { margin: 0; }

.brand-preview { position: sticky; top: 1.5rem; }
.brand-preview .side-label { color: var(--muted); padding: 0; }
.preview-doc { background: #fff; color: #1B2440; border-radius: 14px; border: 1px solid var(--line); padding: 1.4rem; font-size: .88rem; }
.pv-top img { height: 40px; width: auto; min-width: 40px; max-width: 200px; object-fit: contain; object-position: left center; display: block; }
.pv-top strong { font: 800 1.1rem var(--display); color: var(--accent); }
.pv-title { font: 800 1.45rem/1.15 var(--display); margin: 1rem 0 .25rem; letter-spacing: -.02em; }
.pv-for { color: #58627A; margin: 0; }
.pv-intro { margin: .7rem 0 0; }
.pv-score { display: flex; align-items: center; gap: 1rem; margin: 1.2rem 0; padding: 1rem; background: #1B2440; border-radius: 10px; }
.pv-num { font: 800 2.2rem var(--display); color: #fff; }
.pv-bars { flex: 1; display: flex; height: 10px; border-radius: 5px; overflow: hidden; }
.pv-bars i:nth-child(1) { background: #3CC48B; }
.pv-bars i:nth-child(2) { background: #F0B43C; }
.pv-bars i:nth-child(3) { background: #FF7474; }
.pv-btn { display: inline-block; background: var(--accent); color: #fff; padding: .45rem .8rem; border-radius: 7px; font-weight: 600; font-size: .8rem; }
.pv-foot { margin-top: 1.2rem; padding-top: .9rem; border-top: 1px solid #D8DFE8; display: grid; gap: .25rem; }
.pv-foot span { color: #58627A; }
.pv-foot p { margin: 0; }
.pv-foot .muted { color: #58627A; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%);
  background: var(--ink); color: var(--bg); padding: .7rem 1.15rem; border-radius: 10px;
  font-weight: 500; transition: transform .25s, opacity .25s; z-index: 50; pointer-events: none;
  opacity: 0; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* ================= Responsive ================= */
@media (max-width: 1100px) {
  .grid-top { grid-template-columns: 1fr 1fr; }
  .metrics { grid-column: 1 / -1; }
  .cat-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; gap: 1rem; padding: .7rem 1rem;
  }
  .brand { padding: 0; font-size: 1.05rem; }
  .brand-name { display: none; }
  .nav { display: flex; gap: .15rem; margin-left: auto; }
  .nav a { padding: .45rem .6rem; font-size: .9rem; gap: .4rem; }
  .nav-count { display: none; }
  .side-recent { display: none; }
  .grid-mid, .brand-grid { grid-template-columns: 1fr; }
  .brand-preview { position: static; }
  .edit-bar { position: static; }
}
@media (max-width: 640px) {
  .main { padding-top: 1.25rem; }
  .nav svg { display: none; }
  .grid-top { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-cards { grid-template-columns: 1fr 1fr; }
  .check summary { grid-template-columns: 28px 1fr 20px; gap: .25rem .8rem; }
  .check-msg { grid-column: 2; grid-row: 2; }
  .chev { grid-column: 3; grid-row: 1; }
  .check-body { padding-left: 1.1rem; }
  .checkbar { flex-direction: column; gap: 6px; }
  .checkbar button { width: 100%; }
  .start.compact .checkbar { flex-direction: row; }
  .start.compact .checkbar button { width: auto; }
  .edit-bar { grid-template-columns: 1fr; }
  .edit-score { text-align: left; }
  .edit-actions .btn { margin-left: 0; }
  .rpt-actions { margin-left: 0; }
  .prio li { grid-template-columns: 24px 1fr; }
  .prio-cat { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ================= Print / PDF ================= */
@media print {
  @page { margin: 14mm; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #F3F5F8; --ink: #111827; --muted: #4B5563; --line: #D1D5DB; }
  body { background: #fff; color: #111827; font-size: 11pt; }
  .app { display: block; }
  .side, .start, .no-print, .toast, .chev, .inc, .skip, #view-history, #view-brand { display: none !important; }
  .main { padding: 0; }
  .card, .cat-card { break-inside: avoid; }
  .score-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .dial .tick.on { animation: none; }
  .grid-top { grid-template-columns: .9fr 1fr 1.3fr; }
  .cat-cards { grid-template-columns: repeat(5, 1fr); }
  .grid-mid { display: block; }
  .grid-mid > .card { margin-bottom: 1rem; }
  .priorities, .checklist { break-inside: auto; }
  .serp { break-inside: avoid; }
  .cl-group h3 { break-after: avoid; }
  .row { break-inside: avoid; }
  .check summary { padding: .55rem .8rem; }
  .check-body { padding-bottom: .7rem; }
  .serp-card, .seg-track, .ring-track, .tile, .det li, .pill, .badge, .legend span, .donut, .ring { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

/* Dark mode: keep uploaded logos legible and the score card defined */
@media (prefers-color-scheme: dark) {
  .cover-brand img { background: #fff; padding: 6px 10px; border-radius: 10px; height: 64px; box-sizing: border-box; }
  .score-card { border-color: var(--line); }
}
@media screen and (max-width: 900px) {
  .nav a { white-space: nowrap; }
}
@media screen and (max-width: 640px) {
  .side { gap: .5rem; padding: .6rem .75rem; }
  .brand-mark.has-logo { max-width: 104px; }
  .brand-mark.has-logo img { max-width: 92px; }
  .nav a { padding: .4rem .5rem; font-size: .88rem; }
}
