/* AnswerRank dashboard. Plain CSS, light + dark via prefers-color-scheme. */
:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f3f3f1;
  --line: #e6e5e1;
  --line-strong: #d6d4ce;
  --text: #16171a;
  --text-2: #52514e;
  --muted: #7a7973;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #2a78d61a;
  --bar: #2a78d6;
  --bar-dim: #c9d6e6;
  --good: #137a3f;   --good-bg: #e3f4e9;   --good-line: #b5e0c4;
  --info: #1f5fb0;   --info-bg: #e5effb;   --info-line: #bcd4f2;
  --warn: #8a5a00;   --warn-bg: #fdf1d8;   --warn-line: #f0d698;
  --bad: #b42323;    --bad-bg: #fbe7e6;    --bad-line: #f1bdbb;
  --none: #6b6a65;   --none-bg: #f0efec;   --none-line: #e0dfda;
  --shadow: 0 1px 2px #0000000d, 0 4px 16px #0000000a;
  --radius: 10px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f11;
    --surface: #16171a;
    --surface-2: #1c1d21;
    --line: #26282d;
    --line-strong: #34363c;
    --text: #ecebe8;
    --text-2: #b9b8b2;
    --muted: #8b8a85;
    --accent: #3987e5;
    --accent-soft: #3987e526;
    --bar: #3987e5;
    --bar-dim: #2c3a4c;
    --good: #5fd08d;  --good-bg: #13291c;  --good-line: #1f4a31;
    --info: #79aef0;  --info-bg: #142338;  --info-line: #1f3b5e;
    --warn: #e9b44c;  --warn-bg: #2b2210;  --warn-line: #4d3c15;
    --bad: #f08080;   --bad-bg: #331718;   --bad-line: #5a2526;
    --none: #9a9993;  --none-bg: #202125;  --none-line: #2e3035;
    --shadow: 0 1px 2px #00000066, 0 8px 24px #00000040;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f11; --surface: #16171a; --surface-2: #1c1d21; --line: #26282d; --line-strong: #34363c;
  --text: #ecebe8; --text-2: #b9b8b2; --muted: #8b8a85; --accent: #3987e5; --accent-soft: #3987e526;
  --bar: #3987e5; --bar-dim: #2c3a4c;
  --good: #5fd08d; --good-bg: #13291c; --good-line: #1f4a31; --info: #79aef0; --info-bg: #142338; --info-line: #1f3b5e;
  --warn: #e9b44c; --warn-bg: #2b2210; --warn-line: #4d3c15; --bad: #f08080; --bad-bg: #331718; --bad-line: #5a2526;
  --none: #9a9993; --none-bg: #202125; --none-line: #2e3035; --shadow: 0 1px 2px #00000066, 0 8px 24px #00000040;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; line-height: 1.25; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
.num, td.n, .kpi-value { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- boot / spinner ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
.btn .spinner { width: 13px; height: 13px; border-width: 2px; border-color: currentColor; border-top-color: transparent; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12.5px; border-radius: 6px; }
.btn.icon { width: 32px; padding: 0; }
.btn.sm.icon { width: 26px; }
.btn svg { width: 15px; height: 15px; flex: none; }

label.field { display: block; }
.field > span { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.field > small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--text);
  font: 14px/1.4 var(--font); transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.form-error { color: var(--bad); font-size: 13px; min-height: 0; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brandmark { margin-bottom: 28px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card form { margin-top: 22px; display: grid; gap: 14px; }
.auth-card .btn.primary { height: 36px; width: 100%; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--muted); }

.brandmark { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; color: var(--text); }
.brandmark svg { width: 24px; height: 24px; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; }
.sidebar .brandmark { padding: 4px 8px 12px; }
.ws { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 8px; }
.ws-name { font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 8px 4px; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; color: var(--text-2); font-size: 13.5px; text-decoration: none; min-height: 32px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); font-weight: 550; }
.nav a svg { width: 15px; height: 15px; flex: none; opacity: .8; }
.nav a .favi { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 10.5px; font-weight: 650; background: var(--accent-soft); color: var(--accent); flex: none; }
.nav a .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 10px 8px 0; display: grid; gap: 6px; font-size: 12.5px; }
.side-foot .email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar { display: none; }
.main { min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 22px 28px 64px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .title { min-width: 0; flex: 1; }
.page-head .title h1 { overflow-wrap: anywhere; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 12px 10px; color: var(--muted); font-size: 13.5px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); }

.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 550; border: 1px solid var(--line-strong); color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.badge.accent { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
.badge.good { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 46px; flex-wrap: wrap; }
.card-h h2 { font-size: 13.5px; }
.card-h .hint { color: var(--muted); font-size: 12.5px; }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }
.cards { display: grid; gap: 16px; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.cols-even { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.kpi-foot { color: var(--muted); font-size: 12px; margin-top: 6px; }
.delta-up { color: var(--good); }
.delta-down { color: var(--bad); }

/* ---------- tables ---------- */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.me td { font-weight: 600; }
table.t tr.me td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.matrix td.q { min-width: 220px; max-width: 420px; }
.matrix th.e, .matrix td.e { text-align: center; white-space: nowrap; }

/* bar inside a table cell / list */
.hbar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); min-width: 60px; }
.hbar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--bar-dim); }
.hbar.me > i { background: var(--bar); }
.barlist { display: grid; gap: 10px; }
.barrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.barrow .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.barrow .val { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.barrow .hbar { grid-column: 1 / -1; }

/* verdict pills */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 550; border: 1px solid; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.v-top_pick { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.pill.v-listed { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.pill.v-mentioned { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.pill.v-negative { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.pill.v-absent { color: var(--none); background: var(--none-bg); border-color: var(--none-line); }
.pill.v-none { color: var(--muted); background: transparent; border-color: var(--line); border-style: dashed; }
.pill.v-none::before { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- charts ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--bar); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent-soft); }
.chart .dot { fill: var(--bar); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .dot, .chart .dot.on { r: 5; }
#tip { position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 8px; border-radius: 6px; max-width: 260px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 14.5px; margin-bottom: 6px; }
.empty p { max-width: 440px; margin: 0 auto; font-size: 13px; }
.empty .row { justify-content: center; margin-top: 14px; }
.empty .ico { width: 36px; height: 36px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 12px; color: var(--text-2); }
.empty .ico svg { width: 18px; height: 18px; }

/* ---------- banner (run progress etc) ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; flex-wrap: wrap; }
.banner.info { border-color: var(--info-line); background: var(--info-bg); }
.banner.err { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.banner.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.banner .grow { flex: 1; min-width: 180px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; margin-top: 6px; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }

/* ---------- actions list ---------- */
.actions-list { list-style: none; margin: 0; padding: 0; }
.actions-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.actions-list li:last-child { border-bottom: 0; }
.actions-list .idx { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; display: grid; place-items: center; color: var(--text-2); font-variant-numeric: tabular-nums; }
.actions-list .t { font-weight: 550; overflow-wrap: anywhere; }
.actions-list .d { color: var(--text-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.actions-list .k { margin-top: 6px; }

/* ---------- answers ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select { width: auto; min-width: 130px; }
.filters input[type=search] { flex: 1; min-width: 180px; }
.answer { border-bottom: 1px solid var(--line); }
.answer:last-child { border-bottom: 0; }
.answer > summary { list-style: none; cursor: pointer; padding: 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; }
.answer > summary::-webkit-details-marker { display: none; }
.answer > summary:hover { background: var(--surface-2); }
.answer .q { font-weight: 550; overflow-wrap: anywhere; }
.answer .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; grid-column: 1 / -1; }
.answer .right { display: flex; gap: 8px; align-items: center; grid-row: 1; grid-column: 2; }
.answer .body { padding: 4px 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; }
.answer .body.noshot { grid-template-columns: minmax(0, 1fr); }
.answer pre.text { white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.6 var(--font); margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; max-height: 480px; overflow: auto; }
.answer .srcs { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 12.5px; }
.answer .srcs a { overflow-wrap: anywhere; }
.shot img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--surface-2); }
.shot a { display: block; }
.thumb { width: 44px; height: 30px; border-radius: 4px; border: 1px solid var(--line); object-fit: cover; object-position: top; background: var(--surface-2); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }

/* ---------- audit ---------- */
.score { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.score-ring { width: 88px; height: 88px; flex: none; }
.score-ring .bg { stroke: var(--surface-2); }
.score-ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.score-ring text { fill: var(--text); font: 600 24px var(--font); font-variant-numeric: tabular-nums; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.checks li:last-child { border-bottom: 0; }
.checks .st { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.checks .st svg { width: 11px; height: 11px; }
.checks .st.pass { background: var(--good-bg); color: var(--good); }
.checks .st.part { background: var(--warn-bg); color: var(--warn); }
.checks .st.fail { background: var(--bad-bg); color: var(--bad); }
.checks .c { font-weight: 550; overflow-wrap: anywhere; }
.checks .fix { grid-column: 2 / -1; color: var(--text-2); font-size: 13px; }
.checks .w { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- fixes ---------- */
.fixes { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.filelist { list-style: none; margin: 0; padding: 6px; }
.filelist button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.filelist button:hover { background: var(--surface-2); }
.filelist button.active { background: var(--accent-soft); }
.filelist .fn { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.filelist .fd { font-size: 12px; color: var(--muted); margin-top: 2px; }
pre.code { margin: 0; padding: 14px 16px; overflow: auto; max-height: 560px; font: 12.5px/1.55 var(--mono); white-space: pre; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- forms / settings ---------- */
.form-section { padding: 18px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
.form-section:last-child { border-bottom: 0; }
.form-section > header h2, .form-section > summary > header h2 { font-size: 14px; }
.form-section > header p, .form-section > summary > header p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
details.form-section > summary { cursor: pointer; list-style: none; }
details.form-section > summary::-webkit-details-marker { display: none; }
details.form-section > summary h2::after { content: " +"; color: var(--muted); font-weight: 400; }
details.form-section[open] > summary h2::after { content: " −"; }
details.form-section[open] > summary { margin-bottom: 0; }
.form-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.form-foot .form-error { margin-right: auto; }
.listedit { display: grid; gap: 6px; }
.listedit .li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.listedit .li .i { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.listedit .li.over input { color: var(--muted); }
.kv .li { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; }
.faq .li { grid-template-columns: minmax(0, 1fr) auto; align-items: start; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.faq .li .qa { display: grid; gap: 6px; }
.faq textarea { min-height: 56px; }

.settings { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { display: grid; gap: 2px; position: sticky; top: 16px; }
.subnav a { padding: 7px 10px; border-radius: 6px; color: var(--text-2); font-size: 13.5px; text-decoration: none; }
.subnav a:hover { background: var(--surface-2); }
.subnav a.active { background: var(--surface-2); color: var(--text); font-weight: 550; }

.keybox { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); }
.keybox code { flex: 1; overflow-wrap: anywhere; font-size: 13px; }
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
ol.steps b { color: var(--text); font-weight: 600; }
ol.steps code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }

.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.plan { padding: 16px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan.current { border-color: var(--line-strong); }
.plan.pick { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan .price { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan .price small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.plan ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 13px; color: var(--text-2); }
.plan ul li::before { content: "✓"; color: var(--good); margin-right: 7px; font-size: 12px; }
.plan ul li.no::before { content: "–"; color: var(--muted); }
.plan .btn { margin-top: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; padding: 2px; background: var(--surface-2); }
.seg button { all: unset; padding: 3px 10px; border-radius: 5px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 550; }
.meter { display: grid; gap: 6px; }
.meter .row { justify-content: space-between; font-size: 13px; }

.share-url { display: flex; gap: 8px; flex-wrap: wrap; }
.share-url input { flex: 1; min-width: 200px; font-family: var(--mono); font-size: 12.5px; }

/* ---------- modal & toasts ---------- */
.modal-wrap { position: fixed; inset: 0; background: #0008; display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s ease-out; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: calc(100vh - 32px); overflow: auto; }
.modal .mh { padding: 16px 18px 0; }
.modal .mh h2 { font-size: 16px; }
.modal .mb { padding: 10px 18px 16px; color: var(--text-2); display: grid; gap: 12px; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 70; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); animation: fade .15s ease-out; max-width: 380px; }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- responsive ---------- */

/* ---------- AEO workflow: overview, profile, questions, gaps, content, publishing ---------- */
.kpi-sub { margin: 8px 2px 0; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; background: var(--bar); display: inline-block; }
.legend .sw.c { background: var(--good); }
.chart .line.cite { stroke: var(--good); stroke-dasharray: 5 4; }
.chart .dot.cite { fill: var(--good); }
.opp-based { padding: 10px 16px 0; }
.opp-based .off { text-decoration: line-through; opacity: .7; }
ul.evidence { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; display: grid; gap: 2px; }
ul.evidence li, .actions-list ul.evidence li { display: list-item; padding: 0; border: 0; overflow-wrap: anywhere; }

.facts { list-style: none; margin: 0; padding: 0; }
.facts li { display: grid; grid-template-columns: 22px 150px auto minmax(0, 1fr); gap: 4px 10px; align-items: start; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.facts .nm { font-weight: 550; }
.facts .fv { overflow-wrap: anywhere; font-size: 13px; }
.facts .ev { margin-top: 3px; }
.facts .ck input { margin: 2px 0 0; }
.tech { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; border-top: 1px solid var(--line); }
.tech .wide { grid-column: 1 / -1; }
.tech .row { gap: 4px; margin-top: 4px; }

.listedit .li.qli { grid-template-columns: 22px minmax(0, 1fr) 140px auto; }
.catstrip { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.catstrip > div { flex: 1 1 150px; max-width: 240px; padding: 10px 14px; display: grid; gap: 1px; border-right: 1px solid var(--line); }
.catstrip b { font-size: 18px; font-weight: 600; }
.sugg { display: grid; gap: 12px; max-height: 55vh; overflow-y: auto; }
.sugg fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 10px; margin: 0; display: grid; gap: 6px; }
.sugg legend { font-weight: 600; padding: 0 4px; }
.sugg label { align-items: flex-start; gap: 8px; font-size: 13.5px; }
.sugg input { margin-top: 3px; }

table.gaps td.lead { color: var(--good); font-weight: 650; }
table.gaps .tag.on { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
table.gaps .tag.off { color: var(--muted); text-decoration: line-through; }
table.gaps td, table.gaps th { white-space: nowrap; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.editor textarea { min-height: 460px; font-size: 12.5px; line-height: 1.5; resize: vertical; }
.editor iframe { width: 100%; height: 460px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.draft-actions { justify-content: flex-start; }
.draft-actions .sep { flex: 1; }
.draft-actions select { width: auto; flex: none; }
ul.missing { margin: 6px 0 0; padding-left: 18px; }
pre.diff { margin: 0; padding: 10px 0; font-size: 12px; line-height: 1.55; overflow-x: auto; max-height: 420px; overflow-y: auto; font-family: var(--mono, ui-monospace, monospace); }
pre.diff span { display: block; padding: 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.diff .add { background: var(--good-bg); color: var(--good); }
pre.diff .del { background: var(--bad-bg); color: var(--bad); }
ul.versions { list-style: none; margin: 0; padding: 0; }
ul.versions li { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
ul.versions li:last-child { border-bottom: 0; }
ul.versions .grow { flex: 1; min-width: 0; }

.verify { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.verify > div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.verify h3 { font-size: 13.5px; }
.kvline { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.kvline:not(:has(> span)) { grid-template-columns: minmax(0, 1fr) auto; }
.kvline code { overflow-wrap: anywhere; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px 6px; border-radius: 5px; }
fieldset[disabled] { opacity: .6; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
@media (max-width: 860px) {
  .editor, .verify { grid-template-columns: minmax(0, 1fr); }
  .editor textarea, .editor iframe { min-height: 300px; height: 300px; }
  .facts li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .facts .fv { grid-column: 2 / -1; }
}
@media (max-width: 560px) {
  .listedit .li.qli { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .listedit .li.qli select { grid-column: 2; grid-row: 2; }
}

@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .cols-even { grid-template-columns: minmax(0, 1fr); }
  .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: #0006; z-index: 30; display: none; }
  .shell.nav-open .scrim { display: block; }
  .topbar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
  .topbar .brandmark { font-size: 14px; }
  .page { padding: 16px 16px 56px; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .subnav { position: static; display: flex; overflow-x: auto; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .subnav a { white-space: nowrap; }
  .fixes { grid-template-columns: minmax(0, 1fr); }
  .filelist { display: flex; overflow-x: auto; gap: 4px; }
  .filelist li { flex: none; }
  .filelist .fd { display: none; }
  .answer .body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 24px; }
  .kpi { padding: 12px; }
  .kpis { gap: 8px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .answer > summary { grid-template-columns: minmax(0, 1fr); }
  .answer .right { grid-row: auto; grid-column: 1; }
  .kv .li { grid-template-columns: minmax(0, 1fr) auto; }
  .kv .li input:nth-child(2) { grid-column: 1; grid-row: 2; }
  .filters select { flex: 1; min-width: 0; }
  #toasts { left: 16px; right: 16px; }
}
@media (min-width: 861px) { .scrim { display: none; } }

/* ---------- mode switch ---------- */
.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); }
.seg a { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none !important; }
.seg a:hover { color: var(--text); }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px #00000014; }
.seg svg { width: 14px; height: 14px; }

/* ---------- agent ---------- */
.agent { max-width: 780px; margin: 4px auto 0; display: grid; grid-template-rows: 1fr auto; gap: 18px; min-height: calc(100vh - 150px); }
.agent-thread { display: flex; flex-direction: column; gap: 20px; }
.msg { display: flex; align-items: flex-start; gap: 12px; scroll-margin-bottom: 170px; animation: msg-in .32s cubic-bezier(.16, 1, .3, 1) both; }
.msg .who { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.msg .who svg { width: 16px; height: 16px; }
.msg .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; line-height: 1.6; }
.msg .body p { max-width: 68ch; }
.msg .lead:empty { display: none; }
.msg.user { justify-content: flex-end; }
.msg.user .body { flex: 0 1 auto; }
.msg.user .body { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; padding: 8px 14px; max-width: 80%; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }

.steps-live { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.steps-live:empty { display: none; }
.step { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); animation: msg-in .28s cubic-bezier(.16, 1, .3, 1) both; }
.step:last-child { border-bottom: 0; }
.st-ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; color: var(--muted); }
.st-ico svg { width: 11px; height: 11px; }
.st-ico .spinner { width: 14px; height: 14px; }
.step[data-st="done"] .st-ico { background: var(--good-bg); color: var(--good); }
.step[data-st="fail"] .st-ico { background: var(--bad-bg); color: var(--bad); }
.step[data-st="skip"] .st-ico { background: var(--none-bg); color: var(--none); }
.step[data-st="wait"] .st-ico { background: var(--accent-soft); color: var(--accent); }
.step[data-st="wait"] .st-ico svg, .gate-h svg { width: 13px; height: 13px; }
.step-main { min-width: 0; display: grid; gap: 4px; }
.step-t { font-weight: 550; }
.step[data-st="skip"] .step-t { color: var(--text-2); }
.step-n { color: var(--text-2); font-size: 13px; }
.step-n:empty, .step-w:empty { display: none; }
.step-w { margin-top: 8px; display: grid; gap: 10px; min-width: 0; }

.gate { border: 1px solid var(--accent); border-radius: 9px; background: var(--accent-soft); padding: 12px 14px; display: grid; gap: 10px; }
.gate.decided { border-color: var(--line); background: var(--surface-2); }
.gate.decided .badge { display: none; }
.gate-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); }
.gate-h svg { color: var(--accent); flex: none; }
.gate-b { display: grid; gap: 8px; }
.gate-f { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { display: grid; gap: 6px; }
.pick label { align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.pick input { margin-top: 3px; accent-color: var(--accent); }
.pick .tag { margin-left: auto; }
ul.plain { margin: 0; padding-left: 18px; display: grid; gap: 3px; }

.w-audit { display: flex; gap: 16px; align-items: flex-start; }
.w-audit .score-ring { width: 72px; height: 72px; }
.w-audit .grow { flex: 1; min-width: 0; }
.checks.compact li { padding: 6px 0; border-bottom: 0; }
.w-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; }
.w-stats > div { display: grid; gap: 1px; padding: 8px 12px; border-left: 1px solid var(--line); min-width: 0; }
.w-stats > div:first-child { border-left: 0; }
.w-stats b { font-size: 18px; font-weight: 600; }
.w-stats span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix.compact td, .matrix.compact th { padding-top: 6px; padding-bottom: 6px; }
.matrix.compact td.q { min-width: 180px; font-size: 13px; }
.actions-list.compact li { padding: 8px 0; }
ul.drafts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ul.drafts li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
ul.drafts li > span:first-child { flex: 1; min-width: 160px; font-weight: 550; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font: 500 12.5px/1 var(--font); cursor: pointer; transition: background-color .12s, color .12s, border-color .12s; }
.chip:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.chip:disabled { opacity: .5; cursor: default; }
.composer { position: sticky; bottom: 0; padding: 10px 0 14px; background: linear-gradient(to bottom, transparent, var(--bg) 22px); display: grid; gap: 8px; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.composer-box textarea { border: 0; box-shadow: none !important; padding: 6px 0; min-height: 0; height: 34px; resize: none; background: transparent; overflow-y: hidden; }
.composer-box textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer-box .btn { border-radius: 10px; flex: none; }
.composer-note { text-align: center; }
::selection { background: var(--accent-soft); }

@media (max-width: 560px) {
  .w-stats { grid-template-columns: 1fr 1fr; }
  .w-stats > div:nth-child(3) { border-left: 0; }
  .w-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .w-stats span { white-space: normal; }
  .w-audit { flex-direction: column; }
  .msg.user .body { max-width: 92%; }
  .seg a { padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) { .msg, .step { animation: none; } }
.step-w > .btn { justify-self: start; }
.msg .body > .btn, .msg .body > .chips { align-self: flex-start; }

/* Onboarding + SEO/Search Console widgets */
dl.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 0 0 6px; }
dl.facts > div { display: grid; gap: 1px; min-width: 0; }
dl.facts dt { font-size: 12px; color: var(--muted); }
dl.facts dd { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.bad-t { color: var(--bad); }
.checks .st.note { background: var(--surface-2); color: var(--muted); }
.field .src { font-style: normal; font-weight: 550; font-size: 11px; margin-left: 6px; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--line); }
.field .src.good { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.field .src.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.field .src.muted { color: var(--muted); background: var(--surface-2); }
.ob-grid .field:last-child { grid-column: 1 / -1; }
.gate .field input, .gate .field textarea { background: var(--surface); }
.code-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.code-row code { overflow-wrap: anywhere; font-size: 12px; }
table.t.compact td, table.t.compact th { padding: 6px 10px; }
table.t.compact td.q { overflow-wrap: anywhere; }
table.t th.num, table.t td.num { text-align: right; }
@media (max-width: 560px) {
  .ob-grid, .gate .grid2 { grid-template-columns: 1fr; }
  .code-row { grid-template-columns: 1fr auto; }
  .code-row > span { grid-column: 1 / -1; }
}
.composer .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(to right, #000 92%, transparent); padding-bottom: 2px; }
.composer .chips::-webkit-scrollbar { display: none; }
.composer .chip { flex: none; }

/* Settings → AI questions */
.ai-opts { display: grid; gap: 8px; }
.ai-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.ai-opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ai-opt.off { opacity: .55; cursor: not-allowed; }
.ai-opt input { margin-top: 3px; accent-color: var(--accent); }
.ai-opt small { display: block; color: var(--text-2); margin-top: 2px; }
.ai-opt small i { font-style: normal; color: var(--muted); }
