/* Zaggify SEO & Website Health Scanner — main styles */
:root {
  --brand: #4287C9;
  --brand-ink: #2B6AA8;
  --brand-soft: #EAF2FB;
  --brand-line: #C9DDF2;
  --ink: #13233A;
  --ink-2: #33465F;
  --muted: #5D6E84;
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #DCE3EC;
  --line-2: #E9EEF4;
  --critical: #9B1C1C;
  --critical-bg: #FBE9E9;
  --error: #D23434;
  --error-bg: #FDEDED;
  --warning: #B46F00;
  --warning-bg: #FFF4DE;
  --opportunity: #5B4BC4;
  --opportunity-bg: #EFEDFC;
  --passed: #1B8A57;
  --passed-bg: #E6F6EE;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(19, 35, 58, .06), 0 4px 14px rgba(19, 35, 58, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar: 248px;
  color-scheme: light;
}
[data-theme="dark"] {
  --brand: #5B9BD8;
  --brand-ink: #8BBCEB;
  --brand-soft: #172A40;
  --brand-line: #24425F;
  --ink: #E6EDF5;
  --ink-2: #C3CFDD;
  --muted: #95A6BB;
  --bg: #0D1520;
  --surface: #142030;
  --surface-2: #18263A;
  --line: #24344A;
  --line-2: #1D2C40;
  --critical: #FF8A8A;
  --critical-bg: #3A1A1D;
  --error: #FF7070;
  --error-bg: #351C1F;
  --warning: #F2B54A;
  --warning-bg: #33280F;
  --opportunity: #A99CFF;
  --opportunity-bg: #241F44;
  --passed: #4CCB8D;
  --passed-bg: #12301F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 .8em; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: .05em .35em; word-break: break-word; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.topbar { display: none; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 18px; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 4px 6px 12px; border-bottom: 1px solid var(--line-2); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.15rem; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: .74rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 550; }
.nav-item svg { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-item.active svg { color: var(--brand); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; font-size: .85rem; }
.version { color: var(--muted); font-size: .75rem; }
.main { padding: 28px clamp(16px, 3vw, 40px) 80px; min-width: 0; outline: none; }
.bare .main { min-height: 100vh; display: grid; place-items: center; }
.theme-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface-2); }
.theme-switch button { border: 0; background: transparent; color: var(--muted); width: 30px; height: 26px; border-radius: 999px; cursor: pointer; display: grid; place-items: center; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow); }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-ink); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: .9rem; }
.banner.warn { background: var(--warning-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); }

/* ---------- Buttons & forms ---------- */
.btn { --b: var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--b); background: var(--surface); color: var(--ink); font: 600 .9rem/1.2 var(--font); cursor: pointer; text-decoration: none; min-height: 38px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { border-color: var(--brand-line); color: var(--ink); background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
[data-theme="dark"] .btn.primary { color: #0B1726; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; min-height: 30px; font-size: .82rem; }
.btn.lg { padding: 12px 22px; min-height: 50px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn.danger-ghost { color: var(--error); border-color: color-mix(in srgb, var(--error) 40%, transparent); background: transparent; }
.btn.danger-ghost:hover { background: var(--error-bg); color: var(--error); }
.btn.ai { border-color: var(--brand-line); color: var(--brand-ink); background: var(--brand-soft); }
.btn.ai img { width: 14px; height: auto; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; color: var(--ink); padding: 8px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; min-height: 40px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent); outline-offset: 0; }
.field { display: flex; flex-direction: column; gap: 5px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-weight: 600; font-size: .86rem; color: var(--ink-2); padding: 0; }
.field small { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; padding: 3px 0; }
.check input { width: auto; min-height: 0; accent-color: var(--brand); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: .92rem; margin-bottom: 14px; }
.alert.error { background: var(--error-bg); color: var(--error); }
.alert.success { background: var(--passed-bg); color: var(--passed); }
.alert.info { background: var(--brand-soft); color: var(--ink); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Auth ---------- */
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.5rem; margin-top: 16px; }

/* ---------- Dashboard ---------- */
.hero { max-width: 900px; margin: 12px 0 28px; }
.hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -.025em; }
.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 64ch; }
.scan-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); margin-top: 22px; }
.url-row { display: flex; gap: 10px; }
.url-row input { font-size: 1.1rem; min-height: 50px; padding: 0 16px; }
.form-error { color: var(--error); margin: 10px 2px 0; font-weight: 550; }
.scan-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 14px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface-2); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: .88rem; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.inline-field select { width: auto; min-height: 38px; }
.advanced { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); width: max-content; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 18px; margin-top: 14px; }
.adv-grid .checks { grid-column: span 2; }
.robots-note { display: block; margin-top: 4px; }
.fine { color: var(--muted); font-size: .8rem; margin: 12px 2px 0; }
.dash-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; max-width: 900px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.stat-num { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .84rem; }
.stat.has-critical .stat-num { color: var(--critical); }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li + li { border-top: 1px solid var(--line-2); }
.recent a { display: flex; align-items: center; gap: 14px; padding: 11px 4px; text-decoration: none; color: var(--ink); }
.recent a:hover { background: var(--surface-2); }
.recent-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.recent-main small { color: var(--muted); }
.recent-counts { display: flex; gap: 6px; }
.empty { text-align: center; padding: 48px 20px; max-width: 520px; margin: 0 auto; }
.empty-logo { opacity: .9; margin-bottom: 8px; }
.empty p { color: var(--muted); }
.empty-inline { padding: 22px; text-align: center; color: var(--muted); background: var(--surface-2); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty-inline.good { color: var(--passed); background: var(--passed-bg); border-color: transparent; }

/* ---------- Badges & pills ---------- */
.sev, .badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: .76rem; font-weight: 650; white-space: nowrap; line-height: 1.5; }
.sev.critical { background: var(--critical-bg); color: var(--critical); }
.sev.error { background: var(--error-bg); color: var(--error); }
.sev.warning { background: var(--warning-bg); color: var(--warning); }
.sev.opportunity { background: var(--opportunity-bg); color: var(--opportunity); }
.sev.passed { background: var(--passed-bg); color: var(--passed); }
.badge { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge.blue { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.badge.ok { background: var(--passed-bg); color: var(--passed); border-color: transparent; }
.badge.bad { background: var(--error-bg); color: var(--error); border-color: transparent; }
.badge.warn { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.score-pill { display: inline-grid; place-items: center; min-width: 42px; height: 42px; border-radius: 10px; font-weight: 750; font-size: 1.05rem; color: #fff; }
.score-pill.sm { min-width: 34px; height: 26px; border-radius: 6px; font-size: .85rem; }
.s-excellent { background: #1B8A57; } .s-good { background: #3E9E4F; } .s-needs-improvement { background: #C98A00; } .s-poor { background: #D9622B; } .s-critical { background: #B42323; } .s-none { background: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Scanner ---------- */
.scan-live { max-width: 860px; margin: 10px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 32px); box-shadow: var(--shadow); }
.scan-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.scan-head h1 { margin: 0; font-size: clamp(1.3rem, 3vw, 1.8rem); word-break: break-all; }
.stage-line { margin: 4px 0 0; color: var(--ink-2); font-weight: 600; }
.stage-line .sep { margin: 0 8px; color: var(--muted); }
.pulse-logo { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }
.done .pulse-logo { animation: none; }
.progress { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .5s ease; }
.current-url { margin: 12px 0 18px; font-family: var(--mono); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 20px; }
.live-stats div { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px; }
.live-stats dt { font-size: .78rem; color: var(--muted); }
.live-stats dd { margin: 0; font-size: 1.4rem; font-weight: 700; }
.stages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; counter-reset: st; }
.stages li { counter-increment: st; font-size: .86rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.stages li::before { content: counter(st); width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: .7rem; flex: none; }
.stages li.done { color: var(--ink-2); }
.stages li.done::before { content: "✓"; background: var(--passed-bg); border-color: transparent; color: var(--passed); }
.stages li.active { color: var(--brand-ink); font-weight: 650; }
.stages li.active::before { border-color: var(--brand); color: var(--brand-ink); }
.scan-actions { display: flex; gap: 10px; }
.scan-end { margin-top: 18px; }

/* ---------- Report header & tabs ---------- */
.report-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.report-head h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); word-break: break-all; }
.report-meta { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; flex: 1 1 520px; }
.report-actions input[type=search] { flex: 1 1 200px; max-width: 300px !important; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; min-width: 200px; z-index: 30; display: flex; flex-direction: column; }
.dropdown-menu a, .dropdown-menu button { text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; border: 0; background: none; font: inherit; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 22px; scrollbar-width: thin; position: sticky; top: 0; background: var(--bg); z-index: 20; }
.tab { border: 0; background: none; padding: 11px 14px; font: 600 .9rem var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tab .count { font-size: .72rem; background: var(--surface-2); border: 1px solid var(--line); padding: 0 6px; border-radius: 999px; margin-left: 4px; color: var(--muted); }
.panel { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.notice { background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--ink); padding: 10px 14px; border-radius: var(--radius); font-size: .88rem; margin-bottom: 16px; }
.notice.warn { background: var(--warning-bg); border-color: transparent; }

/* ---------- Overview ---------- */
.overview-top { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; margin-bottom: 20px; }
.score-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.score-ring { position: relative; width: 210px; height: 210px; }
.score-ring svg { width: 100%; height: 100%; }
.score-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num { font-size: 3.4rem; font-weight: 750; letter-spacing: -.04em; line-height: 1; }
.score-label { font-weight: 650; margin-top: 4px; }
.score-sub { color: var(--muted); font-size: .8rem; }
.ring-legend { list-style: none; padding: 0; margin: 16px 0 0; width: 100%; display: grid; gap: 7px; }
.ring-legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: .86rem; text-align: left; }
.ring-legend b { font-weight: 700; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.metric { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: inherit; display: block; }
a.metric:hover { border-color: var(--brand-line); }
.metric b { display: block; font-size: 1.35rem; letter-spacing: -.02em; }
.metric span { font-size: .78rem; color: var(--muted); }
.metric.sev-critical b { color: var(--critical); } .metric.sev-error b { color: var(--error); } .metric.sev-warning b { color: var(--warning); } .metric.sev-opportunity b { color: var(--opportunity); } .metric.sev-passed b { color: var(--passed); }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.chart { min-height: 120px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--ink-2); }
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.bar-list { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 44px; gap: 10px; align-items: center; font-size: .85rem; }
.bar-track { height: 9px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.bar-row b { text-align: right; }

/* ---------- Issues ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters input[type="search"] { max-width: 280px; }
.filters select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font: 600 .82rem var(--font); color: var(--ink-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.issue { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.issue > summary { list-style: none; cursor: pointer; padding: 13px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.issue > summary::-webkit-details-marker { display: none; }
.issue > summary:hover { background: var(--surface-2); }
.issue-title { font-weight: 650; }
.issue-msg { color: var(--muted); font-size: .86rem; display: block; margin-top: 2px; }
.issue-count { font-weight: 700; font-size: 1.05rem; text-align: right; }
.issue-count small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.issue-body { padding: 4px 16px 16px; border-top: 1px solid var(--line-2); }
.guide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin: 14px 0; }
.guide h4 { font-size: .8rem; color: var(--muted); font-weight: 650; margin: 0 0 4px; }
.guide p, .guide .pre { margin: 0; font-size: .9rem; white-space: pre-line; }
.guide .wide { grid-column: 1 / -1; }
.guide .wp { background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; }
.issue-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.affected { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow: auto; border: 1px solid var(--line-2); border-radius: 8px; }
.affected li { padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: .86rem; display: grid; gap: 2px; }
.affected li:last-child { border-bottom: 0; }
.affected a { word-break: break-all; }
.affected .detail { color: var(--muted); word-break: break-word; }
.priority-list { list-style: none; counter-reset: pr; padding: 0; margin: 0; }
.priority-list li { counter-increment: pr; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-2); align-items: start; }
.priority-list li::before { content: counter(pr); width: 30px; height: 30px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 750; display: grid; place-items: center; }
.priority-list li:last-child { border-bottom: 0; }
.pl-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.passed-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 18px; }
.passed-list li { display: flex; gap: 8px; align-items: baseline; font-size: .9rem; }
.passed-list li::before { content: "✓"; color: var(--passed); font-weight: 800; }

/* ---------- Tables ---------- */
.table-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.table-tools .grow { flex: 1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data th { background: var(--surface-2); font-weight: 650; color: var(--ink-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--brand-ink); }
table.data th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
table.data th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.url { max-width: 380px; word-break: break-all; }
table.data td.num { text-align: right; white-space: nowrap; }
table.data td.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.status { font-weight: 700; }
.status.s2 { color: var(--passed); } .status.s3 { color: var(--warning); } .status.s4, .status.s5, .status.s0 { color: var(--error); }
.colvis { position: relative; }
.colvis-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 12px; z-index: 25; min-width: 200px; max-height: 320px; overflow: auto; }

/* ---------- Key/value, code, misc ---------- */
.kv { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: 0; font-size: .9rem; margin: 0; }
.kv dt, .kv dd { padding: 8px 0; border-bottom: 1px solid var(--line-2); margin: 0; }
.kv dt { color: var(--muted); padding-right: 12px; }
.kv dd { word-break: break-word; }
pre.code { background: #0F1B2A; color: #DCE6F2; border-radius: var(--radius); padding: 14px 16px; overflow: auto; max-height: 460px; font-size: .82rem; line-height: 1.55; margin: 0; white-space: pre; }
.code-wrap { position: relative; }
.code-wrap .copy-btn { position: absolute; top: 8px; right: 8px; }
.tree { list-style: none; padding-left: 18px; margin: 0; border-left: 1px dashed var(--line); }
.tree.root { padding-left: 0; border: 0; }
.tree li { padding: 3px 0; font-size: .88rem; }
.tree li > span::before { content: "↳ "; color: var(--muted); }
.tree.root > li > span::before { content: ""; }
.headings-tree { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.headings-tree li { padding: 4px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 8px; align-items: baseline; }
.headings-tree .hl { font-family: var(--mono); font-size: .72rem; background: var(--brand-soft); color: var(--brand-ink); padding: 1px 6px; border-radius: 4px; flex: none; }
.serp { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); max-width: 640px; font-family: Arial, sans-serif; }
.serp-url { font-size: .82rem; color: var(--ink-2); }
.serp-title { color: #1A0DAB; font-size: 1.2rem; margin: 3px 0; line-height: 1.3; }
[data-theme="dark"] .serp-title { color: #8AB4F8; }
.serp-desc { color: var(--ink-2); font-size: .9rem; }
.social-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; max-width: 520px; background: var(--surface-2); }
.social-img { aspect-ratio: 1.91 / 1; background: var(--line-2) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.social-body { padding: 10px 14px; }
.social-body small { text-transform: uppercase; color: var(--muted); font-size: .72rem; letter-spacing: .04em; }
.social-body strong { display: block; margin: 2px 0; }
.page-score { display: flex; gap: 16px; align-items: center; }
.factor-list { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.factor-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.factor-list b { color: var(--error); }
.cmp-arrow.up { color: var(--passed); } .cmp-arrow.down { color: var(--error); }
.big-delta { font-size: 2.4rem; font-weight: 750; letter-spacing: -.03em; }

/* ---------- Toasts & modal ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: 8px; font-size: .88rem; box-shadow: var(--shadow); animation: fade .2s ease; }
.toast.error { background: var(--error); color: #fff; }
.modal { position: fixed; inset: 0; background: rgba(9, 17, 28, .5); display: grid; place-items: center; z-index: 150; padding: 16px; }
.modal-box { background: var(--surface); border-radius: var(--radius-lg); max-width: 560px; width: 100%; padding: 22px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---------- AI Assistant ---------- */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: var(--surface); border: 0; border-radius: 999px; padding: 11px 18px 11px 14px; font: 650 .92rem var(--font); cursor: pointer; box-shadow: 0 8px 24px rgba(19, 35, 58, .25); }
.ai-fab img { width: 20px; height: auto; }
.ai-fab:hover { background: var(--brand-ink); }
.ai-panel { visibility: hidden; position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0, 0, 0, .12); z-index: 120; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease, visibility 0s linear .22s; }
.ai-panel.open { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
.ai-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.ai-head img { width: 28px; height: auto; }
.ai-head h2 { margin: 0; font-size: 1.05rem; }
.ai-head p { margin: 0; font-size: .76rem; color: var(--muted); }
.ai-head .icon-btn { margin-left: auto; }
.ai-controls { padding: 10px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-bottom: 1px solid var(--line-2); }
.ai-controls select { min-height: 34px; padding: 5px 8px; font-size: .84rem; }
.ai-controls label { font-size: .74rem; color: var(--muted); display: grid; gap: 3px; }
.ai-context-chip { grid-column: 1 / -1; font-size: .78rem; color: var(--brand-ink); }
.ai-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ai-msg { max-width: 100%; }
.ai-msg.user { align-self: flex-end; background: var(--brand-soft); padding: 9px 13px; border-radius: 12px 12px 4px 12px; max-width: 88%; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.ai-msg.assistant { display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.ai-msg.assistant > img { width: 22px; height: auto; margin-top: 4px; }
.ai-bubble { min-width: 0; font-size: .9rem; }
.ai-bubble.collapsed .md { max-height: 340px; overflow: hidden; mask-image: linear-gradient(#000 75%, transparent); -webkit-mask-image: linear-gradient(#000 75%, transparent); }
.ai-task-label { font-size: .74rem; color: var(--muted); margin-bottom: 4px; }
.ai-msg-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.ai-msg-actions button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 6px; padding: 3px 8px; font: 600 .74rem var(--font); cursor: pointer; }
.ai-msg-actions button:hover { border-color: var(--brand-line); color: var(--brand-ink); }
.ai-msg-actions button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.ai-thinking { color: var(--muted); font-size: .88rem; display: flex; gap: 8px; align-items: center; }
.ai-thinking img { width: 18px; height: auto; animation: pulse 1.3s ease-in-out infinite; }
.ai-error { background: var(--error-bg); color: var(--error); border-radius: 8px; padding: 9px 12px; font-size: .86rem; }
.ai-quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid var(--line-2); }
.ai-quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font: 600 .76rem var(--font); color: var(--ink-2); cursor: pointer; }
.ai-quick button:hover { border-color: var(--brand-line); color: var(--brand-ink); }
.ai-input { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.ai-input textarea { min-height: 44px; max-height: 140px; resize: none; }
.ai-foot { padding: 0 16px 10px; font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.ai-empty { color: var(--muted); font-size: .88rem; }
.ai-empty strong { color: var(--ink); }
.ai-off { padding: 18px; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 6px; font-size: 1rem; }
.md h1 { font-size: 1.1rem; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md pre { margin: 6px 0 12px; }
.md blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--brand-line); color: var(--ink-2); }
.md table { border-collapse: collapse; margin: 6px 0 12px; font-size: .84rem; display: block; overflow-x: auto; }
.md td, .md th { border: 1px solid var(--line); padding: 4px 8px; }
.ai-inline-result { margin-top: 12px; border: 1px solid var(--brand-line); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.ai-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ai-tool { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.ai-tool p { color: var(--muted); font-size: .84rem; margin: 0; flex: 1; }
.print-only { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
pre.code code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; word-break: normal; }
