/* ============================================================================
   Voice Cockpit — "NIGHT OPS HUD" (totalt redesign, 2026-07-02)
   Et ægte cockpit: OLED-sort med blueprint-grid, elektrisk cyan som
   system-farve (linjer, signaler, fokus), Hovborg-guldet reserveret til brand
   og primær-handlinger, sigtekorn omkring den gyldne orb, HUD-hjørnebeslag på
   panelerne og terminal-composer med ❯-prompt.
   No-build, CSP-safe (ingen inline styles), WCAG 2.2 AA, reduced-motion.
   ========================================================================== */

/* Self-hosted Geist (CSP-safe, no CDN). See frontend/fonts/. */
@font-face { font-family:"Geist"; src:url("/static/fonts/geist-400.woff2?v=60") format("woff2"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"Geist"; src:url("/static/fonts/geist-500.woff2?v=60") format("woff2"); font-weight:500; font-style:normal; font-display:swap; }
@font-face { font-family:"Geist"; src:url("/static/fonts/geist-600.woff2?v=60") format("woff2"); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:"Geist"; src:url("/static/fonts/geist-700.woff2?v=60") format("woff2"); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:"Geist Mono"; src:url("/static/fonts/geist-mono-400.woff2?v=60") format("woff2"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"Geist Mono"; src:url("/static/fonts/geist-mono-500.woff2?v=60") format("woff2"); font-weight:500; font-style:normal; font-display:swap; }

:root {
  color-scheme: dark;
  /* OLED-sort HUD-canvas */
  --bg: #060608;
  --surface-1: #0c0c10;
  --surface-2: #111117;
  --surface-3: #17171f;
  --surface-glass: rgba(13, 13, 18, .72);
  /* Kanter + toplys */
  --border-subtle: rgba(140, 200, 255, .08);
  --border: rgba(140, 200, 255, .13);
  --border-strong: rgba(140, 200, 255, .22);
  --highlight-top: inset 0 1px 0 rgba(180, 220, 255, .05);
  /* Tekst */
  --text: #eef1f6;
  --text-muted: #9aa3b4;
  --text-faint: #7d8799;
  /* SYSTEM-accent: elektrisk cyan (linjer, fokus, signaler) */
  --accent: #55d6ff;
  --accent-press: #2fc4f6;
  --accent-soft: rgba(85, 214, 255, .14);
  --accent-strong: #9ce8ff;
  /* BRAND-accent: Hovborg-guld (logo, primær-handlinger) */
  --gold: #e8b558;
  --gold-strong: #f6cd7c;
  --gold-soft: rgba(232, 181, 88, .16);
  /* Funktionelle tilstands-hues */
  --listen: #55d6ff;  --listen-soft: rgba(85, 214, 255, .16);   /* cyan   */
  --think:  #b592ff;  --think-soft:  rgba(181, 146, 255, .18);  /* violet */
  --speak:  #4fd6a2;  --speak-soft:  rgba(79, 214, 162, .18);   /* grøn   */
  --warn:   #f2b13d;  --warn-soft:   rgba(242, 177, 61, .16);   /* rav    */
  --danger: #ff7a6b;  --danger-soft: rgba(255, 122, 107, .18);  /* rød    */
  --ok:     #4fd6a2;
  --grad-voice: conic-gradient(from 210deg, #e8b558, #4fd6a2, #55d6ff, #e8b558);
  /* HUD-hjørnebeslag: 8 småstreger malet med background-gradients (genbruges) */
  --bracket-c: rgba(85, 214, 255, .45);
  /* Typografi */
  --font-display: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-ui:      "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  /* Rytme */
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --radius: 12px; --radius-lg: 18px;
  --ease-out:    cubic-bezier(.23,1,.32,1);
  --ease-move:   cubic-bezier(.77,0,.175,1);
  --ease-drawer: cubic-bezier(.32,.72,0,1);
  --ease: cubic-bezier(.23,1,.32,1);
  --dur-press:140ms; --dur-pop:200ms; --dur-panel:320ms;
  --shadow-1: 0 10px 28px rgba(0, 0, 0, .45);
  --shadow-2: 0 28px 70px rgba(0, 0, 0, .65);
  /* Læsekolonnen */
  --column: 880px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
/* HUD-atmosfære: blueprint-grid + kølige glød-lommer + korn. Gridet er så
   svagt at det læses som tekstur, ikke som linjer. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1000px 640px at 50% -14%, rgba(85, 214, 255, .07), transparent 60%),
    radial-gradient(820px 560px at 100% 108%, rgba(181, 146, 255, .05), transparent 58%),
    radial-gradient(700px 480px at -6% 100%, rgba(232, 181, 88, .04), transparent 55%),
    repeating-linear-gradient(0deg, rgba(140, 200, 255, .022) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(140, 200, 255, .022) 0 1px, transparent 1px 44px);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.brand, h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.015em; }
.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
button { cursor: pointer; font-family: inherit; }
.ico { width: 20px; height: 20px; display: block; flex: none; }

/* ---------------------------------------------------------------- login --- */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(1100px 700px at 50% -15%, rgba(85, 214, 255, .08) 0%, transparent 60%),
    radial-gradient(700px 500px at 90% 110%, rgba(181, 146, 255, .06) 0%, transparent 55%),
    repeating-linear-gradient(0deg, rgba(140, 200, 255, .02) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(140, 200, 255, .02) 0 1px, transparent 1px 44px),
    var(--bg);
}
/* HUD-panel med hjørnebeslag (4 hjørner × 2 streger, malet med gradients). */
.card {
  background:
    linear-gradient(to right, var(--bracket-c) 2px, transparent 2px) left 0 top 0 / 16px 2px,
    linear-gradient(to bottom, var(--bracket-c) 2px, transparent 2px) left 0 top 0 / 2px 16px,
    linear-gradient(to left, var(--bracket-c) 2px, transparent 2px) right 0 top 0 / 16px 2px,
    linear-gradient(to bottom, var(--bracket-c) 2px, transparent 2px) right 0 top 0 / 2px 16px,
    linear-gradient(to right, var(--bracket-c) 2px, transparent 2px) left 0 bottom 0 / 16px 2px,
    linear-gradient(to top, var(--bracket-c) 2px, transparent 2px) left 0 bottom 0 / 2px 16px,
    linear-gradient(to left, var(--bracket-c) 2px, transparent 2px) right 0 bottom 0 / 16px 2px,
    linear-gradient(to top, var(--bracket-c) 2px, transparent 2px) right 0 bottom 0 / 2px 16px,
    linear-gradient(180deg, var(--surface-1), var(--bg));
  background-repeat: no-repeat;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 32px 30px; width: min(380px, 92vw); display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-2), 0 0 60px -30px var(--accent), var(--highlight-top);
  animation: fadeUp .5s var(--ease) both;
}
.card h1 { margin: 0; font-size: 22px; text-align: center; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 600; }
.card .muted { text-align: center; margin: 0 0 4px; font-family: var(--font-mono); font-size: 12.5px; }
/* HELE logoet (emblem + Hovborg-navn) — frit-svævende, stort. */
.login-logo { width: min(240px, 60vw); height: auto; margin: 2px auto 6px; display: block;
  filter: drop-shadow(0 0 38px rgba(246, 205, 124, .30)) drop-shadow(0 14px 24px rgba(0, 0, 0, .55)); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
input {
  background: rgba(8, 8, 11, .9); border: 1px solid var(--border-strong); color: var(--text);
  padding: 12px 14px; border-radius: 8px; font-size: 15px; outline: none; width: 100%;
  font-family: var(--font-mono);
}
input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 18px -6px var(--accent); outline: none; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.remember input { width: auto; accent-color: var(--accent); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  color: #221806; border: 0; padding: 13px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  font-family: var(--font-mono);
  box-shadow: 0 10px 26px -12px var(--gold);
  transition: transform .12s var(--ease), filter .2s, box-shadow .2s;
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 12px 30px -12px var(--gold); }
.btn-primary:active { transform: translateY(1px) scale(.99); }

/* ------------------------------------------------------------ app-skelet --- */
#app { display: flex; flex-direction: column; height: 100dvh; min-height: 0; position: relative; }
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.conversation-scroll { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; overscroll-behavior-y: contain; scroll-padding-block: 16px; }
.conversation-scroll > * { flex-shrink: 0; }

.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm);
  background: transparent; color: var(--text-muted); border: 1px solid transparent;
  transition: background .18s, color .18s, border-color .18s, box-shadow .18s; }
.icon-btn:hover { background: var(--surface-2); color: var(--accent-strong); border-color: var(--border);
  box-shadow: 0 0 14px -6px var(--accent); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ico { width: 17px; height: 17px; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------------------------------------------------------- topbar --- */
.statusbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; row-gap: 6px;
  padding: max(9px, env(safe-area-inset-top)) 18px 9px;
  background: linear-gradient(180deg, rgba(13, 13, 18, .95), rgba(7, 7, 10, .92));
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  animation: fadeDown .5s var(--ease-out) both;
}
.statusbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent 4%, rgba(85, 214, 255, .5) 30%, rgba(85, 214, 255, .5) 70%, transparent 96%);
  opacity: .55; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.sb-left { display: flex; align-items: center; gap: 8px; }
.sb-center { flex: 1 1 auto; display: flex; justify-content: center; min-width: 130px; }
.sb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.brand { font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 10px;
  letter-spacing: .16em; text-transform: uppercase; }
.brand::before { content: ""; width: 38px; height: 38px; flex: none;
  background: url("/static/logo-mark.png?v=54") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(246, 205, 124, .45)); }

.mode-segment { display: inline-flex; gap: 2px; background: rgba(8, 8, 11, .8);
  border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.mode-btn { background: transparent; color: var(--text-muted); border: 0;
  padding: 7px 16px; border-radius: 6px; font-size: 12px; font-weight: 600;
  letter-spacing: .10em; text-transform: uppercase; font-family: var(--font-mono);
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .2s, color .2s, box-shadow .2s; }
.mode-btn:hover { color: var(--text); }
.mode-btn[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(85, 214, 255, .35), 0 0 16px -6px var(--accent); }
.seg-ico .ico { width: 15px; height: 15px; }

.project-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  background: rgba(8, 8, 11, .8); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 7px; padding: 6px 12px 6px 9px; font-size: 12.5px; font-family: var(--font-mono);
  transition: color .18s, border-color .18s, background .18s, box-shadow .18s; }
.project-pill:hover { color: var(--text); border-color: var(--border-strong); }
.project-pill.set { color: var(--accent-strong); border-color: rgba(85, 214, 255, .35);
  background: var(--accent-soft); box-shadow: 0 0 16px -8px var(--accent); }
.project-pill .pill-ico .ico { width: 15px; height: 15px; }
.pill-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.conn { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px;
  background: rgba(8, 8, 11, .8); border: 1px solid var(--border); border-radius: 7px;
  font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono);
  letter-spacing: .06em; text-transform: uppercase; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); transition: background .3s, box-shadow .3s; }
.conn.on .conn-dot { background: var(--speak); box-shadow: 0 0 0 3px var(--speak-soft), 0 0 10px -1px var(--speak); }
.conn.err .conn-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.conn.reconnecting .conn-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

.mode-badge { font-size: 10.5px; padding: 4px 10px; border-radius: 7px; background: rgba(8, 8, 11, .8);
  color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap;
  font-family: var(--font-mono); letter-spacing: .05em; }
.mode-badge.danger { color: #ffd9a0; border-color: rgba(242, 177, 61, .35); background: rgba(242, 177, 61, .10); }
.mode-badge.case { color: var(--gold-strong); border-color: rgba(232, 181, 88, .4); background: var(--gold-soft); }
#case-toggle.on { color: var(--gold-strong); border-color: rgba(232, 181, 88, .45); background: var(--gold-soft); }

.voice-select, .engine-select {
  background: rgba(8, 8, 11, .85); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 6px 9px; font-size: 12.5px; max-width: 150px; font-family: var(--font-mono);
}
.tts-voice-select { max-width: 160px; }
.gemini-model-select { width: 192px; max-width: min(192px, 46vw); letter-spacing: 0; }

.banner { padding: 10px 18px; background: rgba(242, 177, 61, .10); color: #ffd9a0; font-size: 14px;
  border-bottom: 1px solid rgba(242, 177, 61, .25); }

/* --------------------------------------------------------------- sidebar --- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 84vw); z-index: 50;
  background: linear-gradient(180deg, var(--surface-1), #08080b);
  border-right: 1px solid var(--border-subtle); box-shadow: var(--shadow-2), var(--highlight-top);
  transform: translateX(-100%); transition: transform .25s var(--ease); overflow-y: auto;
  padding: max(12px, env(safe-area-inset-top)) 12px 16px; display: flex; flex-direction: column; gap: 2px;
}
.sidebar.open { transform: none; }
/* Hele Hovborg-logoet (emblem + navn) øverst i venstremenuen. */
.rail-logo { width: 148px; height: auto; display: block; margin: 10px auto 14px;
  filter: drop-shadow(0 0 24px rgba(246, 205, 124, .28)) drop-shadow(0 8px 16px rgba(0, 0, 0, .5)); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 0 4px; }
.sidebar-head strong { font-size: 11px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--accent); font-weight: 600; font-family: var(--font-mono); }
.sidebar-head-actions { display: flex; gap: 4px; }
.sidebar-group-head { font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-faint); padding: 14px 8px 4px; font-family: var(--font-mono); }
.rail-search { display: flex; align-items: center; gap: 8px; margin: 2px 2px 10px; padding: 8px 11px;
  background: rgba(8, 8, 11, .8); border: 1px solid var(--border); border-radius: 8px; }
.rail-search .ico { width: 16px; height: 16px; color: var(--text-faint); }
.rail-search input { background: transparent; border: 0; padding: 0; color: var(--text); font-size: 13px;
  width: 100%; outline: none; font-family: var(--font-mono); }

.proj-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: transparent; border: 0; border-left: 2px solid transparent;
  color: var(--text-muted); padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.proj-item .ico, .proj-ico .ico { width: 16px; height: 16px; }
.proj-item:hover { background: var(--surface-2); color: var(--text); }
.proj-item.active { background: var(--accent-soft); color: var(--accent-strong);
  border-left-color: var(--accent); border-radius: 3px 6px 6px 3px;
  box-shadow: 0 0 18px -10px var(--accent); }
.proj-item.has-chat::after { content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--speak); box-shadow: 0 0 0 3px var(--speak-soft); margin-left: auto; flex: none; }
.proj-group { font-weight: 600; color: var(--text); margin-top: 2px; }
.proj-caret { display: inline-block; width: 1em; color: var(--text-faint); transition: transform .15s var(--ease); }
.proj-group.expanded .proj-caret { transform: rotate(90deg); }
.proj-leaf { padding-left: 10px; }
.proj-sub-list.collapsed { display: none; }
.proj-sub { padding-left: 26px; }
.proj-whole { font-style: italic; color: var(--text-faint); }
.proj-all { font-weight: 600; color: var(--text); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(0, 0, 0, .6); }
.sidebar-backdrop.hidden { display: none; }

.active-project-card { margin: 0 2px 10px; padding: 11px 12px; border-radius: 8px;
  background: linear-gradient(180deg, rgba(85, 214, 255, .10), rgba(85, 214, 255, .04));
  border: 1px solid rgba(85, 214, 255, .22); box-shadow: 0 0 22px -12px var(--accent);
  display: flex; flex-direction: column; gap: 5px; }
.apc-head { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; min-width: 0; }
.apc-head .ico { width: 15px; height: 15px; color: var(--accent); flex: none; }
.apc-head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.apc-sub { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.apc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.apc-dot.on { background: var(--speak); box-shadow: 0 0 0 3px var(--speak-soft); }
.apc-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.job-item { font-size: 12px; padding: 5px 10px; border-radius: 6px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); }
.job-item.job-running { color: var(--accent-strong); }
.job-item.job-done { color: var(--speak); }
.job-item.job-error { color: var(--danger); }
.job-empty { font-size: 12px; color: var(--text-faint); padding: 4px 10px; }

/* ------------------------------------------------------------ voice-stage --- */
.voice-stage { display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: clamp(14px, 5vh, 44px) 16px 8px; }
.voice-stage[aria-hidden="true"] { display: none; }
.voice-stage > * { animation: fadeUp .6s var(--ease-out) both; }
.voice-stage .orb { animation: orbIn .9s var(--ease-out) both; }
.voice-stage .voice-hint { animation-delay: .08s; }
.voice-stage .voice-modes-wrap { animation-delay: .16s; }
.voice-stage .empty-chips { animation-delay: .24s; }
.empty-chips:empty { display: none; }

/* ONE row under the orb: who answers + options. */
/* z-index: the stage's fadeUp animation leaves every child with a transform (its own stacking
   context), so the later chips row would paint over the popover without this. */
.voice-modes-wrap { position: relative; z-index: 5; display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.voice-modes { display: flex; align-items: center; gap: 8px; }
.assist-seg { display: inline-flex; gap: 2px; background: rgba(8, 8, 11, .82);
  border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg-btn { background: transparent; color: var(--text-muted); border: 0; border-radius: 7px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px;
  transition: background .18s, color .18s, box-shadow .18s; }
.seg-btn .ico { width: 15px; height: 15px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px rgba(85, 214, 255, .28); }
#case-toggle.seg-btn.on { background: var(--gold-soft); color: var(--gold-strong); box-shadow: inset 0 0 0 1px rgba(232, 181, 88, .4); }
#brain-toggle.seg-btn.on { background: var(--think-soft); color: #d3c2ff; box-shadow: inset 0 0 0 1px rgba(181, 146, 255, .35); }
.engine-seg { animation: fadeUp .2s var(--ease-out) both; }
.engine-seg .seg-btn { padding: 7px 11px; font-size: 12px; }
.engine-seg .seg-btn.on { background: var(--think-soft); color: #d3c2ff; box-shadow: inset 0 0 0 1px rgba(181, 146, 255, .35); }
.voice-modes { flex-wrap: wrap; justify-content: center; }
/* Talemodel · stemme button: labelled with the current choice ("GPT-Live 1 · marin"), so the
   models and voices are discoverable instead of hiding behind an anonymous icon. */
.seg-more { padding: 7px 12px; font-family: var(--font-mono); letter-spacing: 0; text-transform: none; }
.seg-more .seg-label { max-width: min(220px, 52vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-more.on { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px rgba(85, 214, 255, .28); }

/* In-flow options: opening them grows the scrollable conversation instead of
   covering controls or escaping behind the composer on short mobile screens. */
.voice-options { position: relative; width: min(420px, 100%); margin-top: 8px;
  z-index: 30; display: grid; gap: 6px; padding: 10px;
  background: rgba(13, 13, 18, .97); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-2); backdrop-filter: blur(14px); animation: fadeUp .18s var(--ease-out) both; }
.voice-options.hidden { display: none; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px;
  padding: 4px 6px; border-radius: 8px; color: var(--text-muted); font-size: 12.5px; }
.opt-row > span:first-child { overflow-wrap: anywhere; }
.opt-row.muted { opacity: .55; }
.opt-select:disabled { cursor: not-allowed; }
.opt-select { flex: 1 1 auto; min-width: 0; max-width: 200px; min-height: 34px; background: rgba(8, 8, 11, .85);
  color: var(--text); border: 1px solid var(--border-strong); border-radius: 7px; padding: 5px 9px;
  font-size: 12.5px; font-family: var(--font-mono); letter-spacing: 0; }
.opt-toggle { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 38px; padding: 6px 8px;
  border-radius: 8px; border: 0; background: transparent; color: var(--text-muted); font-size: 12.5px; text-align: left;
  transition: background .15s, color .15s; }
.opt-toggle:hover { background: var(--surface-2); color: var(--text); }
.opt-toggle .ico { width: 15px; height: 15px; flex: none; }
.opt-toggle .cb-label { flex: 1 1 auto; }
.opt-toggle.on { color: var(--text); }
.opt-toggle:disabled { opacity: .45; cursor: not-allowed; }
.opt-switch { position: relative; width: 34px; height: 20px; flex: none; border-radius: 10px;
  background: rgba(140, 200, 255, .14); border: 1px solid var(--border-strong); transition: background .18s, border-color .18s; }
.opt-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-muted); transition: transform .18s var(--ease-out), background .18s; }
.opt-toggle.on .opt-switch { background: var(--speak-soft); border-color: rgba(79, 214, 162, .45); }
.opt-toggle.on .opt-switch::after { transform: translateX(14px); background: var(--speak); }
.barge-control input[type="range"] { width: 120px; accent-color: var(--accent); cursor: pointer; }
.barge-control.hidden { display: none; }
@keyframes orbIn { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }

.orb { position: relative; flex: none; width: clamp(176px, 28vmin, 248px); height: clamp(176px, 28vmin, 248px);
  display: grid; place-items: center; overflow: visible; margin: 12px 0 20px; }
/* HUD-sigtekorn omkring orben: to modsat-roterende ringe (den gyldne orb er
   hjertet — cyan-ringene er instrumentet der "tracker" den). */
.orb::before { content: ""; position: absolute; inset: -16px; border-radius: 50%;
  border: 1px dashed rgba(85, 214, 255, .35); pointer-events: none;
  animation: reticleSpin 26s linear infinite; }
.orb::after { content: ""; position: absolute; inset: -30px; border-radius: 50%;
  border: 1px solid rgba(85, 214, 255, .12);
  border-top-color: rgba(85, 214, 255, .55); border-bottom-color: rgba(85, 214, 255, .55);
  pointer-events: none; animation: reticleSpin 44s linear infinite reverse; }
@keyframes reticleSpin { to { transform: rotate(360deg); } }
.orb-canvas { position: absolute; inset: -46px; width: calc(100% + 92px); height: calc(100% + 92px);
  display: none; pointer-events: none; }
.orb.has-canvas .orb-canvas { display: block; }
.orb.has-canvas::before, .orb.has-canvas::after { display: none; }
.orb.has-canvas .orb-halo, .orb.has-canvas .orb-ring,
.orb.has-canvas .orb-core, .orb.has-canvas .orb-bars { display: none !important; }
.voice-stage[data-state="speaking"] .orb { cursor: pointer; }
/* CSS-fallback-orb (uden canvas) */
.orb-core { position: absolute; inset: 0; border-radius: 50%;
  background: var(--grad-voice); filter: blur(2px);
  transform: scale(calc(.9 + var(--amp,0) * .18));
  transition: transform .08s linear, opacity .3s var(--ease), background .4s var(--ease);
  animation: orbSpin 9s linear infinite, orbBreathe 4s var(--ease) infinite; opacity: .9; }
.orb-ring { position: absolute; inset: -14px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--gold-soft), transparent 70%);
  transform: scale(calc(1 + var(--amp,0) * .5));
  transition: transform .1s linear, background .3s; filter: blur(6px); }
.orb-halo { position: absolute; inset: -42px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--gold-soft), transparent 70%);
  filter: blur(38px); opacity: calc(.22 + var(--amp,0) * .7); transition: opacity .2s linear, background .4s var(--ease); }
.orb-bars { display: none; gap: 5px; align-items: center; height: 42px; z-index: 1; }
.orb-bars i { width: 5px; border-radius: 3px; height: 14px; background: #0a0a0d;
  transform: scaleY(var(--b,.4)); transform-origin: center; transition: transform .07s linear; }
@keyframes orbSpin { to { transform: rotate(360deg); } }
@keyframes orbBreathe { 0%,100% { filter: blur(2px) brightness(1); } 50% { filter: blur(4px) brightness(1.15); } }
.voice-stage[data-state="idle"] .orb-core { opacity: .55; animation-duration: 14s, 6s; }
.voice-stage[data-state="listening"] .orb-bars,
.voice-stage[data-state="speaking"] .orb-bars { display: flex; }
.voice-stage[data-state="listening"] .orb-halo { background: radial-gradient(closest-side, var(--listen-soft), transparent 70%); }
.voice-stage[data-state="thinking"] .orb-core { background: conic-gradient(from 0deg, var(--think), #d3c2ff, var(--think));
  animation: orbSpin 2.4s linear infinite reverse, orbBreathe 4s var(--ease) infinite; }
.voice-stage[data-state="thinking"] .orb-halo { background: radial-gradient(closest-side, var(--think-soft), transparent 70%); }
.voice-stage[data-state="speaking"] .orb-core { background: conic-gradient(from 0deg, var(--speak), #86eec4, var(--speak)); }
.voice-stage[data-state="speaking"] .orb-halo { background: radial-gradient(closest-side, var(--speak-soft), transparent 70%); opacity: calc(.4 + var(--amp,0) * .6); }
.voice-stage[data-state="reconnecting"] .orb-core, .voice-stage[data-state="error"] .orb-core { filter: saturate(.6) brightness(.95); }
.voice-stage[data-state="reconnecting"] .orb-halo, .voice-stage[data-state="error"] .orb-halo { background: radial-gradient(closest-side, var(--warn-soft), transparent 70%); }
/* Sigtekornet skifter puls med tilstanden */
.voice-stage[data-state="listening"] .orb::before { border-color: rgba(85, 214, 255, .6); animation-duration: 12s; }
.voice-stage[data-state="thinking"] .orb::before { border-color: rgba(181, 146, 255, .55); animation-duration: 7s; }
.voice-stage[data-state="speaking"] .orb::before { border-color: rgba(79, 214, 162, .55); animation-duration: 10s; }

.voice-stage { --presence: var(--accent-strong); }
.voice-stage[data-state="listening"] { --presence: #83dcff; }
.voice-stage[data-state="thinking"] { --presence: #c4a3ff; }
.voice-stage[data-state="speaking"] { --presence: #86eec4; }
.voice-stage[data-state="connecting"], .voice-stage[data-state="reconnecting"] { --presence: #ffcf76; }
.voice-stage[data-state="error"] { --presence: #ffa3a3; }
.voice-presence { display: inline-flex; align-items: center; gap: 9px; padding: 7px 14px;
  color: var(--presence); border: 1px solid color-mix(in srgb, var(--presence) 24%, transparent);
  background: color-mix(in srgb, var(--presence) 7%, #0d1119); border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: .025em; }
.voice-presence-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 10px color-mix(in srgb, var(--presence) 50%, transparent); }
.voice-hint { position: relative; z-index: 1; color: var(--text-muted); margin: -3px 0 3px; min-height: 1.2em;
  font-size: 12.5px; line-height: 1.5; text-align: center; max-width: 34ch; }

.empty-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 2px; max-width: 560px; }
.chip-suggest, .chip-btn, .chip-toggle { background: rgba(10, 10, 14, .8); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 15px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .18s, border-color .18s, color .18s, transform .18s, box-shadow .18s; }
.chip-suggest { padding: 6px 12px; font-size: 12.5px; }
.chip-suggest:hover, .chip-btn:hover { background: var(--surface-2); color: var(--accent-strong);
  border-color: rgba(85, 214, 255, .3); transform: translateY(-2px);
  box-shadow: 0 0 20px -10px var(--accent), var(--shadow-1); }
.chip-btn .ico, .chip-toggle .ico { width: 16px; height: 16px; }
.chip-toggle.on { color: var(--speak); border-color: var(--speak-soft); background: var(--speak-soft); }
.chip-toggle:disabled { opacity: .45; cursor: not-allowed; }
.src-chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 6px; font: 11px var(--font-mono);
  color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; vertical-align: middle; cursor: help; }
.chip-btn.on { color: var(--speak); border-color: var(--speak-soft); }

/* --------------------------------------------------------- skriv-kontrols --- */
.text-panel { display: flex; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--border-subtle);
  background: transparent; align-items: center; flex-wrap: wrap;
  width: 100%; max-width: calc(var(--column) + 36px); margin-inline: auto; }
.text-panel.hidden { display: none; }

.skriv-empty { padding: 26px 16px 10px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.ctx-strip { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ctx-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted);
  background: rgba(10, 10, 14, .8); border: 1px solid var(--border-subtle); border-radius: 7px; padding: 5px 12px;
  font-family: var(--font-mono); letter-spacing: .04em; }
.ctx-item .ico { width: 14px; height: 14px; }
.ctx-access { color: #ffd9a0; }
.suggest-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 640px; }
.suggest-card { background: rgba(10, 10, 14, .8); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 13px 17px; font-size: 14px; text-align: left;
  min-width: 180px; cursor: pointer; transition: border-color .18s, background .18s, transform .18s, box-shadow .18s; }
.suggest-card:hover { border-color: rgba(85, 214, 255, .3); background: var(--surface-2);
  transform: translateY(-2px); box-shadow: 0 0 22px -10px var(--accent), var(--shadow-1); }

/* -------------------------------------------------------------- samtalen --- */
#transcript { flex: 1 0 auto; min-height: 0; overflow: visible;
  width: 100%; padding: 18px clamp(14px, 3vw, 32px) 24px;
  display: flex; flex-direction: column; gap: clamp(14px, 1.4vw, 20px);
  scroll-padding-block: 24px 96px; }
#transcript > * { width: 100%; max-width: var(--column); margin-inline: auto; }
#transcript:empty { padding-block: 0; }

.msg { position: relative; padding: 12px 16px; border-radius: 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; hyphens: auto; line-height: 1.55;
  animation: msgIn .28s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* Bruger: mørk slate-chip med cyan kant, højrestillet i kolonnen */
.msg.user { width: auto !important; max-width: min(76%, 660px) !important;
  margin-left: auto !important; margin-right: calc((100% - min(100%, var(--column))) / 2) !important;
  color: var(--text); line-height: 1.5; text-wrap: pretty; padding: 12px 17px 13px;
  background: linear-gradient(150deg, rgba(85, 214, 255, .10), rgba(22, 26, 34, .94) 50%, rgba(13, 15, 20, .96));
  border: 1px solid rgba(85, 214, 255, .24);
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .35), 0 0 24px -16px var(--accent); }
.msg.user .msg-img { display: block; margin-top: 8px; max-width: 180px; max-height: 180px;
  border-radius: 8px; background: #f2f2f5; }

/* AI: HUD-panel med cyan spine og logo-avatar */
.msg.ai { padding: 15px 20px 16px 54px; line-height: 1.66; text-wrap: pretty; color: var(--text);
  background: linear-gradient(180deg, rgba(15, 16, 22, .88), rgba(8, 8, 11, .72));
  border: 1px solid var(--border-subtle);
  border-radius: 12px 12px 12px 4px;
  box-shadow: inset 2px 0 0 rgba(85, 214, 255, .45), 0 14px 36px rgba(0, 0, 0, .30); }
.msg.ai::before { content: ""; position: absolute; left: 16px; top: 15px; width: 25px; height: 25px;
  background: url("/static/logo-mark.png?v=54") center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(246, 205, 124, .5)); }
.msg.ai.streaming { border-color: rgba(85, 214, 255, .22);
  box-shadow: inset 2px 0 0 rgba(85, 214, 255, .7), 0 14px 36px rgba(0, 0, 0, .30), 0 0 30px -20px var(--accent); }
.msg.ai.streaming::after { content: "▍"; display: inline; margin-left: 1px; color: var(--accent);
  animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.msg.sys { width: auto !important; align-self: center; color: var(--text-faint); font-size: 11px;
  background: transparent; max-width: 92% !important; text-align: center;
  font-family: var(--font-mono); letter-spacing: .05em; padding: 0 10px; }
.msg.image { width: auto !important; max-width: 360px !important; margin-inline: 0 auto !important;
  align-self: flex-start; padding: 0; background: transparent; border: 0; box-shadow: none; }
.chat-image { max-width: 100%; width: 100%; border-radius: 10px; border: 1px solid var(--border-subtle);
  background: #f2f2f5; padding: 8px; display: block; }
.img-cap { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.msg.image.full { max-width: min(100%, 1024px) !important; }
.chat-image { cursor: zoom-in; }
.msg.image.full .chat-image { cursor: zoom-out; }
.img-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.img-act { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; min-height: 32px; border-radius: 7px;
  background: rgba(10, 10, 14, .8); color: var(--text-muted); border: 1px solid var(--border); font-size: 12.5px;
  transition: background .15s, color .15s, border-color .15s; }
.img-act:hover, .img-act:focus-visible { background: var(--surface-2); color: var(--accent-strong); border-color: rgba(85, 214, 255, .3); }
.img-act .ico { width: 14px; height: 14px; }
.img-meta { margin-left: auto; font: 11px var(--font-mono); color: var(--text-faint); }
.msg.sources { color: var(--text-faint); font-size: 12px; background: transparent;
  border-radius: 0; padding: 2px 0 2px 10px; border-left: 2px solid rgba(85, 214, 255, .3); }

.msg-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(140, 200, 255, .08);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); letter-spacing: .08em;
  text-transform: uppercase; }

/* Markdown i AI-svar */
.msg.ai.rendered { white-space: normal; }
.msg.ai.rendered > :first-child { margin-top: 0; }
.msg.ai.rendered > :last-child { margin-bottom: 0; }
.msg.ai.rendered p { margin: .35em 0 .6em; line-height: 1.68; }
.msg.ai.rendered ul, .msg.ai.rendered ol { margin: .45em 0 .62em; padding-left: 1.2em; }
.msg.ai.rendered li { margin: .25em 0; }
.msg.ai.rendered li::marker { color: var(--accent); }
.msg.ai.rendered h1, .msg.ai.rendered h2, .msg.ai.rendered h3, .msg.ai.rendered h4 { margin: .6em 0 .3em; line-height: 1.25; }
.msg.ai.rendered h1 { font-size: 1.3em; } .msg.ai.rendered h2 { font-size: 1.18em; } .msg.ai.rendered h3 { font-size: 1.07em; }
.msg.ai.rendered a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
.msg.ai.rendered img { max-width: 100%; height: auto; border-radius: 10px; margin: .4em 0; display: block; }
.msg.ai.rendered blockquote { margin: .72em 0; padding: .52em .9em; color: var(--text-muted);
  border-left: 3px solid rgba(85, 214, 255, .4); background: rgba(85, 214, 255, .06); border-radius: 0 10px 10px 0; }
.msg.ai.rendered hr { border: 0; border-top: 1px solid var(--border); margin: .8em 0; }
.msg.ai.rendered table { border-collapse: collapse; margin: .5em 0; font-size: .92em; display: block; overflow-x: auto; }
.msg.ai.rendered th, .msg.ai.rendered td { border: 1px solid var(--border-strong); padding: 5px 9px; text-align: left; }
.msg.ai.rendered :not(pre) > code { background: var(--surface-3); padding: .12em .4em; border-radius: 6px;
  font-family: var(--font-mono); font-size: .88em; color: var(--accent-strong); }
.code-wrap { position: relative; margin: .5em 0; }
.msg.ai.rendered pre { background: rgba(4, 4, 6, .9); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; margin: 0; font-size: .86em; line-height: 1.5; }
.msg.ai.rendered pre code { font-family: var(--font-mono); background: transparent; padding: 0; color: #dfe6f0; white-space: pre; }
.code-copy { position: absolute; top: 7px; right: 7px; padding: 3px 9px; font-size: 11px;
  background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border-strong);
  border-radius: 6px; opacity: 0; transition: opacity .15s, background .2s, color .2s; }
.code-wrap:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: var(--accent-soft); color: var(--accent-strong); }
@media (hover: none) { .code-copy { opacity: 1; } }

/* ---------------------------------------------------------- agent-timeline --- */
/* OPS-LOG: arbejdsblokken som HUD-modul med hjørnebeslag. */
.agent-run {
  background:
    linear-gradient(to right, var(--bracket-c) 2px, transparent 2px) left 0 top 0 / 12px 2px,
    linear-gradient(to bottom, var(--bracket-c) 2px, transparent 2px) left 0 top 0 / 2px 12px,
    linear-gradient(to left, var(--bracket-c) 2px, transparent 2px) right 0 top 0 / 12px 2px,
    linear-gradient(to bottom, var(--bracket-c) 2px, transparent 2px) right 0 top 0 / 2px 12px,
    linear-gradient(to right, var(--bracket-c) 2px, transparent 2px) left 0 bottom 0 / 12px 2px,
    linear-gradient(to top, var(--bracket-c) 2px, transparent 2px) left 0 bottom 0 / 2px 12px,
    linear-gradient(to left, var(--bracket-c) 2px, transparent 2px) right 0 bottom 0 / 12px 2px,
    linear-gradient(to top, var(--bracket-c) 2px, transparent 2px) right 0 bottom 0 / 2px 12px,
    linear-gradient(180deg, rgba(13, 14, 19, .85), rgba(7, 7, 10, .65));
  background-repeat: no-repeat;
  border: 1px solid var(--border-subtle); border-radius: 6px;
  overflow: hidden; animation: msgIn .28s var(--ease) both; }
.ar-head { width: 100%; display: flex; align-items: center; gap: 10px; background: transparent; border: 0;
  color: var(--text-muted); padding: 10px 14px; font-size: 11.5px; cursor: pointer;
  font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.ar-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--think); flex: none;
  animation: arPulse 1.6s var(--ease) infinite; }
.agent-run.done .ar-pulse { background: var(--speak); animation: none; }
@keyframes arPulse {
  0% { box-shadow: 0 0 0 0 var(--think-soft); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.ar-title { color: var(--text); font-weight: 500; }
.ar-count { color: var(--text-faint); font-size: 10.5px; }
.ar-timer { margin-left: auto; color: var(--accent); font-size: 11px; min-width: 4ch; text-align: right; }
.ar-caret { color: var(--text-faint); }
.ar-caret .ico { width: 14px; height: 14px; transition: transform .18s var(--ease-out); }
.agent-run.open .ar-caret .ico { transform: rotate(90deg); }
.ar-body { display: none; padding: 2px 14px 12px; border-top: 1px solid var(--border-subtle); }
.agent-run.open .ar-body { display: block; }
.agent-run.done { opacity: .92; }
.ar-think { color: var(--text-faint); font-size: 12.5px; line-height: 1.55; padding: 3px 0 3px 10px;
  border-left: 2px solid rgba(181, 146, 255, .25); margin: 5px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ar-think.depth-1 { color: var(--text-muted); }
.ar-think.depth-2 { color: var(--text-muted); border-left-color: rgba(181, 146, 255, .55); }
.ar-row { display: flex; align-items: center; gap: 9px; padding: 6px 0;
  font-family: var(--font-mono); font-size: 12.5px; min-width: 0; }
.ar-row + .ar-row { border-top: 1px solid rgba(140, 200, 255, .05); }
.ar-ico { width: 16px; height: 16px; display: grid; place-items: center; color: var(--accent); flex: none; }
.ar-ico .ico { width: 14px; height: 14px; }
.ar-row.running .ar-ico { border: 2px solid var(--listen-soft); border-top-color: var(--listen);
  border-radius: 50%; box-sizing: border-box; animation: spin .7s linear infinite; }
.ar-row.running .ar-ico .ico { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.ar-row.done .ar-ico { color: var(--speak); }
.ar-row.err .ar-ico { color: var(--danger); }
.ar-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; flex: none; }
.ar-row.err .ar-name { color: var(--danger); }
.ar-sum { color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ar-time { color: var(--text-faint); font-size: 11px; flex: none; }
.ar-out { margin: 0 0 6px 25px; padding: 6px 9px; background: rgba(4, 4, 6, .8);
  border: 1px solid var(--border-subtle); border-radius: 6px; font-family: var(--font-mono);
  font-size: 11.5px; line-height: 1.45; color: var(--text-faint);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 96px; overflow-y: auto; }

/* ------------------------------------------------ statuslinje + kommandoer --- */
.agent-status { display: inline-flex; align-items: center; gap: 9px; align-self: flex-start;
  padding: 6px 13px; border-radius: 7px; background: rgba(8, 8, 11, .85);
  border: 1px solid var(--border); box-shadow: 0 0 18px -10px var(--accent);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted);
  letter-spacing: .06em; text-transform: uppercase;
  animation: fadeUp .25s var(--ease-out) both; max-width: 100%; }
.as-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--think); flex: none;
  animation: arPulse 1.6s var(--ease) infinite; }
.agent-status[data-kind="run"] .as-dot { background: var(--listen); }
.agent-status[data-kind="speak"] .as-dot { background: var(--speak); }
.as-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.as-timer { color: var(--accent); flex: none; min-width: 3.5ch; text-align: right; }

.cmd-hints { display: flex; flex-direction: column; gap: 2px; align-self: stretch;
  background: rgba(8, 8, 11, .95); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-1), 0 0 24px -14px var(--accent); padding: 6px; }
.cmd-hint { display: flex; align-items: baseline; gap: 10px; background: transparent; border: 0;
  border-radius: 6px; padding: 7px 10px; text-align: left; cursor: pointer; transition: background .15s; min-width: 0; }
.cmd-hint:hover { background: var(--surface-2); }
.ch-cmd { font-family: var(--font-mono); font-size: 13px; color: var(--accent-strong); font-weight: 500; flex: none; }
.ch-hint { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- composer --- */
.composer { display: flex; flex: none; flex-direction: column; gap: 8px; align-items: stretch;
  padding: 8px clamp(14px, 3vw, 32px) max(12px, env(safe-area-inset-bottom));
  width: 100%; max-width: calc(var(--column) + 64px); margin-inline: auto;
  background: transparent; border: 0; position: relative; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
/* Terminal-prompten: kul-sort boks, cyan fokus-glød, ❯ i guld, mono-skrift. */
.composer .text-form { display: flex; align-items: flex-end; gap: 6px; flex: 1; min-width: 0;
  background: linear-gradient(180deg, rgba(9, 9, 12, .96), rgba(5, 5, 8, .98));
  border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(180, 220, 255, .04);
  padding: 6px 6px 6px 13px;
  transition: border-color .18s, box-shadow .18s; }
.composer .text-form:focus-within { border-color: rgba(85, 214, 255, .5);
  box-shadow: var(--shadow-1), 0 0 0 3px var(--accent-soft), 0 0 26px -10px var(--accent); }
.composer .text-form::before { content: "❯"; order: 0; align-self: center;
  font-family: var(--font-mono); font-size: 15px; font-weight: 500;
  color: var(--gold); flex: none; }
#text-input { flex: 1; min-width: 0; resize: none; background: transparent; border: 0; outline: none;
  color: var(--text); font-family: var(--font-mono); font-size: 14.5px; line-height: 1.5;
  padding: 11px 4px; max-height: 150px; caret-color: var(--accent); order: 1; }
#text-input::placeholder { color: var(--text-faint); }
.composer .attach { width: 36px; height: 36px; border-radius: 7px; order: 2; }
.btn-send { width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--gold-strong), var(--gold)); color: #221806;
  border: 0; border-radius: 7px; padding: 0; transition: filter .15s, box-shadow .15s;
  box-shadow: 0 8px 20px -10px var(--gold); order: 3; }
.btn-send:hover { filter: brightness(1.06); box-shadow: 0 10px 24px -10px var(--gold); }
.btn-send .ico { width: 20px; height: 20px; }
.btn-stop { width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  background: rgba(8, 8, 11, .85); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 0; font-size: 17px; line-height: 1;
  transition: filter .15s, background .15s, border-color .15s; }
.btn-stop:hover { background: var(--surface-2); border-color: rgba(255, 122, 107, .4); color: var(--danger); }
.btn-stop:active { transform: scale(.94); }
.mic { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(8, 8, 11, .85); border: 1px solid var(--border-strong); color: var(--text); flex: none;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s, border-color .2s; }
.mic .ico { width: 24px; height: 24px; }
.mic:hover { background: var(--surface-2); border-color: rgba(85, 214, 255, .4);
  box-shadow: 0 0 22px -8px var(--accent); }
.mic:disabled { opacity: .4; cursor: not-allowed; }
.mic.live { background: var(--listen); color: #06202e; animation: micPulse 1.7s var(--ease) infinite; }
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(85, 214, 255, .5); }
  70% { box-shadow: 0 0 0 15px rgba(85, 214, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(85, 214, 255, 0); }
}

.attach-preview { display: flex; align-items: center; gap: 10px; align-self: flex-start;
  max-width: 100%; padding: 6px 10px 6px 6px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; }
.attach-preview.hidden { display: none; }
.attach-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: #f2f2f5; flex: none; }
.attach-preview .ap-name { font-size: 13px; color: var(--text-muted); max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-preview.uploading .ap-name::after { content: " · sender…"; color: var(--accent); }
.attach-preview .ap-remove { display: grid; place-items: center; width: 26px; height: 26px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); flex: none; }
.attach-preview .ap-remove:hover { background: var(--surface-3); color: var(--text); }

.scroll-bottom { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 13px; font-size: 12px;
  font-family: var(--font-mono); box-shadow: var(--shadow-1), 0 0 18px -8px var(--accent); }
.scroll-bottom .ico { width: 14px; height: 14px; }

/* --------------------------------------------------------------- inspektor --- */
.inspector { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 60;
  background: linear-gradient(180deg, var(--surface-1), #08080b);
  border-left: 1px solid var(--border-subtle); box-shadow: var(--shadow-2);
  transform: translateX(100%); transition: transform var(--dur-panel) var(--ease-drawer);
  display: flex; flex-direction: column; }
.inspector.open { transform: none; }
.inspector-head { display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 10px 8px; border-bottom: 1px solid var(--border-subtle); }
.inspector-tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.insp-tab { background: transparent; border: 0; color: var(--text-faint); padding: 7px 11px; font-size: 12px;
  border-radius: 7px; white-space: nowrap; font-family: var(--font-mono); letter-spacing: .04em; }
.insp-tab.active { background: var(--accent-soft); color: var(--accent-strong); }
.inspector-body { flex: 1; overflow-y: auto; padding: 10px; }
.insp-panel { display: flex; flex-direction: column; gap: 6px; }
.insp-panel.hidden { display: none; }
.insp-empty { color: var(--text-faint); font-size: 13px; padding: 8px; }
.trace-row { background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 7px;
  padding: 7px 10px; font-size: 12px; }
.trace-tool { color: var(--text); font-weight: 500; }
.trace-status { color: var(--text-faint); margin-left: 6px; }
.trace-think { color: var(--text-muted); }
.trace-detail { margin: 6px 0 0; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: auto; }
.health-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border-subtle); border-radius: 7px; font-size: 13px; }
.health-dot { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; font-family: var(--font-mono); }
.health-dot.ok { color: var(--speak); background: var(--speak-soft); }
.health-dot.off { color: var(--text-faint); background: var(--surface-3); }
.health-value { max-width: 150px; color: var(--text-muted); font: 11px var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inspector-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, .6); }
.inspector-backdrop.hidden { display: none; }

/* ------------------------------------------------------------------ toasts --- */
.toasts { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-1), 0 0 20px -10px var(--accent); border-radius: 8px; padding: 8px 16px;
  font-size: 13px; font-family: var(--font-mono); animation: toastIn .25s var(--ease-out) both; }
.toast.leaving { animation: toastOut .25s var(--ease-out) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------------- responsivt --- */
@media (min-width: 1200px) {
  #app { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "status status" "rail main" "rail composer"; }
  .statusbar { grid-area: status; }
  .sidebar { grid-area: rail; position: static; transform: none; width: auto; box-shadow: none;
    border-right: 1px solid var(--border-subtle); z-index: auto; }
  #sidebar-close, #sidebar-toggle { display: none; }
  .stage { grid-area: main; }
  .composer { grid-area: composer; }
  .sidebar-backdrop { display: none !important; }
}
@media (min-width: 1600px) { :root { --column: 980px; } }
@media (max-width: 900px) { .mode-badge { display: none; } }
body[data-cockpit-view="cockpit"] .mode-badge { display: none; }
@media (max-width: 620px) {
  .msg { font-size: 16px; }
  .msg.user { max-width: 92% !important; padding: 11px 15px 12px; border-radius: 11px 11px 4px 11px;
    margin-right: 0 !important; }
  .msg.ai { padding: 13px 14px 15px 46px; border-radius: 11px 11px 11px 4px; line-height: 1.58; }
  .msg.ai::before { left: 13px; top: 14px; width: 21px; height: 21px; }
  #transcript { padding-inline: 10px; gap: 13px; }
  .composer { padding-inline: 10px; }
  .rail-logo { width: 128px; }
}
@media (max-width: 520px) {
  .sb-center { order: 3; flex-basis: 100%; }
  .project-pill { max-width: 140px; }
}
@media (max-width: 400px) {
  .conn-label { display: none; }
  .conn { padding: 4px 7px; }
}
@media (max-height: 560px) {
  .voice-stage { padding-top: 8px; gap: 6px; }
  .orb:not(.orb-sm) { width: clamp(96px, 20vmin, 144px); height: clamp(96px, 20vmin, 144px); }
  .orb::after { inset: -18px; }
  .empty-chips { margin-top: 2px; }
  #transcript { gap: 10px; padding-block: 8px 10px; }
  .msg.user { padding-block: 9px 10px; }
  .msg.ai { padding-block: 10px 11px; line-height: 1.52; }
  .agent-status { padding: 4px 11px; font-size: 11px; }
  .ar-head { padding: 8px 12px; }
}

/* --------------------------------------------------------- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .orb-core { animation: none; transform: none; }
  .orb-bars { display: none !important; }
  .orb::before, .orb::after { animation: none !important; }
  body::before { animation: none !important; }
  .ar-pulse, .as-dot { animation: none !important; }
  .ar-row.running .ar-ico { animation: none !important; border-top-color: var(--listen); }
}

/* Kø: beskeder skrevet mens hjernen arbejder — vises straks, sendes efter turen. */
.msg.user.queued { opacity: .55; border-style: dashed; }
.msg.user.queued::after { content: "· i kø"; display: block; margin-top: 4px;
  font-family: var(--font-mono); font-size: 10px; color: var(--accent);
  letter-spacing: .08em; text-transform: uppercase; }

/* Kopiér hele svaret (hover, som code-copy). */
.msg-copy { position: absolute; top: 9px; right: 9px; padding: 3px 9px; font-size: 11px;
  background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border-strong);
  border-radius: 6px; opacity: 0; transition: opacity .15s, background .2s, color .2s; }
.msg.ai:hover .msg-copy, .msg-copy:focus-visible { opacity: 1; }
.msg-copy:hover { background: var(--accent-soft); color: var(--accent-strong); }
@media (hover: none) { .msg-copy { opacity: .8; } }

/* ----------------------------------------------------------- app hub shell --- */
#app.app-shell {
  display: grid;
  grid-template: minmax(0, 1fr) / 88px minmax(0, 1fr);
  grid-template-areas: "nav main";
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.app-nav {
  grid-area: nav; display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: max(14px, env(safe-area-inset-top)) 9px 14px;
  background: linear-gradient(180deg, rgba(15, 15, 20, .98), rgba(7, 7, 10, .98));
  border-right: 1px solid var(--border-subtle); z-index: 20;
}
.nav-logo { width: 52px; height: 52px; object-fit: contain; margin: 0 auto 14px;
  filter: drop-shadow(0 0 18px rgba(232, 181, 88, .24)); }
.app-nav a, .mobile-nav a {
  min-width: 44px; min-height: 48px; display: flex; align-items: center; justify-content: center;
  gap: 5px; color: var(--text-faint); text-decoration: none; border: 1px solid transparent;
  border-radius: 9px; font: 10px/1.15 var(--font-mono); letter-spacing: .02em;
}
.app-nav a { flex-direction: column; text-align: center; padding: 7px 3px; }
.app-nav a .ico, .mobile-nav a .ico { width: 19px; height: 19px; }
.app-nav a:hover, .mobile-nav a:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.app-nav a[aria-current="page"], .mobile-nav a[aria-current="page"] {
  color: var(--gold-strong); background: var(--gold-soft); border-color: rgba(232, 181, 88, .28);
}
.app-main { grid-area: main; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-view { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.cockpit-view { display: flex; flex-direction: column; overflow: hidden; }
.view-placeholder { width: min(1080px, calc(100% - 40px)); margin: auto; padding: 48px 0; }
.view-placeholder h1 { margin: 2px 0 8px; font-size: clamp(28px, 5vw, 54px); }
.view-placeholder p { color: var(--text-muted); }
.view-kicker { margin: 0; color: var(--gold) !important; font: 11px var(--font-mono);
  text-transform: uppercase; letter-spacing: .18em; }
.mobile-nav { display: none; }
.context-strip { display: flex; flex: none; align-items: center; gap: 6px; padding: 5px 12px; overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle); background: rgba(9, 9, 12, .92); scrollbar-width: thin; }
.context-strip > span { min-width: 0; display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 8px;
  border: 1px solid var(--border-subtle); border-radius: 999px; white-space: nowrap; }
.context-strip small { color: var(--text-faint); font: 9px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }
.context-strip strong { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); font: 10px var(--font-mono); }
.brand { color: inherit; text-decoration: none; }

/* The legacy workspace drawer remains on-demand; the new app rail owns desktop navigation. */
@media (min-width: 1200px) {
  #app.app-shell { grid-template: minmax(0, 1fr) / 88px minmax(0, 1fr); grid-template-areas: "nav main"; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(340px, 92vw); z-index: 50;
    transform: translateX(-100%); box-shadow: var(--shadow-2); }
  .sidebar.open { transform: none; }
  #sidebar-close, #sidebar-toggle { display: inline-grid; }
  .stage, .composer, .statusbar { grid-area: auto; }
}

@media (max-width: 759px) {
  #app.app-shell { display: flex; flex-direction: column; padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .app-nav { display: none; }
  .app-main { flex: 1; width: 100%; }
  .mobile-nav {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px;
    padding: 5px 7px max(5px, env(safe-area-inset-bottom));
    background: rgba(8, 8, 11, .97); border-top: 1px solid var(--border-strong);
    backdrop-filter: blur(18px);
  }
  .mobile-nav a { flex-direction: column; min-height: 52px; padding: 5px 2px; }
  .cockpit-view .composer { padding-bottom: 10px; }
  .view-placeholder { width: min(100% - 24px, 680px); padding: 28px 0; }
}

/* The conversation is the product again: Cockpit owns the full shell, while
   Hub and the focused management views retain the newer navigation. */
body[data-cockpit-view="cockpit"] #app.app-shell {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  grid-template-areas: "main";
}
body[data-cockpit-view="cockpit"] .app-nav,
body[data-cockpit-view="cockpit"] .mobile-nav { display: none; }
body[data-cockpit-view="cockpit"] .app-main { width: 100%; }

@media (min-width: 1200px) {
  body[data-cockpit-view="cockpit"] .app-main {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "status status" "context context" "rail cockpit";
  }
  body[data-cockpit-view="cockpit"] .statusbar { grid-area: status; }
  body[data-cockpit-view="cockpit"] .context-strip { grid-area: context; }
  body[data-cockpit-view="cockpit"] .sidebar {
    grid-area: rail; position: static; transform: none; width: auto; height: auto;
    box-shadow: none; border-right: 1px solid var(--border-subtle); z-index: auto;
  }
  body[data-cockpit-view="cockpit"] .cockpit-view { grid-area: cockpit; }
  body[data-cockpit-view="cockpit"] #sidebar-close,
  body[data-cockpit-view="cockpit"] #sidebar-toggle { display: none; }
  body[data-cockpit-view="cockpit"] .sidebar-backdrop { display: none !important; }
}

@media (max-width: 759px) {
  body[data-cockpit-view="cockpit"] #app.app-shell { padding-bottom: 0; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .app-nav { padding-top: 7px; }
  .nav-logo { width: 36px; height: 36px; margin-bottom: 4px; }
  .app-nav a { min-height: 42px; padding-block: 4px; }
}

/* --------------------------------------------------------------- hub view --- */
.hub-view { background: radial-gradient(780px 420px at 20% 0%, rgba(85, 214, 255, .045), transparent 62%); }
.hub-wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 56px; }
.hub-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.hub-hero h1 { margin: 3px 0 4px; font-size: clamp(31px, 4.5vw, 58px); line-height: 1; }
.hub-hero p:not(.view-kicker) { margin: 9px 0 0; color: var(--text-muted); }
.hub-refresh { min-height: 44px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface-1); color: var(--text-muted); font: 11px var(--font-mono); }
.hub-refresh:hover { color: var(--accent-strong); border-color: rgba(85, 214, 255, .38); }
.hub-continue { width: 100%; min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 18px; padding: 18px 22px; text-align: left; color: var(--text); border-radius: 12px;
  border: 1px solid rgba(232, 181, 88, .28); background: linear-gradient(110deg, rgba(232, 181, 88, .14), rgba(17, 17, 23, .94) 48%);
  box-shadow: var(--highlight-top), 0 20px 50px -36px var(--gold); }
.hub-continue:hover { border-color: rgba(232, 181, 88, .5); transform: translateY(-1px); }
.hub-continue span:first-child { display: flex; flex-direction: column; min-width: 0; }
.hub-continue small { color: var(--gold); font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .15em; }
.hub-continue strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(20px, 3vw, 30px); }
.hub-continue > span:last-child { flex: none; color: var(--text-muted); font: 12px var(--font-mono); }
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.hub-panel { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(180deg, rgba(17, 17, 23, .92), rgba(10, 10, 14, .94)); box-shadow: var(--highlight-top); }
.hub-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hub-panel-head h2 { margin: 0; font-size: 16px; }
.hub-panel-head > span { color: var(--text-faint); font: 10px var(--font-mono); }
.hub-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.hub-status-item { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 11px 12px;
  background: rgba(5, 5, 8, .55); border: 1px solid var(--border-subtle); border-radius: 8px; }
.hub-status-item span { color: var(--text-faint); font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; }
.hub-status-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.hub-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hub-actions button, .hub-project-chip, .ui-state-retry { min-height: 44px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); padding: 9px 11px; font: 12px var(--font-mono); }
.hub-actions button:hover, .hub-project-chip:hover, .ui-state-retry:hover { color: var(--gold-strong); border-color: rgba(232, 181, 88, .35); }
.hub-projects { display: flex; flex-wrap: wrap; gap: 8px; }
.hub-project-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-job-row { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 40px; border-top: 1px solid var(--border-subtle); font-size: 12px; }
.hub-job-row:first-child { border-top: 0; }
.hub-job-row > span { color: var(--text-faint); font: 10px var(--font-mono); }
.hub-job-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.hub-stale { display: block; margin-bottom: 7px; color: var(--warn); font: 10px var(--font-mono); }
.hub-conversation-line { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; margin: 0;
  padding: 9px 0; border-top: 1px solid var(--border-subtle); font-size: 13px; }
.hub-conversation-line:first-child { border-top: 0; }
.hub-conversation-line strong { color: var(--text-faint); font: 10px var(--font-mono); text-transform: uppercase; }
.hub-conversation-line span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ui-state { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px;
  border: 1px dashed var(--border); border-radius: 8px; color: var(--text-muted); font-size: 12px; }
.ui-state span { color: var(--text-faint); }
.ui-state-loading strong::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px;
  border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.ui-state-error { border-color: rgba(255, 122, 107, .26); }
.ui-state-stale { border-color: rgba(242, 177, 61, .26); }
.ui-state-retry { margin-top: 6px; }

@media (max-width: 900px) {
  .hub-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 759px) {
  .hub-wrap { width: min(100% - 24px, 680px); padding: 24px 0 36px; }
  .hub-hero { align-items: flex-start; flex-direction: column; gap: 12px; }
  .hub-grid { grid-template-columns: 1fr; }
  .hub-continue { min-height: 82px; padding: 15px; }
}
@media (max-width: 430px) {
  .hub-status-grid, .hub-actions { grid-template-columns: 1fr; }
  .hub-continue > span:last-child { display: none; }
}

/* ---------------------------------------------------------- focused views --- */
.view-wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 56px; }
.view-header { margin-bottom: 22px; }
.view-header h1 { margin: 3px 0 5px; font-size: clamp(30px, 4vw, 52px); }
.view-header p:not(.view-kicker) { margin: 7px 0 0; color: var(--text-muted); }
.view-notice { padding: 11px 14px; border: 1px solid rgba(242, 177, 61, .25); border-radius: 8px;
  background: var(--warn-soft); color: #f6ca77; font: 12px var(--font-mono); }
.view-search { display: flex; flex-direction: column; gap: 6px; margin: 20px 0; }
.view-search > span, .settings-section label > span { color: var(--text-muted); font: 11px var(--font-mono); }
.view-search input { max-width: 560px; }
.view-section { min-width: 0; padding: 18px; margin-bottom: 16px; border: 1px solid var(--border);
  border-radius: 12px; background: linear-gradient(180deg, rgba(17, 17, 23, .92), rgba(10, 10, 14, .94)); box-shadow: var(--highlight-top); }
.view-section > h2 { margin: 0 0 14px; font-size: 16px; }
.project-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.project-group { margin-top: 20px; }
.project-group:first-child { margin-top: 0; }
.project-group h2 { margin: 0 0 8px; color: var(--text-muted); font: 11px var(--font-mono); text-transform: uppercase; letter-spacing: .12em; }
.project-card { min-width: 0; min-height: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 10px 12px; text-align: left; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: 12px var(--font-mono); }
.project-card:hover { color: var(--accent-strong); border-color: rgba(85, 214, 255, .34); }
.project-card.active { color: var(--gold-strong); border-color: rgba(232, 181, 88, .4); background: var(--gold-soft); }
.activity-grid, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.activity-row, .activity-job, .activity-health-row { min-height: 40px; padding: 9px 0; border-top: 1px solid var(--border-subtle); font-size: 12px; }
.activity-row:first-child, .activity-job:first-child, .activity-health-row:first-child { border-top: 0; }
.activity-row { color: var(--text-muted); overflow-wrap: anywhere; }
.activity-job { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 9px; align-items: center; }
.activity-job span { color: var(--text-faint); font: 10px var(--font-mono); }
.activity-job strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-health-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.activity-health-row span { color: var(--text-muted); }
.activity-health-row strong { font: 11px var(--font-mono); }
.settings-section { display: flex; flex-direction: column; gap: 15px; margin: 0; }
.settings-section label { display: flex; flex-direction: column; gap: 6px; }
.settings-section select { min-height: 44px; width: 100%; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 9px 12px; background: var(--surface-2); color: var(--text); font: 13px var(--font-mono); }
.settings-section .setting-check { min-height: 44px; flex-direction: row; align-items: center; gap: 10px; }
.settings-section .setting-check input { width: 18px; height: 18px; accent-color: var(--gold); }
.settings-section .setting-check input:disabled + span { color: var(--text-faint); }
.setting-help { margin: -10px 0 0 28px; color: var(--warn); font: 11px/1.4 var(--font-mono); }
.settings-section input[type="range"] { padding: 0; accent-color: var(--gold); }
.settings-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.settings-tools h2 { margin: 0 0 5px; font-size: 16px; }
.settings-tools p, .settings-reset-note { margin: 0; color: var(--text-muted); font-size: 12px; }
.settings-tool-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.settings-tool-actions button { min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: 12px var(--font-mono); }
.settings-tool-actions button:hover { color: var(--gold-strong); border-color: rgba(232, 181, 88, .35); }
.settings-note { margin: 16px 0; padding: 15px 17px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-muted); }
.settings-note strong { color: var(--text); }
.settings-note p { margin: 5px 0 0; }
.settings-reset { min-height: 44px; padding: 10px 14px; border: 1px solid rgba(255, 122, 107, .3); border-radius: 8px;
  background: var(--danger-soft); color: #ff9d92; font: 12px var(--font-mono); }
.settings-reset:hover { border-color: rgba(255, 122, 107, .55); }
.settings-reset-note { margin-top: 8px; }

/* ------------------------------------------------------ transcript history --- */
.history-dialog { width: min(880px, calc(100vw - 28px)); max-height: min(820px, calc(100dvh - 28px)); padding: 0;
  color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, #111117, #09090d); box-shadow: var(--shadow-2); }
.history-dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(5px); }
.history-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px 13px;
  border-bottom: 1px solid var(--border-subtle); }
.history-dialog-head h2 { margin: 3px 0 0; font-size: 24px; }
.history-retention { margin: 0; padding: 12px 20px; color: var(--text-muted); font-size: 12px; background: rgba(85, 214, 255, .04); }
.history-retention strong { color: var(--text); }
.history-controls { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px; padding: 14px 20px; }
.history-controls label { display: flex; flex-direction: column; gap: 5px; color: var(--text-muted); font: 10px var(--font-mono); }
.history-controls select, .history-controls input { width: 100%; min-height: 42px; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 10px; background: var(--surface-2); color: var(--text); font: 12px var(--font-mono); }
#history-state { padding: 0 20px; }
.history-list { max-height: min(52dvh, 520px); padding: 0 20px 16px; overflow: auto; }
.history-session { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: rgba(5, 5, 8, .38); }
.history-session-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px;
  border-bottom: 1px solid var(--border-subtle); background: rgba(255, 255, 255, .025); }
.history-session-head h3 { margin: 0 0 3px; font-size: 14px; }
.history-session-head span { color: var(--text-faint); font: 10px var(--font-mono); }
.history-local-name { display: inline-block; margin-left: 8px; color: var(--gold); font: 9px var(--font-mono); text-transform: uppercase; }
.history-session-head button, .history-dialog-actions button { min-height: 38px; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface-2); color: var(--text-muted); font: 11px var(--font-mono); }
.history-session-head button:hover, .history-dialog-actions button:hover { color: var(--gold-strong); border-color: rgba(232, 181, 88, .35); }
.history-line { display: grid; grid-template-columns: 70px minmax(0, 1fr) 44px; gap: 10px; padding: 10px 13px;
  border-top: 1px solid var(--border-subtle); }
.history-line:first-of-type { border-top: 0; }
.history-line strong { color: var(--text-faint); font: 10px var(--font-mono); text-transform: uppercase; }
.history-line p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.history-line time { color: var(--text-faint); font: 10px var(--font-mono); text-align: right; }
.history-role-user p { color: var(--text); }
.history-dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--border-subtle); }
.history-dialog-actions span { flex: 1 1 260px; color: var(--text-faint); font-size: 11px; }

@media (max-width: 900px) {
  .project-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 759px) {
  .statusbar { flex: none; padding-inline: 10px; column-gap: 8px; }
  .sb-left { min-width: 0; }
  .brand { font-size: 13px; letter-spacing: .08em; gap: 8px; }
  .brand::before { width: 30px; height: 30px; }
  .sb-right { margin-left: auto; gap: 4px; flex-wrap: nowrap; }
  .sb-right .project-pill, .sb-right .mode-badge, .conn-label { display: none; }
  .sb-right .icon-btn { width: 32px; }
  .conn { padding: 5px 7px; }
  .sb-center { order: 3; flex-basis: 100%; min-width: 0; }
  .context-strip { flex-wrap: nowrap; gap: 4px; scrollbar-width: none; }
  .context-strip > span { flex: 0 0 auto; padding: 3px 6px; }
  .context-strip small { display: none; }
  .context-strip strong { max-width: 120px; font-size: 11px; }
  .view-wrap { width: min(100% - 24px, 680px); padding: 24px 0 36px; }
  .activity-grid, .settings-grid { grid-template-columns: 1fr; gap: 0; }
  .context-strip { padding-inline: 8px; }
  .context-strip strong { max-width: 150px; }
  .settings-tools { align-items: stretch; flex-direction: column; }
  .settings-tool-actions { justify-content: stretch; }
  .settings-tool-actions button { flex: 1 1 150px; }
  .voice-stage { padding-top: 16px; gap: 10px; }
  .voice-stage .orb { width: clamp(112px, 20dvh, 164px); height: clamp(112px, 20dvh, 164px); margin: 12px 0; }
  .voice-modes { gap: 6px; }
  .voice-options { width: 100%; }
  .opt-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .opt-select { width: 100%; max-width: none; }
  .effort-control { flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 460px) {
  .project-card-grid { grid-template-columns: 1fr; }
  .history-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .history-controls { grid-template-columns: 1fr; padding-inline: 12px; }
  .history-dialog-head, .history-retention, .history-dialog-actions { padding-inline: 12px; }
  #history-state, .history-list { padding-inline: 12px; }
  .history-line { grid-template-columns: 52px minmax(0, 1fr); }
  .history-line time { grid-column: 2; text-align: left; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .context-strip { padding-block: 3px; }
  .context-strip > span { padding-block: 3px; }
  .view-wrap, .hub-wrap { padding-top: 16px; }
  .statusbar { min-height: 48px; }
  .composer { padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}

@media (min-width: 600px) and (max-width: 900px) and (max-height: 760px) {
  .hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-grid, .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
.effort-control { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; font-size: 12px; color: var(--text-muted); }
.effort-control select { min-width: 0; max-width: 210px; }
.voice-group-help { margin: 0 0 8px; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
