@font-face {
  font-family: "Unbounded";
  src: url("fonts/unbounded.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

/* ---------------------------------------------------------------- Themes
   Each theme is a set of tokens; components only use the tokens. */
:root, [data-theme="horizon"] {
  --bg: #0c1430;
  --bg-glow-1: rgba(255, 181, 71, 0.16);
  --bg-glow-2: rgba(92, 225, 230, 0.10);
  --grid-line: rgba(150, 175, 255, 0.05);
  --panel: rgba(20, 30, 66, 0.72);
  --panel-solid: #131d42;
  --panel-2: rgba(120, 145, 230, 0.10);
  --text: #eaf0ff;
  --muted: #9da9cc;
  --border: rgba(150, 175, 255, 0.16);
  --accent: #ffb547;
  --accent-ink: #1f1405;
  --accent-soft: rgba(255, 181, 71, 0.14);
  --accent-2: #5ce1e6;
  --glow: 0 0 0 1px rgba(255, 181, 71, 0.35), 0 0 24px rgba(255, 181, 71, 0.25);
  --ok: #57d9a3;
  --danger: #ff7b72;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(3, 6, 20, 0.45);
  color-scheme: dark;
}
[data-theme="ultraviolet"] {
  --bg: #150d2c;
  --bg-glow-1: rgba(255, 95, 210, 0.18);
  --bg-glow-2: rgba(143, 123, 255, 0.16);
  --grid-line: rgba(200, 160, 255, 0.05);
  --panel: rgba(36, 22, 74, 0.72);
  --panel-solid: #22164a;
  --panel-2: rgba(190, 150, 255, 0.10);
  --text: #f3edff;
  --muted: #b2a3dc;
  --border: rgba(200, 160, 255, 0.18);
  --accent: #ff5fd2;
  --accent-ink: #2a0520;
  --accent-soft: rgba(255, 95, 210, 0.15);
  --accent-2: #8f7bff;
  --glow: 0 0 0 1px rgba(255, 95, 210, 0.4), 0 0 26px rgba(255, 95, 210, 0.28);
  --ok: #6ee7b7;
  --danger: #ff8a8a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 12px 32px rgba(8, 2, 22, 0.5);
  color-scheme: dark;
}
[data-theme="arctic"] {
  --bg: #e7f1f3;
  --bg-glow-1: rgba(11, 127, 134, 0.14);
  --bg-glow-2: rgba(58, 109, 240, 0.10);
  --grid-line: rgba(12, 43, 51, 0.05);
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --panel-2: rgba(11, 127, 134, 0.07);
  --text: #0c2b33;
  --muted: #4d6870;
  --border: rgba(12, 43, 51, 0.13);
  --accent: #0b7f86;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 127, 134, 0.12);
  --accent-2: #3a6df0;
  --glow: 0 0 0 1px rgba(11, 127, 134, 0.35), 0 0 22px rgba(11, 127, 134, 0.18);
  --ok: #157f3c;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(12, 43, 51, 0.06), 0 10px 28px rgba(12, 43, 51, 0.08);
  color-scheme: light;
}
[data-theme="daylight"] {
  --bg: #f4f5fb;
  --bg-glow-1: rgba(51, 70, 255, 0.10);
  --bg-glow-2: rgba(255, 122, 69, 0.10);
  --grid-line: rgba(18, 22, 51, 0.045);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --panel-2: rgba(51, 70, 255, 0.06);
  --text: #121633;
  --muted: #565d7e;
  --border: rgba(18, 22, 51, 0.12);
  --accent: #3346ff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(51, 70, 255, 0.10);
  --accent-2: #ff7a45;
  --glow: 0 0 0 1px rgba(51, 70, 255, 0.35), 0 0 22px rgba(51, 70, 255, 0.18);
  --ok: #157f3c;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(18, 22, 51, 0.05), 0 10px 28px rgba(18, 22, 51, 0.08);
  color-scheme: light;
}
:root {
  --radius: 12px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Unbounded", var(--font);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14.5px/1.5 var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 78% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, var(--bg-glow-2), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  background-attachment: fixed;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }

/* Buttons & inputs */
.btn { font: inherit; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; cursor: pointer; background: var(--panel-2); color: var(--text); display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-link { background: none; color: var(--accent); padding: 4px 0; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
input, textarea, select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 14px/1 var(--display); color: var(--text); letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent)); color: var(--accent-ink); font: 700 11px/1 var(--display); box-shadow: var(--glow); }
.brand-lg { font-size: 20px; }
.brand-lg .logo { width: 38px; height: 38px; font-size: 14px; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--panel); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login-card .btn-primary { margin-top: 16px; }
.code-input { font-family: var(--mono); font-size: 22px; letter-spacing: .3em; text-align: center; }
.error { color: var(--danger); margin: 14px 0 0; font-size: 13px; }

/* Boot / toast */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 70; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); font-size: 13px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 24px; padding: 0 20px; background: var(--panel); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs a:hover { text-decoration: none; background: var(--panel-2); color: var(--text); }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

/* Catalogue layout */
.view { height: calc(100vh - 60px); }
.catalogue { display: grid; grid-template-columns: 280px 1fr; }
.filters { border-right: 1px solid var(--border); padding: 16px; overflow-y: auto; background: var(--panel); backdrop-filter: blur(12px); }
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.toggle { margin: 6px 0 10px; display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.toggle input { width: auto; }
.facet { border-top: 1px solid var(--border); padding: 10px 0 6px; }
.facet summary { cursor: pointer; font-weight: 600; font-size: 13px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.facet summary::-webkit-details-marker { display: none; }
.facet summary::after { content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s; }
.facet[open] summary::after { transform: rotate(90deg); }
.facet-items { margin-top: 8px; display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.facet-item { margin: 0; font-weight: 400; display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.facet-item:hover { background: var(--panel-2); }
.facet-item input { width: auto; margin: 0; }
.facet-item .n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.results { overflow-y: auto; padding: 18px 24px 40px; }
.results-bar { display: flex; gap: 10px; align-items: center; }
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { padding-left: 38px; height: 42px; font-size: 15px; }
.results-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 8px; min-height: 26px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; border: 0; cursor: pointer; }
.chip.plain { background: var(--panel-2); color: var(--muted); font-weight: 500; cursor: default; }

.day-head { position: sticky; top: -18px; z-index: 2; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 14px 0 8px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.list { display: grid; gap: 8px; }
.card { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: start; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; text-align: left; font: inherit; color: inherit; width: 100%; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--glow); transform: translateY(-1px); }
.card .time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); padding-top: 1px; }
.card .code { display: inline-block; font-family: var(--mono); font-size: 11.5px; background: var(--panel-2); border-radius: 5px; padding: 1px 6px; margin-right: 6px; color: var(--muted); vertical-align: 1px; }
.card .title { font-weight: 650; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.card .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.tag { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.badge-slides { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.badge-slides svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.match { margin-top: 6px; font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 8px; }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.more { margin: 14px auto 0; display: block; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 12, 16, .35); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--panel-solid); border-left: 1px solid var(--border); z-index: 31; overflow-y: auto; padding: 28px 30px 40px; box-shadow: -8px 0 30px rgba(0,0,0,.15); }
.drawer-close { position: absolute; top: 14px; right: 14px; }
.drawer h2 { font-size: 21px; margin-right: 36px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13.5px; margin: 14px 0 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }
.speaker { padding: 6px 0; }
.speaker strong { display: block; }
.speaker.has-photo { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; }
.speaker-photo { display: block; width: 52px; height: 52px; padding: 0; border: 2px solid var(--border); border-radius: 50%; overflow: hidden; background: var(--panel-2); cursor: pointer; }
span.speaker-photo { cursor: default; }
.speaker-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.speaker-initials { display: grid; place-items: center; width: 100%; height: 100%; font: 600 16px/1 var(--display); color: var(--accent); }
button.speaker-photo:hover { border-color: var(--accent); }
.speaker-name { display: block; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--text); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.speaker-name:hover { color: var(--accent); }
.speaker-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.bio-dialog { width: min(620px, calc(100vw - 24px)); max-height: min(78vh, 720px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-solid, var(--bg)); color: var(--text); box-shadow: 0 30px 80px rgb(0 0 0 / .45); overflow: hidden; }
.bio-dialog[open] { display: flex; flex-direction: column; }
.bio-dialog::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(4px); }
.bio-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 14px 12px 22px; border-bottom: 1px solid var(--border); }
.bio-head > div { flex: 1; align-self: center; }
.bio-photo { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); flex: none; }
.bio-photo[hidden] { display: none; }
.bio-head h2 { margin: 0; font: 600 19px/1.25 var(--display); }
.bio-role { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.bio-text { padding: 6px 22px 20px; overflow-y: auto; font-size: 15px; line-height: 1.6; }
.bio-text p { margin: 12px 0 0; max-width: 68ch; }
.files { display: grid; gap: 8px; }
.file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.file .name { flex: 1; font-size: 13px; word-break: break-word; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.desc { white-space: pre-line; }

/* Chat */
.ask { display: flex; justify-content: center; }
.chat { width: 100%; max-width: 860px; display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; overflow-y: auto; padding: 24px 20px; }
.chat-empty { text-align: center; padding: 40px 10px 10px; }
.chat-empty h2 { font-size: 24px; }
.suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 24px; text-align: left; }
.suggestion { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.suggestion:hover { border-color: var(--accent); }
.msg { margin: 0 0 20px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-radius: 14px 14px 4px 14px; padding: 9px 14px; max-width: 80%; white-space: pre-wrap; }
.msg.assistant .bubble { backdrop-filter: blur(10px); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; }
.activity { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.activity .step { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.activity .step::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .7; flex: none; }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.cite { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 5px; padding: 0 6px; margin: 0 1px; cursor: pointer; vertical-align: 1px; font-family: var(--font); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite:hover { filter: brightness(.95); }
.sources { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat-form { border-top: 1px solid var(--border); padding: 12px 20px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); }
.chat-form textarea { resize: none; max-height: 200px; min-height: 46px; }
.chat-actions { display: flex; justify-content: space-between; margin-top: 8px; }
.chat-context { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .75em; }
.md ul, .md ol { margin: 0 0 .75em; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 .45em; font-size: 1.05em; }
.md h1, .md h2 { font-size: 1.15em; }
.md code { font-family: var(--mono); font-size: .9em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--panel-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 0 0 .8em; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); }
.md blockquote { margin: 0 0 .75em; padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted); }

/* Admin */
.admin { overflow-y: auto; }
.admin-inner { max-width: 1100px; margin: 0 auto; padding: 22px 24px 48px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-head h2 { margin: 0; font-size: 20px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.segmented button { font: inherit; font-size: 13px; border: 0; background: none; color: var(--muted); padding: 6px 12px; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile-label { font-size: 12.5px; color: var(--muted); }
.tile-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; margin-top: 12px; }
.chart { margin: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 8px; }
.chart figcaption { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.chart-wrap { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .grid.base { stroke: var(--muted); stroke-opacity: .5; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar-fill { fill: var(--accent); }
.chart .bar.hover .bar-fill { filter: brightness(1.15); }
.chart .bar { cursor: default; }
.chart-tip { position: absolute; top: 0; width: 140px; background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 8px; border-radius: 6px; pointer-events: none; box-shadow: var(--shadow); }
.admin-section { margin-top: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.admin-section h3 { font-size: 14px; margin: 0 0 10px; }
.admin-section summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.admin-section details[open] summary, .admin-section[open] summary { margin-bottom: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); padding: 6px 8px; }
table.data td { border-bottom: 1px solid var(--border); padding: 6px 8px; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.usage-line { margin-top: 10px; font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Home */
.home { overflow-y: auto; }
.home-inner { max-width: 1120px; margin: 0 auto; padding: 56px 28px 64px; }
.hero { padding: 8px 0 40px; }
.hero-title {
  font: 700 clamp(34px, 6vw, 68px)/1.04 var(--display);
  letter-spacing: -0.02em;
  margin: 0 0 22px;
  max-width: 15ch;
  background: linear-gradient(100deg, var(--text) 30%, var(--accent) 75%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 58ch; margin: 0 0 28px; }
.hero-ask { display: flex; gap: 8px; max-width: 640px; padding: 6px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.hero-ask:focus-within { box-shadow: var(--glow); border-color: transparent; }
.hero-ask input { border: 0; background: transparent; font-size: 16px; padding: 10px 12px; }
.hero-ask input:focus { outline: none; }
.hero-ask .btn { border-radius: 11px; padding: 10px 22px; }

.horizon { margin-top: 12px; padding: 26px 28px 24px; border-radius: 20px; background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.horizon-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.horizon-head h2, .home-panel h2 { font: 600 16px/1.3 var(--display); letter-spacing: .01em; margin: 0 0 4px; }
.horizon-head p { margin: 0; font-size: 13px; }
.horizon-plot { position: relative; height: calc(var(--rows) * 16px + 64px); margin: 26px 18px 6px; }
.horizon-line { position: absolute; left: -18px; right: -18px; bottom: 30px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 12%, var(--accent-2) 88%, transparent);
  box-shadow: 0 0 18px var(--accent), 0 0 42px color-mix(in srgb, var(--accent) 50%, transparent); }
.horizon-line::after { content: ""; position: absolute; inset: -40px 0 2px; background: linear-gradient(to top, color-mix(in srgb, var(--accent) 16%, transparent), transparent); pointer-events: none; }
.pdot { position: absolute; bottom: calc(40px + var(--stack) * 16px); width: 11px; height: 11px; margin-left: -5.5px; padding: 0; border-radius: 50%;
  border: 2px solid var(--bg); background: var(--accent-2); cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s; }
.pdot:hover, .pdot:focus-visible, .pdot.active { transform: scale(1.6); background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 18px var(--accent); outline: none; }
.horizon-years { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; }
.horizon-years span { position: absolute; transform: translateX(-50%); font: 500 11.5px/20px var(--display); color: var(--muted); }
.prediction-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; margin-top: 18px; }
.prediction-nav { display: flex; align-items: center; gap: 2px; }
.prediction-nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.prediction-pos { min-width: 52px; text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); }
.prediction { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; align-items: start; min-height: 112px; }
.prediction-year { grid-row: span 2; font: 700 44px/1 var(--display); color: var(--accent); letter-spacing: -0.03em; text-shadow: 0 0 28px color-mix(in srgb, var(--accent) 45%, transparent); }
.prediction blockquote { margin: 2px 0 0; font-size: 18px; line-height: 1.45; max-width: 64ch; }
.prediction figcaption { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.home-panel { padding: 22px 24px; border-radius: 20px; background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.topic-bars, .stage-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; }
.topic-bar { width: 100%; display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr 28px; align-items: center; gap: 12px; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.topic-bar:hover { background: var(--panel-2); }
.topic-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-track { height: 6px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.topic-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.topic-n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage-item { width: 100%; display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 9px 8px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.stage-item:hover { background: var(--panel-2); }
.stage-when { font: 500 12px/1.6 var(--display); color: var(--accent); white-space: nowrap; }
.stage-title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.stage-kind { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- Top bar extras */
.jump { display: inline-flex; align-items: center; gap: 14px; font: inherit; font-size: 13px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 5px 6px 5px 12px; cursor: pointer; }
.jump:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.jump kbd { font: 500 11px/1 var(--font); padding: 4px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--panel-solid); color: var(--muted); }
.theme-btn .swatch { width: 14px; height: 14px; border-radius: 50%; background: conic-gradient(var(--accent), var(--accent-2), var(--accent)); box-shadow: 0 0 10px var(--accent); }

/* ---------------------------------------------------------------- Command palette */
.palette-backdrop { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.palette { width: min(640px, 92vw); border-radius: 18px; background: var(--panel-solid); border: 1px solid var(--border); box-shadow: var(--glow), 0 30px 80px rgba(0, 0, 0, .45); overflow: hidden; animation: palette-in .14s ease-out; }
@keyframes palette-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.palette-input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; font-size: 17px; padding: 18px 20px; }
.palette-input:focus { outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.palette-item.sel { background: var(--accent-soft); }
.palette-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { color: var(--muted); font-size: 12px; }
.palette-kind { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.palette-ask { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.palette-session { background: var(--accent-2); }
.palette-foot { padding: 8px 16px 10px; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- AI thinking orb */
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.orb { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent)); box-shadow: 0 0 14px var(--accent); animation: orb 1.2s linear infinite, orb-pulse 1.8s ease-in-out infinite; }
@keyframes orb { to { transform: rotate(360deg); } }
@keyframes orb-pulse { 50% { box-shadow: 0 0 26px var(--accent-2); } }

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

/* Responsive */
.show-sm { display: none; }
@media (max-width: 860px) {
  .catalogue { grid-template-columns: 1fr; }
  .filters { position: fixed; inset: 60px 0 0 0; z-index: 25; display: none; }
  .filters.open { display: block; }
  .show-sm { display: inline-flex; }
  .hide-sm { display: none; }
  .card { grid-template-columns: 1fr auto; }
  .card .time { grid-column: 1 / -1; }
  .results { padding: 14px; }
  .topbar { gap: 12px; padding: 0 12px; }
  .brand-text { display: none; }
  .charts { grid-template-columns: 1fr; }
  .home-inner { padding: 28px 16px 40px; }
  .home-grid { grid-template-columns: 1fr; }
  .horizon { padding: 20px 16px; }
  .prediction { grid-template-columns: 1fr; }
  .prediction-row { grid-template-columns: 1fr; }
  .prediction-nav { order: -1; justify-self: end; margin-bottom: -8px; }
  .prediction-year { grid-row: auto; font-size: 32px; }
  .theme-btn #theme-name { display: none; }
  .tabs { gap: 0; }
  .topbar > .brand { display: none; }
  .tabs a { padding: 6px 8px; white-space: nowrap; font-size: 13.5px; }
  .topbar-right { gap: 6px; }
  .topbar-right .btn-sm { padding: 5px 8px; white-space: nowrap; }
  .horizon-years span:nth-child(even) { display: none; }
  .horizon-plot { margin: 22px 8px 6px; }
  .pdot { width: 9px; height: 9px; margin-left: -4.5px; }
  .admin-inner { padding: 14px; }
  table.data { display: block; overflow-x: auto; }
}

/* ---------- session recordings ---------- */
.play-disc { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in oklab, var(--accent) 92%, transparent); color: var(--bg); box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 22%, transparent); transition: transform .18s ease, box-shadow .18s ease; }
.play-disc svg { width: 26px; height: 26px; margin-left: 3px; }
.video-dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 5px; font-size: 12px; font-variant-numeric: tabular-nums; background: rgb(0 0 0 / .68); color: #fff; }
.video-poster { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; margin: 14px 0 6px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel-2); cursor: pointer; }
.video-poster img, .stage-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease, filter .3s; }
.video-poster:hover img, .stage-thumb:hover img { transform: scale(1.03); filter: brightness(.85); }
.video-poster:hover .play-disc, .stage-thumb:hover .play-disc { transform: scale(1.08); box-shadow: 0 0 0 10px color-mix(in oklab, var(--accent) 28%, transparent); }
.video-poster:focus-visible, .stage-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage-list li.has-video { display: grid; grid-template-columns: 112px 1fr; gap: 6px; align-items: center; }
.stage-list li.has-video .stage-item { grid-template-columns: 1fr; gap: 2px; }
.stage-thumb { position: relative; display: block; width: 112px; aspect-ratio: 16 / 9; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel-2); cursor: pointer; }
.stage-thumb .play-disc { width: 30px; height: 30px; box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.stage-thumb .play-disc svg { width: 15px; height: 15px; margin-left: 2px; }
.stage-thumb .video-dur { right: 4px; bottom: 4px; font-size: 10.5px; padding: 0 4px; }

.card .badges { display: grid; gap: 6px; justify-items: end; }
.badge-video { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.badge-video svg { width: 13px; height: 13px; }

@media (prefers-reduced-motion: reduce) { .video-poster img, .stage-thumb img, .play-disc { transition: none; } }
@media (max-width: 560px) { .stage-list li.has-video { grid-template-columns: 88px 1fr; } .stage-thumb { width: 88px; } }
