/* ---------- Tokens ---------- */
:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-2: #f0f2f4;
  --border: #dde1e5;
  --border-strong: #c5cbd2;
  --text: #1d2125;
  --muted: #5f6b76;
  --accent: #0b7a53;
  --accent-hover: #09663f;
  --accent-soft: #e6f3ed;
  --accent-text: #0a6a48;
  --good: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --info: #0969da;
  --good-soft: #dafbe1;
  --warn-soft: #fff8c5;
  --bad-soft: #ffebe9;
  --info-soft: #ddf4ff;
  --ring-track: #e9ecef;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
  --sidebar-w: 236px;
  --topbar-h: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1214; --surface: #171b1f; --surface-2: #1f2428; --border: #2d333a; --border-strong: #3d444d;
    --text: #e6e9ec; --muted: #9aa5b0; --accent: #2ea57a; --accent-hover: #3cbb8c; --accent-soft: #15302a; --accent-text: #5fd0a4;
    --good: #3fb950; --warn: #d29922; --bad: #f85149; --info: #58a6ff;
    --good-soft: #12261b; --warn-soft: #2b2411; --bad-soft: #2d1416; --info-soft: #0f2238; --ring-track: #2a3036;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1214; --surface: #171b1f; --surface-2: #1f2428; --border: #2d333a; --border-strong: #3d444d;
  --text: #e6e9ec; --muted: #9aa5b0; --accent: #2ea57a; --accent-hover: #3cbb8c; --accent-soft: #15302a; --accent-text: #5fd0a4;
  --good: #3fb950; --warn: #d29922; --bad: #f85149; --info: #58a6ff;
  --good-soft: #12261b; --warn-soft: #2b2411; --bad-soft: #2d1416; --info-soft: #0f2238; --ring-track: #2a3036;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); font-size: 13px; }
.sub { color: var(--muted); margin-top: -4px; }
.empty { color: var(--muted); font-style: italic; }
.ok { color: var(--good); } .over { color: var(--bad); } .near { color: var(--warn); }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: 16px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: var(--radius); color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-btn { display: none; margin-left: -6px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 12px 10px 24px; }
.nav-group { margin: 14px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.nav-group:first-child { margin-top: 2px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--radius); padding: 6px 10px; color: var(--text); font-size: 14px; }
.nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn:hover { background: var(--surface-2); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-btn.active svg { stroke: var(--accent-text); }
.main { flex: 1; min-width: 0; padding: 28px 32px 0; display: flex; flex-direction: column; }
.view { display: none; max-width: 1080px; width: 100%; }
.view.active { display: block; }
.scrim { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 19; }

/* ---------- Page header & forms ---------- */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.page-head p { color: var(--muted); margin: 0; max-width: 720px; }
.url-form { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.url-form input, .url-form select { height: 38px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0 12px; outline: none; }
.url-form input { flex: 1 1 320px; min-width: 0; }
.url-form .kw-input { flex: 0 1 240px; }
.url-form select { flex: 0 0 auto; padding-right: 8px; }
.url-form input:focus, .url-form select:focus, .field input:focus, .field select:focus, .field textarea:focus, .search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-primary { height: 38px; padding: 0 16px; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: var(--radius); font-weight: 600; white-space: nowrap; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { height: 34px; padding: 0 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); font-weight: 500; white-space: nowrap; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost:disabled { opacity: .6; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field em { font-style: normal; font-weight: 400; font-family: var(--mono); font-size: 12px; margin-left: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 10px; outline: none; }
.field textarea { resize: vertical; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.inline-check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search-input { height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0 10px; background: var(--surface); outline: none; flex: 1 1 200px; max-width: 320px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; font-size: 13px; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.notice { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; }

/* ---------- Status ---------- */
.status { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.status.error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cards, tables, badges ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; overflow: hidden; }
.card.flush { padding: 0; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: top; }
thead th { border-top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.card:not(.flush) thead th { background: transparent; padding-top: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
td.url { word-break: break-all; max-width: 520px; }
.pill { display: inline-block; font-size: 12px; line-height: 18px; padding: 0 7px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-weight: 500; white-space: nowrap; border: 1px solid var(--border); }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); border-radius: 4px; padding: 3px 9px; font-size: 13px; }
button.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip em { color: var(--muted); font-style: normal; margin-left: 4px; }
.kv { display: grid; grid-template-columns: 190px 1fr; }
.kv > div { padding: 9px 0; border-top: 1px solid var(--border); min-width: 0; }
.kv > div:nth-child(-n+2) { border-top: 0; padding-top: 0; }
.kv .k { color: var(--muted); padding-right: 12px; }
.kv .v { word-break: break-word; }
.kv .v small { color: var(--muted); display: block; margin-top: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.stat b { display: block; font-size: 20px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 12px; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow: auto; font: 12px/1.55 var(--mono); margin: 0; white-space: pre; max-height: 540px; }

/* ---------- Audit ---------- */
.intro { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; padding: 8px 0 40px; border-top: 1px solid var(--border); margin-top: 8px; }
.intro h2 { font-size: 15px; font-weight: 600; margin: 18px 0 10px; }
.check-list { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; }
.check-list dt { font-weight: 600; }
.check-list dd { margin: 0; color: var(--muted); }
.example-list { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 12px; }
.example { background: none; border: 0; padding: 2px 0; color: var(--info); font-family: var(--mono); font-size: 13px; }
.example:hover { text-decoration: underline; }
.summary { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 14px; margin-bottom: 18px; }
.score-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; gap: 18px; align-items: center; }
.ring { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--ring-track); }
.ring-fg { stroke: var(--accent); stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .8s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label span { font-size: 30px; font-weight: 600; line-height: 1; }
.ring-label small { color: var(--muted); font-size: 11px; }
.score-grade { font-weight: 600; font-size: 17px; margin: 0 0 2px; }
.score-url { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; word-break: break-all; }
.score-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; text-align: left; }
.cat:hover { border-color: var(--border-strong); background: var(--surface-2); }
.cat-name { font-size: 12.5px; color: var(--muted); }
.cat-score { font-size: 22px; font-weight: 600; }
.bar { height: 4px; border-radius: 2px; background: var(--ring-track); overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px; color: var(--muted); white-space: nowrap; margin-bottom: -1px; font-size: 13.5px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.panel { padding: 18px 0 8px; min-height: 200px; }
.panel h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel h3 { font-size: 14px; font-weight: 600; margin: 22px 0 10px; }
.issue { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.issue:first-child { border-top: 0; padding-top: 0; }
.issue-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.issue-dot.bad { background: var(--bad); } .issue-dot.warn { background: var(--warn); } .issue-dot.info { background: var(--info); } .issue-dot.good { background: var(--good); }
.issue-title { font-weight: 600; }
.issue-fix { color: var(--muted); margin-top: 1px; }
.issue-cat { font-size: 12px; color: var(--muted); }
.check { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.check:first-child { border-top: 0; padding-top: 0; }
.check-icon { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 11px; font-weight: 700; color: #fff; margin-top: 1px; }
.check-icon.pass { background: var(--good); } .check-icon.fail { background: var(--bad); } .check-icon.warn { background: var(--warn); }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.hl { display: flex; gap: 10px; padding: 5px 0; align-items: baseline; }
.hl-tag { font-family: var(--mono); font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); padding: 0 5px; border-radius: 3px; flex-shrink: 0; }
.hl-tag.skip { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.ai-inline { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ai-options { margin-top: 10px; }
.ai-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.ai-option:first-child { border-top: 0; }
.ai-option div { flex: 1; }
.ai-option small { display: block; color: var(--muted); }
.report-bar { border-top: 1px solid var(--border); padding: 16px 0 40px; margin-top: 8px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.brand-opts summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.brand-opts summary:hover { color: var(--text); }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; margin-top: 12px; }
.share-card { padding: 0; max-width: 500px; }
.share-card img { width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; display: block; background: var(--surface-2); }
.share-noimg { aspect-ratio: 1.91 / 1; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.share-body { padding: 10px 14px; border-top: 1px solid var(--border); }
.share-host { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.share-title { font-weight: 600; margin: 2px 0; }
.share-desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Tools ---------- */
#bulkResults td, #linksRows td { max-width: 280px; overflow-wrap: anywhere; }
.domain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.domain-grid .card { margin: 0; }
.domain-grid h3 { margin: 0 0 10px; font-size: 14px; }
.match-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.kw-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.kw-head p { margin: 0; color: var(--muted); }
.kw-group h3 { margin: 0 0 8px; font-size: 14px; }
.repeat { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; position: relative; }
.repeat .rm { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; }
.code-col { position: sticky; top: calc(var(--topbar-h) + 16px); }
.code-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; font-size: 13px; }
.code-head small { font-weight: 500; margin-left: 6px; }
.ai-gen .url-form { margin-bottom: 0; }
.ai-gen .status { margin: 12px 0 0; }
.redir-card { margin-bottom: 10px; }
.redir-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }
.hop { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border); align-items: baseline; }
.hop:first-of-type { border-top: 0; }
.hop .mono { word-break: break-all; }
.grade { width: 52px; height: 52px; border-radius: var(--radius); display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sec-summary { display: flex; gap: 14px; align-items: center; }
.src-view { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: 640px; font: 12px/1.6 var(--mono); }
.src-view table { font: inherit; }
.src-view td { border: 0; padding: 0 12px; white-space: pre-wrap; word-break: break-all; }
.src-view td.ln { color: var(--muted); text-align: right; user-select: none; width: 1%; white-space: nowrap; border-right: 1px solid var(--border); background: var(--surface-2); }
.src-view tr.hit td { background: var(--warn-soft); }
.src-view tbody tr:hover td { background: inherit; }
.src-view .t { color: #116329; } .src-view .a { color: #953800; } .src-view .s { color: #0a3069; } .src-view .c { color: var(--muted); }
:root[data-theme="dark"] .src-view .t { color: #7ee787; } :root[data-theme="dark"] .src-view .a { color: #ffa657; } :root[data-theme="dark"] .src-view .s { color: #a5d6ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .src-view .t { color: #7ee787; } :root:not([data-theme="light"]) .src-view .a { color: #ffa657; } :root:not([data-theme="light"]) .src-view .s { color: #a5d6ff; } }

/* SERP preview */
.serp-toggle { margin-bottom: 12px; }
.serp-card { background: #fff; color: #202124; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; font-family: Arial, sans-serif; max-width: 600px; }
.serp-card.mobile { max-width: 380px; }
.serp-site { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.serp-fav { width: 26px; height: 26px; border-radius: 50%; background: #f1f3f4; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #5f6368; }
.serp-name { font-size: 14px; line-height: 1.3; }
.serp-crumb { font-size: 12px; color: #4d5156; line-height: 1.3; }
.serp-title { color: #1a0dab; font-size: 20px; line-height: 1.3; margin-bottom: 4px; }
.serp-card.mobile .serp-title { font-size: 18px; }
.serp-desc { font-size: 14px; color: #4d5156; line-height: 1.58; }
.serp-tips { padding-left: 18px; color: var(--muted); }

/* AI brief & assistant */
.brief-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brief-titles li { margin-bottom: 4px; }
.brief-sec { padding: 10px 0; border-top: 1px solid var(--border); }
.brief-sec:first-child { border-top: 0; padding-top: 0; }
.brief-sec h4 { margin: 0 0 4px; font-size: 14px; }
.brief-sec ul { margin: 4px 0; padding-left: 20px; color: var(--muted); }
.brief-sec p { margin: 4px 0 0; color: var(--muted); }
.qa { padding: 10px 0; border-top: 1px solid var(--border); }
.qa:first-child { border-top: 0; padding-top: 0; }
.qa b { display: block; margin-bottom: 2px; }
.qa p { margin: 0; color: var(--muted); }
.chat-tool { display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h) - 90px); max-width: 860px; }
.chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.context-bar { background: var(--accent-soft); color: var(--accent-text); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; margin-bottom: 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.context-bar button { background: none; border: 0; color: inherit; text-decoration: underline; font-size: 13px; padding: 0; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 4px 0 16px; }
.chat-empty { margin: auto 0; }
.suggest-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.suggest-list button { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; color: var(--text); }
.suggest-list button:hover { border-color: var(--border-strong); background: var(--surface-2); }
.msg { max-width: 88%; padding: 10px 14px; border-radius: var(--radius); line-height: 1.6; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; }
.msg.assistant { align-self: stretch; max-width: 100%; background: transparent; padding: 0; }
.msg.error { align-self: flex-start; background: var(--bad-soft); color: var(--bad); }
.msg p { margin: 0 0 10px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 10px; padding-left: 22px; }
.msg h4 { margin: 14px 0 6px; font-size: 15px; }
.msg pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; overflow-x: auto; font: 12px/1.5 var(--mono); margin: 0 0 10px; white-space: pre; }
.msg code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }
.msg pre code { background: none; padding: 0; }
.md-table { overflow-x: auto; margin: 0 0 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.md-table table { min-width: 480px; }
.md-table pre { margin: 6px 0 0; }
.typing::after { content: '▍'; animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.chat-form { position: sticky; bottom: 12px; display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px; }
.chat-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-form textarea { flex: 1; border: 0; background: transparent; resize: none; outline: none; padding: 8px 10px; max-height: 180px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* ---------- Page content (help text, FAQs) ---------- */
.nav-btn { text-decoration: none; }
.nav-btn:hover { text-decoration: none; }
.seo-content { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: start; }
.prose { max-width: 720px; line-height: 1.65; }
.prose h2 { font-size: 17px; font-weight: 600; margin: 26px 0 8px; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 12px; color: var(--text); }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.faq { border-top: 1px solid var(--border); padding: 10px 0; }
.faq:last-child { border-bottom: 1px solid var(--border); }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; }
.faq[open] summary::after { content: '−'; }
.faq p { margin: 8px 0 2px; color: var(--muted); }
.related h2 { font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.related ul { list-style: none; margin: 0; padding: 0; }
.related li { padding: 10px 0; border-top: 1px solid var(--border); }
.related li:first-child { border-top: 0; padding-top: 0; }
.related a { font-weight: 600; display: block; }
.related span { color: var(--muted); font-size: 13px; }
#view-about .prose, #view-privacy .prose { padding-bottom: 40px; }

/* ---------- Footer ---------- */
.footer { margin-top: auto; border-top: 1px solid var(--border); padding: 24px 0 18px; color: var(--muted); font-size: 13px; max-width: 1080px; }
.footer-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; margin-bottom: 20px; }
.footer-links h3 { font-size: 12px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.footer-links ul { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 5px; }
.footer-links a, .footer-bottom a { color: var(--muted); }
.footer-links a:hover, .footer-bottom a:hover { color: var(--text); }
.footer-badges { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.footer-badges img { display: block; max-width: 100%; height: auto; }
.footer-bottom { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .sidebar { position: fixed; left: 0; top: var(--topbar-h); z-index: 20; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
  .main { padding: 20px 16px 0; }
  .summary, .split, .intro, .seo-content { grid-template-columns: 1fr; }
  .code-col { position: static; }
}
@media (max-width: 560px) {
  .url-form input, .url-form .kw-input { flex-basis: 100%; }
  .url-form select { flex: 1; }
  .url-form .btn-primary { flex: 1 0 100%; }
  .kv { grid-template-columns: 1fr; }
  .kv .k { padding-bottom: 0; }
  .kv > div.v { border-top: 0; padding-top: 2px; }
  .score-card { flex-direction: column; text-align: center; }
  .score-meta { justify-content: center; }
  .brief-extra, .suggest-list { grid-template-columns: 1fr; }
  .check-list { grid-template-columns: 1fr; gap: 2px; }
  .check-list dd { margin-bottom: 8px; }
  .footer-links { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 20px; }
}
@media print {
  .topbar, .sidebar, .report-bar, .tabs, .footer, .intro, .url-form { display: none !important; }
  body { background: #fff; }
}
