/* 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: 236px;

    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; 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; max-width: 1160px; margin: 0 auto; }

/* ---------- 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"], 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-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 { 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; }
.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 { display: block; 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 { flex: 1; min-width: 0; }
.form-actions-left { justify-content: flex-start; margin-top: 8px; }
.panel h2 { margin-bottom: 8px; }
@media (max-width: 860px) { .copy-row { flex-direction: column; } }
