/*
 * The admin console, in the hub's Empyreal look (see hub/hub.css): dark ground,
 * purple accent, Schibsted Grotesk text, Unbounded headings, IBM Plex Mono
 * labels. A separate site with its own copy, so the hub can change freely.
 */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@500;700&family=Schibsted+Grotesk:wght@400;500;600&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  --bg: #0B0B0D;
  --panel: #121316;
  --panel-light: #1A1B1F;
  --text: #EDEFF2;
  --text-muted: #B8BBC0;
  --muted: #A6A8AD;
  --muted-dark: #6B6D73;
  --label: #8E979E;
  --rule: #232529;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --accent: #A855F7;
  --accent-hover: #C084FC;
  --error: #EF4444;
  --success: #10B981;
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
  --font-sans: 'Schibsted Grotesk', system-ui, sans-serif;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, Monaco, monospace;
  --chip-ok-bg: rgba(16, 185, 129, 0.14);
  --chip-ok: #34D399;
  --chip-warn-bg: rgba(245, 158, 11, 0.14);
  --chip-warn: #FBBF24;
  --chip-bad-bg: rgba(239, 68, 68, 0.14);
  --chip-bad: #F87171;
  --chip-muted-bg: rgba(255, 255, 255, 0.06);
  --accent-soft: rgba(168, 85, 247, 0.14);
  --skeleton: rgba(255, 255, 255, 0.06);
  --skeleton-hi: rgba(255, 255, 255, 0.12);
  color-scheme: dark;
}

/* Light, for people whose system asks for it. Same accent family, same type. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F7F6F3;
    --panel: #FFFFFF;
    --panel-light: #F2F1EE;
    --text: #16161A;
    --text-muted: #45474D;
    --muted: #5C5F66;
    --muted-dark: #8A8D94;
    --label: #646870;
    --rule: #E4E2DE;
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.16);
    --accent: #9333EA;
    --accent-hover: #7E22CE;
    --error: #C62828;
    --success: #047857;
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.08);
    --chip-ok-bg: rgba(4, 120, 87, 0.1);
    --chip-ok: #047857;
    --chip-warn-bg: rgba(180, 83, 9, 0.1);
    --chip-warn: #92400E;
    --chip-bad-bg: rgba(198, 40, 40, 0.1);
    --chip-bad: #B71C1C;
    --chip-muted-bg: rgba(0, 0, 0, 0.05);
    --accent-soft: rgba(147, 51, 234, 0.1);
    --skeleton: rgba(0, 0, 0, 0.06);
    --skeleton-hi: rgba(0, 0, 0, 0.11);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font-sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); color: var(--accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sr-only:focus { position: static; width: auto; height: auto; margin: 8px; clip: auto; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand img { width: 24px; height: 24px; display: block; }
.brand span { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.24em; }
.brand small { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-left: 4px; }

main.con { padding-block: 32px 48px; }
h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2rem); line-height: 1.15; margin: 0 0 8px; }
h2 { margin: 0; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 4px; }
h4 { font-size: 0.95rem; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted, .sub { color: var(--muted); }
.sub { font-size: 0.95rem; }
a { color: var(--accent); text-underline-offset: 4px; overflow-wrap: anywhere; }
a:hover { color: var(--accent-hover); }
.mono, code { font-family: var(--font-mono); font-size: 0.875em; letter-spacing: 0.02em; overflow-wrap: anywhere; }

/* Buttons */
.btn, button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 500 1rem/1.4 var(--font-sans); padding: 8px 16px; border-radius: 1rem; border: 0; cursor: pointer; text-decoration: none; transition: background 0.2s, box-shadow 0.2s; background: var(--accent); color: #fff; box-shadow: var(--shadow-soft); text-align: center; }
button:hover, .btn:hover { background: var(--accent-hover); color: #fff; }
button.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--border-light); box-shadow: none; }
button.secondary:hover { background: var(--panel-light); color: var(--text); }
button.ghost { background: transparent; color: var(--text); box-shadow: none; padding: 6px 10px; }
button.ghost:hover { background: var(--panel-light); color: var(--accent); }
button:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
button[aria-busy="true"] { cursor: progress; }
.linkish { background: none; border: 0; box-shadow: none; color: var(--accent); padding: 0 2px; min-height: 44px; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 4px; }
.linkish:hover { background: none; color: var(--accent-hover); }
.full { width: 100%; }

/* Forms */
label.field { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--label); margin-bottom: 8px; }
input[type=email], input[type=text], input[type=password] { font: inherit; width: 100%; min-height: 44px; padding: 9px 14px; border-radius: 1rem; border: 1px solid var(--border-light); background: var(--panel); color: var(--text); }
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fg { margin: 0 0 16px; }
.fg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 4px 12px; border-radius: 0.75rem; background: transparent; color: var(--text-muted); box-shadow: none; font-size: 0.9rem; }
.pw button:hover { background: var(--panel-light); color: var(--text); }
.fg-head .linkish { min-height: 32px; margin-bottom: 4px; }

/* Status lines and notices */
.status { margin: 8px 0 0; font-size: 0.95rem; }
.status:empty { display: none; }
.status.error, .error { color: var(--error); }
.status.ok { color: var(--success); }
.notice { border: 1px solid var(--border-light); background: var(--accent-soft); border-radius: 1rem; padding: 12px 16px; margin: 0 0 16px; font-size: 0.95rem; }
.notice.error { background: var(--chip-bad-bg); border-color: transparent; color: var(--text); }
.notice.warn { background: var(--chip-warn-bg); border-color: transparent; color: var(--text); }
.notice > :last-child { margin-bottom: 0; }

/* Loading and failure */
.boot { padding-block: 24px; display: grid; gap: 14px; max-width: 520px; }
.sk { display: block; height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-hi) 50%, var(--skeleton) 100%); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; }
.sk-title { height: 24px; width: 50%; }
.sk-line { width: 100%; }
.sk-short { width: 60%; }
.sk-block { height: 96px; border-radius: 1rem; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.loading { display: grid; gap: 12px; padding-block: 4px; }
.fail { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.fail p { margin: 0; color: var(--text-muted); }

/* Signed out and not-admin: one card */
.auth { display: grid; place-items: start center; padding-block: 8px 24px; }
.auth-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--border); border-radius: 1.5rem; padding: 24px 20px; box-shadow: var(--shadow-soft); }
@media (min-width: 640px) { .auth-card { padding: 32px; } }
.auth-card .lead { color: var(--text-muted); margin-bottom: 20px; }
.auth-foot { max-width: 440px; margin: 16px auto 0; font-size: 0.9rem; text-align: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--label); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; margin: 20px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.stack { display: grid; gap: 10px; }

/* Signed in: sidebar on desktop, tabs on phones */
.dash { display: grid; gap: 20px; }
@media (min-width: 900px) { .dash { grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; } }
.side { display: grid; gap: 12px; min-width: 0; }
@media (min-width: 900px) { .side { position: sticky; top: 24px; } }
.who { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.who-text { min-width: 0; }
.who-name { margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--label); }
.who-email { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) { .who { flex-direction: column; align-items: stretch; } .who .ghost { justify-content: flex-start; } }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 0.9rem; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted); font-size: 0.95rem; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--text); background: var(--panel-light); }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
@media (min-width: 900px) {
  .tabs { flex-direction: column; overflow: visible; margin: 0; padding: 0; gap: 2px; }
  .tabs a { border-color: transparent; background: transparent; }
  .tabs a[aria-current="page"] { border-color: transparent; box-shadow: inset 3px 0 0 var(--accent); }
}
.panels { min-width: 0; }
.panel-head { margin-bottom: 20px; }
.panel-head h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin: 0 0 6px; }
.panel-head h2:focus { outline: none; }
.panel-head p { margin: 0; color: var(--text-muted); }
.cards { display: grid; gap: 16px; min-width: 0; }
.box { background: var(--panel); border: 1px solid var(--border); border-radius: 1.25rem; padding: 18px 16px; min-width: 0; }
@media (min-width: 640px) { .box { padding: 24px; } }
.box-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.box-head h3 { margin: 0; }
.box-head p { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.empty { color: var(--muted); margin: 0; }
.bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.bar p { margin: 0; }

/* Chips and lights */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 500; white-space: nowrap; background: var(--chip-muted-bg); color: var(--text-muted); }
.chip.ok { background: var(--chip-ok-bg); color: var(--chip-ok); }
.chip.warn { background: var(--chip-warn-bg); color: var(--chip-warn); }
.chip.bad { background: var(--chip-bad-bg); color: var(--chip-bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted-dark); flex: 0 0 auto; }
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--chip-ok-bg); }
.dot.missing { background: var(--chip-warn); box-shadow: 0 0 0 3px var(--chip-warn-bg); }
.dot.error { background: var(--error); box-shadow: 0 0 0 3px var(--chip-bad-bg); }

/* Overview */
.lights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lights a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border-radius: 1rem; border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.lights a:hover { background: var(--panel-light); border-color: var(--border-light); color: var(--text); }
.lights .light-text { display: grid; line-height: 1.3; }
.lights .light-text small { color: var(--muted); font-size: 0.8rem; }
progress { width: 100%; height: 10px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; background: var(--chip-muted-bg); overflow: hidden; margin: 8px 0 12px; }
progress::-webkit-progress-bar { background: var(--chip-muted-bg); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.big { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: 0; }

/* Checks */
.checks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.checks li > span:not(.mark) { min-width: 0; overflow-wrap: anywhere; }
.checks li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 2px 8px; align-items: start; }
.mark { font-weight: 700; line-height: 1.6; text-align: center; }
.mark.ok { color: var(--success); }
.mark.bad { color: var(--error); }
.checks .fix { grid-column: 2; margin: 0; font-size: 0.9rem; color: var(--text-muted); overflow-wrap: anywhere; }
.tasks { display: grid; gap: 12px; border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 4px; }
.task-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--label); margin: 0 0 6px; }

/* Plan and results */
.runner { min-width: 0; }
.out { margin-top: 10px; }
.out:empty { display: none; }
.plan { border: 1px solid var(--border-light); background: var(--bg); border-radius: 1rem; padding: 14px; }
.plan-group + .plan-group { margin-top: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: start; }
.steps .chip { min-width: 64px; justify-content: center; }
.steps .what { margin: 0; overflow-wrap: anywhere; padding-top: 1px; }
.steps .detail { grid-column: 2; margin: 0; font-size: 0.875rem; color: var(--text-muted); overflow-wrap: anywhere; }
.steps .detail dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; }
.steps .detail dt { color: var(--label); font-family: var(--font-mono); font-size: 0.8rem; }
.steps .detail dd { margin: 0; overflow-wrap: anywhere; }
.plan .actions { margin-top: 14px; }
.plan .hint { font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; }
.plan-sum { margin: 0 0 10px; font-size: 0.95rem; }

/* Tables: a real table on wide screens, stacked rows on phones */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); font-weight: 400; text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--rule); }
td { padding: 12px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  table.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; width: 100%; }
  table.stack-sm tr { padding: 10px 0; border-bottom: 1px solid var(--rule); }
  table.stack-sm tr:last-child { border-bottom: 0; }
  table.stack-sm td { border: 0; padding: 2px 0; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
  table.stack-sm td::before { content: attr(data-label); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); padding-top: 3px; }
  td.num { white-space: normal; }
}

/* Checklist */
.cl { list-style: none; margin: 0; padding: 0; }
.cl > li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 4px 12px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.cl > li:first-child { padding-top: 4px; }
.cl > li:last-child { border-bottom: 0; padding-bottom: 0; }
.cl .tick { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--chip-muted-bg); color: var(--muted); margin-top: 2px; }
.cl .tick.ok { background: var(--chip-ok-bg); color: var(--chip-ok); }
.cl .why { margin: 2px 0 4px; color: var(--text-muted); font-size: 0.95rem; }
.cl .where { margin: 0; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.cl .row-foot { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.check { display: inline-flex; gap: 10px; align-items: center; min-height: 44px; font-size: 0.95rem; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.check input:disabled { cursor: progress; }

/* Toasts (a courtesy; results also stay on the page) */
.toasts { position: fixed; z-index: 50; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); border-radius: 1rem; padding: 12px 16px; box-shadow: var(--shadow-medium); font-size: 0.95rem; }
.toast.error { background: var(--error); color: #fff; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; } .sk { animation: none; } }
