/* Self-hosted font: no requests to third parties. */
@font-face {
    font-family: "Schibsted Grotesk";
    src: url("/assets/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
    font-weight: 400 900;
    font-display: swap;
}

:root {
    --ink: #101015;
    --panel: #16161d;
    --surface: #1c1c25;
    --raised: #262631;
    --line: #2e2e3b;
    --text: #f2f1f6;
    --muted: #a3a1b3;
    --violet: #b07bff;
    --violet-deep: #7b4dff;
    --violet-soft: rgba(176, 123, 255, 0.14);
    --mint: #63d6a4;
    --amber: #f2b65c;
    --coral: #f27b72;
    --accent-gradient: linear-gradient(100deg, #7b4dff 0%, #c084fc 100%);

    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 22px;
    --sidebar: 270px;

    color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--violet); text-underline-offset: 3px; }
a:hover { color: #c9a5ff; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--muted); font-weight: 400; }
.lead { color: var(--muted); max-width: 62ch; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.js [data-hide-with-js] { display: none; }

/* ---------- App frame ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 22px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { font-size: 1.15rem; font-weight: 750; letter-spacing: -0.02em; color: var(--text); text-decoration: none; padding: 0 10px; }
.brand:hover { color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-s);
    color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-active { color: #fff; background: var(--accent-gradient); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { margin: 0 0 4px; padding: 0 10px; font-size: 0.8rem; color: var(--muted); }
.nav-sub { padding: 7px 10px; border-radius: var(--radius-s); color: var(--muted); text-decoration: none; }
.nav-sub:hover { color: var(--text); background: var(--surface); }
.nav-sub.is-active { color: var(--text); background: var(--violet-soft); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 10px 0; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who span { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; }
.topbar { display: flex; justify-content: flex-end; padding: 14px 32px; border-bottom: 1px solid var(--line); }
.switcher { display: flex; align-items: center; gap: 10px; }
.switcher label { color: var(--muted); font-size: 0.9rem; }

.content { padding: 32px; }

/* ---------- Buttons and form controls ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
    color: var(--text); background: var(--raised);
}
.btn:hover { color: var(--text); background: #30303d; }
.btn-primary { background: var(--accent-gradient); color: #fff; }
.btn-primary:hover { color: #fff; background: linear-gradient(100deg, #8a61ff 0%, #cb9bfd 100%); }
.btn-quiet { background: transparent; border-color: var(--line); }
.btn-quiet:hover { background: var(--surface); }
.btn-danger { background: transparent; border-color: var(--coral); color: var(--coral); }
.btn-danger:hover { background: rgba(242, 123, 114, 0.12); color: var(--coral); }
.btn-small { padding: 6px 13px; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
    font: inherit; color: var(--text);
    background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-s);
    padding: 10px 12px; width: 100%;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; resize: vertical; }
select { width: auto; max-width: 100%; padding-right: 30px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--violet); outline-offset: 0; border-color: transparent; }
::placeholder { color: #77758a; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 0.875rem; margin: 6px 0 0; }
.field .error, .has-error .error { color: var(--coral); font-size: 0.875rem; margin: 6px 0 0; }
.has-error input { border-color: var(--coral); }
.input-short { max-width: 110px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; }
.check input { margin-top: 4px; accent-color: var(--violet); }
.stack > * + * { margin-top: 14px; }

fieldset { border: 0; border-top: 1px solid var(--line); margin: 26px 0 0; padding: 22px 0 0; }
legend { font-weight: 650; font-size: 1.05rem; padding: 0 12px 0 0; }

.form { max-width: 640px; }
.form select { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.form-inline { display: flex; align-items: flex-end; gap: 12px; }
.form-inline .field { flex: 1; margin: 0; }

/* ---------- Panels, cards, lists ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 24px; margin-bottom: 18px; }
.panel.narrow { max-width: 520px; }
.panel.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.panel h3 { margin-bottom: 12px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .lead { margin: 8px 0 0; }
.page-head h1 .muted { font-size: 1.05rem; margin-left: 6px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.section { margin-top: 38px; }
.section > h2 { margin-bottom: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--violet); }
.card-desc { color: var(--muted); font-size: 0.9rem; margin: 0; flex: 1; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 0.85rem; }
.card-actions { display: flex; gap: 8px; }
.card-planned { background: transparent; border-style: dashed; }
.card-planned h3 { color: var(--muted); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--raised); color: var(--muted); white-space: nowrap; }
.pill-new { background: var(--violet-soft); color: #cdb0ff; }
.pill-ok { background: rgba(99, 214, 164, 0.14); color: var(--mint); }
.pill-warn { background: rgba(242, 182, 92, 0.14); color: var(--amber); }
.pill-bad { background: rgba(242, 123, 114, 0.14); color: var(--coral); }

.flash { padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 18px; border: 1px solid var(--line); background: var(--surface); }
.flash-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flash-ok { border-color: rgba(99, 214, 164, 0.4); }
.flash-warn { border-color: rgba(242, 182, 92, 0.5); }
.flash-error { border-color: rgba(242, 123, 114, 0.5); }
.note { color: var(--muted); border-left: 3px solid var(--violet); padding: 4px 0 4px 14px; margin-bottom: 18px; max-width: 70ch; }
.run-info { font-size: 0.9rem; margin-bottom: 22px; }

/* ---------- Dashboard hero ---------- */
.hero { text-align: center; padding: 56px 0 30px; display: flex; flex-direction: column; align-items: center; }
.hero-greeting { color: var(--muted); margin-bottom: 10px; }
.hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.5rem); max-width: 22ch; text-wrap: balance; }
.hero .lead { margin: 16px auto 0; }
.hero-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; justify-content: center; }

.ask {
    display: flex; gap: 8px; align-items: center;
    width: min(100%, 620px); margin-top: 28px; padding: 7px 7px 7px 20px;
    background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(100deg, rgba(123, 77, 255, 0.7), rgba(192, 132, 252, 0.35)) border-box;
    border: 1px solid transparent; border-radius: 999px;
}
.ask input { border: 0; background: transparent; padding: 8px 0; }
.ask input:focus-visible { outline: none; }
.ask:focus-within { box-shadow: 0 0 0 3px var(--violet-soft); }
.ask-left { margin: 14px 0 22px; }

.progress { width: min(100%, 520px); margin: 22px auto 0; color: var(--muted); font-size: 0.9rem; }
.page-head + .progress { margin: 0 0 26px; }
progress { width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--raised); appearance: none; }
progress::-webkit-progress-bar { background: var(--raised); }
progress::-webkit-progress-value { background: var(--accent-gradient); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--violet); border-radius: 999px; }

/* ---------- Stats ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 20px; min-width: 170px; display: flex; flex-direction: column; }
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.875rem; margin-top: 4px; }

/* ---------- Suggestions ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 7px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; border: 1px solid var(--line); }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); background: var(--violet-soft); border-color: transparent; }
.count { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.filter { display: flex; gap: 8px; margin-bottom: 18px; }

.suggestion-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.suggestion { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px 20px; }
.suggestion-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.page-url { font-size: 0.875rem; color: var(--muted); word-break: break-all; }
.tag { font-size: 0.8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }

.diff { margin: 0 0 14px; display: grid; gap: 10px; }
.diff dt { color: var(--muted); font-size: 0.8rem; margin-bottom: 3px; }
.diff dd { margin: 0; padding: 10px 12px; border-radius: var(--radius-s); background: var(--ink); max-width: 75ch; }
.diff dd.old { color: var(--muted); }
.diff dd.new { border-left: 3px solid var(--violet); font-weight: 500; }
.value { font-size: 1.05rem; font-weight: 600; margin-bottom: 10px; max-width: 70ch; }
.reason { color: var(--muted); max-width: 70ch; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; }
.chips li { background: var(--raised); border-radius: 6px; padding: 3px 9px; font-size: 0.82rem; }

details { margin-bottom: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.plain { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.plain li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }

.warnings { margin: 0 0 12px; padding: 10px 14px 10px 30px; border-radius: var(--radius-s); background: rgba(242, 182, 92, 0.1); color: var(--amber); font-size: 0.9rem; }
.checks-ok { color: var(--mint); font-size: 0.875rem; }

.suggestion-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 0.85rem; flex-wrap: wrap; }
.actions { display: flex; align-items: center; gap: 8px; }
.status { font-weight: 600; font-size: 0.85rem; }
.status-approved, .status-done, .status-job-done { color: var(--mint); }
.status-rejected, .status-job-failed { color: var(--coral); }
.status-job-running { color: var(--violet); }
.status-job-pending { color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--muted); font-weight: 600; font-size: 0.82rem; white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
.curve th[scope="row"] { width: 90px; font-weight: 500; }
.curve td.num { width: 90px; }
.bar-cell { width: auto; }
.bar { display: block; height: 8px; margin-top: 6px; border-radius: 999px; background: var(--accent-gradient); min-width: 2px; }

.site-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.site-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.site-list li:last-child { border-bottom: 0; }
.site-list a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); min-width: 0; }
.site-list a:hover strong { color: var(--violet); }

.stored { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0 0; font-size: 0.875rem; }
/* A key that is stored: the field says so in mint until something new is typed */
.field .is-stored { border-color: rgba(99, 214, 164, 0.45); }
.field .is-stored::placeholder { color: var(--mint); opacity: 1; font-weight: 600; }
.field .is-stored:focus::placeholder { opacity: 0.5; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 26px; }

/* ---------- Login ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 24px;
    background: radial-gradient(900px 480px at 50% -10%, rgba(123, 77, 255, 0.22), transparent 70%), var(--ink); }
.auth-card { width: min(100%, 420px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 34px 30px; }
.auth-card .brand { padding: 0; margin-bottom: 26px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 10px; }
.auth-card .lead { margin-bottom: 22px; }
.auth-alt { margin: 22px 0 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand { padding: 0; margin-right: auto; }
    .nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
    .nav-link { white-space: nowrap; padding: 8px 12px; }
    .nav-group { flex-direction: row; order: 4; width: 100%; overflow-x: auto; gap: 6px; }
    .nav-heading { display: none; }
    .nav-sub { white-space: nowrap; border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; font-size: 0.875rem; }
    .sidebar-foot { margin: 0; border: 0; padding: 0; flex-direction: row; align-items: center; order: 2; }
    .who { display: none; }
    .topbar { padding: 10px 16px; justify-content: flex-start; }
    .content { padding: 22px 16px 40px; }
    .hero { padding: 30px 0 18px; }
    .form-inline { flex-direction: column; align-items: stretch; }
    .stat { flex: 1 1 140px; min-width: 0; }
    .ask { padding-left: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
    .btn, .nav-link, .nav-sub, .tab { transition: background-color 0.15s ease, color 0.15s ease; }
}

/* ---------- Code, snippets (schema and internal links) ---------- */
.code-label { color: var(--muted); font-size: 0.8rem; margin: 0 0 4px; }
.code { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-s); background: var(--ink); border: 1px solid var(--line);
    overflow-x: auto; max-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; line-height: 1.55; }
details .code { margin-top: 10px; }
.snippet { margin: 0 0 12px; }
.snippet figcaption { color: var(--muted); font-size: 0.8rem; margin-bottom: 3px; }
.snippet blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--violet); background: var(--ink); border-radius: 0 var(--radius-s) var(--radius-s) 0; max-width: 75ch; }
.plain li a { font-size: 0.85rem; word-break: break-word; }
.plain li { min-width: 0; }

/* ---------- Report sharing ---------- */
.copy-row { display: flex; gap: 8px; }
.copy-row input, .copy-row textarea { flex: 1; min-width: 0; }
.copy-row-tall { align-items: flex-start; }
.copy-row-tall textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; line-height: 1.45; resize: vertical; }
.form-actions-left { justify-content: flex-start; margin-top: 8px; }
.panel h2 { margin-bottom: 8px; }
@media (max-width: 860px) { .copy-row { flex-direction: column; } }

/* ---------- Queue status ---------- */
.queue-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 18px; border-radius: var(--radius-s); background: var(--violet-soft); color: var(--text); font-size: 0.9rem; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: var(--violet); flex: none; }
.queue-bar.is-done .spinner { display: none; }
@media (prefers-reduced-motion: no-preference) {
    .spinner { animation: spin 0.9s linear infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }
}
.card-note { color: var(--amber); font-size: 0.85rem; margin: 0; }

/* ---------- Sidebar site switcher and profile menu ---------- */
.sidebar .switcher { display: flex; flex-direction: column; gap: 6px; padding: 0; }
.sidebar .switcher select { width: 100%; font-weight: 600; background: var(--surface); }
.topbar { justify-content: flex-end; }
.profile-menu { position: relative; }
.profile-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px 12px 5px 5px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); font-size: 0.95rem; font-weight: 600; }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary:hover, .profile-menu[open] summary { background: var(--surface); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-gradient); color: #fff; display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; }
.profile-drop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 220px; padding: 8px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-m); display: flex; flex-direction: column; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
.profile-mail { margin: 0; padding: 8px 10px 10px; color: var(--muted); font-size: 0.85rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.profile-drop a, .profile-drop button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--radius-s); color: var(--text); text-decoration: none; font: inherit; background: transparent; border: 0; cursor: pointer; }
.profile-drop a:hover, .profile-drop button:hover { background: var(--surface); color: var(--text); }
.profile-drop form { margin: 0; }

/* ---------- Research, pillars and briefs ---------- */
textarea.plain-text { font-family: inherit; font-size: 0.95rem; }
.cluster { margin: 0 0 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.cluster > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; color: var(--text); font-size: 0.95rem; }
.cluster-name { font-weight: 600; }
.cluster .table-wrap { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-m) var(--radius-m); }
.pillar .section-head { align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pillar-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; margin-bottom: 10px; border-radius: var(--radius-m); background: var(--violet-soft); }
.pillar-card h2 { margin-bottom: 2px; }
.pillar-card p { margin: 0; }
.pillar-page { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
a.pill { text-decoration: none; }
.plain.compact { margin: 0; gap: 2px; }
.steps { margin: 0 0 16px; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.upload { margin-top: 16px; }
input[type="file"] { color: var(--muted); font: inherit; max-width: 100%; }
.brief-meta { margin: 0 0 12px; display: grid; gap: 6px; }
.brief-meta div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; }
.brief-meta dt { color: var(--muted); font-size: 0.85rem; }
.brief-meta dd { margin: 0; }
.outline { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 0.95rem; }
.outline ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); display: grid; gap: 2px; }

@media (max-width: 860px) {
    .sidebar .switcher { order: 2; flex: 1 1 100%; }
    .brief-meta div { grid-template-columns: 1fr; gap: 0; }
    .profile-name { display: none; }
    .profile-menu summary { padding: 4px; }
}
.form > .help, .panel > .help { color: var(--muted); font-size: 0.875rem; margin: 10px 0 0; }
.form-actions-left { justify-content: flex-start; }

/* ---------- Client overview and client card ---------- */
[data-show-with-js] { display: none; }
.js [data-show-with-js] { display: block; }
a.stat { text-decoration: none; color: var(--text); }
a.stat:hover { border-color: var(--violet); color: var(--text); }
.stat-delta { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
.delta-up { color: var(--mint); }
.delta-down { color: var(--coral); }
.stats + .stats { margin-top: 6px; }

.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin: 22px 0 12px; }
.list-tools input[type="search"] { width: min(100%, 280px); background: var(--surface); }
.sorts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 0 auto; font-size: 0.875rem; }
.sorts .muted { margin-right: 4px; }
.sort { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.sort:hover { color: var(--text); }
.sort.is-active { color: var(--text); background: var(--violet-soft); border-color: transparent; }

.client-table th[scope="row"] { font-weight: 400; min-width: 180px; }
.client-table td, .client-table th { vertical-align: middle; }
.client-table td > .muted, .client-table th > .muted { display: block; font-size: 0.82rem; }
.client-table td > span:first-child:last-child.muted { display: inline; font-size: inherit; }
.client-name { display: block; font-weight: 650; color: var(--text); text-decoration: none; }
.client-name:hover { color: var(--violet); }
.client-table td a:not(.pill) { color: var(--text); text-decoration-color: var(--line); }
.client-table td a:not(.pill):hover { color: var(--violet); }
.client-table td a.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Meter: the fill and its track are two steps of the same violet, so it reads as one bar. */
.meter { display: block; width: 110px; max-width: 100%; height: 6px; border-radius: 999px; background: var(--violet-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; min-width: 2px; border-radius: 999px; background: var(--violet); }
.meter-wide { width: 100%; height: 8px; }
.meter-text { margin-top: 5px; }
.plan-progress { display: grid; gap: 8px; margin: 0 0 18px; max-width: 640px; font-size: 0.9rem; }

.client-sub { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; font-size: 0.95rem; }
.tabs .count { margin-left: 2px; }
.tabs-small { margin-top: 26px; }
.tabs-small .tab { padding: 5px 12px; font-size: 0.875rem; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.split .panel { margin: 0; }
.split .panel h3 { margin: 16px 0 8px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.section-head a { font-size: 0.9rem; white-space: nowrap; }
.mini-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.mini-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.mini-list .muted { font-size: 0.85rem; }
.mini-title { min-width: 0; overflow-wrap: anywhere; }

.field-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.field-row-main { grid-template-columns: minmax(0, 1fr) 170px; }
.form-wide { max-width: 820px; }
.form-full { max-width: none; }
.form-wide .field-row { max-width: none; }
.form-actions-left { align-items: center; }
.panel.form > h2 { margin-bottom: 16px; }

.task-list, .entry-list { display: grid; gap: 10px; }
.task, .entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; }
.task h3, .entry h3 { font-size: 0.98rem; font-weight: 600; overflow-wrap: anywhere; }
.task-note, .entry-body { color: var(--muted); margin: 6px 0 0; font-size: 0.92rem; max-width: 80ch; overflow-wrap: anywhere; }
.task-meta { margin: 4px 0 0; font-size: 0.85rem; }
.task.is-done h3 { color: var(--muted); font-weight: 500; }
.task .edit, .entry .edit, .entry-body { grid-column: 1 / -1; }
.edit { margin: 4px 0 0; }
.edit[open] { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 10px; }
.edit[open] > summary { margin-bottom: 14px; }
.edit form + form { margin-top: 10px; }
.entry { grid-template-columns: minmax(0, 1fr); }
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.entry-date { margin-left: auto; font-size: 0.875rem; white-space: nowrap; }
.done-list > summary { font-size: 1.1rem; font-weight: 650; color: var(--text); margin-bottom: 14px; }
.done-list h3 { margin: 22px 0 12px; }

/* Small column chart: tasks carried out per month. One series, so no legend. */
.bars { margin: 0; }
.bars-plot { display: flex; align-items: flex-end; gap: 2px; height: 170px; padding: 16px 18px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); max-width: 560px; }
.bars-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.bars-bar { width: min(60%, 44px); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--violet); }
.bars-col:hover .bars-bar { background: #c9a5ff; }
.bars-value { font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.bars-label { color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--line); width: 100%; text-align: center; padding-top: 6px; }

@media (max-width: 860px) {
    .split, .field-row, .field-row-main { grid-template-columns: minmax(0, 1fr); }
    .sorts { margin-left: 0; }
    .task { grid-template-columns: minmax(0, 1fr); }
    .entry-date { margin-left: 0; }

    /* The overview table becomes one card per client. */
    .client-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .client-table, .client-table tbody, .client-table tr, .client-table th, .client-table td { display: block; }
    .client-table tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
    .client-table tr:last-child { border-bottom: 0; }
    .client-table th, .client-table td { border: 0; padding: 0; }
    .client-table th[scope="row"] { margin-bottom: 10px; }
    .client-table td { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 0 10px; align-items: baseline; padding: 4px 0; }
    .client-table td::before { content: attr(data-label); color: var(--muted); font-size: 0.82rem; grid-row: span 2; }
    .client-table td[colspan]::before { content: none; }
    .client-table td > * { grid-column: 2; justify-self: start; }
}

/* ---------- Mails ---------- */
.mail.is-waiting { border-color: rgba(176, 123, 255, 0.45); }
.mail-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; font-size: 0.875rem; overflow-wrap: anywhere; }
.mail-text { margin: 10px 0 0; }
.mail-body { margin-top: 8px; padding: 12px 14px; background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-s); max-height: 320px; overflow-y: auto; font-size: 0.92rem; max-width: 90ch; overflow-wrap: anywhere; }
.reply { margin-top: 14px; display: grid; gap: 8px; max-width: 90ch; }
.reply label { font-weight: 600; font-size: 0.9rem; }
.reply textarea[readonly] { background: var(--violet-soft); border-color: transparent; }
.reply-note { margin: 0; font-size: 0.9rem; }
.reply-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.reply-actions form { margin: 0; }
.js .reply-actions [data-show-with-js] { display: inline-flex; }
.steps li { color: var(--muted); }

/* Good news: draft on the left, the mail as the client sees it on the right */
.news .entry-head h2 { margin: 0; font-size: 1.15rem; }
.news-facts { color: var(--muted); margin: 10px 0 18px; max-width: 80ch; }
.news-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.news-preview p { margin: 0 0 8px; font-size: 0.875rem; }
.news-preview iframe { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: var(--radius-m); background: #f4f2ee; }
.news-dismiss { margin-top: 14px; }
.news-rules ul { margin: 8px 0 0; padding-left: 18px; }
.news-rules li + li { margin-top: 4px; }
.news-rules summary { cursor: pointer; color: var(--text); }
.stat-news .stat-value { color: var(--mint); }
@media (max-width: 900px) {
    .news-grid { grid-template-columns: minmax(0, 1fr); }
    .news-preview iframe { height: 560px; }
}

/* Prompt plan */
.plan-actions { margin-top: 18px; }
.plan-cost { margin: 4px 0 14px; }
.plan-stat-sub { display: block; font-size: 0.8rem; margin-top: 4px; }
.plan-competitors { margin: 10px 0 0; padding-left: 22px; columns: 2; column-gap: 32px; }
.plan-competitors li { margin-bottom: 6px; break-inside: avoid; }
.plan-group { padding: 0; }
.plan-group > summary { cursor: pointer; padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.plan-group[open] > summary { border-bottom: 1px solid var(--line); }
.plan-group .table-wrap { border: 0; border-radius: 0 0 var(--radius-m) var(--radius-m); }
.plan-group-count { margin-left: auto; font-size: 0.875rem; }
.plan-cell { white-space: nowrap; }
fieldset.field { border: 0; padding: 0; margin: 0 0 18px; }
fieldset.field legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
fieldset.field .check { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-weight: 400; }
@media (max-width: 700px) { .plan-competitors { columns: 1; } }

/* SEO audit */
.tabs-wrap { flex-wrap: wrap; }
.finding h3 { margin: 0; font-size: 1.05rem; }
.finding-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.875rem; margin: 6px 0 10px; }
.finding-details { margin: 10px 0; }
.finding-details summary { cursor: pointer; color: var(--text); }
.evidence { margin: 8px 0 0; padding-left: 18px; font-size: 0.875rem; word-break: break-word; }
.evidence li + li { margin-top: 3px; }
.compare-body { padding: 16px 20px 20px; }
.compare-body .table-wrap { border: 1px solid var(--line); border-radius: var(--radius-m); margin: 10px 0 18px; }
.compare tr.is-ours td { background: var(--violet-soft); }
.compare tr.is-gap td { background: rgba(242, 182, 92, 0.08); }
.compare-schema { max-width: 220px; font-size: 0.85rem; }
.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.compare-grid h4 { margin: 0 0 6px; }
.compare-grid ul, .compare-grid ol { margin: 0; padding-left: 20px; }
.compare-grid li + li { margin-top: 4px; }
@media (max-width: 800px) { .compare-grid { grid-template-columns: minmax(0, 1fr); } }

.panel.good { border-color: rgba(99, 214, 164, 0.35); }
.panel.good ul { margin: 10px 0 0; padding-left: 20px; }
.panel.good li + li { margin-top: 6px; }

/* Text proposals on audit findings */
.fixes { margin: 14px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.fixes h4 { margin: 0 0 10px; }
.fix { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 10px; background: var(--raised); }
.fix.is-decided { opacity: 0.65; }
.fix-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.fix-item { margin: 0 0 8px; }
.fix-compare { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; margin: 0 0 8px; }
.fix-compare dt { font-weight: 600; }
.fix-compare dd { margin: 0; }

/* Fact bank */
.facts-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 8px; }
.facts-forms h2 { font-size: 1.05rem; margin: 0 0 10px; }
.field-row-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts-texts { margin: 12px 0 0; padding-left: 18px; font-size: 0.875rem; }
.facts-kind { font-size: 1rem; margin: 22px 0 8px; }
.facts-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.fact { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; }
.fact-body { min-width: 0; flex: 1; }
.fact-body p { margin: 0; }
.fact-source { font-size: 0.8125rem; margin-top: 4px !important; overflow-wrap: anywhere; }
.fact-quote { margin-left: 8px; font-style: italic; }
.fact-edit { flex-shrink: 0; text-align: right; }
.fact-edit summary { list-style: none; cursor: pointer; }
.fact-edit summary::-webkit-details-marker { display: none; }
.fact-edit[open] { flex-basis: 45%; }
.fact-edit .form { margin-top: 8px; text-align: left; }
.fact-edit textarea { width: 100%; }
.fact-edit-row { display: flex; gap: 8px; margin: 6px 0; }
.fact-edit-row select { flex: 1; }
@media (max-width: 760px) {
    .facts-forms, .field-row-two { grid-template-columns: 1fr; }
    .fact { flex-direction: column; }
    .fact-edit, .fact-edit[open] { flex-basis: auto; width: 100%; text-align: left; }
}
.plan-gaps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.plan-gaps h3 { font-size: 1rem; margin: 0 0 8px; }
@media (max-width: 760px) { .plan-gaps { grid-template-columns: 1fr; } }
.facts-scan { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.facts-scan select { max-width: 340px; }
@media (max-width: 760px) { .facts-scan { justify-content: flex-start; } .facts-scan select { max-width: 100%; } }

/* Overview pages without the side menu: all clients and one client's dashboard */
.app-bare { grid-template-columns: minmax(0, 1fr); }
.app-bare .topbar { justify-content: space-between; align-items: center; gap: 16px; }
.app-bare .content { max-width: 1240px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.spinner-small { display: inline-block; width: 11px; height: 11px; border-width: 2px; vertical-align: -1px; margin-right: 6px; }
.warn-text { color: var(--amber); }

.up { color: var(--mint); }
.down { color: var(--coral); }

.scan-form { display: flex; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.scan-form .help { text-align: right; margin: 0; flex: 1 1 100%; }
.btn-scan { padding-left: 22px; padding-right: 22px; }
.btn-price { font-weight: 500; opacity: 0.85; margin-left: 6px; }
.scan-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 22px; }

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tool-box { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; min-height: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); color: var(--text); text-decoration: none; transition: border-color 0.15s ease; }
.tool-box:hover { border-color: var(--violet); color: var(--text); }
.tool-box:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.tool-box-name { font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tool-box-name .spinner-small { margin: 0; }
.tool-box-value { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tool-box-label { color: var(--muted); font-size: 0.875rem; }
.tool-box-line { color: var(--muted); font-size: 0.8125rem; margin-top: auto; padding-top: 10px; }
.tool-attention { border-left: 3px solid var(--amber); }
.tool-bad { border-left: 3px solid var(--coral); }
.tool-running { border-left: 3px solid var(--violet); }
.tool-empty .tool-box-value { color: var(--muted); }

@media (max-width: 760px) {
    .app-bare .topbar { padding: 12px 16px; flex-wrap: wrap; }
    .scan-form { justify-content: flex-start; width: 100%; }
    .scan-form .help { text-align: left; }
    .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tool-box { min-height: 0; padding: 14px; }
    .tool-box-value { font-size: 1.5rem; }
}

/* Logo */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { flex: none; display: block; }
.brand-name { font-size: 1.15rem; font-weight: 750; letter-spacing: -0.02em; }

/* Top bar: logo on the start page, data sources and the user on the right */
.topbar { align-items: center; gap: 16px; }
.app-bare .topbar { justify-content: space-between; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-right .btn.is-active { border-color: var(--violet); color: var(--text); }
.site-name { margin: 0; padding: 0 10px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }

@media (max-width: 860px) {
    .site-name { order: 2; flex: 1 1 100%; padding: 0; }
    .topbar-right .btn { padding-left: 10px; padding-right: 10px; }
}

/* Start page: one line per website */
.site-rows { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--panel); overflow: hidden; }
.site-row { display: grid; grid-template-columns: minmax(0, 1.9fr) repeat(5, minmax(0, 1fr)) minmax(0, 1.7fr); gap: 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.site-row .num small { display: block; font-size: 0.75rem; font-weight: 500; }
.site-row .num em.muted { font-weight: 500; }
.site-row:first-child { border-top: 0; }
.site-row[hidden] { display: none; }
a.site-row:hover { background: var(--surface); color: var(--text); }
a.site-row:focus-visible { outline: 2px solid var(--violet); outline-offset: -2px; }
.site-row-head { padding-top: 10px; padding-bottom: 10px; color: var(--muted); font-size: 0.8125rem; font-weight: 600; background: var(--ink); }
.site-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.site-row .num em { display: block; font-style: normal; font-size: 0.8125rem; font-weight: 600; }
.site-row-name { min-width: 0; display: flex; flex-direction: column; }
.site-row-name strong { font-size: 1.02rem; }
.site-row-name small, .site-row-scan small { color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.site-row-scan { display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; min-width: 0; }
.site-row-scan .pill { align-self: flex-start; white-space: nowrap; }
.site-row-wide { grid-column: 2 / -1; }

@media (max-width: 860px) {
    .site-row-head { display: none; }
    .site-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 14px 16px; }
    .site-row-name, .site-row-scan, .site-row-wide { grid-column: 1 / -1; }
    .site-row .num { text-align: left; display: flex; flex-direction: column; }
    .site-row .num::before { content: attr(data-label); color: var(--muted); font-size: 0.75rem; font-weight: 600; }
}

/* Website dashboard: groups of tools, four boxes to a row */
.dash-actions { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.tool-group { margin-bottom: 26px; }
.tool-group h2 { font-size: 0.95rem; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
@media (max-width: 1000px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dash-actions { justify-content: flex-start; width: 100%; } .dash-actions > .btn { order: 2; } }

/* Fact bank: plain text, one fact per line */
.facts-add { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.facts-add label { font-weight: 600; }
.facts-add textarea, .fact-form textarea { width: 100%; }
.fact { align-items: center; }
.fact-form { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 0; }
.fact-form textarea { background: transparent; border-color: transparent; resize: vertical; min-height: 44px; }
.fact-form textarea:hover, .fact-form textarea:focus { border-color: var(--line); background: var(--ink); }
@media (max-width: 760px) { .fact-form { flex-direction: column; align-items: stretch; } .fact { align-items: stretch; } }

/* Data sources page: one section per website */
.source-sites { display: flex; flex-direction: column; gap: 10px; }
.source-site { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--panel); scroll-margin-top: 20px; }
.source-site > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; cursor: pointer; list-style: none; }
.source-site > summary::-webkit-details-marker { display: none; }
.source-site > summary:hover { background: var(--surface); }
.source-site[open] > summary { border-bottom: 1px solid var(--line); }
.source-site-name small { color: var(--muted); margin-left: 6px; }
.source-site-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.source-site-body { padding: 18px; }
.source-site-tools { display: flex; gap: 10px; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts-add textarea, .fact-form textarea { font: inherit; line-height: 1.5; }
.fact-form textarea { min-height: 0; padding: 8px 10px; }

/* Content plan: the result of the topic check next to the brief buttons */
.check-note { margin: 0 0 8px; font-size: 0.8125rem; color: var(--muted); max-width: 46ch; }
.check-note strong { color: var(--amber); margin-right: 4px; }
.check-duplicate strong { color: var(--coral); }
.check-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.check-actions form { margin: 0; }

/* Top bar: the website switcher on the left, data sources and the user on one line on the right */
.topbar { min-height: 68px; }
.topbar .switcher { margin: 0; }
.topbar .switcher select { height: 40px; min-width: 240px; max-width: 360px; font-weight: 600; background: var(--surface); }
.topbar .site-name { padding: 0; }
.topbar .site-name small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.topbar-right > * { margin: 0; }
.topbar-right .btn { height: 40px; padding-top: 0; padding-bottom: 0; }
.profile-menu summary { height: 40px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
@media (max-width: 860px) {
    .topbar .switcher, .topbar .site-name { flex: 1; min-width: 0; }
    .topbar .switcher select { min-width: 0; width: 100%; }
    .topbar-right .btn { padding-left: 12px; padding-right: 12px; }
}
.scan-problems { margin: -10px 0 22px; }
.scan-problems p { margin: 0 0 6px; }
.scan-problems ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.failed-jobs { margin-bottom: 26px; }
.failed-jobs summary { cursor: pointer; font-weight: 600; color: var(--coral); }
.failed-jobs table { margin-top: 12px; }
.section > .help { color: var(--muted); font-size: 0.875rem; margin: 12px 0 0; }

/* Prompt plan: stability of the AI answers */
.stability .stats { margin: 12px 0 6px; }
.stats-small .stat-value { font-size: 1.4rem; }
.stability details { margin-top: 10px; }
.stability summary { cursor: pointer; font-weight: 600; }
.plan-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 0.95rem; }

/* ---------- The website as it is today (pillar og cluster) ---------- */
.stat-warn .stat-value { color: var(--amber); }
.site-section { margin-top: 22px; }
.site-section-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.site-section-head h2 { margin: 0; font-size: 1.1rem; }
details.site-section > summary { cursor: pointer; list-style: none; }
details.site-section > summary::-webkit-details-marker { display: none; }
details.site-section > summary h2::before { content: '▸'; display: inline-block; margin-right: 8px; color: var(--muted); font-size: 0.9em; }
details.site-section[open] > summary h2::before { content: '▾'; }
.site-table td:first-child { min-width: 180px; max-width: 420px; word-break: break-word; }
.site-table th.num, .site-table td.num { white-space: nowrap; }
.site-table .pill { white-space: nowrap; }

/* ---------- Local visibility ---------- */
.chips { margin: 4px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.label { display: block; font-weight: 600; margin-bottom: 4px; }
.rank-up { color: var(--mint); font-size: 0.8rem; }
.rank-down { color: var(--amber); font-size: 0.8rem; }
.local-top { font-size: 0.85rem; line-height: 1.5; }
.is-ours-text { color: var(--text); font-weight: 600; }
.nowrap { white-space: nowrap; }
.site-table th, .site-table td { font-size: 0.85rem; padding: 8px 9px; }
.page-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 0.875rem; align-items: center; }
.dst-fact-text { font-size: 1.02rem; margin: 0 0 6px; }

/* Sources behind the AI answers and the customer journey */
.small { font-size: 0.85rem; }
.sources-table tr.is-gap td, .journey-table tr.is-gap td { background: rgba(242, 182, 92, 0.08); }
.sources-table td, .journey-table td { vertical-align: top; }
.journey-candidates { columns: 1; }
.journey-questions li { margin-bottom: 4px; }
.journey-platform { margin-top: 16px; }
.journey-platform h3 { margin: 0 0 6px; font-size: 1rem; }
.journey-root { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.journey-table .journey-q { max-width: 260px; }
.journey-table td:nth-child(2) { max-width: 320px; }
@media (max-width: 720px) {
    .journey-table .journey-q, .journey-table td:nth-child(2) { max-width: none; }
}
.section > h3 { margin: 24px 0 6px; font-size: 1.05rem; }
.journey-table td > .small { white-space: nowrap; }
.scans-table td { vertical-align: top; }
.scans-table .scans-name { max-width: 420px; }
.scans-table .scans-name p { margin: 4px 0 0; }
.scans-table tr.is-failed td { background: rgba(242, 123, 114, 0.06); }
.scans-table .scans-message { margin: 6px 0 0; max-width: 260px; }
.scans-table form { display: inline; }
@media (max-width: 720px) {
    /* The scans list as cards: the buttons must be in reach without sideways scrolling. */
    .scans-table, .scans-table tbody, .scans-table tr, .scans-table td { display: block; }
    .scans-table thead { display: none; }
    .scans-table tr { padding: 12px 0; border-bottom: 1px solid var(--line, rgba(255,255,255,0.08)); }
    .scans-table td { padding: 4px 0; border: 0; text-align: left; max-width: none; }
    .scans-table td.num { text-align: left; }
    .scans-table td.num form { display: block; margin-top: 6px; }
    .scans-table .scans-name { max-width: none; }
}
.terms { text-align: left; }
.terms h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.terms p { margin: 0; color: var(--text); line-height: 1.55; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
form.inline { display: inline-block; margin-left: 6px; }
.expand-page summary .plan-group-count { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.expand-grounds { margin-top: 18px; }
.expand-grounds > summary { cursor: pointer; font-weight: 600; }
.expand-grounds h4 { margin: 18px 0 8px; font-size: 0.95rem; }
.expand-rivals li { margin-bottom: 10px; }
.expand-intent { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); border-left-width: 4px; }
.expand-intent.is-ok { border-left-color: var(--mint); }
.expand-intent.is-bad { border-left-color: var(--coral); }
.expand-intent p { margin: 6px 0 0; }
.expand-intent .fix-head { margin: 0; }
.expand-compare { margin-top: 18px; }
.expand-compare h4 { margin: 0 0 8px; font-size: 0.95rem; }
.expand-compare ul { margin: 6px 0 0; padding-left: 20px; }
.expand-compare tr.is-ours td { background: var(--violet-soft); }

/* A small table of contents that follows the reader down the audit. */
.with-toc { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 0 28px; align-items: start; }
.toc { order: 2; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; padding: 12px 0 12px 14px; border-left: 1px solid var(--line); }
.toc-title { margin: 0 0 6px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.toc a { color: var(--muted); text-decoration: none; font-size: 0.9rem; line-height: 1.35; padding: 5px 10px; margin-left: -11px; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; }
.toc a:hover { color: var(--text); background: var(--surface); }
.toc a.is-active { color: var(--text); border-left-color: var(--violet); font-weight: 600; }
.toc-content { order: 1; min-width: 0; }
.toc-content > .section, .toc-content > .panel { scroll-margin-top: 20px; }
.not-checked { padding: 20px 22px; margin-top: 28px; }
.not-checked h2 { margin: 0 0 6px; font-size: 1.05rem; }
.not-checked .evidence { margin: 12px 0 0; padding-left: 20px; }
.not-checked .evidence li { margin-bottom: 6px; color: var(--muted); }
@media (max-width: 900px) {
    .with-toc { grid-template-columns: minmax(0, 1fr); }
    .toc { order: 1; position: static; flex-direction: row; flex-wrap: wrap; gap: 6px 10px; padding: 0 0 16px; border-left: 0; }
    .toc-title { width: 100%; margin: 0 0 2px; }
    .toc a { margin: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; }
    .toc a.is-active { border-color: var(--violet); }
    .toc-content { order: 2; }
}

/* Top bar: the client pages next to the website switcher */
.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-link { padding: 9px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.topbar-link:hover { color: var(--text); background: var(--surface); }
.topbar-link.is-active { color: var(--text); background: var(--violet-soft); }
/* The switcher gives way first, so the buttons never slide under the sidebar */
.topbar .switcher { flex: 1 1 200px; min-width: 0; max-width: 360px; }
.topbar .switcher select { min-width: 0; width: 100%; }
.topbar-nav, .topbar-right { flex: none; }
@media (max-width: 1000px) {
    .topbar .switcher { flex: 1 1 100%; max-width: none; }
}
@media (max-width: 1400px) {
    .topbar { flex-wrap: wrap; }
    .topbar-nav { order: 3; flex: 1 1 100%; overflow-x: auto; gap: 6px; }
    .topbar-link { padding: 6px 12px; border: 1px solid var(--line); font-size: 0.875rem; }
}

/* Pages against the ones above them: a strip of facts, then one block per keyword */
.facts-label { margin: 0 0 6px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.facts-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.fact { display: inline-flex; flex-direction: column; gap: 2px; min-width: 72px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line); }
.fact small { color: var(--muted); font-size: 0.75rem; }
.fact b { font-size: 1rem; font-weight: 650; }
.facts-line { margin: 0 0 6px; }
.kw-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.kw-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; }
.kw-head strong { font-size: 1.02rem; }
.above-line { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0; }
.above-item { white-space: nowrap; }
.kw-block .table-wrap { margin: 6px 0 12px; }
.gaps { margin: 4px 0 0; padding-left: 20px; }
.gaps li + li { margin-top: 3px; }
.page-card summary .page-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }

/* Local visibility: one row per keyword, our place in three places, and who is above us under each */
.local-summary { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: -6px 0 14px; color: var(--muted); }
.local-summary b { color: var(--text); font-weight: 650; }
.local-table th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; margin-top: 2px; }
.local-table td { vertical-align: top; }
.local-table .local-kw { min-width: 140px; }
.rank-pill { font-weight: 650; }
.local-who { display: block; margin-top: 6px; color: var(--muted); font-size: 0.85rem; line-height: 1.45; max-width: 36ch; }

/* Top bar: the Search Console file for the AI answers, in a small drop-down */
.upload-menu summary { font-weight: 600; font-size: 0.9rem; padding: 0 14px; white-space: nowrap; }
.upload-drop { min-width: 340px; max-width: 420px; padding: 14px; gap: 10px; }
.upload-title { margin: 0; font-weight: 650; }
.upload-drop .steps { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; }
.upload-drop input[type=file] { width: 100%; font-size: 0.9rem; }
.upload-drop .btn { align-self: flex-start; }
@media (max-width: 860px) { .upload-menu summary { padding: 0 10px; } .upload-drop { right: auto; left: 0; min-width: 280px; } }

/* Keyword research: pillars folded, the cluster table straight under the pillar card, keywords under each cluster */
.pillar-block { margin-bottom: 14px; }
.pillar-block > summary { list-style: none; cursor: pointer; margin-bottom: 0; border-radius: var(--radius-m); }
.pillar-block > summary::-webkit-details-marker { display: none; }
.pillar-block[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.pillar-block > summary h2 { font-size: 1.15rem; margin: 0 0 2px; }
.pillar-block > summary h2::before { content: '▸'; display: inline-block; width: 1em; color: var(--muted); font-size: 0.85em; transition: transform 0.15s ease; }
.pillar-block[open] > summary h2::before { transform: rotate(90deg); }
.pillar-table { margin: 0; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-m) var(--radius-m); }
.pillar-table table { margin: 0; }
.cluster-row { cursor: pointer; }
.cluster-row:hover td { background: var(--surface); }
.cluster-row .caret { display: inline-block; width: 1em; color: var(--muted); transition: transform 0.15s ease; }
.cluster-row[aria-expanded="true"] .caret { transform: rotate(90deg); }
.cluster-row.is-pillar .cluster-cell { font-weight: 600; }
.cluster-keywords > td { padding: 0 0 0 28px; background: var(--ink); }
.keyword-table { font-size: 0.9rem; }
.keyword-table th { font-size: 0.78rem; }
.pill-intent { background: var(--surface); color: var(--muted); }
.brief-cell form { margin: 0; display: inline; }
/* The topic check in the brief column of the research: the note reads left, the buttons sit right */
.brief-cell { min-width: 140px; max-width: 320px; white-space: normal; }
.brief-cell .check-note { text-align: left; max-width: none; margin: 0 0 6px; white-space: normal; }
.brief-cell .check-actions { justify-content: flex-end; }
.brief-cell .check-actions form { display: block; }
.brief-cell small { display: block; margin-top: 4px; }

/* Settings pages: keys in two columns, the website's settings in two columns, the red mark in the top bar */
.keys-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.keys-grid .field { min-width: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; align-items: start; }
.settings-grid > fieldset, .settings-grid > .field { min-width: 0; }
.settings-grid > fieldset { margin-top: 0; }
.setup-missing { border-left: 4px solid var(--coral); padding: 16px 20px; margin-bottom: 16px; }
.setup-missing h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--coral); }
.setup-missing ul { margin: 0; padding-left: 20px; }
.setup-missing li + li { margin-top: 4px; }
.setup-missing a { color: var(--text); }
.site-settings-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.badge-alert { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 0.75rem; font-weight: 700; margin-left: 6px; }
.site-row-settings { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(0, 1.4fr); }
.site-row-setup { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.source-site-tools { display: flex; gap: 10px; margin-top: 16px; }
@media (max-width: 860px) {
    .keys-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
    .site-row-settings { grid-template-columns: minmax(0, 1fr); }
    .site-row-setup { justify-content: flex-start; }
}

/* Dashboard: the full scan and the single scans side by side, the last scan on its own line */
.btn-scan-single { background: var(--surface); border-color: var(--line); color: var(--text); }
.scan-strip .scan-last { flex: 1 1 100%; display: block; margin-bottom: 4px; }

/* Tasks: every piece of work on the site in one list */
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--violet); color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center; }
.task-stats .stat { color: var(--text); text-decoration: none; }
.task-stats .stat:hover { border-color: var(--violet); }
.task-stats .stat.is-active { border-color: var(--violet); background: var(--violet-soft); }
.task-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 190px auto; gap: 10px; align-items: center; margin: 14px 0 10px; }
.task-add input, .task-add select, .task-add textarea { margin: 0; }
.task-add select { height: 44px; }
.task-add-value { grid-column: 1 / -1; min-height: 44px; resize: vertical; }
.task-items { margin: 0; padding-left: 18px; columns: 2; column-gap: 24px; font-size: 0.9rem; }
.task-items li { break-inside: avoid; margin-bottom: 3px; overflow-wrap: anywhere; }
.task-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0 0 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--panel); }
.task-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.task-filters label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 0.9rem; padding-bottom: 10px; }
.task-filters select, .task-filters input[type="search"] { margin: 0; min-width: 150px; height: 38px; }
.task-list-form { position: relative; }
.bulk-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 10px 14px; border-radius: var(--radius-m); background: var(--violet-soft); }
.bulk-bar[hidden] { display: none; }
.task-table th.task-check, .task-table td.task-check { width: 36px; padding-right: 0; }
.task-row { cursor: pointer; }
.task-row:hover td { background: var(--surface); }
.task-cell { min-width: 280px; }
.task-cell .caret { display: inline-block; width: 1em; color: var(--muted); transition: transform 0.15s ease; }
.task-row[aria-expanded="true"] .caret { transform: rotate(90deg); }
.task-title { font-weight: 600; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 0 0 1em; font-size: 0.8rem; }
.task-page { color: var(--violet-text, var(--violet)); overflow-wrap: anywhere; }
.task-why { font-size: 0.9rem; white-space: nowrap; }
.task-why small { display: block; font-size: 0.78rem; }
.task-actions { min-width: 250px; text-align: right; }
.task-actions .inline-form { display: inline-block; margin: 2px 0 2px 4px; }
.task-table td { vertical-align: top; }
.btn-danger-text { color: var(--coral); }
.pill-sev-high { background: rgba(242, 123, 114, 0.14); color: var(--coral); }
.pill-sev-medium { background: rgba(242, 182, 92, 0.14); color: var(--amber); }
.pill-sev-low { background: var(--surface); color: var(--muted); }
.pill-status-new { background: var(--violet-soft); color: #cdb0ff; }
.pill-status-approved { background: rgba(99, 214, 164, 0.14); color: var(--mint); }
.pill-status-in_progress { background: rgba(242, 182, 92, 0.14); color: var(--amber); }
.pill-status-done, .pill-status-confirmed { background: rgba(99, 214, 164, 0.2); color: var(--mint); }
.pill-status-blocked { background: rgba(242, 123, 114, 0.14); color: var(--coral); }
.pill-status-waiting { background: var(--surface); color: var(--amber); }
.pill-status-rejected, .pill-status-gone { background: var(--surface); color: var(--muted); }
.task-detail td { background: var(--panel); padding: 14px 18px 16px 48px; }
.task-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.task-block h4 { margin: 0 0 4px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.task-block p { margin: 0; max-width: 70ch; }
.task-agent { border-left: 3px solid var(--violet); padding-left: 12px; }
.task-agent p + p { margin-top: 4px; }
.task-block-wide { grid-column: 1 / -1; }
.task-value { margin: 0; padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; max-height: 260px; overflow: auto; }
.task-urls { margin: 0; padding-left: 18px; columns: 2; column-gap: 24px; font-size: 0.9rem; }
.task-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.tag-finding { border-color: var(--coral); color: var(--coral); }
.tag-suggestion { border-color: var(--violet); color: #cdb0ff; }
.tag-section, .tag-brief { border-color: var(--amber); color: var(--amber); }
@media (max-width: 860px) {
    .task-add { grid-template-columns: minmax(0, 1fr); }
    .task-detail-grid { grid-template-columns: minmax(0, 1fr); }
    .task-urls, .task-items { columns: 1; }
    .task-why { white-space: normal; }
    .task-actions { white-space: normal; text-align: left; }
    .task-detail td { padding-left: 16px; }
}
.btn-tasks { height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.btn-tasks .badge-alert { background: var(--violet); }

/* The catalogue of checks: one line per check, green when in order */
.cmark { vertical-align: middle; }
.cmark-ok circle { fill: var(--mint); }
.cmark-bad circle { fill: var(--amber); }
.cmark-skip circle { fill: var(--line); }
.catalog-area { margin-top: 26px; }
.catalog-table th.catalog-mark, .catalog-table td.catalog-mark { width: 32px; padding-right: 0; }
.catalog-name { font-weight: 600; min-width: 220px; }
.catalog-result { color: var(--text); }
.catalog-skipped .catalog-name { color: var(--muted); font-weight: 500; }
.catalog-links { white-space: nowrap; text-align: right; }
.catalog-links a { margin-left: 12px; font-size: 0.875rem; }
@media (max-width: 860px) { .catalog-links { white-space: normal; text-align: left; } .catalog-name { min-width: 0; } }

/* One page: head data, tasks, headings, images, links and changes */
.page-head-table th { width: 160px; color: var(--muted); font-weight: 600; vertical-align: top; }
.page-head-value { overflow-wrap: anywhere; }
.page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.page-tasks { list-style: none; margin: 8px 0 0; padding: 0; }
.page-task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.page-task-title { font-weight: 600; }
.page-headings { margin: 0; padding-left: 22px; }
.page-headings li { margin: 3px 0; }
.page-headings .h-level-2 { margin-left: 14px; }
.page-headings .h-level-3 { margin-left: 28px; }
.page-headings .h-level-4, .page-headings .h-level-5, .page-headings .h-level-6 { margin-left: 42px; color: var(--muted); }
.page-headings .is-footer { color: var(--muted); }
.page-images, .page-links { list-style: none; margin: 0; padding: 0; }
.page-images li, .page-links li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; font-size: 0.92rem; }
.page-images li.is-bad a { color: var(--amber); }
@media (max-width: 960px) { .page-grid { grid-template-columns: minmax(0, 1fr); } .page-task { grid-template-columns: minmax(0, 1fr); } }
