:root {
  color-scheme: dark;
  /* Design tokens — OLED dark (ui-ux-pro-max design system, 2026-07-13) */
  --bg: #030305;
  --surface: #0c0d13;
  --surface-subtle: #14151e;
  --line: #1e2030;
  --line-strong: #2d3044;
  --text: #f4f4f8;
  --text-secondary: #b8bacb;
  --muted: #8b8ea3;
  /* Brand accent — AI purple + cyan interactions; swap here to rebrand. */
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --accent-text: #a78bfa;      /* links/tekst op donker: 4.5:1+ */
  --accent-weak: rgba(124, 58, 237, 0.16);
  --accent-weak-2: rgba(124, 58, 237, 0.40);
  --accent-ink: #ffffff;
  --cyan: #22d3ee;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.6);
  --glow-accent: 0 0 18px rgba(124, 58, 237, 0.35);
  --card-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
* { box-sizing: border-box; }
html, body { max-width:100%; overflow-x:clip; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 20% -5%, rgba(124, 58, 237, 0.13), transparent 34rem),
    radial-gradient(ellipse at 90% 0%, rgba(34, 211, 238, 0.05), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
}
code, .mono { font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; }
a { color: var(--accent-text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Login view ---------- */
#login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}
#login-view main {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(24, 18, 43, 0.92), rgba(5, 5, 10, 0.97));
  box-shadow: var(--shadow-md), var(--card-sheen);
  padding: clamp(28px, 6vw, 52px);
}
.login-brand-logo {
  width: 116px; height: 116px; display: block; object-fit: contain;
  margin: -10px auto 22px; filter: drop-shadow(0 10px 24px rgba(124, 58, 237, 0.28));
}
#login-view h1 {
  margin: 22px 0 12px;
  font-size: clamp(34px, 7vw, 52px);
  letter-spacing: -0.06em;
  line-height: 0.98;
}
#login-view p { margin: 0; color: var(--text-secondary); max-width: 46ch; }
.login-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}
.login-legal a { color: var(--text-secondary); text-underline-offset: 3px; }
.login-legal a:hover, .login-legal a:focus-visible { color: var(--accent-text); }

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-pill);
  color: var(--success);
  background: rgba(52, 211, 153, 0.08);
  font-weight: 700;
  font-size: 13px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 14px var(--success); }

form { display: grid; gap: 12px; margin-top: 22px; max-width: 420px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent-text); }

button {
  border: 0;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  background: linear-gradient(135deg, #8b5cf6, var(--accent));
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow .18s ease, filter .18s ease;
}
button:hover { background: linear-gradient(135deg, #9d75f8, var(--accent-hover)); box-shadow: var(--glow-accent); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary { background: rgba(255, 255, 255, 0.07); color: var(--text); border: 1px solid var(--line); }
button.secondary:hover { background: rgba(255, 255, 255, 0.12); }
[data-tiktok-oauth] { margin-left: 10px; }
button.sm { padding: 7px 12px; font-size: 13px; }
/* Glow alleen op primaire (accent) knoppen — ghost/utility-knoppen niet laten gloeien */
button.secondary:hover, .modal-close:hover, .chip:hover, .tab:hover, .seg button:hover,
.link-btn:hover, .chat-attach-btn:hover, .chat-mic-btn:hover, .chat-speak:hover,
.chat-ac-item:hover, .graph-zoombar button:hover, .onboard-x:hover, button.notif-item:hover,
.chat-attach-chip .rm:hover { box-shadow: none; }

.notice { margin-top: 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(0, 0, 0, 0.18); font-size: 13px; }
.ok { color: var(--success); }
.bad { color: var(--danger); }
.warn { color: var(--warning); }

/* ---------- App shell (sidebar + main) ---------- */
#app {
  --sidebar-rail: 72px;
  --sidebar-expanded: 250px;
  display: grid; grid-template-columns: var(--sidebar-rail) minmax(0, 1fr); min-height: 100vh;
}

.sidebar {
  position: sticky; top: 0; z-index: 30; align-self: start; width: var(--sidebar-rail); height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 10, 20, 0.92), rgba(3, 3, 6, 0.96));
  backdrop-filter: blur(10px); overflow: hidden;
  transition: width .18s ease, box-shadow .18s ease;
}
.sidebar:hover, .sidebar:has(:focus-visible) {
  width: var(--sidebar-expanded);
  box-shadow: 18px 0 40px rgba(0,0,0,.34);
}
.side-brand { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 0 0 14px; }
.side-brand .logo {
  width: 44px; height: 44px; display: block; object-fit: contain; flex: none;
  filter: drop-shadow(0 4px 10px rgba(124, 58, 237, 0.32));
}
.side-brand .name { min-width: 0; font-weight: 800; letter-spacing: -0.03em; font-size: 15px; line-height: 1.1; white-space: nowrap; }
.side-brand .name small { display: block; margin-top: 3px; color: var(--muted); font-weight: 600; font-size: 11px; line-height: 1.22; letter-spacing: 0; }
.side-brand .agentos-label, .side-brand #side-company-name { display: block; max-width: 164px; overflow: hidden; text-overflow: ellipsis; }

.side-nav {
  display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; scrollbar-width: none;
}
.side-nav::-webkit-scrollbar { width: 0; }
.sidebar:hover .side-nav, .sidebar:has(:focus-visible) .side-nav { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sidebar:hover .side-nav::-webkit-scrollbar, .sidebar:has(:focus-visible) .side-nav::-webkit-scrollbar { width: 5px; }
.sidebar:hover .side-nav::-webkit-scrollbar-thumb, .sidebar:has(:focus-visible) .side-nav::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.nav-group { display:flex; flex:none; width:42px; min-width:42px; flex-direction:column; gap:3px; }
.nav-group:not(:first-child) { margin-top:7px; padding-top:8px; border-top:1px solid rgba(255,255,255,.055); }
.nav-group:not(:has(a:not(.hidden))) { display:none; }
.nav-group-label {
  width:220px; height:13px; margin:0 11px 3px; overflow:hidden;
  color:var(--muted); font-size:8px; font-weight:800; line-height:13px; letter-spacing:.13em; text-transform:uppercase; white-space:nowrap;
  opacity:0; transform:translateX(-5px); pointer-events:none;
  transition:opacity .12s ease, transform .16s ease;
}
.sidebar:hover .nav-group, .sidebar:has(:focus-visible) .nav-group { width:220px; min-width:220px; }
.sidebar:hover .nav-group-label, .sidebar:has(:focus-visible) .nav-group-label { opacity:.72; transform:translateX(0); }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  width: 42px; min-width: 42px; min-height: 40px; padding: 9px 11px; border-radius: var(--radius-md);
  color: var(--text-secondary); text-decoration: none; font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; white-space: nowrap;
  transition: width .18s ease, background .12s, color .12s, border-color .12s;
}
.sidebar:hover .side-nav a, .sidebar:has(:focus-visible) .side-nav a { width: 220px; min-width: 220px; }
.side-nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.side-brand .name, .side-nav .nav-label, .side-nav .nav-private, .side-action-label {
  opacity: 0; transform: translateX(-5px); pointer-events: none;
  transition: opacity .12s ease, transform .16s ease;
}
.sidebar:hover .side-brand .name, .sidebar:has(:focus-visible) .side-brand .name,
.sidebar:hover .side-nav .nav-label, .sidebar:has(:focus-visible) .side-nav .nav-label,
.sidebar:hover .side-nav .nav-private, .sidebar:has(:focus-visible) .side-nav .nav-private,
.sidebar:hover .side-action-label, .sidebar:has(:focus-visible) .side-action-label {
  opacity: 1; transform: translateX(0); pointer-events: auto;
}
.side-nav a:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.side-nav a { position: relative; }
.side-nav a.active { background: var(--accent-weak); color: var(--text); border-color: var(--accent-weak-2); }
.side-nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--accent-hover), var(--cyan));
  box-shadow: var(--glow-accent);
}
.side-nav a.active svg { opacity: 1; color: var(--accent-text); }
.side-nav .nav-badge { margin-left: auto; font-size: 11px; color: var(--warning); font-weight: 700; }
.sidebar:not(:hover):not(:has(:focus-visible)) .side-nav .nav-badge:not(:empty) {
  position: absolute; top: 6px; left: 32px; width: 7px; height: 7px; overflow: hidden;
  color: transparent; background: var(--warning); border: 1px solid var(--surface); border-radius: 50%;
}

.side-spacer { display: none; }
.side-foot { display: flex; flex: none; width: 100%; min-width: 0; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.agent-pill {
  display: none; width:220px; min-width:220px; flex-direction: column; gap: 3px; padding: 9px 11px;
  border-radius: var(--radius-md); border: 1px solid var(--line); background: rgba(0,0,0,0.22); font-size: 11.5px;
}
.agent-pill strong { color: var(--warning); font-size: 12px; }
.agent-pill .agent-sub { color: var(--muted); font-size: 11px; line-height: 1.4; }
.side-user { display:none; width:220px; min-width:220px; font-size: 11.5px; color: var(--muted); line-height: 1.5; word-break: break-word; }
.side-user .side-company { color:var(--text); font-size:12px; }
.sidebar:hover .agent-pill { display:flex; }
.sidebar:hover .side-user { display:block; }
@supports selector(:has(*)) {
  .sidebar:has(:focus-visible) .agent-pill { display:flex; }
  .sidebar:has(:focus-visible) .side-user { display:block; }
}
.sidebar:not(:hover):not(:has(:focus-visible)) .side-action-label { display: none; }
.side-action { width: 100%; min-height: 36px; flex: none; white-space: nowrap; overflow: hidden; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 32px; border-bottom: 1px solid var(--line); flex-wrap: nowrap;
  background: rgba(3, 3, 5, 0.78); backdrop-filter: blur(10px);
}
.support-mode-banner { position:sticky; top:0; z-index:30; display:flex; align-items:center; justify-content:space-between; gap:18px; margin:0; padding:13px 16px; border:1px solid color-mix(in srgb,var(--warning) 65%,var(--line)); border-radius:0; background:color-mix(in srgb,var(--warning) 15%,var(--surface)); box-shadow:0 10px 28px rgba(0,0,0,.16); }
:root.support-mode-active .topbar { position:relative; }
.support-mode-copy { display:grid; gap:3px; min-width:0; }
.support-mode-kicker { color:var(--warning); font-size:9px; font-weight:900; letter-spacing:.14em; }
.support-mode-copy strong { color:var(--text); font-size:12px; }
.support-mode-copy > span:not(.support-mode-kicker),.support-mode-copy small { overflow:hidden; color:var(--text-secondary); font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
#support-mode-exit { flex:none; border-color:color-mix(in srgb,var(--warning) 75%,var(--line)); background:var(--warning); color:#16130a; }
.topbar-title { display:flex; align-items:center; gap:12px; flex:none; min-width:0; }
.topbar .page-title { font-size: 19px; font-weight: 750; letter-spacing: -0.02em; }
.topbar .top-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:nowrap; min-width:0; margin-left:auto; }
.company-field,.workspace-field { min-width:0; display:flex; grid-template-columns:none; flex-direction:row; align-items:center; gap:8px; margin:0; }
.workspace-field { color:var(--muted); }
.workspace-field select { width:auto; min-width:150px; min-height:44px; padding:7px 28px 7px 10px; }
.company-field { padding:4px 5px 4px 10px; border:1px solid rgba(167,139,250,.28); border-radius:12px; background:rgba(124,58,237,.09); }
.company-field::before { content:""; flex:none; width:7px; height:7px; border-radius:50%; background:var(--accent-text); box-shadow:0 0 0 4px rgba(167,139,250,.1); }
.company-field select { width:auto; min-width:180px; min-height:44px; max-width:260px; padding:6px 28px 6px 8px; border:0; background:transparent; color:var(--text); font-size:12px; font-weight:750; box-shadow:none; }
.company-field select:focus-visible { outline:2px solid var(--accent-text); outline-offset:2px; }
.company-field select:disabled { opacity:1; cursor:default; }
.more-wrap { position: relative; display: inline-flex; }
.topbar .more-toggle { display:none; font-size:18px; line-height:1; padding:7px 10px; }
.more-menu { display: inline-flex; align-items: center; gap: 10px; }
.more-action-label { display:none; }
.more-shortcut { opacity:.7; }
.topbar .icon-btn { min-height:44px; }
.topbar .icon-btn:not(#quick-new-task) { min-width:44px; justify-content:center; }
.content { padding: 24px 32px; max-width: 1720px; width: 100%; margin: 0 auto; }
/* On large monitors, let the content actually use the screen (grids reflow
   into more columns) instead of staying stuck in a narrow left-hung column. */
@media (min-width: 1800px) { .content { max-width: min(94vw, 2400px); } }

section.block { margin-top: 28px; }
section.block:first-child { margin-top: 0; }
.page > .block:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.section-head .count { color: var(--muted); font-size: 13px; font-weight: 500; }
.ov-h { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; color: var(--text-secondary); margin: 30px 0 12px; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- Overview: KPI tiles + nav cards ---------- */
.kpi-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-subtle), var(--surface));
  padding: 16px; box-shadow: var(--shadow-sm), var(--card-sheen); min-height: 92px;
}
.kpi .num { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; width: fit-content;
  background: linear-gradient(180deg, var(--text) 35%, var(--accent-text)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi .lbl { color: var(--text-secondary); font-size: 12.5px; margin-top: 4px; }
.kpi .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.kpi.attn { border-color: rgba(251,191,36,0.5); background: rgba(251,191,36,0.06); }
.kpi.attn .num { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--warning); }

.attention-strip {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-lg);
  border: 1px solid rgba(251,191,36,0.45); background: rgba(251,191,36,0.07);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.attention-strip strong { color: var(--warning); margin-right: 4px; }

.navcards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.navcard {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  padding: 16px; box-shadow: var(--shadow-sm), var(--card-sheen); transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
}
.navcard:hover { transform: translateY(-2px); border-color: var(--accent-weak-2); background: var(--surface-subtle); box-shadow: var(--shadow-md), var(--card-sheen); }
.navcard .nc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.navcard .nc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent-text); }
.navcard .nc-ic svg { width: 19px; height: 19px; }
.navcard .nc-count { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.navcard .nc-title { font-weight: 700; margin-top: 12px; font-size: 15px; }
.navcard .nc-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 16px; box-shadow: var(--shadow-sm), var(--card-sheen);
}
.card.attention { border-color: rgba(251, 191, 36, 0.5); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-title { font-size: 15px; font-weight: 650; }
.card-meta { color: var(--muted); font-size: 12px; }
.card-prompt { color: var(--text-secondary); font-size: 13px; margin: 10px 0 0; max-height: 4.4em; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
/* status colors (35_design_system.md) */
.st-queued   { color: #cbd5e1; background: rgba(148,163,184,0.14); border-color: rgba(148,163,184,0.3); }
.st-approved,
.st-planning,
.st-running  { color: #93c5fd; background: rgba(96,165,250,0.14); border-color: rgba(96,165,250,0.35); }
.st-completed{ color: #6ee7b7; background: rgba(52,211,153,0.14); border-color: rgba(52,211,153,0.35); }
.st-failed,
.st-blocked  { color: #fca5a5; background: rgba(248,113,113,0.14); border-color: rgba(248,113,113,0.35); }
.risk-approval { color: #fcd34d; background: rgba(251,191,36,0.14); border-color: rgba(251,191,36,0.4); }
.loop-badge { color: #c4b5fd; background: rgba(139,92,246,0.14); border-color: rgba(167,139,250,0.35); }

/* External agent badges: claude = brand purple, codex = cyan (external-agent-worktrees D2). */
.agent-badge.agent-claude { color: #c4b5fd; background: var(--accent-weak); border-color: var(--accent-weak-2); }
.agent-badge.agent-codex { color: var(--cyan); background: rgba(34,211,238,0.12); border-color: rgba(34,211,238,0.4); }
.agent-badge svg { width: 12px; height: 12px; vertical-align: -2px; }

/* "Agents aan het werk" panel rows. */
.agents-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid rgba(148,163,184,0.12);
}
.agents-row:last-child { border-bottom: none; }
.agents-title { font-weight: 600; }
.agents-branch { font-size: 12px; color: #94a3b8; }
.agents-meta { font-size: 12px; color: #94a3b8; margin-left: auto; }
.agents-log {
  flex-basis: 100%; font-size: 11px; color: #7d8aa0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Live agent-run log in the task modal (D3). */
.run-log-head { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.run-log-follow { font-size: 12px; color: #94a3b8; display: inline-flex; align-items: center; gap: 6px; }
.run-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.5; color: #cbd5e1;
  background: rgba(2, 6, 23, 0.6); border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px; padding: 12px; max-height: 420px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.mini-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.mini-table th, .mini-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid rgba(148,163,184,0.18); }
.mini-table th { color: #94a3b8; font-weight: 600; }
.mini-table td { color: #cbd5e1; }

/* Knowledge graph — a focused, cinematic topology workspace. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.graph-page-head { align-items: flex-end; margin-bottom: 20px; }
.graph-page-head > div { max-width: 680px; }
.graph-page-head h2 { margin-top: 5px; font-size: clamp(24px, 3vw, 34px); font-weight: 760; letter-spacing: -0.045em; }
.graph-page-head p { margin: 7px 0 0; color: var(--text-secondary); font-size: 13.5px; }
.graph-eyebrow { color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.graph-rebuild { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.graph-rebuild svg { width: 15px; height: 15px; }
.graph-shell { position: relative; padding: 0; overflow: hidden; border-color: rgba(38,145,255,.2); border-radius: 20px;
  background: #020306;
  box-shadow: 0 26px 70px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.055); }
.graph-shell::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; z-index: 2;
  background: linear-gradient(90deg, transparent 8%, rgba(30,113,255,.72), rgba(101,222,255,.76), rgba(240,199,169,.56), transparent 92%); }
.graph-toolbar { min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid rgba(148,163,184,.09); background: rgba(3,5,9,.94); flex-wrap: wrap; }
.graph-searchbox { position: relative; flex: 1 1 330px; max-width: 560px; }
.graph-searchbox > svg { position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.graph-searchbox input[type="search"] { width: 100%; min-width: 0; height: 42px; padding: 9px 42px 9px 39px;
  border-color: rgba(148,163,184,.16); border-radius: 12px; background: rgba(0,0,0,.28); }
.graph-searchbox input[type="search"]:focus { background: rgba(3,7,13,.92); border-color: rgba(68,196,255,.72); }
.graph-searchbox kbd { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); min-width: 22px; height: 22px;
  display: grid; place-items: center; border: 1px solid var(--line-strong); border-bottom-color: rgba(255,255,255,.22);
  border-radius: 6px; background: rgba(255,255,255,.045); color: var(--muted); font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1; }
.graph-search-info { min-width: 92px; color: var(--accent-text); font: 650 11px/1.3 "JetBrains Mono", SFMono-Regular, Consolas, monospace; }
.graph-drag-hint { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.graph-drag-hint svg { width: 15px; height: 15px; }
.graph-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-height: 52px; margin: 0; padding: 10px 16px;
  border-bottom: 1px solid rgba(148,163,184,.1); color: var(--muted); font-size: 11.5px; }
.graph-legend .legend-item { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
  padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(148,163,184,.13); background: rgba(255,255,255,.025);
  transition: color .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease, transform .18s ease; }
.graph-legend .legend-item:hover { color: var(--text); border-color: var(--legend-color); background: color-mix(in srgb, var(--legend-color) 10%, transparent); transform: translateY(-1px); }
.graph-legend .legend-item:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.graph-legend .legend-item.off { opacity: .4; background: transparent; }
.graph-legend .legend-item.off i { background: transparent !important; box-shadow: none !important; }
.graph-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--legend-color);
  box-shadow: 0 0 9px color-mix(in srgb, var(--legend-color) 75%, transparent); }
.graph-legend b { min-width: 18px; padding: 1px 5px; border-radius: 999px; background: rgba(255,255,255,.055); color: var(--text-secondary);
  font: 700 9.5px/1.5 "JetBrains Mono", SFMono-Regular, Consolas, monospace; text-align: center; }
.graph-wrap { position: relative; width: 100%; height: 560px; border: 0; border-radius: 0; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 51%, rgba(17,91,205,.11) 0, rgba(2,17,45,.08) 24%, transparent 54%),
    radial-gradient(ellipse at 50% 51%, #020408 0, #010204 56%, #000 100%); }
.graph-wrap::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 34%, rgba(0,0,0,.72) 100%); }
#graph-svg { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#graph-svg.panning { cursor: grabbing; }
#graph-svg .graph-vector-layer { pointer-events: none; }
#graph-svg .graph-vector-path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#graph-svg .graph-atmosphere-vector { stroke: url(#graph-atmosphere-gradient); }
#graph-svg .graph-edge-cool { stroke: url(#graph-fibre-cool); }
#graph-svg .graph-edge-warm,
#graph-svg .graph-plume-warm { stroke: url(#graph-fibre-warm); }
#graph-svg .graph-particles-vector { fill: var(--particle-color); stroke: none; }
#graph-svg .graph-focus-vector { opacity: 0; transition: opacity .14s ease; }
#graph-svg.has-node-focus .graph-focus-vector { opacity: .94; }
#graph-svg .node-group { --node-color: #94a3b8; cursor: grab; outline: none; transition: opacity .18s ease; }
#graph-svg .node-group:active { cursor: grabbing; }
#graph-svg .node-hit { fill: transparent; pointer-events: all; }
#graph-svg .node-aura { fill: var(--node-color); opacity: .055; transform-origin: center; transition: opacity .18s ease, transform .18s ease; }
#graph-svg .node-project .node-aura { fill: url(#graph-core-gradient); opacity: .92; }
#graph-svg .node-point { fill: var(--node-color); stroke: rgba(255,255,255,.78); stroke-width: .55; cursor: inherit;
  transition: stroke-width .18s ease, opacity .18s ease; }
#graph-svg .node-spark { fill: #fff; opacity: .94; pointer-events: none; }
#graph-svg .label { fill: #e7f6ff; font-size: 10.5px; font-weight: 620; letter-spacing: .01em; pointer-events: none; opacity: 0;
  paint-order: stroke; stroke: rgba(3,4,8,.94); stroke-width: 3px; stroke-linejoin: round; transition: opacity .18s ease, fill .18s ease; }
#graph-svg .node-project .label { opacity: .72; }
#graph-svg .node-group:hover .node-aura,
#graph-svg .node-group:focus-visible .node-aura,
#graph-svg .node-group.is-focus .node-aura { opacity: .42; transform: scale(1.35); }
#graph-svg .node-project:hover .node-aura,
#graph-svg .node-project:focus-visible .node-aura,
#graph-svg .node-project.is-focus .node-aura { opacity: 1; }
#graph-svg .node-group:hover .node-point,
#graph-svg .node-group:focus-visible .node-point,
#graph-svg .node-group.is-focus .node-point { stroke: #fff; stroke-width: 1.25; }
#graph-svg .node-group:hover .label,
#graph-svg .node-group:focus-visible .label,
#graph-svg .node-group.is-focus .label { fill: #fff; opacity: 1; font-weight: 700; }
#graph-svg.has-node-focus .node-group.is-muted { opacity: .16; }
#graph-svg.is-searching .node-group:not(.match) { opacity: .11; }
#graph-svg .node-group.match .node-aura { opacity: .7; transform: scale(1.45); }
#graph-svg .node-group.match .node-point { stroke: #fff; stroke-width: 1.6; }
#graph-svg .node-group.match .label { fill: #fff; opacity: 1; font-weight: 750; }
.graph-live-badge { position: absolute; top: 14px; left: 14px; z-index: 2; min-height: 32px; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 9px; border: 1px solid rgba(148,163,184,.13); border-radius: 999px; background: rgba(7,8,14,.72);
  box-shadow: 0 8px 24px rgba(0,0,0,.22); backdrop-filter: blur(12px); color: var(--text-secondary); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
.graph-live-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 9px var(--success); }
.graph-live-badge b { margin-left: 2px; color: var(--text); font: 750 10px/1 "JetBrains Mono", SFMono-Regular, Consolas, monospace; }
.graph-zoombar { position: absolute; top: 14px; right: 14px; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.graph-zoombar button { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 1px solid rgba(148,163,184,.15);
  border-radius: 12px; background: rgba(7,8,14,.72); color: var(--text-secondary); box-shadow: 0 8px 24px rgba(0,0,0,.2); backdrop-filter: blur(12px);
  transition: transform .18s ease, color .18s ease, border-color .18s ease, background .18s ease; }
.graph-zoombar button:hover { background: rgba(25,24,38,.92); border-color: rgba(167,139,250,.55); color: #fff; transform: translateY(-1px); }
.graph-zoombar button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.graph-zoombar button svg { width: 16px; height: 16px; }
.graph-inspector { position: absolute; left: 16px; bottom: 16px; z-index: 3; max-width: min(420px, calc(100% - 32px)); min-height: 58px;
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 10px 12px;
  border: 1px solid rgba(148,163,184,.16); border-radius: 14px; background: rgba(8,9,15,.82); backdrop-filter: blur(16px);
  box-shadow: 0 18px 38px rgba(0,0,0,.36); opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .18s ease, transform .18s cubic-bezier(.16,1,.3,1); }
.graph-inspector.visible { opacity: 1; transform: translateY(0); }
.graph-inspector-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--inspector-color, var(--accent-text));
  box-shadow: 0 0 14px var(--inspector-color, var(--accent-text)); }
.graph-inspector div { min-width: 0; display: grid; gap: 1px; }
.graph-inspector div span { color: var(--muted); font-size: 9.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
.graph-inspector strong { overflow: hidden; color: var(--text); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.graph-inspector-links { color: var(--text-secondary); font: 650 10px/1.3 "JetBrains Mono", SFMono-Regular, Consolas, monospace; white-space: nowrap; }
.graph-footer { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px;
  border-top: 1px solid rgba(148,163,184,.09); background: rgba(3,5,9,.94); }
.graph-footer p { margin: 0; }
.graph-footer-tip { flex: none; color: var(--muted); font-size: 10.5px; }
.graph-empty { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; padding: 20px; background: rgba(6,7,12,.72); backdrop-filter: blur(8px); }

.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 28px; text-align: center; color: var(--muted); }
.empty strong { color: var(--text); display: block; margin-bottom: 6px; }

/* Shared bounded-list pagination for media and workspace libraries. */
.content-pagination { grid-column:1/-1; width:100%; display:flex; align-items:center; justify-content:space-between; gap:14px; min-height:58px; padding:8px 10px 8px 14px; border:1px solid var(--line); border-radius:13px; background:color-mix(in srgb,var(--surface) 92%,var(--accent) 8%); }
.content-pagination-summary { flex:none; color:var(--muted); font-size:11px; font-weight:650; }
.content-pagination-controls,.content-pagination-pages { display:flex; align-items:center; gap:5px; min-width:0; }
.content-pagination-controls > button,.content-pagination-pages button { min-width:44px; min-height:44px; padding:7px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface-subtle); color:var(--text-secondary); font-size:11px; font-weight:750; box-shadow:none; }
.content-pagination-pages button { padding-inline:8px; }
.content-pagination-controls > button:hover:not(:disabled),.content-pagination-pages button:hover:not(:disabled),.content-pagination-pages button.active { transform:none; border-color:color-mix(in srgb,var(--accent) 58%,var(--line)); background:var(--accent-weak); color:var(--accent-text); box-shadow:none; }
.content-pagination-controls button:disabled { opacity:.38; cursor:not-allowed; }
.content-pagination-current { min-width:94px; color:var(--text-secondary); font-size:11px; font-weight:750; text-align:center; }
.content-pagination-ellipsis { display:grid; place-items:center; min-width:22px; color:var(--muted); }

.create-form { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-subtle); padding: 18px; margin-top: 0; }
.create-form .row { display: grid; gap: 12px; grid-template-columns: 2fr 1fr; }
@media (max-width: 640px) { .create-form .row { grid-template-columns: 1fr; } }
.create-form form { max-width: none; margin-top: 0; }

.knowledge-review { margin-top:32px; padding-top:24px; border-top:1px solid var(--line); }
.knowledge-review-head p { margin:4px 0 0; color:var(--text-secondary); max-width:680px; }
.knowledge-layout { display:grid; grid-template-columns:minmax(280px,.85fr) minmax(320px,1.15fr); gap:16px; align-items:start; }
.knowledge-compose { display:grid; gap:8px; }
.knowledge-compose label { color:var(--text-secondary); font-size:12px; font-weight:700; }
.knowledge-compose textarea { resize:vertical; min-height:150px; }
.knowledge-subtitle { margin:0 0 10px; font-size:14px; }
.knowledge-batches { display:grid; gap:8px; }
.knowledge-batch { width:100%; display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 14px; text-align:left; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface); color:var(--text); }
.knowledge-batch:hover, .knowledge-batch.active { border-color:var(--accent); background:var(--surface-subtle); }
.knowledge-batch span { display:grid; gap:3px; }
.knowledge-batch small { color:var(--text-secondary); }
.knowledge-proposals { margin-top:16px; border:1px solid var(--line); border-radius:var(--radius-lg); padding:16px; background:var(--surface-subtle); }
.knowledge-proposal-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.knowledge-proposal { padding:13px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface); min-width:0; }
.knowledge-proposal h4 { margin:0 0 7px; font-size:13px; overflow-wrap:anywhere; }
.knowledge-proposal p { margin:5px 0; color:var(--text-secondary); font-size:12px; overflow-wrap:anywhere; }
.knowledge-evidence { padding:8px; border-left:2px solid var(--accent); background:var(--surface-subtle); font-size:11px; color:var(--text-secondary); margin-top:8px; }
.knowledge-warning { color:var(--warning, #b45309) !important; font-weight:700; }
.knowledge-actions { display:flex; gap:7px; flex-wrap:wrap; margin-top:10px; }
.knowledge-review-actions { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
@media (max-width: 860px) { .knowledge-layout, .knowledge-proposal-grid { grid-template-columns:1fr; } }
.form-msg { font-size: 13px; margin-top: 4px; }

/* ---------- Information Library ---------- */
.library-head { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; margin-bottom:20px; }
.library-head h2 { margin:4px 0 6px; font-size:34px; letter-spacing:-.035em; }
.library-head p { margin:0; max-width:720px; color:var(--text-secondary); }
.library-head-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.library-head-actions button { min-height:44px; }
.library-dropzone { display:grid; gap:4px; margin:-6px 0 16px; padding:18px; border:1px dashed var(--line-strong); border-radius:var(--radius-lg); background:var(--surface-subtle); color:var(--text-secondary); cursor:pointer; transition:border-color .16s ease,background .16s ease; }
.library-dropzone strong { color:var(--text); }
.library-dropzone:hover,.library-dropzone:focus-visible,.library-dropzone.dragging { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 8%,var(--surface-subtle)); outline:none; }
.library-paste { display:grid; grid-template-columns:minmax(180px,.55fr) minmax(300px,1.45fr); gap:12px; align-items:end; margin-bottom:16px; padding:18px; border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-subtle); }
.library-paste label { display:grid; gap:6px; color:var(--text-secondary); font-size:12px; font-weight:700; }
.library-paste-source { grid-row:span 2; }
.library-paste textarea { min-height:148px; resize:vertical; }
.library-toolbar { display:grid; grid-template-columns:minmax(260px,1fr) repeat(3,minmax(130px,.32fr)) auto; gap:8px; margin-bottom:12px; }
.library-toolbar input,.library-toolbar select,.library-toolbar button { min-height:44px; }
.library-search input { width:100%; }
.library-collection-bar { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:11px 13px; margin-bottom:8px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.library-collection-bar > span { display:grid; gap:2px; }
.library-collection-bar small { color:var(--text-secondary); }
.library-collection-bar form { display:flex; gap:7px; }
.library-collection-bar input,.library-collection-bar button { min-height:44px; }
.library-results { overflow:hidden; border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); }
.library-results > .content-pagination { border-width:1px 0 0; border-radius:0; background:var(--surface-subtle); }
.library-visual-section { display:grid; gap:14px; padding:18px; border-bottom:1px solid var(--line); background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 4%,var(--surface)),var(--surface)); }
.library-visual-section > header { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; }
.library-visual-section h3 { margin:3px 0 0; font-size:18px; letter-spacing:-.02em; }
.library-visual-section > header > small { color:var(--text-secondary); font-size:11px; }
.library-visual-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:12px; }
.library-visual-card { min-width:0; min-height:44px; display:grid; grid-template-rows:auto auto; gap:0; overflow:hidden; padding:0; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); color:var(--text); text-align:left; box-shadow:none; }
.library-visual-card:hover { transform:none; border-color:color-mix(in srgb,var(--accent) 52%,var(--line)); background:color-mix(in srgb,var(--accent) 5%,var(--surface-subtle)); box-shadow:0 12px 28px rgba(0,0,0,.18); }
.library-visual-card:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.library-visual-thumb { position:relative; display:grid; place-items:center; aspect-ratio:4/3; overflow:hidden; background:color-mix(in srgb,var(--surface-subtle) 68%,#05070b); }
.library-visual-thumb img { width:100%; height:100%; display:block; object-fit:cover; transition:transform .18s ease; }
.library-visual-card:hover .library-visual-thumb img { transform:scale(1.015); }
.library-visual-thumb.is-unavailable::after { content:"Preview unavailable"; padding:10px; color:var(--text-secondary); font-size:11px; text-align:center; }
.library-visual-copy { min-width:0; display:grid; gap:3px; padding:11px 12px 12px; border-top:1px solid var(--line); }
.library-visual-copy strong,.library-visual-copy small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.library-visual-copy strong { font-size:13px; }
.library-visual-copy small { color:var(--text-secondary); font-size:10px; }
.library-table-head,.library-row { display:grid; grid-template-columns:minmax(240px,1.5fr) minmax(120px,.55fr) minmax(130px,.55fr) minmax(110px,.4fr) 38px; align-items:center; gap:14px; padding:12px 15px; }
.library-table-head { min-height:44px; color:var(--text-secondary); font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; background:var(--surface-subtle); border-bottom:1px solid var(--line); }
.library-row { width:100%; min-height:68px; border:0; border-bottom:1px solid var(--line); border-radius:0; box-shadow:none; color:var(--text); background:transparent; text-align:left; }
.library-row:last-child { border-bottom:0; }
.library-row:hover { transform:none; background:var(--surface-subtle); box-shadow:none; }
.library-row-main { min-width:0; display:grid; gap:4px; }
.library-row-main strong,.library-row-main small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.library-row-main small,.library-row-meta { color:var(--text-secondary); font-size:12px; }
.library-row-tags { display:flex; gap:5px; flex-wrap:wrap; }
.library-tag { display:inline-flex; padding:2px 7px; border:1px solid var(--accent-weak-2); border-radius:99px; background:var(--accent-weak); color:var(--text-secondary); font-size:10px; }
.library-status { display:inline-flex; align-items:center; width:max-content; gap:6px; font-size:12px; text-transform:capitalize; }
.library-status::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--success); }
.library-status.archived::before { background:var(--muted); }
.library-row-arrow { color:var(--muted); font-size:20px; text-align:right; }
.library-results > .empty { margin:14px; }
.memory-library-link { color:var(--text-secondary); font-size:13px; }
.memory-library-link a { color:var(--accent-text); }
.library-drawer-backdrop { position:fixed; inset:0; z-index:80; display:flex; justify-content:flex-end; background:rgba(3,6,12,.68); }
.library-drawer { width:min(560px,100vw); height:100%; display:flex; flex-direction:column; border-left:1px solid var(--line-strong); background:var(--surface); box-shadow:var(--shadow-md); }
.library-drawer.library-image-active { width:min(900px,100vw); }
.library-drawer > header { flex:0 0 auto; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:20px; border-bottom:1px solid var(--line); }
.library-drawer h2 { margin:4px 0 0; font-size:22px; }
.library-drawer-close { flex:0 0 48px; width:48px!important; height:48px!important; min-height:48px!important; padding:0; font-size:25px; }
.library-drawer-body { flex:1; overflow:auto; padding:20px; }

/* ---------- Transparent Research ---------- */
.research-head { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; margin-bottom:20px; }
.research-head h2 { margin:5px 0 7px; font-size:clamp(24px,3vw,36px); }
.research-head p { margin:0; max-width:720px; color:var(--muted); }
.research-create { display:grid; grid-template-columns:minmax(0,2fr) minmax(220px,1fr) auto; gap:12px; align-items:end; margin-bottom:18px; padding:18px; border:1px solid var(--line); border-radius:18px; background:var(--surface); }
.research-create label { display:grid; gap:7px; }
.research-toolbar { display:flex; align-items:end; gap:12px; margin-bottom:14px; }
.research-toolbar label { display:grid; gap:5px; color:var(--muted); font-size:12px; }
.research-toolbar .form-msg { margin-left:auto; }
.research-results { display:grid; gap:10px; }
.research-session-card { width:100%; min-height:96px; display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:20px; text-align:left; padding:18px 20px; border:1px solid var(--line); border-radius:16px; background:linear-gradient(145deg,var(--surface),rgba(124,92,255,.035)); color:inherit; }
.research-session-card:hover { border-color:rgba(150,119,255,.55); transform:translateY(-1px); }
.research-session-card > span:first-child { display:grid; gap:5px; min-width:0; }
.research-session-card strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; }
.research-session-card small,.research-session-card time { color:var(--muted); font-size:12px; }
.research-session-facts { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.research-session-facts em { font-style:normal; color:var(--muted); font-size:12px; }
.research-badge { display:inline-flex; align-items:center; min-height:24px; padding:3px 8px; border:1px solid var(--line); border-radius:999px; color:var(--muted); background:rgba(255,255,255,.025); font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.research-badge.ready,.research-badge.verified,.research-badge.high { color:#7ee2ad; border-color:rgba(70,190,130,.35); background:rgba(36,150,98,.1); }
.research-badge.medium,.research-badge.active { color:#b9a8ff; border-color:rgba(150,119,255,.38); background:rgba(124,92,255,.11); }
.research-badge.blocked,.research-badge.unverified,.research-badge.conflicted,.research-badge.low,.research-badge.needs_evidence { color:#ffb4aa; border-color:rgba(255,106,92,.36); background:rgba(255,106,92,.09); }
.research-badge.assumption,.research-badge.not_applicable { color:#f4cd78; border-color:rgba(220,170,70,.35); background:rgba(220,170,70,.08); }
.research-drawer-backdrop { position:fixed; inset:0; z-index:84; display:flex; justify-content:flex-end; background:rgba(3,6,12,.72); }
.research-drawer { width:min(720px,100vw); height:100%; display:flex; flex-direction:column; border-left:1px solid var(--line-strong); background:var(--surface); box-shadow:var(--shadow-md); }
.research-drawer > header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:20px; border-bottom:1px solid var(--line); }
.research-drawer h2 { margin:4px 0 0; }
.research-drawer-close { width:48px!important; height:48px!important; min-height:48px!important; padding:0; font-size:25px; }
.research-drawer-body { flex:1; overflow:auto; padding:22px; display:grid; align-content:start; gap:22px; }
.research-detail-intent { padding:18px; border:1px solid rgba(150,119,255,.25); border-radius:16px; background:rgba(124,92,255,.06); }
.research-detail-intent h3 { margin:7px 0; line-height:1.35; }
.research-detail-intent p { margin:0; color:var(--muted); font-size:12px; }
.research-summary-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.research-summary-grid > div { min-height:88px; display:flex; flex-direction:column; justify-content:center; gap:5px; padding:14px; border:1px solid var(--line); border-radius:14px; }
.research-summary-grid strong { font-size:24px; }
.research-summary-grid small { color:var(--muted); }
.research-warning { padding:14px 16px; border:1px solid rgba(255,106,92,.35); border-radius:14px; background:rgba(255,106,92,.08); color:var(--muted); }
.research-warning strong { display:block; margin-bottom:4px; color:#ffb4aa; }
.research-claims,.research-sources { display:grid; gap:10px; }
.research-claim,.research-sources article { padding:15px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.018); }
.research-claim header,.research-sources header { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.research-claim p,.research-sources p { line-height:1.55; white-space:pre-wrap; }
.research-claim small,.research-sources small { color:var(--muted); }
.research-claim ul { margin:10px 0 0; padding-left:18px; color:var(--muted); }
.research-sources a { display:inline-flex; margin-top:10px; font-size:12px; }
@media (max-width:760px) {
  .research-head { display:grid; }
  .research-create { grid-template-columns:1fr; }
  .research-session-card { grid-template-columns:1fr; gap:10px; }
  .research-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .research-drawer { width:100vw; border-left:0; }
  .research-drawer-body { padding:15px; }
}
.library-detail-form { display:grid; gap:12px; }
.library-detail-form label { display:grid; gap:6px; color:var(--text-secondary); font-size:12px; font-weight:700; }
.library-detail-facts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:4px 0; }
.library-detail-facts div { padding:10px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.library-detail-facts small,.library-detail-facts strong { display:block; overflow-wrap:anywhere; }
.library-detail-facts small { color:var(--text-secondary); margin-bottom:3px; }
.library-preview { max-height:320px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; padding:14px; border:1px solid var(--line); border-radius:var(--radius-md); background:rgba(0,0,0,.16); font:12px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace; }
.library-image-viewer { min-width:0; display:grid; gap:10px; margin-bottom:4px; }
.library-image-stage { position:relative; min-height:300px; max-height:min(64vh,720px); display:grid; place-items:center; overflow:hidden; border:1px solid var(--line); border-radius:var(--radius-lg); background:#07090f; }
.library-image-stage > img { display:block; width:100%; height:auto; max-height:min(64vh,720px); object-fit:contain; }
.library-image-nav { position:absolute; z-index:1; top:50%; width:48px!important; height:48px!important; min-height:48px!important; display:grid; place-items:center; padding:0; border:1px solid rgba(255,255,255,.22); border-radius:50%; background:rgba(7,9,15,.78); color:#fff; transform:translateY(-50%); backdrop-filter:blur(8px); }
.library-image-nav:hover { transform:translateY(-50%); border-color:rgba(255,255,255,.48); background:rgba(7,9,15,.92); }
.library-image-nav:focus-visible { outline:2px solid #fff; outline-offset:3px; }
.library-image-nav:disabled { opacity:.32; cursor:not-allowed; }
.library-image-nav.previous { left:14px; }
.library-image-nav.next { right:14px; }
.library-image-nav svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.library-image-caption { min-width:0; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.library-image-caption > span { min-width:0; display:grid; gap:3px; }
.library-image-caption strong,.library-image-caption small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.library-image-caption small { color:var(--text-secondary); font-size:11px; }
.library-image-caption .button { flex:0 0 auto; min-height:44px; }
.library-image-description { margin:0; padding:12px 14px; border-left:2px solid var(--accent); background:var(--surface-subtle); color:var(--text-secondary); font-size:12px; line-height:1.55; }
.library-archive-tree { max-height:360px; overflow:auto; margin-top:8px; padding:8px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.library-archive-entry { display:grid; grid-template-columns:1fr auto; gap:10px; min-height:30px; align-items:center; padding:4px 7px; border-bottom:1px solid var(--line); font:12px/1.35 ui-monospace,SFMono-Regular,Menlo,monospace; }
.library-archive-entry:last-child { border-bottom:0; }
.library-archive-entry span:first-child { overflow-wrap:anywhere; }
.library-archive-entry small { color:var(--muted); }
.library-delete { border-color:var(--danger)!important; color:var(--danger)!important; }
.library-drawer-actions { display:flex; gap:8px; flex-wrap:wrap; }
.library-drawer-actions button,.library-drawer-actions a { min-height:44px; }
.library-versions { display:grid; gap:7px; margin-top:8px; }
.library-version { display:flex; justify-content:space-between; gap:10px; padding:9px; border-top:1px solid var(--line); color:var(--text-secondary); font-size:12px; }
.library-version > span:first-child { display:grid; gap:2px; min-width:0; }
.library-version small { color:var(--muted); overflow-wrap:anywhere; }

@media (max-width:900px) {
  .library-head { flex-direction:column; }
  .library-head-actions { width:100%; justify-content:flex-start; }
  .library-toolbar { grid-template-columns:1fr 1fr; }
  .library-search { grid-column:1/-1; }
  .library-table-head { display:none; }
  .library-row { grid-template-columns:1fr auto; gap:8px; padding:14px; }
  .library-row > .library-row-meta,.library-row > .library-status,.library-row > .library-row-tags { grid-column:1; }
  .library-row-arrow { grid-column:2; grid-row:1/5; align-self:center; }
}
@media (max-width:620px) {
  .library-head h2 { font-size:30px; }
  .library-head-actions,.library-head-actions button { width:100%; }
  .library-paste,.library-toolbar { grid-template-columns:1fr; }
  .library-paste-source,.library-search { grid-column:auto; grid-row:auto; }
  .library-collection-bar { align-items:stretch; flex-direction:column; }
  .library-collection-bar form,.library-collection-bar input { width:100%; }
  .library-collection-bar button { flex:0 0 auto; }
  .library-drawer { width:100vw; border-left:0; }
  .library-drawer-body { padding:15px; }
  .library-visual-section { padding:14px; }
  .library-visual-section > header { align-items:flex-start; }
  .library-visual-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .library-visual-copy { padding:9px; }
  .library-image-stage { min-height:220px; max-height:54vh; }
  .library-image-stage > img { max-height:54vh; }
  .library-image-nav { top:auto; bottom:12px; transform:none; }
  .library-image-nav:hover { transform:none; }
  .library-image-caption { align-items:stretch; flex-direction:column; }
  .library-image-caption .button { width:100%; }
  .library-detail-facts { grid-template-columns:1fr; }
  .content-pagination { align-items:stretch; flex-direction:column; padding:10px; }
  .content-pagination-summary { text-align:center; }
  .content-pagination-controls { width:100%; justify-content:space-between; overflow-x:auto; scrollbar-width:none; }
  .content-pagination-controls::-webkit-scrollbar { display:none; }
  .content-pagination-controls > button span { display:none; }
  .content-pagination-pages { flex:none; }
}

/* Chat command center correction: compact, readable and evidence-led. */
.chat-command-head { min-height:68px; justify-content:flex-start; gap:9px; padding:10px 14px; }
.chat-history-toggle { flex:none; }
.chat-agent-picker { min-width:0; flex:1 1 250px; max-width:320px; }
.chat-agent-trigger { width:100%; min-width:0; min-height:46px; grid-template-columns:32px minmax(0,1fr) 16px; padding:6px 10px; }
.chat-agent-copy { gap:1px; }
.chat-agent-copy small,.chat-model-copy small { font-size:10px; line-height:1.2; }
.chat-agent-copy strong,.chat-model-copy strong { font-size:12px; }
.chat-agent-copy em { color:var(--muted); font-size:11px; }
.chat-agent-menu-head { gap:5px; padding:10px; }
.chat-agent-menu-head strong { font-size:13px; }
.chat-agent-menu-head small { font-size:11px; }
.chat-agent-search { min-height:42px; display:grid; grid-template-columns:18px minmax(0,1fr); align-items:center; gap:8px; margin-top:5px; padding:0 11px; border:1px solid var(--line); border-radius:10px; background:var(--surface-subtle); }
.chat-agent-search:focus-within { border-color:rgba(167,139,250,.55); box-shadow:0 0 0 3px rgba(124,58,237,.08); }
.chat-agent-search svg { width:17px; height:17px; color:var(--muted); }
.chat-agent-search input { width:100%; min-width:0; padding:0; border:0; outline:0; color:var(--text); background:transparent; font:inherit; font-size:12px; box-shadow:none; }
.chat-agent-group { padding:13px 10px 6px; font-size:10px; }
.chat-agent-option { min-height:58px; }
.chat-agent-option-copy strong { font-size:12px; }
.chat-agent-option-copy small { font-size:11px; }
.chat-agent-option b { font-size:10px; }
.chat-model-trigger { min-width:166px; min-height:46px; }
.chat-model-menu-head span { font-size:12px; }
.chat-model-menu-head small,.chat-model-option-copy small,.chat-model-option-copy em { font-size:11px; }
.chat-model-option-copy strong { font-size:12px; }
.chat-model-menu [role="option"] > b { font-size:10px; }
.chat-runtime { min-width:0; max-width:205px; padding:8px 10px; }
.chat-runtime strong { font-size:11px; }
.chat-runtime small { font-size:10px; }
.chat-team-trigger { min-width:76px; min-height:46px; justify-content:center; }
.chat-team-trigger span,.chat-team-trigger i { font-size:11px; }
.chat-team-head small { font-size:10px; }
.chat-team-intro { font-size:11px; }
.chat-team-card { padding:12px; }
.chat-team-card-head strong { font-size:12px; }
.chat-team-card-head span,.chat-team-card-copy > small,.chat-team-missions li,.chat-team-missions em { font-size:10.5px; }
.chat-model-settings-open { width:100%; min-height:52px; display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:14px; padding:9px 11px; border:1px solid var(--line); border-radius:12px; color:var(--text); background:var(--surface-subtle); box-shadow:none; text-align:left; }
.chat-model-settings-open:hover,.chat-model-settings-open:focus-visible { border-color:rgba(167,139,250,.45); background:rgba(124,58,237,.08); box-shadow:none; }
.chat-model-settings-open > span { display:grid; gap:2px; }
.chat-model-settings-open strong { font-size:12px; }
.chat-model-settings-open small { color:var(--muted); font-size:11px; }
.chat-model-settings-open svg { width:18px; height:18px; color:var(--muted); }
.chat-model-policy-dialog { width:min(720px,calc(100vw - 28px)); max-height:min(760px,calc(100dvh - 28px)); padding:0; overflow:hidden; border:1px solid var(--line-strong); border-radius:18px; color:var(--text); background:color-mix(in srgb,var(--surface) 98%,#111827 2%); box-shadow:0 30px 100px rgba(0,0,0,.62); }
.chat-model-policy-dialog::backdrop { background:rgba(2,3,6,.72); backdrop-filter:blur(4px); }
.chat-model-policy-head { display:flex; align-items:center; justify-content:space-between; gap:16px; min-height:72px; padding:14px 18px; border-bottom:1px solid var(--line); }
.chat-model-policy-head > span { display:grid; gap:2px; }
.chat-model-policy-head small { color:var(--accent-text); font-size:10px; font-weight:800; letter-spacing:.13em; }
.chat-model-policy-head strong { font-size:17px; }
.chat-model-policy-head button { width:44px; height:44px; display:grid; place-items:center; padding:0; border:1px solid var(--line); border-radius:11px; color:var(--muted); background:transparent; box-shadow:none; }
.chat-model-policy-head svg { width:18px; height:18px; }
.chat-model-policy-dialog > p { margin:0; padding:14px 18px; color:var(--muted); font-size:12px; line-height:1.55; }
.chat-model-policy-list { max-height:calc(100dvh - 190px); display:grid; gap:7px; padding:0 14px 16px; overflow:auto; }
.chat-model-policy-row { min-height:58px; display:grid; grid-template-columns:34px minmax(120px,1fr) minmax(145px,190px) 58px; align-items:center; gap:10px; padding:9px 10px; border:1px solid var(--line); border-radius:12px; background:var(--surface-subtle); }
.chat-model-policy-row > span:nth-child(2) { min-width:0; display:grid; gap:2px; }
.chat-model-policy-row strong { font-size:12px; }
.chat-model-policy-row small { overflow:hidden; color:var(--muted); font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.chat-model-policy-row select { min-height:40px; font-size:11px; }
.chat-model-policy-row button { min-height:40px; padding:7px 10px; border:1px solid var(--line); border-radius:9px; color:var(--text-secondary); background:transparent; box-shadow:none; font-size:11px; }
.chat-model-policy-row button:disabled { opacity:.38; }

@media (max-width:1100px) {
  .chat-runtime { display:none; }
  .chat-agent-picker { max-width:none; }
}
@media (max-width:700px) {
  .chat-command-head { gap:7px; padding:9px 10px; }
  .chat-agent-picker { flex:1 1 auto; }
  .chat-agent-trigger { min-width:0; }
  .chat-model-trigger { min-width:122px; }
  .chat-model-copy small { display:none; }
  .chat-model-icon { display:none; }
  .chat-model-trigger { grid-template-columns:minmax(0,1fr) 14px; }
  .chat-model-policy-row { grid-template-columns:32px minmax(0,1fr) 52px; }
  .chat-model-policy-row select { grid-column:2 / 4; width:100%; }
  .chat-agent-option b { display:none; }
}

/* ---------- Template Studio ---------- */
.content.template-route {
  max-width:none;
  margin-inline:0;
}
.template-studio { display:grid; gap:16px; min-width:0; }
.template-studio-head {
  display:flex; align-items:flex-end; justify-content:space-between; gap:24px;
  padding:24px 26px; border:1px solid var(--line); border-radius:18px;
  background:
    radial-gradient(circle at 88% 0, rgba(124,58,237,.2), transparent 24rem),
    linear-gradient(135deg, rgba(18,18,27,.98), rgba(7,7,12,.98));
  box-shadow:var(--card-sheen);
}
.template-studio-head > div:first-child { max-width:760px; }
.template-kicker { display:block; margin-bottom:8px; color:var(--accent-text); font-size:10px; font-weight:800; letter-spacing:.15em; }
.template-studio-head h2 { margin:0; font-size:clamp(27px,3.2vw,42px); line-height:1.05; letter-spacing:-.045em; }
.template-studio-head p { margin:10px 0 0; max-width:68ch; color:var(--text-secondary); }
.template-head-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.template-head-actions button { min-height:44px; }
.template-toolbar {
  display:flex; align-items:end; gap:10px; padding:10px 12px;
  border:1px solid var(--line); border-radius:14px; background:rgba(12,13,19,.88);
}
.template-toolbar > label:not(.template-search) { display:grid; gap:5px; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.04em; }
.template-toolbar select { min-height:40px; min-width:145px; }
.template-search { position:relative; flex:1; min-width:220px; }
.template-search svg { position:absolute; top:12px; left:13px; width:17px; height:17px; fill:none; stroke:var(--muted); stroke-width:1.8; pointer-events:none; }
.template-search input { width:100%; min-height:42px; padding-left:40px; }
.template-result-count { margin:0 6px 10px auto; white-space:nowrap; color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.template-view-toggle { display:flex; align-items:center; gap:2px; margin-bottom:1px; padding:3px; border:1px solid var(--line); border-radius:9px; }
.template-view-toggle button { min-height:32px; padding:5px 8px; border:0; background:transparent; color:var(--muted); font-size:9px; }
.template-view-toggle button.active { background:var(--surface-subtle); color:var(--text); }
.template-workspace {
  display:grid; grid-template-columns:220px minmax(260px,320px) minmax(520px,1fr);
  min-height:680px; overflow:hidden; border:1px solid var(--line); border-radius:18px;
  background:rgba(6,6,10,.94); box-shadow:var(--shadow-sm),var(--card-sheen);
}
.template-folders,.template-library { border-right:1px solid var(--line); background:rgba(12,13,19,.84); }
.template-folders { display:flex; flex-direction:column; min-width:0; }
.template-folders > header { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:68px; padding:13px 14px; border-bottom:1px solid var(--line); }
.template-folders > header span,.template-folders > header strong { display:block; }
.template-folders > header span { color:var(--muted); font-size:9px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.template-folders > header strong { margin-top:2px; font-size:14px; }
.template-folders > header button { min-width:48px; min-height:40px; padding:7px 10px; }
.template-folder-tree { flex:1; min-height:0; overflow:auto; padding:8px; }
.template-folder-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; border-radius:9px; }
.template-folder-row:hover,.template-folder-row.active { background:rgba(124,58,237,.12); }
.template-folder-select { display:flex; align-items:center; gap:8px; min-width:0; min-height:42px; padding:8px 9px; border:0; background:transparent; color:var(--text-secondary); text-align:left; cursor:pointer; }
.template-folder-row .template-folder-select { padding-left:calc(9px + var(--template-folder-depth,0) * 13px); }
.template-folder-row.drag-over { outline:1px solid var(--accent); background:rgba(124,58,237,.2); }
.template-folder-select svg { flex:0 0 16px; width:16px; fill:none; stroke:currentColor; stroke-width:1.8; }
.template-folder-select span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; font-weight:650; }
.template-folder-row.active .template-folder-select { color:var(--text); }
.template-folder-actions { display:none; align-items:center; gap:2px; padding-right:4px; }
.template-folder-row:hover .template-folder-actions,.template-folder-row:focus-within .template-folder-actions { display:flex; }
.template-folder-actions button { min-height:30px; padding:4px 6px; border:0; background:transparent; color:var(--muted); font-size:9px; }
.template-folder-actions button:hover { color:var(--text); }
.template-folders > footer { padding:14px; border-top:1px solid var(--line); }
.template-folders > footer span { display:block; color:var(--success); font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.template-folders > footer small { display:block; margin-top:5px; color:var(--muted); font-size:9px; line-height:1.45; }
.template-library { min-width:0; overflow:auto; }
.template-catalog { display:grid; align-content:start; gap:6px; min-height:100%; padding:8px; }
.template-catalog[data-view="grid"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
.template-catalog[data-view="grid"] .template-card { grid-template-columns:36px minmax(0,1fr); min-height:132px; }
.template-catalog[data-view="grid"] .template-state { grid-column:1/-1; justify-self:start; }
.template-catalog[data-view="grid"] .template-load-more,.template-catalog[data-view="grid"] .template-empty { grid-column:1/-1; }
.template-card {
  display:grid; grid-template-columns:36px minmax(0,1fr) auto; align-items:start; gap:10px;
  width:100%; min-height:84px; padding:11px; border:1px solid transparent; border-radius:11px;
  background:transparent; color:var(--text); text-align:left; cursor:pointer; transition:background .18s ease,border-color .18s ease;
}
.template-card:hover { border-color:var(--line); background:rgba(255,255,255,.025); }
.template-card.active { border-color:rgba(124,58,237,.58); background:rgba(124,58,237,.12); }
.template-card-mark { display:grid; place-items:center; width:36px; height:36px; border:1px solid var(--line); border-radius:9px; background:#090a10; color:var(--accent-text); font:700 10px/1 monospace; }
.template-card-copy { min-width:0; }
.template-card-copy strong,.template-card-copy small,.template-card-copy span { display:block; }
.template-card-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.template-card-copy small { display:-webkit-box; margin-top:4px; overflow:hidden; color:var(--text-secondary); font-size:10px; line-height:1.4; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.template-card-copy span { margin-top:6px; color:var(--muted); font-size:9px; text-transform:capitalize; }
.template-state { padding:3px 6px; border-radius:999px; background:rgba(52,211,153,.1); color:var(--success); font-size:8px; font-weight:800; text-transform:uppercase; }
.template-state.archived { background:rgba(248,113,113,.1); color:var(--danger); }
.template-load-more { width:calc(100% - 12px); margin:6px; }
.template-empty { display:grid; place-items:center; align-content:center; gap:8px; min-height:240px; padding:24px; color:var(--muted); text-align:center; }
.template-empty svg { width:38px; fill:none; stroke:var(--line-strong); stroke-width:1.4; }
.template-empty strong { color:var(--text); font-size:13px; }
.template-empty span { max-width:32ch; font-size:10px; }
.template-empty.error strong { color:var(--danger); }
.template-editor-shell { min-width:0; min-height:0; overflow:auto; background:#07070c; }
.template-editor-empty { display:grid; place-items:center; align-content:center; min-height:680px; padding:48px; text-align:center; }
.template-empty-mark { display:grid; place-items:center; width:72px; height:72px; margin-bottom:16px; border:1px solid rgba(124,58,237,.36); border-radius:18px; background:rgba(124,58,237,.09); color:var(--accent-text); font:800 16px/1 monospace; box-shadow:0 0 32px rgba(124,58,237,.12); }
.template-editor-empty strong { font-size:18px; }
.template-editor-empty p { max-width:48ch; margin:8px 0 0; color:var(--muted); font-size:11px; }
.template-editor-active { min-width:0; }
.template-editor-form { width:100%; max-width:none; min-width:0; margin:0; gap:0; }
.template-editor-head { display:flex; align-items:center; justify-content:space-between; gap:16px; min-height:68px; padding:11px 14px; border-bottom:1px solid var(--line); background:rgba(12,13,19,.94); }
.template-editor-head span,.template-editor-head strong { display:block; }
.template-editor-head span { color:var(--muted); font-size:9px; font-variant-numeric:tabular-nums; }
.template-editor-head strong { margin-top:2px; font-size:13px; }
.template-editor-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; }
.template-editor-actions button { min-height:38px; padding:7px 10px; font-size:10px; }
.template-folder-actions .danger-link { color:var(--danger); }
.template-folder-actions .danger-link:hover,
.template-folder-actions .danger-link:focus-visible { background:color-mix(in srgb,var(--danger) 12%,transparent); color:#ff7b7b; }
.template-details-grid { display:grid; grid-template-columns:minmax(180px,1.4fr) minmax(130px,.7fr) minmax(110px,.55fr); gap:8px; padding:12px 14px; border-bottom:1px solid var(--line); background:rgba(12,13,19,.58); }
.template-details-grid label { display:grid; gap:5px; margin:0; color:var(--muted); font-size:9px; font-weight:750; letter-spacing:.04em; }
.template-details-grid input,.template-details-grid select,.template-details-grid textarea { width:100%; min-height:39px; font-size:11px; }
.template-description-field { grid-column:1 / -1; }
.template-description-field textarea { resize:vertical; }
.template-tags-field { grid-column:span 2; }
.template-editor-grid { display:grid; grid-template-columns:minmax(360px,.8fr) minmax(520px,1.2fr); min-height:500px; }
.template-code-workbench,.template-preview-workbench { min-width:0; }
.template-code-workbench { display:flex; flex-direction:column; border-right:1px solid var(--line); background:#090a10; }
.template-code-tabs { display:flex; align-items:center; gap:3px; min-height:46px; padding:6px 8px; border-bottom:1px solid var(--line); }
.template-code-tabs button { min-height:32px; padding:5px 9px; border:1px solid transparent; background:transparent; color:var(--muted); font-size:9px; }
.template-code-tabs button.active { border-color:var(--line); background:var(--surface-subtle); color:var(--text); }
.template-code-tabs > span { margin-left:auto; color:var(--muted); font-size:8px; }
.template-code-panel { flex:1; min-height:420px; }
.template-code-panel textarea { width:100%; height:100%; min-height:420px; padding:16px; border:0; border-radius:0; outline:0; resize:vertical; background:#08090e; color:#e9e7f5; font:12px/1.65 "JetBrains Mono",SFMono-Regular,Consolas,monospace; tab-size:2; }
.template-code-panel textarea:focus { box-shadow:inset 3px 0 0 var(--accent); }
.template-code-workbench > footer { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:40px; padding:8px 11px; border-top:1px solid var(--line); color:var(--muted); }
#template-save-status { font-size:9px; font-weight:800; }
#template-save-status[data-state="dirty"] { color:var(--warning); }
#template-save-status[data-state="saving"] { color:var(--cyan); }
#template-save-status[data-state="saved"] { color:var(--success); }
#template-save-status[data-state="error"] { color:var(--danger); }
.template-code-workbench > footer small { font-size:8px; }
.template-preview-workbench { display:flex; flex-direction:column; background:#101119; }
.template-preview-workbench > header { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:46px; padding:6px 9px; border-bottom:1px solid var(--line); }
.template-preview-workbench > header > div:first-child { display:flex; align-items:center; gap:6px; min-width:0; }
.template-preview-workbench > header i { width:7px; height:7px; border-radius:50%; background:var(--success); box-shadow:0 0 10px rgba(52,211,153,.6); }
.template-preview-workbench > header strong { font-size:9px; }
.template-preview-workbench > header span { color:var(--muted); font-size:8px; }
.template-device-tabs { display:flex; align-items:center; gap:2px; }
.template-device-tabs button { min-height:32px; padding:5px 7px; border:1px solid transparent; background:transparent; color:var(--muted); font-size:8px; }
.template-device-tabs button.active { border-color:var(--line-strong); background:var(--surface-subtle); color:var(--text); }
.template-preview-stage { flex:1; min-height:460px; overflow:auto; padding:18px; background:repeating-linear-gradient(45deg,#0c0d13,#0c0d13 8px,#0f1017 8px,#0f1017 16px); }
.template-preview-device { width:min(100%,var(--template-preview-width,100%)); height:100%; min-height:424px; margin:0 auto; overflow:hidden; border:1px solid var(--line-strong); border-radius:10px; background:#fff; box-shadow:0 18px 48px rgba(0,0,0,.38); transition:width .22s cubic-bezier(.16,1,.3,1); }
.template-preview-device[data-viewport="mobile"] { min-height:680px; border-radius:24px; }
.template-preview-device[data-viewport="tablet"] { min-height:640px; border-radius:16px; }
.template-preview-device iframe { display:block; width:100%; height:100%; min-height:inherit; border:0; background:#fff; }
.template-history { border-top:1px solid var(--line); background:rgba(12,13,19,.72); }
.template-history > header { display:flex; align-items:end; justify-content:space-between; gap:14px; padding:14px; }
.template-history > header span { color:var(--accent-text); font-size:8px; font-weight:800; letter-spacing:.12em; }
.template-history h3 { margin:3px 0 0; font-size:14px; }
.template-history > header small { color:var(--muted); font-size:9px; }
.template-version-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:7px; padding:0 14px 14px; }
.template-version { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:5px; padding:8px; border:1px solid var(--line); border-radius:9px; background:#0b0c12; }
.template-version > button:first-child { min-width:0; padding:0; border:0; background:transparent; color:var(--text); text-align:left; }
.template-version strong,.template-version span,.template-version small { display:block; }
.template-version strong { font-size:10px; }
.template-version span { margin-top:3px; overflow:hidden; color:var(--text-secondary); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.template-version small { margin-top:4px; color:var(--muted); font-size:8px; }
.template-version-restore { align-self:center; min-height:32px; padding:5px 7px; font-size:8px; }
.template-version-empty { grid-column:1/-1; padding:18px; color:var(--muted); font-size:10px; text-align:center; }
@media (max-width:1400px) {
  .template-workspace { grid-template-columns:200px 270px minmax(480px,1fr); }
  .template-editor-grid { grid-template-columns:1fr; }
  .template-code-workbench { border-right:0; border-bottom:1px solid var(--line); }
}
@media (max-width:1050px) {
  .template-workspace { grid-template-columns:200px minmax(0,1fr); }
  .template-editor-shell { grid-column:1/-1; border-top:1px solid var(--line); }
  .template-editor-empty { min-height:320px; }
}
@media (max-width:720px) {
  .template-studio-head { align-items:stretch; flex-direction:column; padding:19px; }
  .template-head-actions { display:grid; grid-template-columns:1fr 1fr; }
  .template-head-actions .primary { grid-column:1/-1; }
  .template-toolbar { align-items:stretch; flex-direction:column; }
  .template-toolbar > label:not(.template-search) { grid-template-columns:72px 1fr; align-items:center; }
  .template-result-count { margin:4px 0; }
  .template-workspace { display:block; overflow:visible; }
  .template-folders,.template-library { border-right:0; border-bottom:1px solid var(--line); }
  .template-folder-tree { display:flex; gap:5px; overflow-x:auto; }
  .template-folder-row { flex:0 0 auto; }
  .template-folder-actions,.template-folders > footer { display:none !important; }
  .template-library { max-height:340px; }
  .template-editor-head { align-items:stretch; flex-direction:column; }
  .template-editor-actions { display:grid; grid-template-columns:repeat(2,1fr); }
  .template-editor-actions #template-save { grid-column:1/-1; }
  .template-details-grid { grid-template-columns:1fr; }
  .template-description-field,.template-tags-field { grid-column:auto; }
  .template-code-tabs { overflow-x:auto; }
  .template-code-tabs > span { display:none; }
  .template-preview-workbench > header { align-items:flex-start; flex-direction:column; }
  .template-device-tabs { width:100%; overflow-x:auto; }
  .template-preview-stage { padding:10px; }
  .template-version-list { grid-template-columns:1fr; }
}

/* Template Studio UX polish — focused desktop workspace and staged touch workflow. */
.template-studio-head { align-items:center; padding:19px 22px; }
.template-studio-head > div:first-child { max-width:700px; }
.template-studio-head h2 { font-size:clamp(25px,2.5vw,35px); }
.template-studio-head p { margin-top:8px; font-size:13px; line-height:1.55; }
.template-toolbar { align-items:center; min-height:62px; padding:9px 11px; }
.template-filter-controls { display:contents; }
.template-filter-toggle,.template-workspace-nav,.template-back-library,.template-mobile-savebar { display:none; }
.template-toolbar > .template-filter-controls > label { display:grid; gap:5px; color:var(--muted); font-size:11px; font-weight:700; letter-spacing:.03em; }
.template-toolbar input,.template-toolbar select { font-size:12px; }
.template-toolbar select { min-height:42px; }
.template-view-toggle button { min-width:48px; min-height:36px; font-size:11px; }
.template-result-count { margin:0 5px 0 auto; font-size:12px; }
.template-workspace { grid-template-columns:210px minmax(280px,310px) minmax(0,1fr); min-height:720px; }
.template-folders > header button,.template-folder-select { min-height:44px; }
.template-folder-select span { font-size:12px; }
.template-folder-actions { display:flex; opacity:0; transition:opacity .16s ease; }
.template-folder-row:hover .template-folder-actions,.template-folder-row:focus-within .template-folder-actions { opacity:1; }
.template-folder-actions button { min-width:32px; min-height:34px; font-size:10px; }
.template-card { min-height:90px; padding:12px; }
.template-card-copy strong { font-size:13px; }
.template-card-copy small { font-size:11px; }
.template-card-copy span { font-size:10px; }
.template-state { font-size:9px; }
.template-editor-head { position:sticky; top:0; z-index:6; min-height:72px; padding:12px 14px; backdrop-filter:blur(14px); }
.template-editor-identity { display:grid; grid-template-columns:auto 1fr; align-items:center; min-width:150px; }
.template-editor-identity span,.template-editor-identity strong { grid-column:2; }
.template-editor-head span { font-size:10px; }
.template-editor-head strong { font-size:14px; }
.template-editor-actions { gap:7px; }
.template-editor-actions button { min-height:42px; padding:8px 12px; font-size:11px; }
.template-editor-actions .primary { min-width:112px; }
.template-editor-actions .danger { border:1px solid color-mix(in srgb,var(--danger) 48%,var(--line)); background:color-mix(in srgb,var(--danger) 10%,var(--surface)); color:#ff8585; }
.template-editor-actions .danger:hover { background:color-mix(in srgb,var(--danger) 18%,var(--surface)); color:#ff9b9b; }
.template-details-grid { gap:10px; padding:14px; }
.template-details-grid label { font-size:10px; }
.template-details-grid input,.template-details-grid select,.template-details-grid textarea { min-height:44px; font-size:12px; }
.template-code-tabs,.template-preview-workbench > header { min-height:52px; padding:7px 10px; }
.template-code-tabs button,.template-device-tabs button { min-height:38px; padding:7px 10px; font-size:10px; }
.template-code-tabs > span,.template-preview-workbench > header span { font-size:9px; }
.template-preview-workbench > header strong { font-size:10px; }
.template-code-panel,.template-code-panel textarea { min-height:480px; }
.template-code-panel textarea { font-size:13px; line-height:1.65; }
#template-save-status,.template-code-workbench > footer small { font-size:10px; }
.template-preview-stage { min-height:clamp(680px,72vh,960px); }
.template-preview-device { min-height:clamp(640px,68vh,920px); }
.template-history > header span { font-size:9px; }
.template-history h3 { font-size:16px; }
.template-history > header small,.template-version span { font-size:10px; }
.template-version strong { font-size:11px; }
.template-version small { font-size:9px; }

@media (min-width:1051px) {
  .template-studio[data-layout="focus"] .template-workspace { grid-template-columns:minmax(0,1fr); }
  .template-studio[data-layout="focus"] .template-folders,
  .template-studio[data-layout="focus"] .template-library { display:none; }
}

@media (min-width:1051px) and (max-width:1400px) {
  .template-workspace { grid-template-columns:190px 270px minmax(0,1fr); }
}

@media (max-width:1050px) {
  .template-studio-head { align-items:flex-start; }
  .template-toolbar { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; }
  .template-search { min-width:0; }
  .template-filter-toggle { display:inline-flex; align-items:center; justify-content:center; min-height:44px; }
  .template-filter-controls { display:none; grid-column:1/-1; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; padding-top:9px; border-top:1px solid var(--line); }
  .template-studio[data-filters-open="true"] .template-filter-controls { display:grid; }
  .template-filter-controls > label { display:grid; gap:5px; }
  .template-filter-controls .template-view-toggle { align-self:end; justify-content:center; min-height:44px; }
  .template-result-count { margin:0; }
  .template-workspace-nav { display:grid; grid-template-columns:repeat(4,1fr); gap:4px; padding:4px; border:1px solid var(--line); border-radius:13px; background:rgba(12,13,19,.9); }
  .template-workspace-nav button { min-height:44px; padding:8px; border:0; border-radius:9px; background:transparent; color:var(--muted); box-shadow:none; font-size:12px; font-weight:700; }
  .template-workspace-nav button.active { color:var(--text); background:rgba(124,58,237,.16); }
  .template-workspace-nav button:disabled { opacity:.34; cursor:not-allowed; }
  .template-workspace { display:grid; grid-template-columns:220px minmax(0,1fr); min-height:620px; overflow:hidden; }
  .template-editor-shell { grid-column:auto; border-top:0; }
  .template-studio:not([data-mobile-view="library"]) .template-workspace { display:block; }
  .template-studio:not([data-mobile-view="library"]) .template-folders,
  .template-studio:not([data-mobile-view="library"]) .template-library { display:none; }
  .template-studio[data-mobile-view="library"] .template-editor-shell { display:none; }
  .template-studio[data-mobile-view="editor"] .template-preview-workbench,
  .template-studio[data-mobile-view="editor"] .template-history { display:none; }
  .template-studio[data-mobile-view="preview"] .template-editor-head,
  .template-studio[data-mobile-view="preview"] .template-details-grid,
  .template-studio[data-mobile-view="preview"] .template-code-workbench,
  .template-studio[data-mobile-view="preview"] .template-history { display:none; }
  .template-studio[data-mobile-view="preview"] .template-editor-grid { display:block; }
  .template-studio[data-mobile-view="history"] .template-editor-form { display:none; }
  .template-studio[data-mobile-view="history"] .template-history { min-height:520px; border-top:0; }
  .template-studio[data-mobile-view="editor"] .template-mobile-savebar { display:flex; }
  .template-editor-head { align-items:center; flex-direction:row; }
  .template-editor-identity { grid-template-columns:auto minmax(0,1fr); column-gap:10px; }
  .template-back-library { display:inline-flex; grid-row:1/3; grid-column:1; align-items:center; justify-content:center; min-width:64px; min-height:44px; padding:8px 10px; }
  .template-focus-toggle { display:none; }
  .template-editor-actions { display:flex; }
  .template-editor-actions button { min-height:44px; }
  .template-editor-grid { display:block; }
  .template-code-workbench { border-right:0; border-bottom:0; }
  .template-code-panel,.template-code-panel textarea { min-height:520px; }
  .template-mobile-savebar { position:sticky; bottom:0; z-index:8; align-items:center; justify-content:space-between; gap:14px; min-height:68px; padding:10px 14px; border-top:1px solid var(--line-strong); background:rgba(12,13,19,.96); backdrop-filter:blur(16px); }
  .template-mobile-savebar span { color:var(--muted); font-size:11px; font-weight:750; }
  .template-mobile-savebar span[data-state="dirty"] { color:var(--warning); }
  .template-mobile-savebar span[data-state="saving"] { color:var(--cyan); }
  .template-mobile-savebar span[data-state="saved"] { color:var(--success); }
  .template-mobile-savebar span[data-state="error"] { color:var(--danger); }
  .template-mobile-savebar button { min-width:132px; min-height:46px; }
  .template-preview-stage { min-height:620px; }
  .template-preview-device { min-height:580px; }
}

@media (max-width:720px) {
  .template-studio { gap:11px; width:100%; }
  .template-studio-head { gap:16px; padding:17px; border-radius:15px; }
  .template-studio-head h2 { font-size:27px; }
  .template-studio-head p { font-size:12px; }
  .template-head-actions { display:grid; grid-template-columns:1fr 1fr; width:100%; }
  .template-head-actions button { min-height:46px; }
  .template-toolbar { grid-template-columns:minmax(0,1fr) auto; padding:8px; }
  .template-search input,.template-toolbar input,.template-toolbar select { min-height:46px; font-size:16px; }
  .template-result-count { grid-column:1/-1; padding:0 4px 2px; }
  .template-filter-controls { grid-template-columns:1fr; }
  .template-filter-controls .template-view-toggle { width:100%; }
  .template-filter-controls .template-view-toggle button { flex:1; }
  .template-workspace-nav { position:sticky; top:8px; z-index:12; overflow-x:auto; }
  .template-workspace-nav button { min-width:72px; font-size:11px; }
  .template-workspace { display:block; min-height:520px; border-radius:15px; }
  .template-folders,.template-library { border-right:0; }
  .template-folders { max-height:none; }
  .template-folders > header { min-height:62px; }
  .template-folder-tree { display:flex; gap:5px; max-width:100%; overflow-x:auto; padding:8px; }
  .template-folder-row { flex:0 0 auto; }
  .template-folder-actions { display:none; }
  .template-library { max-height:none; min-height:360px; }
  .template-catalog[data-view="grid"] { grid-template-columns:1fr; }
  .template-card { min-height:88px; }
  .template-editor-head { position:static; align-items:stretch; flex-direction:column; }
  .template-editor-actions { display:grid; grid-template-columns:1fr 1fr; }
  .template-editor-actions button { width:100%; font-size:12px; }
  .template-editor-actions #template-focus-toggle { display:none; }
  .template-editor-actions #template-save { display:none; }
  .template-details-grid { grid-template-columns:1fr; padding:12px; }
  .template-description-field,.template-tags-field,.template-change-field { grid-column:auto; }
  .template-details-grid label { font-size:11px; }
  .template-details-grid input,.template-details-grid select,.template-details-grid textarea { min-height:48px; font-size:16px; }
  .template-code-tabs { overflow-x:auto; }
  .template-code-tabs button { min-width:82px; min-height:44px; font-size:11px; }
  .template-code-panel,.template-code-panel textarea { min-height:430px; }
  .template-code-panel textarea { padding:14px; font-size:13px; }
  .template-code-workbench > footer { align-items:flex-start; flex-direction:column; }
  .template-preview-workbench > header { align-items:stretch; flex-direction:column; }
  .template-device-tabs { display:grid; grid-template-columns:repeat(3,1fr); width:100%; }
  .template-device-tabs button { min-height:44px; font-size:10px; }
  .template-device-tabs button:nth-child(n+4) { grid-column:span 1; }
  .template-preview-stage { min-height:560px; padding:8px; }
  .template-preview-device { min-height:540px; }
  .template-history > header { align-items:flex-start; flex-direction:column; }
  .template-version-list { grid-template-columns:1fr; }
  .template-version { padding:11px; }
  .template-version-restore { min-height:44px; font-size:10px; }
}
@media (prefers-reduced-motion:reduce) { .template-preview-device,.template-card { transition:none; } }
/* Chat UX 2026-07-23 — conversation first, operational context on demand. */
#page-chat .chat-wrap {
  grid-template-columns:288px minmax(0,1fr);
  border-color:color-mix(in srgb,var(--line-strong) 82%,transparent);
  border-radius:20px;
  background:color-mix(in srgb,var(--bg) 86%,var(--surface));
  box-shadow:0 22px 60px rgba(0,0,0,.18),inset 0 1px rgba(255,255,255,.025);
}
#page-chat .chat-history {
  padding:18px 14px 14px;
  background:color-mix(in srgb,var(--surface) 76%,var(--bg));
}
#page-chat .chat-history-head { padding:0 5px 14px; }
#page-chat .chat-history-head small { font-size:10px; letter-spacing:.13em; }
#page-chat .chat-history-head strong { font-size:16px; }
#page-chat .chat-new-thread {
  min-height:46px; margin-bottom:10px; padding:0 13px; border-radius:11px;
  background:rgba(124,58,237,.11);
}
#page-chat .chat-new-thread span { font-size:13px; }
#page-chat .chat-history-search {
  min-height:44px; display:grid; grid-template-columns:18px minmax(0,1fr); align-items:center; gap:9px;
  margin:0 0 12px; padding:0 11px; border:1px solid var(--line); border-radius:11px;
  color:var(--muted); background:color-mix(in srgb,var(--bg) 64%,var(--surface));
  transition:border-color .18s ease,box-shadow .18s ease,background .18s ease;
}
#page-chat .chat-history-search:focus-within {
  border-color:rgba(167,139,250,.52); background:var(--surface);
  box-shadow:0 0 0 3px rgba(124,58,237,.08);
}
#page-chat .chat-history-search svg { width:18px; height:18px; }
#page-chat .chat-history-search input {
  width:100%; min-width:0; padding:0; border:0; outline:0; color:var(--text);
  background:transparent; box-shadow:none; font:inherit; font-size:13px;
}
#page-chat .chat-history-search input::-webkit-search-cancel-button { opacity:.7; cursor:pointer; }
#page-chat .chat-history-group { padding:13px 8px 6px; font-size:10px; letter-spacing:.1em; }
#page-chat .chat-history-item { min-height:92px; grid-template-columns:minmax(0,1fr) 40px; border-radius:12px; }
#page-chat .chat-history-open { min-height:90px; gap:5px; padding:11px 5px 11px 12px; }
#page-chat .chat-history-open strong { font-size:13px; }
#page-chat .chat-history-summary { font-size:11.5px; line-height:1.45; }
#page-chat .chat-history-meta { font-size:10.5px; }
#page-chat .chat-history-delete { width:40px; height:40px; opacity:.7; }
#page-chat .chat-history-empty { display:grid; gap:5px; font-size:12px; }
#page-chat .chat-history-empty strong { color:var(--text-secondary); font-size:13px; }
#page-chat .chat-history-empty span { color:var(--muted); }
#page-chat .chat-history-foot { padding:14px 7px 1px; font-size:10px; }

#page-chat .chat-command-head {
  min-height:72px; gap:10px; padding:11px 16px;
  background:color-mix(in srgb,var(--surface) 92%,transparent);
  backdrop-filter:blur(14px);
}
#page-chat .chat-agent-picker { flex:1 1 260px; max-width:360px; }
#page-chat .chat-agent-trigger {
  min-height:48px; grid-template-columns:34px minmax(0,1fr) 16px;
  border-color:transparent; background:transparent;
}
#page-chat .chat-agent-trigger:hover,
#page-chat .chat-agent-trigger:focus-visible,
#page-chat .chat-agent-trigger[aria-expanded="true"] { background:var(--surface-subtle); }
#page-chat .chat-agent-avatar { width:34px; height:34px; font-size:12px; }
#page-chat .chat-agent-copy small { font-size:11px; }
#page-chat .chat-agent-copy strong { font-size:13px; }
#page-chat .chat-agent-copy em { font-size:11px; }
#page-chat .chat-model-trigger {
  min-width:154px; min-height:44px; grid-template-columns:26px minmax(0,1fr) 14px;
  padding:6px 8px; border-color:var(--line); background:var(--surface-subtle);
}
#page-chat .chat-model-icon { width:26px; height:26px; border:0; background:transparent; }
#page-chat .chat-model-copy small { font-size:11px; }
#page-chat .chat-model-copy strong { font-size:11.5px; }
#page-chat .chat-runtime {
  max-width:176px; min-height:44px; padding:7px 9px; border-color:transparent; background:transparent;
}
#page-chat .chat-runtime strong { font-size:11.5px; }
#page-chat .chat-runtime small { font-size:11px; }
#page-chat .chat-team-trigger { min-width:82px; min-height:44px; border-color:var(--line); border-radius:11px; }
#page-chat .chat-team-trigger span,#page-chat .chat-team-trigger i { font-size:11px; }

#page-chat .chat-thread {
  padding:28px clamp(22px,6vw,84px) 32px; gap:22px;
  background:
    radial-gradient(circle at 50% -24%,rgba(124,58,237,.07),transparent 42%),
    color-mix(in srgb,var(--bg) 92%,var(--surface));
}
#page-chat .chat-empty { width:min(760px,100%); padding:44px 0; }
#page-chat .chat-empty-orb { width:58px; height:58px; border-radius:18px; box-shadow:none; }
#page-chat .chat-empty-kicker { font-size:10px; letter-spacing:.14em; }
#page-chat .chat-empty h3 { margin:10px 0; font-size:clamp(26px,3vw,38px); }
#page-chat .chat-empty > p { max-width:610px; font-size:15px; line-height:1.65; }
#page-chat .chat-starters { grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; margin-top:28px; }
#page-chat .chat-starters button {
  min-height:82px; padding:14px; border-radius:12px; background:transparent;
  transform:none;
}
#page-chat .chat-starters button:hover,#page-chat .chat-starters button:focus-visible { transform:none; }
#page-chat .chat-starters button span { font-size:13px; }
#page-chat .chat-starters button small { font-size:11px; line-height:1.45; }
#page-chat .chat-msg { gap:12px; }
#page-chat .chat-message-avatar { width:36px; height:36px; margin-top:20px; border-radius:11px; font-size:11px; }
#page-chat .chat-message-body { max-width:min(84%,820px); }
#page-chat .chat-message-meta { min-height:20px; margin:0 4px 5px; gap:8px; font-size:11px; }
#page-chat .chat-message-meta strong { font-size:12px; }
#page-chat .chat-message-route,#page-chat .chat-message-delegated { padding:3px 7px; font-size:10px; }
#page-chat .chat-bubble {
  padding:14px 17px; border-radius:15px; font-size:15px; line-height:1.65;
}
#page-chat .chat-msg.agent .chat-bubble {
  border:1px solid color-mix(in srgb,var(--line) 70%,transparent);
  background:color-mix(in srgb,var(--surface) 74%,transparent); box-shadow:none;
}
#page-chat .chat-msg.user .chat-bubble {
  background:linear-gradient(135deg,#7040d7,#5745c5);
  box-shadow:0 8px 24px rgba(91,72,214,.14);
}

#page-chat .chat-composer {
  margin:0 clamp(14px,3vw,34px) 18px; border-radius:17px;
  background:color-mix(in srgb,var(--surface) 97%,var(--bg));
  box-shadow:0 14px 36px rgba(0,0,0,.2);
}
#page-chat .chat-input { gap:9px; padding:10px 11px 8px; }
#page-chat .chat-input textarea { min-height:48px; padding:11px 8px; font-size:16px; line-height:1.5; }
#page-chat .chat-attach-btn,#page-chat .chat-mic-btn,#page-chat .chat-input button.primary {
  width:48px; height:48px; min-width:48px; border-radius:12px;
}
#page-chat .chat-input button.primary { box-shadow:none; }
#page-chat .chat-composer-foot { min-height:38px; padding:0 13px 10px; }
#page-chat .chat-voice-options { gap:7px; font-size:11px; }
#page-chat .chat-speech-status,#page-chat .chat-voice-toggle { min-height:30px; font-size:10.5px; }
#page-chat .chat-voice-engine,#page-chat .chat-input-hint { font-size:10px; }
#page-chat .chat-input-hint kbd { font-size:10px; }

#page-chat .chat-team-drawer {
  width:min(410px,94vw); padding:0 18px 20px;
  background:color-mix(in srgb,var(--surface) 98%,var(--bg));
}
#page-chat .chat-team-head { min-height:76px; }
#page-chat .chat-team-head small { font-size:11px; }
#page-chat .chat-team-head strong { font-size:17px; }
#page-chat .chat-team-head button { width:44px; height:44px; }
#page-chat .chat-team-intro { margin:16px 2px 10px; font-size:12px; line-height:1.55; }
#page-chat .chat-team-list { gap:9px; }
#page-chat .chat-team-card { grid-template-columns:38px minmax(0,1fr); gap:11px; padding:13px; border-radius:12px; }
#page-chat .chat-team-card-head strong { font-size:13px; }
#page-chat .chat-team-card-head span,#page-chat .chat-team-card-copy > small,
#page-chat .chat-team-missions li,#page-chat .chat-team-missions em { font-size:11px; }
#page-chat .chat-agent-policy label { font-size:11px; }
#page-chat .chat-agent-policy select { min-height:38px; font-size:11px; }
#page-chat .chat-model-settings-open { min-height:56px; }
#page-chat .chat-model-settings-open strong { font-size:13px; }
#page-chat .chat-model-settings-open small { font-size:11.5px; }

@media (max-width:1100px) {
  #page-chat .chat-wrap { grid-template-columns:260px minmax(0,1fr); }
  #page-chat .chat-runtime { display:none; }
  #page-chat .chat-thread { padding-inline:clamp(18px,4vw,48px); }
}
@media (max-width:860px) {
  #page-chat .chat-wrap { grid-template-columns:1fr; }
  #page-chat .chat-history {
    position:absolute; z-index:44; inset:0 auto 0 0; width:min(340px,92vw); border-right:1px solid var(--line-strong);
    box-shadow:20px 0 56px rgba(0,0,0,.42); transform:translateX(-104%); transition:transform .22s ease-out;
  }
  #page-chat .chat-wrap.history-open .chat-history { transform:translateX(0); }
  #page-chat .chat-history-close,#page-chat .chat-history-toggle { display:grid; }
  #page-chat .chat-model-trigger { min-width:44px; width:44px; grid-template-columns:1fr; place-items:center; padding:0; }
  #page-chat .chat-model-copy,#page-chat .chat-model-chevron { display:none; }
  #page-chat .chat-model-icon { display:grid; }
}
@media (max-width:640px) {
  #app:has(#page-chat:not(.hidden)) .sidebar:hover,
  #app:has(#page-chat:not(.hidden)) .sidebar:has(:focus-visible) { width:var(--sidebar-rail); box-shadow:none; }
  #app:has(#page-chat:not(.hidden)) .sidebar .side-brand .name,
  #app:has(#page-chat:not(.hidden)) .sidebar .nav-label,
  #app:has(#page-chat:not(.hidden)) .sidebar .nav-private,
  #app:has(#page-chat:not(.hidden)) .sidebar .nav-group-label,
  #app:has(#page-chat:not(.hidden)) .sidebar .side-action-label,
  #app:has(#page-chat:not(.hidden)) .sidebar .agent-pill,
  #app:has(#page-chat:not(.hidden)) .sidebar .side-user { display:none!important; }
  #app:has(#page-chat:not(.hidden)) .sidebar .nav-group,
  #app:has(#page-chat:not(.hidden)) .sidebar .side-nav a { width:42px; min-width:42px; }
  #page-chat { margin:-4px; }
  #page-chat .chat-wrap { height:calc(100dvh - 132px); min-height:520px; border-radius:0; border-inline:0; }
  #page-chat .chat-command-head { min-height:64px; gap:6px; padding:8px 9px; }
  #page-chat .chat-agent-picker { min-width:0; flex:1 1 auto; }
  #page-chat .chat-agent-trigger { min-width:0; min-height:46px; padding:5px 6px; }
  #page-chat .chat-agent-copy small,#page-chat .chat-agent-copy em { display:none; }
  #page-chat .chat-agent-copy strong { font-size:13px; }
  #page-chat .chat-team-trigger { width:44px; min-width:44px; padding:0; }
  #page-chat .chat-team-trigger span { display:none; }
  #page-chat .chat-thread { padding:20px 12px 26px; gap:18px; }
  #page-chat .chat-empty { padding:26px 4px; }
  #page-chat .chat-empty > p { font-size:14px; }
  #page-chat .chat-starters { grid-template-columns:1fr; gap:7px; margin-top:20px; }
  #page-chat .chat-starters button { min-height:64px; }
  #page-chat .chat-message-avatar { width:32px; height:32px; margin-top:20px; }
  #page-chat .chat-message-body { max-width:88%; }
  #page-chat .chat-message-role,#page-chat .chat-message-route { display:none; }
  #page-chat .chat-bubble { padding:12px 14px; font-size:15px; }
  #page-chat .chat-composer {
    margin:0 7px max(7px,env(safe-area-inset-bottom)); border-radius:15px;
  }
  #page-chat .chat-input textarea { font-size:16px; }
  #page-chat .chat-composer-foot { display:none; }
  #page-chat .chat-history,#page-chat .chat-team-drawer { width:100%; }
  #page-chat .chat-team-drawer { padding:0 15px max(18px,env(safe-area-inset-bottom)); border-left:0; }
}
@media (prefers-reduced-motion:reduce) {
  #page-chat .chat-history,#page-chat .chat-team-drawer,
  #page-chat .chat-history-search,#page-chat .chat-starters button { transition:none!important; }
}

/* Agent conversations — operational transcript, not private model reasoning. */
.agent-conversations-open { margin-top:14px; border-color:rgba(167,139,250,.35); background:linear-gradient(135deg,rgba(124,58,237,.13),rgba(79,70,229,.05)); }
.agent-conversations-dialog { width:min(1120px,calc(100vw - 30px)); height:min(790px,calc(100dvh - 30px)); padding:0; overflow:hidden; border:1px solid var(--line-strong); border-radius:20px; color:var(--text); background:color-mix(in srgb,var(--surface) 98%,#0b0b12 2%); box-shadow:0 34px 120px rgba(0,0,0,.68); }
.agent-conversations-dialog::backdrop { background:rgba(2,3,6,.76); backdrop-filter:blur(5px); }
.agent-conversations-head { min-height:80px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 18px; border-bottom:1px solid var(--line); }
.agent-conversations-head > span:first-child { min-width:0; display:grid; gap:2px; }
.agent-conversations-head small { color:var(--accent-text); font-size:10px; font-weight:850; letter-spacing:.14em; }
.agent-conversations-head strong { font-size:18px; letter-spacing:-.02em; }
.agent-conversations-head em { color:var(--muted); font-size:11px; font-style:normal; }
.agent-conversations-actions { display:flex; gap:8px; }
.agent-conversations-actions button { width:44px; height:44px; display:grid; place-items:center; padding:0; border:1px solid var(--line); border-radius:11px; color:var(--text-secondary); background:var(--surface-subtle); box-shadow:none; }
.agent-conversations-actions button:hover,.agent-conversations-actions button:focus-visible { border-color:rgba(167,139,250,.5); color:var(--text); background:rgba(124,58,237,.1); box-shadow:none; }
.agent-conversations-actions svg { width:18px; height:18px; }
.agent-conversations-layout { min-height:0; height:calc(100% - 80px); display:grid; grid-template-columns:340px minmax(0,1fr); }
.agent-conversations-list { min-height:0; padding:12px; overflow:auto; border-right:1px solid var(--line); background:color-mix(in srgb,var(--bg) 74%,var(--surface)); }
.agent-conversation-group { display:block; padding:10px 8px 6px; color:var(--muted); font-size:10px; font-weight:850; letter-spacing:.12em; text-transform:uppercase; }
.agent-conversation-item { width:100%; min-height:78px; display:grid; grid-template-columns:36px minmax(0,1fr); gap:10px; margin:0 0 6px; padding:11px; border:1px solid transparent; border-radius:13px; color:var(--text); background:transparent; box-shadow:none; text-align:left; }
.agent-conversation-item:hover,.agent-conversation-item:focus-visible { border-color:var(--line); background:rgba(255,255,255,.035); box-shadow:none; }
.agent-conversation-item.active { border-color:rgba(167,139,250,.36); background:rgba(124,58,237,.11); }
.agent-conversation-item > span:last-child { min-width:0; display:grid; gap:3px; }
.agent-conversation-item-head { min-width:0; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.agent-conversation-item-head strong { overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.agent-conversation-item-head i { flex:none; width:7px; height:7px; border-radius:50%; background:#64748b; }
.agent-conversation-item[data-status="running"] .agent-conversation-item-head i,.agent-conversation-item[data-status="approved"] .agent-conversation-item-head i { background:var(--success); box-shadow:0 0 0 4px rgba(52,211,153,.1); }
.agent-conversation-item[data-status="blocked"] .agent-conversation-item-head i { background:var(--warning); }
.agent-conversation-item small { overflow:hidden; color:var(--text-secondary); font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.agent-conversation-item em { color:var(--muted); font-size:10px; font-style:normal; }
.agent-conversation-detail { min-width:0; min-height:0; overflow:auto; background:radial-gradient(circle at 85% -10%,rgba(124,58,237,.09),transparent 34%),var(--surface); }
.agent-conversation-empty { height:100%; display:grid; place-content:center; justify-items:center; padding:30px; text-align:center; }
.agent-conversation-empty strong { font-size:17px; }
.agent-conversation-empty p { max-width:410px; color:var(--muted); font-size:12px; line-height:1.6; }
.agent-conversation-summary { position:sticky; z-index:2; top:0; display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:18px 22px; border-bottom:1px solid var(--line); background:color-mix(in srgb,var(--surface) 94%,transparent); backdrop-filter:blur(16px); }
.agent-conversation-summary > div { min-width:0; display:grid; gap:5px; }
.agent-conversation-route { display:flex; align-items:center; gap:7px; color:var(--accent-text); font-size:11px; font-weight:750; }
.agent-conversation-route svg { width:15px; height:15px; }
.agent-conversation-summary h3 { margin:0; font-size:18px; letter-spacing:-.025em; }
.agent-conversation-summary p { margin:0; color:var(--muted); font-size:11px; }
.agent-conversation-summary > span { flex:none; padding:5px 8px; border:1px solid var(--line); border-radius:999px; color:var(--text-secondary); font-size:10px; text-transform:capitalize; }
.agent-conversation-timeline { display:grid; gap:0; padding:18px 22px 28px; }
.agent-conversation-links { display:flex; gap:7px; padding:10px 22px 0; }
.agent-conversation-links button { min-height:38px; padding:7px 11px; border-radius:9px; font-size:11px; }
.agent-conversation-message { position:relative; display:grid; grid-template-columns:38px minmax(0,1fr); gap:11px; padding:12px 0; }
.agent-conversation-message:not(:last-child)::after { content:""; position:absolute; top:51px; bottom:-1px; left:18px; width:1px; background:var(--line); }
.agent-conversation-message .chat-agent-avatar { width:38px; height:38px; z-index:1; }
.agent-conversation-message-copy { min-width:0; display:grid; gap:5px; padding:0 0 4px; }
.agent-conversation-message-head { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.agent-conversation-message-head strong { font-size:12px; }
.agent-conversation-message-head span { padding:3px 6px; border-radius:999px; color:var(--muted); background:var(--surface-subtle); font-size:9px; text-transform:uppercase; }
.agent-conversation-message-head time { margin-left:auto; color:var(--muted); font-size:10px; }
.agent-conversation-message-copy p { margin:0; color:var(--text-secondary); font-size:12px; line-height:1.55; white-space:pre-wrap; }
.agent-conversation-message[data-kind="assignment"] .agent-conversation-message-copy,.agent-conversation-message[data-kind="learning_proposal"] .agent-conversation-message-copy { padding:11px 12px; border:1px solid rgba(167,139,250,.28); border-radius:12px; background:rgba(124,58,237,.07); }
.agent-conversation-learning { display:grid; gap:9px; margin:8px 0 0 49px; padding:13px; border:1px solid rgba(52,211,153,.24); border-radius:12px; background:rgba(52,211,153,.055); }
.agent-conversation-learning header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.agent-conversation-learning strong { font-size:12px; }
.agent-conversation-learning header span { color:var(--muted); font-size:10px; text-transform:capitalize; }
.agent-conversation-learning p { margin:0; color:var(--text-secondary); font-size:11px; line-height:1.5; }
.agent-conversation-review { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.agent-conversation-review > div { display:flex; align-items:center; gap:9px; min-width:0; }
.agent-conversation-review > div p { display:grid; gap:1px; min-width:0; }
.agent-conversation-review > div strong { font-size:11px; }
.agent-conversation-review > div small { color:var(--muted); font-size:9px; overflow-wrap:anywhere; }
.agent-conversation-review > span { padding:4px 7px; border-radius:999px; background:rgba(52,211,153,.1); color:#34d399; font-size:9px; font-style:normal; text-transform:uppercase; letter-spacing:.06em; }
.agent-conversation-review[data-decision="rejected"] > span { background:rgba(248,113,113,.1); color:#f87171; }
.agent-conversation-review ul { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:5px; margin:0; padding:0; list-style:none; }
.agent-conversation-review li { padding:4px 7px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:9px; }
.agent-conversation-activation { padding-left:10px; border-left:2px solid #34d399; color:var(--text-secondary); }
.agent-conversation-learning footer { display:flex; gap:7px; }
.agent-conversation-learning button { min-height:38px; padding:7px 11px; border-radius:9px; font-size:11px; }
.agent-conversation-learning button.secondary { background:transparent; }

@media (max-width:760px) {
  .agent-conversations-dialog { width:calc(100vw - 12px); height:calc(100dvh - 12px); border-radius:16px; }
  .agent-conversations-head { min-height:74px; padding:10px 12px; }
  .agent-conversations-head em { display:none; }
  .agent-conversations-layout { height:calc(100% - 74px); grid-template-columns:1fr; grid-template-rows:minmax(150px,34%) minmax(0,1fr); }
  .agent-conversations-list { border-right:0; border-bottom:1px solid var(--line); }
  .agent-conversation-item { min-height:68px; }
  .agent-conversation-summary { padding:14px; }
  .agent-conversation-summary h3 { font-size:16px; }
  .agent-conversation-timeline { padding:12px 14px 22px; }
  .agent-conversation-links { padding:10px 14px 0; }
  .agent-conversation-message { grid-template-columns:34px minmax(0,1fr); }
  .agent-conversation-message .chat-agent-avatar { width:34px; height:34px; }
  .agent-conversation-message:not(:last-child)::after { left:16px; top:47px; }
  .agent-conversation-learning { margin-left:45px; }
}
@media (prefers-reduced-motion:reduce) {
  .library-row,.library-drawer-backdrop,.library-visual-thumb img { transition:none; }
}

.runtime-foot { margin: 0; padding: 16px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* ---------- Modal / task detail ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(3, 6, 12, 0.72);
  display: grid; place-items: center; padding: 20px; z-index: 50;
}
#confirm-modal,#prompt-modal { z-index:1300; }
.modal {
  width: min(640px, 100%); max-height: 88vh; overflow-y: auto;
  border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow-md); padding: 22px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.modal-close { background: transparent; color: var(--muted); border: 0; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--text); background: transparent; }
.detail-prompt { white-space: pre-wrap; background: rgba(0,0,0,0.22); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; font-size: 13px; margin: 12px 0; max-height: 220px; overflow: auto; }
.modal-actions { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
button.danger { background: var(--danger); color: #2b0808; }
button.danger:hover { background: #ef4444; }
.task-recovery-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.task-recovery-panel > div:first-child { display: grid; gap: 4px; }
.task-recovery-panel > div:first-child span { color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
.task-recovery-count { display: grid; gap: 5px; color: var(--text-secondary); font-size: 11px; }
.task-recovery-count input { width: 92px; }
.task-recovery-actions { display: flex; gap: 8px; flex-wrap: wrap; grid-column: 1 / -1; }
.task-delete-row { display: flex; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .task-recovery-panel { grid-template-columns: 1fr; }
  .task-recovery-count input { width: 100%; }
}

/* ---------- Safe content preview (Plan 11 foundation) ---------- */
.safe-preview-overlay {
  position:fixed; inset:0; z-index:72; display:grid; place-items:center; padding:24px;
  background:rgba(2,3,8,.78); backdrop-filter:blur(10px);
}
.safe-preview-shell {
  display:grid; grid-template-rows:auto minmax(0,1fr) auto auto; width:min(1040px,100%); height:min(820px,92dvh);
  overflow:hidden; border:1px solid var(--line-strong); border-radius:22px;
  background:var(--surface); box-shadow:0 32px 90px rgba(0,0,0,.48);
}
.safe-preview-head,.safe-preview-foot { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:16px 20px; }
.safe-preview-head { border-bottom:1px solid var(--line); }
.safe-preview-head span { color:var(--accent-text); font-size:10px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.safe-preview-head h2 { margin:4px 0 0; font-size:20px; letter-spacing:-.02em; }
.safe-preview-meta { min-height:16px; margin:4px 0 0; color:var(--muted); font-size:11px; }
.safe-preview-close { display:grid; place-items:center; width:44px; height:44px; padding:0; border-radius:999px; background:var(--surface-subtle); color:var(--text); font-size:25px; }
.safe-preview-body { display:grid; place-items:center; min-width:0; min-height:0; overflow:auto; padding:20px; background:radial-gradient(circle at 50% 20%,rgba(124,58,237,.09),transparent 48%),var(--bg); }
.safe-preview-body > img,.safe-preview-body > video { display:block; width:100%; height:100%; object-fit:contain; border-radius:14px; }
.safe-preview-body > audio { width:min(560px,100%); }
.safe-preview-body > iframe { width:100%; height:100%; min-height:480px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.safe-preview-markdown { align-self:start; width:min(760px,100%); padding:22px 24px; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.safe-preview-empty { width:min(520px,100%); text-align:center; }
.safe-preview-empty strong { display:block; margin-bottom:8px; font-size:18px; }
.safe-preview-empty p { margin:0; color:var(--text-secondary); }
.safe-preview-foot { border-top:1px solid var(--line); color:var(--muted); font-size:11px; }
.safe-preview-actions { display:flex; gap:8px; align-items:center; }
.safe-preview-foot a,.safe-preview-foot button,.safe-preview-history button { min-height:44px; padding:10px 14px; text-decoration:none; white-space:nowrap; }
.safe-preview-history { max-height:190px; overflow:auto; padding:14px 20px; border-top:1px solid var(--line); background:var(--surface-subtle); }
.safe-preview-history > div { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.safe-preview-history ol { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 16px; margin:12px 0 0; padding:0; list-style:none; }
.safe-preview-history li { min-width:0; padding:9px 11px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.safe-preview-history li span,.safe-preview-history li small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.safe-preview-history li span { color:var(--text); font-size:12px; font-weight:700; }
.safe-preview-history li small,.safe-preview-history-empty { margin:3px 0 0; color:var(--muted); font-size:10px; }
.content-alert { display:grid; grid-template-columns:auto minmax(0,1fr); gap:6px 12px; margin:12px 0; padding:12px 14px; border:1px solid rgba(96,165,250,.35); border-radius:12px; background:rgba(59,130,246,.08); }
.content-alert strong { color:#93c5fd; font-size:11px; letter-spacing:.08em; text-transform:uppercase; }
.content-alert.warning,.content-alert.caution { border-color:rgba(251,191,36,.4); background:rgba(245,158,11,.08); }
.content-alert.warning strong,.content-alert.caution strong { color:#fbbf24; }
@media (max-width:700px) {
  .safe-preview-overlay { padding:0; }
  .safe-preview-shell { width:100%; height:100dvh; border:0; border-radius:0; }
  .safe-preview-head,.safe-preview-foot { padding:14px 16px; }
  .safe-preview-body { padding:14px; }
  .safe-preview-foot span { display:none; }
  .safe-preview-actions { width:100%; }
  .safe-preview-foot a,.safe-preview-foot button { flex:1; text-align:center; }
  .safe-preview-history ol { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce) { .safe-preview-overlay { backdrop-filter:none; } }

.timeline { list-style: none; margin: 14px 0 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.timeline li.ev-rejected::before { background: var(--danger); }
.timeline li.ev-approved::before { background: var(--success); }
.tl-msg { font-size: 13px; }
.tl-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ---------- Persistente agent loop ---------- */
.loop-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin:4px 0 14px; }
.loop-head h4 { margin:3px 0 0; font-size:20px; text-transform:capitalize; }
.loop-progress { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
.loop-progress > div { flex:1; height:8px; overflow:hidden; border-radius:999px; background:var(--surface-subtle); }
.loop-progress > div span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#8b5cf6,#38bdf8); }
.loop-progress strong { flex:none; color:var(--muted); font-size:12px; }
.loop-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.loop-metrics > div { padding:10px 11px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.loop-metrics span,.loop-metrics strong { display:block; }
.loop-metrics span { color:var(--muted); font-size:11px; margin-bottom:3px; }
.loop-metrics strong { font-size:12.5px; overflow-wrap:anywhere; }
.loop-alert { display:grid; gap:4px; margin:12px 0; padding:11px 12px; border-radius:var(--radius-md); border:1px solid var(--line); font-size:12.5px; }
.loop-alert.bad { border-color:rgba(248,113,113,.4); background:rgba(248,113,113,.08); }
.loop-alert.ok { border-color:rgba(52,211,153,.4); background:rgba(52,211,153,.08); }
.loop-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:18px; }
.loop-section-head h4 { margin:0; font-size:14px; }
.loop-section-head code { max-width:52%; overflow:hidden; text-overflow:ellipsis; color:var(--muted); font-size:10px; }
.loop-checkpoints { list-style:none; display:grid; gap:8px; margin:10px 0 0; padding:0; }
.loop-checkpoints li { position:relative; padding:10px 12px 10px 28px; border:1px solid var(--line); border-radius:var(--radius-md); }
.loop-checkpoints li::before { content:""; position:absolute; left:11px; top:15px; width:7px; height:7px; border-radius:50%; background:#a78bfa; }
.loop-checkpoints li.loop-outcome-passed::before,.loop-checkpoints li.loop-outcome-completed::before { background:#34d399; }
.loop-checkpoints li.loop-outcome-failed::before,.loop-checkpoints li.loop-outcome-stopped::before { background:#f87171; }
.loop-checkpoints li.loop-outcome-paused::before,.loop-checkpoints li.loop-outcome-waiting_input::before { background:#fbbf24; }
.loop-checkpoints li > div { display:flex; justify-content:space-between; gap:12px; font-size:12.5px; }
.loop-checkpoints li > div span { color:var(--muted); font-size:11px; }
.loop-checkpoints p { margin:5px 0; color:var(--text-secondary); font-size:12px; }
.loop-checkpoints small { color:var(--muted); font-size:10.5px; }
@media (max-width:560px) { .loop-metrics { grid-template-columns:1fr; } }

.diff { font-family: "JetBrains Mono", monospace; font-size: 12px; line-height: 1.5;
  background: rgba(0,0,0,0.28); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 10px; overflow-x: auto; margin: 8px 0; max-height: 300px; white-space: pre; }
.diff .add { color: #6ee7b7; background: rgba(52,211,153,0.10); display: block; }
.diff .del { color: #fca5a5; background: rgba(248,113,113,0.10); display: block; }
.diff .hd { color: var(--muted); display: block; }

/* ---------- Buttons: focus + primary quick action ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
button:focus-visible, a:focus-visible, .navcard:focus-visible, .side-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.icon-btn { display: inline-flex; align-items: center; gap: 6px; }
button.icon-btn svg { width: 15px; height: 15px; }

/* ---------- Card hover (interactive lift) ---------- */
.grid .card { transition: transform .12s ease, border-color .12s ease; }
.grid .card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
#ov-recent .card, #tasks-grid .card { cursor: default; }

/* ---------- Approval badge: pulsing dot to draw the eye ---------- */
.badge.risk-approval::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; animation: pulse-dot 1.6s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ---------- KPI tiles: icon accent ---------- */
.kpi { position: relative; overflow: hidden; }
.kpi .kpi-ic { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; background: var(--accent-weak); color: var(--accent-text); }
.kpi .kpi-ic svg { width: 17px; height: 17px; }
.kpi.attn .kpi-ic { background: rgba(251,191,36,0.16); color: var(--warning); }
.kpi.ok .kpi-ic { background: rgba(52,211,153,0.16); color: var(--success); }

/* ---------- Skeleton loaders ---------- */
.skel { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); }
.skel.kpi-skel { height: 92px; }
.skel.card-skel { height: 118px; }
.skel::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 36px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-left-width: 3px; border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-md); font-size: 13px; color: var(--text);
  animation: toast-in .2s ease;
}

/* ---------- Cross-page process progress ---------- */
.process-dock {
  position:fixed; top:88px; right:18px; z-index:60; display:grid; gap:8px;
  width:min(360px,calc(100vw - 36px)); pointer-events:none;
}
.process-dock.hidden { display:none; }
.process-card {
  position:relative; overflow:hidden; display:grid; grid-template-columns:36px minmax(0,1fr) auto;
  gap:4px 10px; padding:13px 14px; border:1px solid rgba(167,139,250,.34);
  border-radius:14px; background:rgba(10,8,18,.94); color:var(--text);
  box-shadow:0 16px 42px rgba(0,0,0,.42); backdrop-filter:blur(14px); pointer-events:auto; text-decoration:none;
}
:root[data-theme="light"] .process-card { background:rgba(255,255,255,.96); box-shadow:0 14px 36px rgba(67,48,111,.16); }
.process-mark { grid-row:1/4; width:36px; height:36px; display:grid; place-items:center; border-radius:11px; background:var(--accent-weak); color:var(--accent-text); }
.process-mark svg { width:17px; height:17px; }
.process-card.running .process-mark svg { animation:process-rotate 1.1s linear infinite; }
.process-card.completed .process-mark { background:rgba(52,211,153,.12); color:var(--success); }
.process-card.failed .process-mark { background:rgba(248,113,113,.12); color:var(--danger); }
.process-card.attention .process-mark { background:rgba(251,191,36,.12); color:var(--warning); }
.process-title { min-width:0; overflow:hidden; font-size:13px; font-weight:780; text-overflow:ellipsis; white-space:nowrap; }
.process-percent { color:var(--accent-text); font:700 12px ui-monospace,SFMono-Regular,Menlo,monospace; font-variant-numeric:tabular-nums; }
.process-stage { grid-column:2/4; min-width:0; overflow:hidden; color:var(--text-secondary); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.process-track { grid-column:2/4; height:5px; overflow:hidden; margin-top:3px; border-radius:999px; background:var(--line); }
.process-track span { display:block; width:var(--process-progress,0%); height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--accent),var(--cyan)); transition:width .25s ease; }
.process-track.indeterminate span { width:38%; animation:process-slide 1.4s ease-in-out infinite; }
.process-card.completed .process-track span { width:100%; background:var(--success); }
.process-card.failed .process-track span { background:var(--danger); }
.process-timing { grid-column:2/4; display:flex; justify-content:space-between; gap:10px; color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.process-timing span:last-child { text-align:right; }
@keyframes process-rotate { to { transform:rotate(360deg); } }
@keyframes process-slide { 0% { transform:translateX(-115%); } 55%,100% { transform:translateX(265%); } }
@media (max-width:620px) {
  .process-dock { top:122px; right:10px; width:calc(100vw - 82px); }
  .process-card { padding:11px 12px; }
}
@media (prefers-reduced-motion:reduce) {
  .process-card.running .process-mark svg,.process-track.indeterminate span { animation:none; }
  .process-track span { transition:none; }
}
.toast.bad { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--success); }
.toast.info { border-left-color: var(--accent-text); }
.toast .t-ic { flex: none; font-weight: 800; }
.toast.bad .t-ic { color: var(--danger); }
.toast.ok .t-ic { color: var(--success); }
.toast.info .t-ic { color: var(--accent-text); }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Prompt modal ---------- */
#prompt-modal .modal { width: min(440px, 100%); }
#prompt-modal label { margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
/* ---------- Light theme ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  /* Licht thema — ui-ux-pro-max palet (AI purple op paars-getint wit) */
  --bg: #faf7ff;
  --surface: #ffffff;
  --surface-subtle: #f3effc;
  --line: #e4ddf5;
  --line-strong: #cfc3ec;
  --text: #1e1b4b;
  --text-secondary: #3b3670;
  --muted: #6b6795;
  --accent-text: #6d28d9;  /* donkerder paars: 4.5:1+ op wit */
  --accent-hover: #6d28d9;
  --shadow-sm: 0 1px 2px rgba(30,27,75,0.07);
  --shadow-md: 0 12px 32px rgba(30,27,75,0.13);
  --glow-accent: 0 4px 14px rgba(124, 58, 237, 0.28);
  --card-sheen: inset 0 1px 0 rgba(255,255,255,0.9);
}
:root[data-theme="light"] body {
  background:
    radial-gradient(ellipse at 20% -5%, rgba(124,58,237,0.09), transparent 34rem),
    radial-gradient(ellipse at 90% 0%, rgba(8,145,178,0.06), transparent 28rem),
    var(--bg);
}
:root[data-theme="light"] #login-view main { background: linear-gradient(160deg, #ffffff, #f3effc); }
:root[data-theme="light"] .login-brand-logo,
:root[data-theme="light"] .side-brand .logo {
  filter: brightness(.22) saturate(1.4) drop-shadow(0 4px 10px rgba(76, 29, 149, 0.16));
}
:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] select { background: #ffffff; }
:root[data-theme="light"] button.secondary { background: #f3effc; color: var(--text); border-color: var(--line-strong); }
:root[data-theme="light"] button.secondary:hover { background: #ebe3fa; }
:root[data-theme="light"] .sidebar { background: linear-gradient(180deg, #ffffff, #f3effc); }
:root[data-theme="light"] .topbar { background: rgba(250,247,255,0.86); }
:root[data-theme="light"] .side-nav a:hover { background: rgba(15,23,42,0.05); }
:root[data-theme="light"] .agent-pill { background: #f3effc; }
:root[data-theme="light"] .notice { background: #f3effc; }
:root[data-theme="light"] .graph-shell { border-color: rgba(38,145,255,.2); background: #020306;
  box-shadow: 0 22px 55px rgba(80,58,130,.12), inset 0 1px 0 #fff; }
:root[data-theme="light"] .graph-toolbar,
:root[data-theme="light"] .graph-footer { background: rgba(250,247,255,.9); }
:root[data-theme="light"] .graph-searchbox input[type="search"] { background: #fff; }
:root[data-theme="light"] .graph-legend { background: rgba(250,247,255,.7); }
:root[data-theme="light"] .graph-legend .legend-item { background: rgba(255,255,255,.74); border-color: rgba(71,85,105,.13); }
:root[data-theme="light"] .graph-wrap { background:
  radial-gradient(ellipse at 50% 51%, rgba(17,91,205,.11) 0, rgba(2,17,45,.08) 24%, transparent 54%),
  radial-gradient(ellipse at 50% 51%, #020408 0, #010204 56%, #000 100%); }
:root[data-theme="light"] .graph-wrap::before { background: radial-gradient(ellipse at center, transparent 34%, rgba(0,0,0,.72) 100%); }
:root[data-theme="light"] #graph-svg .node-point { stroke: rgba(255,255,255,.96); }
:root[data-theme="light"] #graph-svg .label { fill: #e7f6ff; stroke: rgba(0,0,0,.94); }
:root[data-theme="light"] #graph-svg .node-group:hover .label,
:root[data-theme="light"] #graph-svg .node-group:focus-visible .label,
:root[data-theme="light"] #graph-svg .node-group.is-focus .label,
:root[data-theme="light"] #graph-svg .node-group.match .label { fill: #0f172a; }
:root[data-theme="light"] .graph-live-badge,
:root[data-theme="light"] .graph-zoombar button,
:root[data-theme="light"] .graph-inspector { background: rgba(3,7,13,.84); border-color: rgba(148,163,184,.18); color: #dbeafe; }
:root[data-theme="light"] .detail-prompt,
:root[data-theme="light"] .diff { background: #f3effc; }
/* Badge readability on light backgrounds */
:root[data-theme="light"] .st-queued { color:#475569; background:rgba(100,116,139,0.13); border-color:rgba(100,116,139,0.3); }
:root[data-theme="light"] .st-approved,
:root[data-theme="light"] .st-planning,
:root[data-theme="light"] .st-running { color:#4338ca; background:rgba(99,102,241,0.12); border-color:rgba(99,102,241,0.3); }
:root[data-theme="light"] .st-completed { color:#047857; background:rgba(5,150,105,0.12); border-color:rgba(5,150,105,0.3); }
:root[data-theme="light"] .st-failed,
:root[data-theme="light"] .st-blocked { color:#b91c1c; background:rgba(220,38,38,0.10); border-color:rgba(220,38,38,0.3); }
:root[data-theme="light"] .risk-approval { color:#b45309; background:rgba(245,158,11,0.14); border-color:rgba(245,158,11,0.4); }
:root[data-theme="light"] .mini-table th { color:#475569; }
:root[data-theme="light"] .mini-table td { color:#1e293b; }

/* ---------- Overview toolbar + KPI customize popover ---------- */
.ov-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; position: relative; }
.ov-toolbar .link-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 5px 10px; font-size: 12px; font-weight: 600; }
.ov-toolbar .link-btn:hover { color: var(--text); border-color: var(--line-strong); background: transparent; }
.health-cockpit { border-block: 1px solid var(--line); padding: 12px 0; margin-bottom: 18px; }
.health-summary { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.health-dot.green { background: var(--success); }
.health-dot.yellow { background: var(--warning); }
.health-dot.red { background: var(--danger); }
.health-components { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 5px 16px; }
.health-component { min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; }
.health-component .health-dot { width: 7px; height: 7px; }
.health-component strong { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-component small { grid-column: 2; color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover {
  position: absolute; top: 34px; right: 0; z-index: 30; width: 230px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 10px;
}
.popover h5 { margin: 2px 4px 8px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.popover .opt { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.popover .opt:hover { background: var(--accent-weak); }
.popover .opt input { width: auto; }

/* ---------- Business overview: sourced KPI grid (Plan 05) ---------- */
.business-overview { overflow: hidden; }
.business-pulse { position: relative; padding: 16px 18px; overflow: hidden; border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); background: linear-gradient(125deg, color-mix(in srgb, var(--accent) 8%, var(--surface)) 0%, var(--surface) 62%); }
.business-pulse::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--accent), var(--cyan), transparent 82%); }
.business-pulse-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.business-pulse-head h3 { margin: 0; font-size: 16px; letter-spacing: -.025em; }
.business-pulse-head p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; }
.business-pulse-link { display: inline-flex; align-items: center; gap: 8px; flex: none; text-decoration: none; }
.business-pulse-link span { color: var(--accent-text); font-size: 16px; transition: transform .18s ease; }
.business-pulse-link:hover span { transform: translateX(3px); }
.business-pulse-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.business-pulse-metric { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; min-height: 70px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.business-pulse-metric > span { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.business-pulse-metric > strong { grid-row: span 2; align-self: center; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.business-pulse-metric > small { align-self: end; font-size: 9.5px; font-weight: 750; }
.business-pulse-metric > small.is-improved { color: var(--success); }
.business-pulse-metric > small.is-declined { color: var(--danger); }
.business-pulse-metric > small.is-neutral { color: var(--muted); }
.business-pulse-empty { grid-column: 1 / -1; padding: 12px; color: var(--muted); font-size: 11px; }
.business-pulse-skeleton { background: linear-gradient(100deg, var(--surface) 20%, var(--surface-subtle) 40%, var(--surface) 60%); background-size: 200% 100%; animation: business-shimmer 1.3s linear infinite; }
.business-page { padding-bottom: 32px; }
.business-page-hero { position: relative; align-items: center; padding: 24px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line)); border-radius: var(--radius-lg); background: radial-gradient(circle at 86% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 38%), linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface) 58%); }
.business-page-hero::after { content: ""; position: absolute; inset: auto 24px 0; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--cyan) 42%, transparent), transparent); }
.business-page-hero h2 { max-width: 620px; margin: 0; font-size: clamp(27px, 4vw, 43px); letter-spacing: -.055em; line-height: 1.04; }
.business-page-hero p { max-width: 610px; font-size: 13px; }
.business-command-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 12px; align-items: start; }
.business-command-grid .business-summary, .business-command-grid .business-alerts { height: 100%; margin: 0; }
.business-command-grid .business-alert-list { grid-template-columns: 1fr; }
.business-command-grid .business-alert { background: color-mix(in srgb, var(--surface) 92%, transparent); }
.business-metrics-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.business-metrics-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 11px; }
.business-metrics-head h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.business-metrics-head p { max-width: 420px; margin: 0; color: var(--muted); font-size: 10.5px; text-align: right; }
.business-overview-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.business-overview-kicker { display: block; margin-bottom: 5px; color: var(--accent-text); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.business-overview-head h3 { margin: 0; font-size: clamp(20px, 2vw, 27px); letter-spacing: -.035em; }
.business-overview-head p { max-width: 650px; margin: 7px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.business-overview-controls { display: flex; align-items: flex-end; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.business-overview-controls > label:not(.business-compare) { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.business-overview-controls input[type="month"] { width: 152px; min-height: 38px; padding: 7px 10px; }
.business-compare { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--text-secondary); font-size: 11.5px; cursor: pointer; }
.business-compare input { width: auto; }
.business-overview-controls button { min-height: 38px; }
.business-overview-meta { min-height: 18px; margin: 17px 0 9px; color: var(--muted); font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; font-size: 10.5px; }
.business-alerts { margin: 0 0 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface-subtle) 72%, transparent); }
.business-alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.business-alerts-kicker { display: block; margin-bottom: 3px; color: var(--warning); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.business-alerts-head h4 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.business-alert-count { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--text-secondary); font-size: 11px; font-weight: 800; }
.business-alert-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.business-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.business-alert::before { content: ""; width: 3px; height: 100%; min-height: 44px; border-radius: 999px; background: var(--warning); }
.business-alert.severity-high::before { background: var(--danger); }
.business-alert-body { min-width: 0; }
.business-alert-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.business-alert-top strong { overflow: hidden; color: var(--text); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.business-alert-severity { flex: none; padding: 3px 6px; border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--line)); border-radius: 999px; color: var(--warning); font-size: 8.5px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.severity-high .business-alert-severity { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger); }
.business-alert p { margin: 5px 0 7px; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.business-alert-evidence { display: flex; flex-wrap: wrap; gap: 5px 10px; color: var(--text-secondary); font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; font-size: 9px; }
.business-alert-empty { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); font-size: 11px; }
.business-alert-empty i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px color-mix(in srgb, var(--success) 70%, transparent); }
.business-summary { position: relative; margin: 0 0 12px; padding: 17px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: var(--radius-lg); background: linear-gradient(125deg, color-mix(in srgb, var(--accent) 9%, var(--surface)) 0%, var(--surface) 58%, color-mix(in srgb, var(--cyan) 4%, var(--surface)) 100%); }
.business-summary::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(180deg, var(--accent), var(--cyan)); }
.business-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.business-summary-kicker { display: block; margin-bottom: 4px; color: var(--accent-text); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.business-summary-head h4 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.business-summary-head p { max-width: 680px; margin: 5px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.business-summary-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.business-summary-actions button { min-height: 36px; }
.business-summary-body { min-height: 76px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.business-summary-empty { display: grid; gap: 4px; min-height: 56px; align-content: center; color: var(--muted); font-size: 11px; line-height: 1.5; }
.business-summary-empty strong { color: var(--text); font-size: 12px; }
.business-summary-overview { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.business-summary-overview h5 { margin: 0; color: var(--text); font-size: clamp(15px, 2vw, 19px); letter-spacing: -.025em; line-height: 1.25; }
.business-summary-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.business-summary-badge { padding: 4px 7px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text-secondary); font-size: 8.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.business-summary-badge.is-fallback { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); color: var(--warning); }
.business-summary-coverage { margin: 6px 0 0; color: var(--muted); font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; font-size: 9.5px; }
.business-summary-insights { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.business-summary-insight { display: grid; grid-template-columns: 5px minmax(0, 1fr); gap: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 84%, transparent); }
.business-summary-insight::before { content: ""; border-radius: 999px; background: var(--accent); }
.business-summary-insight.priority-high::before { background: var(--danger); }
.business-summary-insight.priority-medium::before { background: var(--warning); }
.business-summary-insight p { margin: 0; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.business-summary-evidence { display: flex; flex-wrap: wrap; gap: 5px 9px; margin-top: 6px; color: var(--muted); font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; font-size: 8.5px; }
.business-summary-evidence span { padding: 2px 5px; border: 1px solid var(--line); border-radius: 999px; }
.business-summary-recommendation { margin: 10px 0 0; padding: 9px 11px; border-left: 2px solid var(--cyan); color: var(--text-secondary); font-size: 10.5px; line-height: 1.5; }
.business-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.business-kpi { position: relative; min-width: 0; min-height: 190px; padding: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 6%, var(--surface)), var(--surface) 55%); }
.business-kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--accent), var(--cyan)); opacity: .8; }
.business-kpi.status-stale::before { background: var(--warning); }
.business-kpi.status-missing::before { background: var(--muted); opacity: .45; }
.business-kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.business-kpi-name { min-width: 0; color: var(--text-secondary); font-size: 11.5px; font-weight: 700; line-height: 1.35; }
.business-kpi-status { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--muted); font-size: 9.5px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.business-kpi-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 7px color-mix(in srgb, var(--success) 70%, transparent); }
.status-stale .business-kpi-status i { background: var(--warning); box-shadow: none; }
.status-missing .business-kpi-status i { background: var(--muted); box-shadow: none; }
.business-kpi-value { display: block; margin-top: 15px; color: var(--text); font-size: clamp(27px, 3vw, 38px); font-variant-numeric: tabular-nums; letter-spacing: -.05em; line-height: 1; }
.business-kpi-delta { margin-top: 8px; font-size: 10.5px; font-weight: 750; }
.business-kpi-delta.is-improved { color: var(--success); }
.business-kpi-delta.is-declined { color: var(--danger); }
.business-kpi-delta.is-neutral { color: var(--muted); }
.business-trend { display: grid; height: 46px; margin: 9px 0 2px; align-items: center; }
.business-trend svg { display: block; width: 100%; height: 44px; overflow: visible; }
.business-trend-line { fill: none; stroke: var(--accent-text); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; vector-effect: non-scaling-stroke; }
.business-trend-baseline { stroke: var(--line); stroke-dasharray: 3 4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.business-trend-empty { color: var(--muted); font-size: 9.5px; }
.business-kpi p { min-height: 34px; margin: 12px 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.business-kpi footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9.5px; }
.business-kpi footer span { color: var(--text-secondary); font-weight: 700; }
.business-kpi footer time { min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.business-overview-empty { grid-column: 1 / -1; display: grid; justify-items: start; gap: 6px; min-height: 124px; padding: 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--muted); }
.business-overview-empty strong { color: var(--text); }
.business-overview-empty button { margin-top: 5px; }
.business-kpi-skeleton { min-height: 190px; background: linear-gradient(100deg, var(--surface) 20%, var(--surface-subtle) 40%, var(--surface) 60%); background-size: 200% 100%; animation: business-shimmer 1.3s linear infinite; }
@keyframes business-shimmer { to { background-position-x: -200%; } }
@media (max-width: 1100px) { .business-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) {
  .business-command-grid { grid-template-columns: 1fr; }
  .business-alert-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) { .business-alert-list { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .business-pulse { padding: 14px; }
  .business-pulse-head { align-items: stretch; flex-direction: column; gap: 12px; }
  .business-pulse-link { justify-content: center; min-height: 44px; }
  .business-pulse-metrics { grid-template-columns: 1fr; }
  .business-page-hero { padding: 18px; }
  .business-overview { padding: 15px; }
  .business-overview-head { align-items: stretch; flex-direction: column; gap: 15px; }
  .business-overview-controls { align-items: stretch; justify-content: flex-start; }
  .business-overview-controls > label:not(.business-compare) { flex: 1 1 145px; }
  .business-overview-controls input[type="month"] { width: 100%; min-height: 44px; }
  .business-compare, .business-overview-controls button { min-height: 44px; }
  .business-alerts { padding: 12px; }
  .business-summary { padding: 14px; }
  .business-summary-head, .business-summary-overview { grid-template-columns: 1fr; flex-direction: column; }
  .business-summary-actions { width: 100%; justify-content: flex-start; }
  .business-summary-actions button { min-height: 44px; flex: 1 1 120px; }
  .business-summary-badges { justify-content: flex-start; }
  .business-metrics-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .business-metrics-head p { text-align: left; }
}
@media (max-width: 520px) {
  .business-kpi-grid { grid-template-columns: 1fr; }
  .business-compare { flex: 1 1 100%; }
  .business-overview-controls button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .business-kpi-skeleton, .business-pulse-skeleton { animation: none; }
  .business-pulse-link span { transition: none; }
}

/* ---------- Command palette (⌘K) ---------- */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(3,6,12,0.62); z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.cmdk { width: min(580px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow-md); overflow: hidden; }
.cmdk input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 15px; background: transparent; }
.cmdk input:focus { outline: none; border-color: var(--line); }
.cmdk-list { max-height: 54vh; overflow: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.cmdk-item .k-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent-text); flex: none; font-size: 13px; }
.cmdk-item .k-ic svg { width: 15px; height: 15px; }
.cmdk-item .k-kind { margin-left: auto; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cmdk-item.sel { background: var(--accent-weak); }
.cmdk-empty { padding: 20px; color: var(--muted); font-size: 13px; text-align: center; }
.cmdk-hint { padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; display: flex; gap: 14px; flex-wrap: wrap; }
.cmdk-hint kbd { background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-family: inherit; }
.kbd-hint { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Task toolbar: filter chips + search + sort (#4) ---------- */
.task-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: transparent; color: var(--text-secondary);
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active { background: var(--accent-weak); border-color: var(--accent-weak-2); color: var(--text); }
.toolbar-right { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.toolbar-right input[type="search"] { min-width: 190px; }
.toolbar-right select { width: auto; }
@media (max-width: 620px) {
  .toolbar-right { margin-left: 0; width: 100%; }
  .toolbar-right input[type="search"] { flex: 1; min-width: 0; }
}

/* ---------- Overview activity diary ---------- */
.activity-section { margin-top: 28px; }
.activity-head { margin-bottom: 10px; }
.activity-head .ov-h { margin: 0; }
.activity-types { margin-bottom: 10px; }
.activity-feed { border-top: 1px solid var(--line); }
.activity-day {
  padding: 15px 0 7px; color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.activity-row {
  display: grid; grid-template-columns: 48px 12px minmax(0, 1fr); gap: 10px;
  align-items: start; min-height: 42px; padding: 9px 8px; border-bottom: 1px solid rgba(148,163,184,0.12);
}
.activity-row[role="button"] { cursor: pointer; border-radius: var(--radius-sm); }
.activity-row[role="button"]:hover, .activity-row[role="button"]:focus { background: var(--surface-subtle); outline: none; }
.activity-row time { color: var(--muted); font-size: 11.5px; font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; line-height: 20px; }
.activity-marker { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #94a3b8; }
.activity-row.type-chat .activity-marker { background: #38bdf8; }
.activity-row.type-task .activity-marker { background: var(--success); }
.activity-row.type-change .activity-marker { background: var(--warning); }
.activity-row.type-memory .activity-marker { background: #c084fc; }
.activity-row.type-workflow .activity-marker { background: #fb7185; }
.activity-text { min-width: 0; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.activity-kind { margin-left: 8px; color: var(--muted); font-size: 10.5px; text-transform: uppercase; }
.activity-more { display: flex; justify-content: center; padding: 12px 0 0; }
.activity-loading { display: flex; align-items: center; gap: 8px; min-height: 74px; color: var(--muted); }
@media (max-width: 620px) {
  .activity-head { align-items: flex-start; flex-direction: column; }
  .activity-row { grid-template-columns: 42px 10px minmax(0, 1fr); gap: 7px; padding-left: 2px; padding-right: 2px; }
  .activity-kind { display: block; margin: 3px 0 0; }
}

/* ---------- Task detail: tabs (#5) ---------- */
.tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin: 2px 0 14px;
}
.tab {
  padding: 8px 13px; border: none; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent-text); }
.tab-badge {
  display: inline-block; min-width: 17px; text-align: center; padding: 0 5px;
  border-radius: var(--radius-pill); background: var(--accent-weak); color: var(--text);
  font-size: 11px; line-height: 16px; margin-left: 3px;
}
.tab.active .tab-badge { background: var(--accent); color: var(--accent-ink); }
.tab-panels .tab-panel { display: none; }
.tab-panels .tab-panel.active { display: block; }
.tab-panel h4:first-child { margin-top: 0; }

/* ---------- Instellingen (#8) ---------- */
#page-instellingen { min-width:0; }
.settings-shell { display:grid; grid-template-columns:190px minmax(0,1fr); align-items:start; gap:20px; }
.settings-nav { position:sticky; top:82px; display:grid; gap:4px; padding:8px; border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); box-shadow:var(--shadow-sm),var(--card-sheen); }
.settings-nav-label { margin:4px 8px 8px; color:var(--muted); font-size:10px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.settings-nav button { min-height:44px; padding:9px 11px; border:0; border-radius:10px; background:transparent; box-shadow:none; color:var(--text-secondary); text-align:left; }
.settings-nav button:hover { background:var(--surface-subtle); color:var(--text); transform:none; }
.settings-nav button[aria-current="page"] { background:var(--accent-weak); color:var(--accent-text); }
.settings-mobile-nav { display:none; }
.settings-content { min-width:0; container-type:inline-size; }
.settings-panel[hidden] { display:none; }
.settings-panel-head { margin-bottom:14px; }
.settings-panel-head h3 { margin:0; font-size:20px; letter-spacing:-.02em; }
.settings-panel-head p { margin:4px 0 0; color:var(--muted); font-size:12px; line-height:1.5; }
.settings-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:14px; align-items:start; }
.settings-panel-single .settings-grid { grid-template-columns:minmax(0,1fr); }
.settings-grid > .card { min-width:0; }
@container (min-width:760px) {
  .settings-panel:not(.settings-panel-single) .settings-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
.company-identity-card { display:flex; align-items:center; gap:11px; padding:12px; border:1px solid rgba(167,139,250,.24); border-radius:13px; background:rgba(124,58,237,.08); }
.company-identity-card > span { flex:none; width:38px; height:38px; display:grid; place-items:center; border-radius:12px; color:#ede9fe; background:linear-gradient(145deg,#7c3aed,#4338ca); font-size:15px; font-weight:900; }
.company-identity-card > div { min-width:0; display:grid; gap:2px; }
.company-identity-card strong { color:var(--text); }
.company-identity-card small { color:var(--muted); font-size:10px; }
#settings-company { min-width:0; }
.company-invite-form { width:100%; max-width:none; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:8px; margin-top:16px; }
.company-invite-form label { min-width:0; display:grid; gap:5px; }
#company-invite-target-wrap,.company-invite-form label[for="company-invite-email"] { grid-column:1 / -1; }
.company-invite-form input,.company-invite-form select { width:100%; min-width:0; max-width:100%; }
.company-invite-form button { max-width:100%; white-space:nowrap; }
.company-invite-result { margin-top:10px; }
.company-invite-result > label { margin-bottom:5px; }
.company-invite-link { display:flex; gap:7px; }
.company-invite-link input { min-width:0; font-size:10px; }
.company-members { display:grid; gap:7px; margin-top:16px; }
.company-members h4 { margin:0 0 3px; color:var(--text-secondary); font-size:11px; }
.company-member-row { min-height:48px; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 10px; border:1px solid var(--line); border-radius:11px; background:var(--surface-subtle); }
.company-member-row > span { min-width:0; display:grid; gap:2px; }
.company-member-row strong { overflow:hidden; color:var(--text); font-size:10.5px; text-overflow:ellipsis; white-space:nowrap; }
.company-member-row small { color:var(--muted); font-size:9px; }
.company-member-row b { padding:3px 7px; border:1px solid var(--line); border-radius:999px; color:var(--accent-text); font-size:8px; }
.company-member-controls { display:flex; align-items:center; gap:7px; }
.company-member-controls select { width:auto; min-height:40px; padding:6px 28px 6px 9px; font-size:10px; }
.company-member-controls button { min-height:40px; }
.settings-wide { grid-column: 1 / -1; }
.set-h { margin: 0 0 12px; font-size: 15px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: none; }
.set-sub { font-size: 12px; margin: 2px 0 0; }
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.set-line:first-child { border-top: none; }
.set-line > span:first-child { color: var(--muted); }
.vault-form { display: grid; gap: 13px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.vault-form label { display: grid; gap: 6px; font-size: 13px; }
.vault-form .set-row { display: flex; }
.codex-device-code { display:block; width:max-content; margin:10px 0; padding:9px 13px; border:1px solid var(--line); border-radius:9px; background:rgba(124,58,237,.11); color:var(--text-primary); font-size:17px; font-weight:800; letter-spacing:.12em; }
.vault-reauth { display: grid; grid-template-columns: 1fr 180px; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(0,0,0,.14); }
.vault-reauth p { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) { .vault-reauth { grid-template-columns: 1fr; } }
.switch { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { display: inline-block; width: 42px; height: 24px; border-radius: 999px; background: var(--line); transition: background 0.18s ease; }
.switch-thumb { display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.35); transition: transform 0.18s ease; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Company access control — dense, responsive and server-backed. */
#page-beheer { width:100%; min-width:0; max-width:100%; overflow:hidden; }
.access-head { display:flex; align-items:flex-end; justify-content:space-between; gap:28px; margin-bottom:20px; }
.access-kicker { color:var(--accent-text); font-size:10px; font-weight:850; letter-spacing:.16em; }
.access-head h2 { margin:6px 0 7px; font-size:clamp(30px,4vw,46px); line-height:1; letter-spacing:-.045em; }
.access-head p { max-width:720px; margin:0; color:var(--text-secondary); font-size:13px; line-height:1.6; }
.access-head-actions { flex:none; display:flex; gap:8px; }
.access-head-actions button { min-height:44px; }
.organization-registry { overflow:hidden; margin-bottom:12px; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.organization-registry-head { display:flex; align-items:flex-start; justify-content:space-between; gap:22px; padding:18px 20px 14px; }
.organization-registry-kicker { color:var(--accent-text); font-size:9px; font-weight:850; letter-spacing:.14em; }
.organization-registry-head h3 { margin:5px 0; font-size:18px; letter-spacing:-.025em; }
.organization-registry-head p { max-width:760px; margin:0; color:var(--text-secondary); font-size:11px; line-height:1.55; }
.organization-registry-count { flex:none; padding:6px 9px; border:1px solid color-mix(in srgb,var(--accent) 28%,var(--line)); border-radius:999px; background:var(--accent-weak); color:var(--accent-text); font-size:8px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.organization-create-form { display:grid; grid-template-columns:minmax(180px,1.1fr) minmax(180px,.8fr) auto; align-items:end; gap:9px; padding:14px 20px; border-block:1px solid var(--line); background:var(--surface-subtle); }
.organization-create-form label { display:grid; gap:5px; color:var(--text-secondary); font-size:8px; font-weight:750; text-transform:uppercase; letter-spacing:.07em; }
.organization-create-form input { width:100%; min-height:42px; margin:0; background:var(--surface); font-size:11px; text-transform:none; letter-spacing:0; }
.organization-create-form button { min-height:42px; white-space:nowrap; }
.organization-create-status { min-height:29px; padding:7px 20px; border-bottom:1px solid var(--line); font-size:9px; }
.organization-registry-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; padding:14px 20px 18px; }
.organization-registry-item { min-width:0; padding:13px; border:1px solid var(--line); border-radius:12px; background:var(--surface-subtle); }
.organization-registry-item-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.organization-registry-item strong { display:block; overflow:hidden; font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.organization-registry-item code { display:block; overflow:hidden; margin-top:4px; color:var(--muted); font-size:8px; text-overflow:ellipsis; white-space:nowrap; }
.organization-support { margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.organization-support-form { display:grid; gap:8px; }
.organization-support-form label { display:grid; gap:4px; color:var(--muted); font-size:8px; font-weight:750; }
.organization-support-form input,.organization-support-form select { width:100%; min-width:0; }
.organization-support-grid { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.organization-support-state { padding:9px; border:1px solid color-mix(in srgb,var(--warning) 35%,var(--line)); border-radius:9px; background:color-mix(in srgb,var(--warning) 8%,var(--surface)); color:var(--text-secondary); font-size:9px; line-height:1.45; }
.organization-status { flex:none; display:inline-flex; align-items:center; gap:5px; color:var(--success); font-size:7px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; }
.organization-status::before { width:6px; height:6px; border-radius:50%; background:currentColor; content:""; }
.organization-status.is-paused,.organization-status.is-disabled { color:var(--warning); }
.organization-registry-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin-top:12px; }
.organization-registry-metrics span { padding:7px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--muted); font-size:8px; }
.organization-registry-metrics b { display:block; margin-bottom:2px; color:var(--text); font-size:13px; }
.organization-owner-state { display:flex; align-items:center; gap:7px; min-height:38px; margin-top:9px; padding:8px 9px; border:1px solid color-mix(in srgb,var(--success) 25%,var(--line)); border-radius:9px; background:color-mix(in srgb,var(--success) 5%,var(--surface)); color:var(--success); font-size:8px; font-weight:700; }
.organization-owner-state::before { width:7px; height:7px; flex:none; border-radius:50%; background:currentColor; content:""; }
.organization-owner-state.is-pending { border-color:color-mix(in srgb,var(--warning) 28%,var(--line)); background:color-mix(in srgb,var(--warning) 5%,var(--surface)); color:var(--warning); }
.organization-owner-form { display:grid; gap:7px; margin-top:9px; padding:9px; border:1px dashed color-mix(in srgb,var(--warning) 36%,var(--line)); border-radius:9px; background:color-mix(in srgb,var(--warning) 4%,var(--surface)); }
.organization-owner-form label { display:grid; gap:4px; color:var(--warning); font-size:8px; font-weight:750; text-transform:uppercase; letter-spacing:.05em; }
.organization-owner-form input { width:100%; min-height:38px; margin:0; background:var(--surface); font-size:10px; text-transform:none; letter-spacing:0; }
.organization-owner-form button { min-height:38px; padding:7px 9px; font-size:8px; }
.organization-owner-result { margin:0 20px 18px; padding:11px 12px; border:1px solid color-mix(in srgb,var(--success) 30%,var(--line)); border-radius:11px; background:color-mix(in srgb,var(--success) 5%,var(--surface)); }
.organization-owner-result strong { display:block; color:var(--success); font-size:10px; }
.organization-owner-result p { margin:4px 0 8px; color:var(--text-secondary); font-size:9px; }
.organization-owner-link { display:flex; gap:7px; }
.organization-owner-link input { min-width:0; min-height:40px; margin:0; background:var(--surface); font-size:9px; }
.organization-owner-link button { flex:none; min-height:40px; }
.organization-lifecycle { display:grid; gap:7px; margin-top:9px; padding-top:9px; border-top:1px solid var(--line); }
.organization-lifecycle-note { display:flex; align-items:flex-start; gap:7px; color:var(--muted); font-size:8px; line-height:1.45; }
.organization-lifecycle-note::before { width:7px; height:7px; margin-top:2px; flex:none; border-radius:50%; background:var(--muted); content:""; }
.organization-lifecycle-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px; }
.organization-lifecycle-form label,.organization-action-form label { display:grid; gap:4px; color:var(--muted); font-size:8px; font-weight:750; text-transform:uppercase; letter-spacing:.05em; }
.organization-lifecycle-form input,.organization-action-form input { width:100%; min-height:38px; margin:0; background:var(--surface); font-size:10px; text-transform:none; letter-spacing:0; }
.organization-lifecycle-form button { align-self:end; min-height:38px; padding:7px 10px; font-size:8px; }
.organization-lifecycle-form.is-resume button { color:var(--success); border-color:color-mix(in srgb,var(--success) 35%,var(--line)); }
.organization-action-pending { display:grid; gap:8px; padding:10px; border:1px solid color-mix(in srgb,var(--warning) 35%,var(--line)); border-radius:10px; background:color-mix(in srgb,var(--warning) 5%,var(--surface)); }
.organization-action-pending > strong { color:var(--warning); font-size:9px; }
.organization-action-pending > p { margin:0; color:var(--text-secondary); font-size:9px; line-height:1.45; }
.organization-action-meta { color:var(--muted); font-size:7px; text-transform:uppercase; letter-spacing:.05em; }
.organization-action-form { display:grid; grid-template-columns:minmax(0,1fr) minmax(100px,.55fr); gap:7px; }
.organization-action-buttons { display:flex; grid-column:1 / -1; gap:7px; }
.organization-action-buttons button { min-height:38px; padding:7px 10px; font-size:8px; }
.organization-action-buttons .danger { color:var(--danger); border-color:color-mix(in srgb,var(--danger) 38%,var(--line)); background:color-mix(in srgb,var(--danger) 5%,var(--surface)); }
.organization-registry-loading,.organization-registry-error { grid-column:1 / -1; display:flex; align-items:center; justify-content:center; gap:9px; min-height:80px; color:var(--muted); font-size:10px; }
.organization-registry-error { color:var(--danger); }
.tenancy-readiness { position:relative; overflow:hidden; margin-bottom:12px; border:1px solid color-mix(in srgb,var(--accent) 24%,var(--line)); border-radius:16px; background:linear-gradient(135deg,color-mix(in srgb,var(--accent) 7%,var(--surface)) 0%,var(--surface) 58%); }
.tenancy-readiness::before { position:absolute; inset:0 auto 0 0; width:3px; background:var(--accent); content:""; }
.tenancy-readiness-head { display:flex; align-items:flex-start; justify-content:space-between; gap:22px; padding:18px 20px 15px; border-bottom:1px solid var(--line); }
.tenancy-readiness-kicker { color:var(--accent-text); font-size:9px; font-weight:850; letter-spacing:.14em; }
.tenancy-readiness-head h3 { margin:5px 0 5px; font-size:18px; letter-spacing:-.025em; }
.tenancy-readiness-head p { max-width:720px; margin:0; color:var(--text-secondary); font-size:11px; line-height:1.55; }
.tenancy-readiness-state { flex:none; display:inline-flex; align-items:center; gap:6px; min-height:28px; padding:5px 9px; border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--text-secondary); font-size:8px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; }
.tenancy-readiness-state::before { width:7px; height:7px; border-radius:50%; background:currentColor; content:""; }
.tenancy-readiness-state.is-ready { border-color:color-mix(in srgb,var(--success) 38%,var(--line)); color:var(--success); }
.tenancy-readiness-state.is-blocked { border-color:color-mix(in srgb,var(--warning) 38%,var(--line)); color:var(--warning); }
.tenancy-readiness-state.is-error { border-color:color-mix(in srgb,var(--danger) 38%,var(--line)); color:var(--danger); }
.tenancy-readiness-state.is-loading { color:var(--muted); }
.tenancy-readiness-body { padding:15px 20px 18px; }
.tenancy-readiness-loading { display:flex; align-items:center; gap:9px; min-height:62px; color:var(--muted); font-size:10px; }
.tenancy-readiness-overview { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.tenancy-readiness-metric { min-width:0; padding:11px 12px; border:1px solid var(--line); border-radius:11px; background:color-mix(in srgb,var(--surface) 88%,transparent); }
.tenancy-readiness-metric span { display:block; color:var(--muted); font-size:8px; font-weight:750; text-transform:uppercase; letter-spacing:.06em; }
.tenancy-readiness-metric strong { display:block; overflow:hidden; margin-top:5px; color:var(--text); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.tenancy-readiness-details { display:grid; grid-template-columns:minmax(0,1fr) minmax(260px,.8fr); gap:14px; margin-top:14px; }
.tenancy-readiness-details h4 { margin:0 0 8px; color:var(--text-secondary); font-size:9px; text-transform:uppercase; letter-spacing:.08em; }
.tenancy-source-counts { display:flex; flex-wrap:wrap; gap:6px; }
.tenancy-source-counts span { padding:6px 8px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text-secondary); font-size:9px; }
.tenancy-source-counts strong { margin-left:4px; color:var(--text); }
.tenancy-blockers { display:grid; gap:6px; }
.tenancy-blocker { padding:8px 10px; border:1px solid color-mix(in srgb,var(--warning) 26%,var(--line)); border-radius:9px; background:color-mix(in srgb,var(--warning) 5%,var(--surface)); }
.tenancy-blocker code { display:block; color:var(--warning); font-size:8px; font-weight:750; }
.tenancy-blocker span { display:block; margin-top:3px; color:var(--text-secondary); font-size:9px; line-height:1.45; }
.tenancy-readiness-note { margin:12px 0 0; color:var(--muted); font-size:9px; }
.tenancy-readiness-error { min-height:62px; display:grid; align-content:center; gap:4px; color:var(--text-secondary); font-size:10px; }
.tenancy-readiness-error strong { color:var(--danger); }
.access-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-bottom:12px; }
.access-summary > div { min-width:0; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:2px 14px; padding:14px 16px; border:1px solid var(--line); border-radius:13px; background:var(--surface); }
.access-summary span { color:var(--text-secondary); font-size:10px; font-weight:750; text-transform:uppercase; letter-spacing:.06em; }
.access-summary strong { grid-row:span 2; font-size:24px; letter-spacing:-.04em; }
.access-summary small { color:var(--muted); font-size:9px; }
.access-toolbar { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; padding:13px 15px; border:1px solid var(--line); border-bottom:0; border-radius:14px 14px 0 0; background:var(--surface-subtle); }
.access-toolbar label { width:min(360px,100%); display:grid; gap:5px; color:var(--text-secondary); font-size:9px; font-weight:750; text-transform:uppercase; letter-spacing:.07em; }
.access-toolbar input { min-height:42px; margin:0; background:var(--surface); font-size:12px; text-transform:none; letter-spacing:0; }
.access-legend { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:12px; padding-bottom:10px; color:var(--muted); font-size:9px; }
.access-legend span { display:flex; align-items:center; gap:5px; }
.access-legend i { width:9px; height:9px; border:1px solid var(--line-strong); border-radius:3px; background:var(--surface); }
.access-legend i.enabled { border-color:var(--accent); background:var(--accent); }
.access-legend i.locked { background:repeating-linear-gradient(135deg,var(--surface) 0 2px,var(--line) 2px 4px); }
.access-status { min-height:30px; padding:7px 15px; border-inline:1px solid var(--line); background:var(--surface); font-size:9px; }
.access-status.has-changes { color:var(--warning); }
.access-matrix-shell { width:100%; min-width:0; max-width:100%; min-height:260px; overflow:hidden; border:1px solid var(--line); border-radius:0 0 14px 14px; background:var(--surface); }
.access-matrix-scroll { width:100%; min-width:0; max-width:100%; overflow:auto; overscroll-behavior-inline:contain; scrollbar-gutter:stable; contain:inline-size; }
.access-matrix { width:max-content; min-width:100%; border-spacing:0; border-collapse:separate; color:var(--text); }
.access-matrix th,.access-matrix td { border-right:1px solid var(--line); border-bottom:1px solid var(--line); }
.access-matrix tr:last-child th,.access-matrix tr:last-child td { border-bottom:0; }
.access-matrix th:last-child,.access-matrix td:last-child { border-right:0; }
.access-matrix thead th { position:sticky; top:0; z-index:3; min-width:205px; padding:12px; background:var(--surface-subtle); vertical-align:top; text-align:left; }
.access-matrix .access-feature-head { left:0; z-index:5; width:260px; min-width:260px; }
.access-feature-head > span { display:block; color:var(--text); font-size:11px; font-weight:800; }
.access-feature-head > small { display:block; margin-top:3px; color:var(--muted); font-size:9px; font-weight:500; }
.access-member-head.is-disabled { opacity:.65; }
.access-member-identity { min-width:0; display:grid; grid-template-columns:34px minmax(0,1fr); align-items:center; gap:9px; }
.access-member-identity > span { display:grid; place-items:center; width:34px; height:34px; border:1px solid color-mix(in srgb,var(--accent) 30%,var(--line)); border-radius:10px; background:var(--accent-weak); color:var(--accent-text); font-size:12px; font-weight:850; }
.access-member-identity > div { min-width:0; display:grid; gap:4px; }
.access-member-identity strong { overflow:hidden; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.access-member-identity small { color:var(--muted); font-size:8px; font-weight:500; }
.access-role { padding:2px 5px; border:1px solid var(--line); border-radius:999px; color:var(--text-secondary); font-size:7px; text-transform:uppercase; letter-spacing:.05em; }
.access-role.role-owner { border-color:color-mix(in srgb,var(--accent) 35%,var(--line)); color:var(--accent-text); }
.access-role.role-admin { border-color:color-mix(in srgb,var(--success) 32%,var(--line)); color:var(--success); }
.access-role.role-viewer { border-color:color-mix(in srgb,var(--cyan) 30%,var(--line)); color:var(--cyan); }
.access-member-tools { display:flex; align-items:center; flex-wrap:wrap; gap:5px; margin-top:9px; }
.access-member-tools > span:first-child { flex:1 1 auto; color:var(--muted); font-size:8px; font-weight:550; }
.access-member-tools button { min-width:44px; min-height:36px; padding:5px 8px; border-color:var(--line); background:var(--surface); color:var(--text-secondary); font-size:8px; box-shadow:none; }
.access-member-tools button:hover { border-color:var(--accent); color:var(--text); transform:none; }
.access-protected { flex:none!important; padding:4px 6px; border:1px solid var(--line); border-radius:999px; font-size:7px!important; text-transform:uppercase; letter-spacing:.04em; }
.access-matrix tbody th { position:sticky; left:0; z-index:2; width:260px; min-width:260px; padding:13px 14px; background:var(--surface); text-align:left; }
.access-matrix tbody th strong { display:block; font-size:10.5px; }
.access-matrix tbody th small { display:block; max-width:230px; margin-top:4px; color:var(--muted); font-size:8.5px; font-weight:450; line-height:1.45; }
.access-matrix td { min-width:205px; height:66px; padding:8px; background:var(--surface); text-align:center; }
.access-matrix tbody tr:hover th,.access-matrix tbody tr:hover td { background:color-mix(in srgb,var(--accent) 3%,var(--surface)); }
.access-check { position:relative; display:inline-grid; place-items:center; width:44px; height:44px; cursor:pointer; }
.access-check input { position:absolute; width:1px; height:1px; opacity:0; }
.access-check > span { pointer-events:none; display:grid; place-items:center; width:28px; height:28px; border:1px solid var(--line-strong); border-radius:8px; background:var(--surface-subtle); transition:border-color .18s ease,background .18s ease,box-shadow .18s ease; }
.access-check > span i { width:8px; height:13px; margin-top:-2px; border:solid transparent; border-width:0 2px 2px 0; transform:rotate(45deg); }
.access-check input:checked + span { border-color:var(--accent); background:var(--accent); box-shadow:0 0 0 4px var(--accent-weak); }
.access-check input:checked + span i { border-color:var(--on-accent,#fff); }
.access-check input:focus-visible + span { outline:2px solid var(--accent); outline-offset:3px; }
.access-check.is-locked { cursor:not-allowed; }
.access-check.is-locked > span { opacity:.58; background:repeating-linear-gradient(135deg,var(--surface-subtle) 0 3px,var(--line) 3px 5px); }
.access-loading,.access-empty { min-height:260px; display:grid; place-content:center; justify-items:center; gap:9px; padding:30px; color:var(--muted); text-align:center; }
.access-loading strong,.access-empty strong { color:var(--text); font-size:12px; }
.access-empty span { font-size:10px; }

@media (max-width:760px) {
  .access-head { align-items:stretch; flex-direction:column; gap:15px; }
  .access-head-actions { display:grid; grid-template-columns:1fr 1.4fr; }
  .organization-registry-head { align-items:stretch; flex-direction:column; gap:12px; padding:16px; }
  .organization-registry-count { align-self:flex-start; }
  .organization-create-form { grid-template-columns:1fr; padding:14px 16px; }
  .organization-create-form button { min-height:44px; }
  .organization-create-status { padding-inline:16px; }
  .organization-registry-list { grid-template-columns:1fr; padding:13px 16px 16px; }
  .organization-owner-result { margin:0 16px 16px; }
  .organization-owner-link { align-items:stretch; flex-direction:column; }
  .organization-owner-link button { min-height:44px; }
  .organization-lifecycle-form,.organization-action-form { grid-template-columns:1fr; }
  .organization-lifecycle-form button,.organization-action-form button { min-height:44px; }
  .organization-action-buttons { grid-column:1; flex-direction:column; }
  .tenancy-readiness-head { align-items:stretch; flex-direction:column; gap:12px; padding:16px; }
  .tenancy-readiness-state { align-self:flex-start; }
  .tenancy-readiness-body { padding:13px 16px 16px; }
  .tenancy-readiness-overview { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tenancy-readiness-details { grid-template-columns:1fr; }
  .access-summary { grid-template-columns:1fr; }
  .access-toolbar { align-items:stretch; flex-direction:column; gap:10px; }
  .access-toolbar label { width:100%; }
  .access-legend { justify-content:flex-start; padding-bottom:2px; }
  .access-matrix .access-feature-head,.access-matrix tbody th { width:190px; min-width:190px; }
  .access-matrix tbody th small { max-width:165px; }
  .access-matrix thead th,.access-matrix td { min-width:190px; }
  .access-member-tools button { min-height:44px; }
}

@media (prefers-reduced-motion:reduce) {
  .access-check > span { transition:none; }
}
.agents-empty { display: flex; align-items: center; gap: 14px; padding: 15px; border: 1px dashed var(--line); border-radius: var(--radius-md); background: var(--panel); }
.agents-empty-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; background: var(--accent-weak); color: var(--accent-text); }
.agents-empty-icon svg { width: 20px; height: 20px; }
.agents-empty div { flex: 1; min-width: 0; }
.agents-empty p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.agent-setup-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.agent-setup-head > div { display: grid; gap: 3px; }
.agent-setup-kicker { color: var(--accent-text); font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.agent-setup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.agent-setup-check { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.agent-setup-check > span { display: grid; place-items: center; width: 23px; height: 23px; flex: 0 0 23px; border-radius: 50%; font-weight: 800; }
.agent-setup-check.ready > span { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.agent-setup-check.pending > span { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.agent-setup-check div { display: grid; min-width: 0; }
.agent-setup-check strong { font-size: 12px; }
.agent-setup-check small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agent-repo-form { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.agent-repo-form label { display: grid; gap: 3px; font-size: 13px; }
.agent-repo-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.agent-repo-row button { min-width: 112px; }
.agent-setup-callout { display: grid; grid-template-columns: auto minmax(180px, auto) 1fr; align-items: center; gap: 9px; margin-top: 12px; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--line)); border-radius: 11px; background: color-mix(in srgb, var(--warning) 8%, transparent); font-size: 12px; }
@media (max-width: 760px) {
  .agent-setup-grid { grid-template-columns: 1fr 1fr; }
  .agent-setup-callout { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .agents-empty { align-items: flex-start; flex-wrap: wrap; }
  .agents-empty a { width: 100%; min-height: 44px; justify-content: center; }
  .agent-setup-head { align-items: flex-start; flex-direction: column; }
  .agent-setup-grid { grid-template-columns: 1fr; }
  .agent-repo-row { grid-template-columns: 1fr; }
  .agent-repo-row button { min-height: 44px; }
}
/* ---------- Chat ---------- */
.chat-wrap { position: relative; display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; }
/* Autocomplete-popup voor /-commando's en @-mentions (A6) */
.chat-ac { position: absolute; bottom: 64px; left: 0; right: 0; z-index: 30; max-width: 480px; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 4px; }
.chat-ac-item { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; background: none; border: none; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--text); font-size: 13px; }
.chat-ac-item strong { font-weight: 650; white-space: nowrap; }
.chat-ac-item span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-ac-item.active, .chat-ac-item:hover { background: var(--accent-weak); }
.chat-mention { display: inline; background: var(--accent-weak); border: none; border-radius: 6px; padding: 1px 6px; color: var(--accent-text); font: inherit; font-size: 0.95em; cursor: pointer; }
.chat-msg.user .chat-mention { background: rgba(255,255,255,0.22); color: var(--accent-ink); }
.chat-thread { flex: 1 1 auto; overflow-y: auto; padding: 4px 2px 12px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto; text-align: center; max-width: 46ch; }
.chat-empty h3 { margin: 0 0 6px; }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.agent { justify-content: flex-start; }
.chat-bubble { max-width: min(80%, 720px); padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; border: 1px solid var(--line); }
.chat-msg.user .chat-bubble { background: linear-gradient(135deg, #8b5cf6, var(--accent)); color: var(--accent-ink); border-color: transparent; border-bottom-right-radius: 5px; }
.chat-msg.agent .chat-bubble { background: var(--surface); color: var(--text); border-bottom-left-radius: 5px; }
.chat-tasks { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.chat-taskchip { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 9px; border-radius: 8px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.chat-taskchip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: none; }
.chat-taskchip.st-completed .dot { background: var(--success); }
.chat-taskchip.st-running .dot, .chat-taskchip.st-planning .dot { background: #f5a623; }
.chat-taskchip.st-failed .dot, .chat-taskchip.st-blocked .dot { background: #e5484d; }
.chat-taskchip em { color: var(--muted); font-style: normal; }
.chat-task-wrap { display: grid; gap: 5px; }
.chat-work { border-left: 2px solid var(--line); padding-left: 9px; font-size: 12px; color: var(--muted); }
.chat-work summary { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-secondary); }
.chat-work ul { margin: 7px 0 2px; padding-left: 18px; }
.chat-work li { margin: 3px 0; }
.chat-work li span { color: var(--accent-text); }
.chat-diffs { margin-top: 8px; }
.chat-diff-head { margin: 6px 0 3px; }
.chat-bubble p { margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble h3, .chat-bubble h4, .chat-bubble h5 { margin: 4px 0 8px; font-size: 14px; }
.chat-bubble ul { margin: 6px 0; padding-left: 20px; }
.chat-bubble a { color: var(--accent-text); }
.chat-bubble > code, .chat-bubble p code, .chat-bubble li code { padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,0.08); font-size: 12px; }
.chat-code { margin: 8px 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #11141a; }
.chat-code-head { min-height: 32px; padding: 4px 6px 4px 10px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font: 11px ui-monospace, monospace; border-bottom: 1px solid var(--line); }
.chat-code pre { margin: 0; padding: 11px 12px; overflow-x: auto; }
.chat-code code { font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: #e5e7eb; }
.code-keyword { color: #7dd3fc; }
.code-comment { color: #86a789; }
.chat-bubble.typing { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.chat-bubble.typing > span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chatblink 1.2s infinite; }
.chat-bubble.typing > span:nth-child(2) { animation-delay: 0.2s; }
.chat-bubble.typing > span:nth-child(3) { animation-delay: 0.4s; }
.chat-live-progress { flex-basis:100%; height:4px; overflow:hidden; border-radius:999px; background:var(--line); margin-top:7px; }
.chat-live-progress > span { display:block; height:100%; border-radius:inherit; background:var(--accent); transition:width .25s ease; }
.chat-bubble.typing > small { color:var(--muted); font-size:11px; }
.chat-bubble blockquote { margin:8px 0; padding:7px 11px; border-left:3px solid var(--accent); background:rgba(255,255,255,.04); color:var(--text-secondary); }
.chat-bubble hr { border:0; border-top:1px solid var(--line); margin:12px 0; }
.chat-table-wrap { max-width:100%; overflow:auto; margin:9px 0; }
.chat-table-wrap table { border-collapse:collapse; min-width:320px; font-size:13px; }
.chat-table-wrap th,.chat-table-wrap td { border:1px solid var(--line); padding:7px 9px; text-align:left; vertical-align:top; }
.chat-table-wrap th { background:rgba(255,255,255,.06); }
.task-list-item { list-style:none; margin-left:-20px; }
.task-list-item input { accent-color:var(--accent); }
@keyframes chatblink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
.chat-input { display: flex; gap: 10px; align-items: flex-end; padding-top: 10px; margin-top: 0; max-width: none; border-top: 1px solid var(--line); }
.chat-input textarea { flex: 1 1 auto; resize: none; min-height: 44px; max-height: 160px; padding: 11px 14px; border-radius: 12px; }
.chat-input button.primary { flex: 0 0 auto; height: 44px; width: 46px; font-size: 16px; border-radius: 12px; }
.chat-attach-btn, .chat-mic-btn { flex: 0 0 auto; height: 44px; width: 44px; font-size: 18px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--text); cursor: pointer; }
.chat-attach-btn:hover, .chat-mic-btn:hover { background: rgba(255,255,255,0.1); }
.chat-mic-btn.recording { border-color: var(--danger); color: var(--danger); background: rgba(248,113,113,0.12); animation: micpulse 1.2s ease-in-out infinite; }
.chat-mic-btn.transcribing { cursor: wait; opacity: 0.65; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 4px rgba(248,113,113,0.14); } }
.chat-voice-options { min-height: 28px; display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding-top: 4px; color: var(--muted); font-size: 11.5px; }
.chat-speech-status { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-voice-toggle { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.chat-voice-toggle input { margin: 0; accent-color: var(--accent-text); }
.chat-speak { width: 28px; height: 28px; display: inline-grid; place-items: center; margin: 7px -5px -5px auto; padding: 0; border: none; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.chat-speak:hover, .chat-speak.playing { color: var(--text); background: rgba(255,255,255,0.08); }
.chat-speak:disabled { cursor: wait; opacity: 0.55; }
.chat-proposal-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.chat-proposal-actions button { font-size: 12px; padding: 5px 9px; }
.chat-attach-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-attach-strip:not(:empty) { padding: 8px 0 2px; }
.chat-attach-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 220px; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 12px; }
.chat-attach-chip img { width: 30px; height: 30px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.chat-attach-chip .ai { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.chat-attach-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attach-chip .rm { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 2px; line-height: 1; }
.chat-attach-chip.loading { opacity: 0.7; }
.mini-spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent-text); border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chat-msg-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chat-att { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: inherit; }
.chat-att.image img { max-width: 200px; max-height: 200px; border-radius: 10px; display: block; background: rgba(0,0,0,0.15); min-width: 60px; min-height: 40px; }
.chat-att.doc { padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); font-size: 12.5px; }
.chat-att-group { display:inline-flex; align-items:stretch; gap:4px; }
.chat-att-library { min-height:36px; padding:6px 9px; border:1px solid var(--line); border-radius:10px; background:var(--surface-subtle); color:var(--text-secondary); box-shadow:none; font-size:11px; }
.chat-att-library:hover { transform:none; box-shadow:none; color:var(--text); }
.chat-att.media { display:grid; gap:6px; width:min(100%, 460px); }
.chat-att.media video { width:100%; max-height:420px; border-radius:10px; background:#000; }
.chat-att.media audio { width:min(100%, 380px); }
.chat-att.media a { color:var(--accent); font-size:12px; }
.chat-msg.user .chat-att.doc { background: rgba(0,0,0,0.15); border-color: rgba(255,255,255,0.25); }

@media (max-width: 620px) {
  .chat-input { gap: 6px; }
  .chat-input textarea { padding-inline: 10px; }
  .chat-attach-btn, .chat-mic-btn { width: 40px; }
  .chat-input button.primary { width: 42px; }
  .chat-voice-options { gap: 10px; }
}

/* ---------- Prioriteit & pauze (B6) ---------- */
.badge.prio-high { color: #f5a623; border-color: rgba(245, 166, 35, 0.45); }
.badge.agent-badge { color: var(--cyan); background: rgba(34,211,238,.08); border-color: rgba(34,211,238,.24); }
.badge.prio-low { color: var(--muted); }
.badge.held { color: #9aa4b2; border-color: rgba(154, 164, 178, 0.45); }
.steer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }

/* ---------- Wijzigingen (C3) ---------- */
.chg-card { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: 12px 14px; margin-bottom: 10px; }
.chg-card.bad { border-color: rgba(229, 72, 77, 0.4); }
.chg-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chg-ic { flex: 0 0 auto; }
.chg-sum { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; min-width: 0; }
.chg-when { flex: 0 0 auto; margin-left: auto; font-size: 12px; }
.chg-task { font-size: 12px; margin-top: 4px; }
.chg-task a { color: var(--accent-text); text-decoration: none; }
.chg-detail { margin-top: 8px; }
.chg-detail summary { cursor: pointer; font-size: 12.5px; color: var(--text-secondary); }
.chg-detail .diff, .chg-detail .sbx-out { margin-top: 8px; max-height: 320px; overflow: auto; }
.chg-meta { font-size: 12.5px; margin-top: 6px; }
.chg-actions { margin-top: 10px; }
#changes-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- Missie-overzicht per doel (C1) ---------- */
.goal-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 18px; }
.goal-card { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: inherit; text-decoration: none; transition: border-color .15s ease; }
.goal-card:hover { border-color: var(--accent-weak-2); }
.goal-card.bad { border-color: rgba(229, 72, 77, 0.45); }
.goal-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.goal-title { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-state { flex: 0 0 auto; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); }
.goal-state.ok { color: var(--success); border-color: rgba(70, 200, 120, 0.4); }
.goal-state.bad { color: #e5484d; border-color: rgba(229, 72, 77, 0.4); }
.goal-state.busy { color: #f5a623; border-color: rgba(245, 166, 35, 0.4); }
.goal-bar { display: block; height: 7px; border-radius: 999px; background: rgba(127,127,127,0.18); overflow: hidden; }
.goal-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .3s ease; }
.goal-card.ok .goal-bar > span { background: var(--success); }
.goal-card.bad .goal-bar > span { background: #e5484d; }
.goal-sub { font-size: 12px; margin-top: 8px; }
.goal-blocked { font-size: 12px; margin-top: 6px; color: #e5484d; }
.chat-goalchip { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.05); font-size: 12.5px; }
.chat-goalchip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.chat-goalchip .goal-bar.sm { flex: 1 1 auto; height: 6px; min-width: 60px; }
.chat-goalchip em { font-style: normal; color: var(--muted); flex: 0 0 auto; }
.chat-goalchip.ok em { color: var(--success); }
.chat-goalchip.bad em { color: #e5484d; }

.goal-opt { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 2px 0; cursor: pointer; }
.goal-opt input { margin-top: 2px; flex: 0 0 auto; }
.auton-log { margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.auton-log li { margin: 2px 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; color: var(--text-secondary); padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--accent-weak); color: var(--text); }
#agent-seg { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); width:100%; gap:1px; overflow:hidden; background:var(--line); }
#agent-seg button { min-height:42px; justify-content:center; white-space:normal; line-height:1.25; background:var(--surface); }
#agent-seg button + button { border-left:0; }
#agent-seg button.active { background:var(--accent-weak); }
.set-copy { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.set-copy code { flex: 1; padding: 8px 10px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12px; overflow-x: auto; white-space: nowrap; }
.set-copy code.ellip { text-overflow: ellipsis; overflow: hidden; }
.scheduler-job { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.scheduler-job:first-child { border-top: none; }
.scheduler-job strong { display: block; font-size: 13px; }
.scheduler-job small { display: block; color: var(--muted); font-size: 11px; }
.scheduler-job select { width: auto; min-width: 88px; padding: 6px 8px; font-size: 12px; }
.scheduler-run { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; }

/* ---------- Workflow catalog and runs ---------- */
.workflow-page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; margin-bottom:20px; }
.workflow-page-head h2 { margin:3px 0 6px; }
.workflow-page-head p { margin:0; max-width:68ch; color:var(--text-secondary); line-height:1.55; }
.workflow-page-head .count { flex:none; margin-top:4px; }
.workflow-kicker { display:block; color:var(--accent-text); font-size:11px; font-weight:750; letter-spacing:.09em; }
.workflow-tabs { display:flex; gap:4px; padding:4px; width:max-content; max-width:100%; margin-bottom:18px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.workflow-tabs button { min-height:44px; padding:8px 16px; border:0; background:transparent; color:var(--text-secondary); box-shadow:none; }
.workflow-tabs button[aria-selected="true"] { background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }
.workflow-panel { min-width:0; }
.workflow-toolbar { display:grid; grid-template-columns:minmax(240px, 1fr) minmax(150px, .34fr) minmax(150px, .34fr) auto; align-items:end; gap:12px; padding:14px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface); }
.workflow-toolbar label { display:flex; flex-direction:column; gap:6px; min-width:0; color:var(--text-secondary); font-size:12px; font-weight:650; }
.workflow-toolbar input, .workflow-toolbar select, .workflow-toolbar button { min-height:44px; }
.workflow-toolbar button { margin:0; }
.workflow-filter-chips { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0 18px; }
.workflow-filter-chips button { min-height:40px; padding:7px 12px; border:1px solid var(--line); border-radius:var(--radius-pill); background:var(--surface); color:var(--text-secondary); box-shadow:none; font-size:12px; }
.workflow-filter-chips button span { margin-left:5px; color:var(--muted); font-variant-numeric:tabular-nums; }
.workflow-filter-chips button.active { border-color:var(--accent); background:var(--accent-weak); color:var(--text); }
.workflow-result-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin:0 0 12px; }
.workflow-result-head h3 { margin:0 0 3px; font-size:16px; }
.workflow-result-head p { margin:0; color:var(--muted); font-size:12px; }
.workflow-result-head .text-button { min-height:40px; }
.workflow-catalog, .workflow-run-groups { display:flex; flex-direction:column; gap:20px; }
.workflow-category-group { min-width:0; }
.workflow-category-group > header, .workflow-run-group > header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:10px; }
.workflow-category-group > header p, .workflow-run-group > header p { margin:3px 0 0; color:var(--muted); font-size:12px; }
.workflow-category-label, .workflow-run-group > header h4 { margin:0; color:var(--text); font-size:13px; font-weight:750; }
.workflow-category-count, .workflow-run-group > header > span { display:grid; place-items:center; min-width:28px; height:28px; padding:0 8px; border:1px solid var(--line); border-radius:var(--radius-pill); color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.workflow-card-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap:12px; }
.workflow-template-card, .workflow-run-card { min-width:0; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface); box-shadow:var(--shadow-xs); }
.workflow-template-card { display:flex; flex-direction:column; min-height:220px; padding:16px; }
.workflow-card-top { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.workflow-card-category { overflow:hidden; color:var(--muted); font-size:10.5px; font-weight:700; letter-spacing:.035em; text-overflow:ellipsis; text-transform:uppercase; white-space:nowrap; }
.workflow-template-card h4, .workflow-run-card h4 { margin:13px 0 7px; font-size:15px; line-height:1.3; }
.workflow-template-card > p { flex:1; margin:0; color:var(--text-secondary); font-size:13px; line-height:1.55; }
.workflow-template-card footer { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; padding-top:12px; border-top:1px solid var(--line); }
.workflow-template-card footer > span { color:var(--muted); font-size:11px; }
.workflow-template-card footer button { min-height:40px; white-space:nowrap; }
.workflow-run-group { min-width:0; }
.workflow-run-group-approval { padding:14px; border:1px solid color-mix(in srgb, var(--warning, #f59e0b) 46%, var(--line)); border-radius:var(--radius-md); background:color-mix(in srgb, var(--warning, #f59e0b) 5%, transparent); }
.workflow-run-list { display:flex; flex-direction:column; gap:10px; }
.workflow-run-card { display:grid; grid-template-columns:minmax(0, 1fr) auto; gap:16px; padding:16px; }
.workflow-run-card.compact { padding:13px 16px; }
.workflow-run-card.compact .wf-progress { max-width:360px; margin-bottom:0; }
.workflow-run-date { margin:0 0 8px; color:var(--muted); font-size:11px; }
.workflow-run-result { margin:10px 0 0; color:var(--text-secondary); font-size:12.5px; line-height:1.5; }
.workflow-run-actions { display:flex; align-items:flex-end; justify-content:flex-end; flex-wrap:wrap; gap:8px; min-width:165px; }
.workflow-run-actions button { min-height:40px; }
.workflow-empty { display:grid; place-items:center; min-height:180px; padding:32px; border:1px dashed var(--line-strong); border-radius:var(--radius-md); text-align:center; }
.workflow-empty strong { font-size:14px; }
.workflow-empty p { margin:5px 0 0; color:var(--muted); font-size:12.5px; }
.workflow-empty button { margin-top:14px; min-height:40px; }

/* ---------- Workflow stepper (#10) ---------- */
.wf-progress { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
.wf-bar { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--surface-subtle); overflow: hidden; }
.wf-bar > span { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.wf-count { font-size: 12px; color: var(--muted); }
.stepper { list-style: none; margin: 0 0 4px; padding: 0; }
.step { display: flex; align-items: center; gap: 10px; padding: 7px 0; position: relative; }
.step + .step { border-top: 1px dashed var(--line); }
.step-dot { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1px solid var(--line-strong); color: var(--muted); }
.step-name { flex: 1; font-size: 13.5px; }
.step-status { font-size: 11px; color: var(--muted); text-transform: lowercase; }
.step-tag { font-size: 10.5px; font-weight: 700; color: #f59e0b; text-transform: uppercase; letter-spacing: 0.03em; margin-left: 6px; }
.step-done .step-dot { background: var(--success, #10b981); border-color: transparent; color: #fff; }
.step-active .step-dot { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.step-fail .step-dot { background: #dc2626; border-color: transparent; color: #fff; }
.step-wait .step-dot, .step-gate .step-dot { border-color: #f59e0b; color: #f59e0b; }
.step-gate { background: rgba(245,158,11,0.06); border-radius: var(--radius-sm); }

@media (max-width: 820px) {
  .workflow-toolbar { grid-template-columns:1fr 1fr; }
  .workflow-toolbar .workflow-search { grid-column:1 / -1; }
  .workflow-run-card { grid-template-columns:1fr; }
  .workflow-run-actions { justify-content:flex-start; min-width:0; }
}

@media (max-width: 560px) {
  .workflow-page-head { flex-direction:column; gap:10px; }
  .workflow-page-head .count { margin:0; }
  .workflow-tabs { width:100%; }
  .workflow-tabs button { flex:1; padding-inline:10px; }
  .workflow-toolbar { grid-template-columns:1fr; padding:12px; }
  .workflow-toolbar .workflow-search { grid-column:auto; }
  .workflow-filter-chips { flex-wrap:nowrap; margin-inline:-2px; padding:2px 2px 8px; overflow-x:auto; scrollbar-width:thin; }
  .workflow-filter-chips button { flex:none; }
  .workflow-template-card footer { align-items:flex-start; flex-direction:column; }
  .workflow-template-card footer button, .workflow-run-actions button { width:100%; }
  .workflow-run-group-approval { padding:10px; }
  .workflow-run-card { padding:14px; }
  .step { align-items:flex-start; }
  .step-status { max-width:88px; text-align:right; }
}

/* ---------- Sandbox output (#12) ---------- */
.sbx-out { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.sbx-out-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 10px; background: var(--surface-subtle); }
.sbx-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sbx-copy { font-size: 11.5px; }
.sbx-pre { margin: 0; padding: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; color: var(--text); }
.sbx-warn { border-color: rgba(220,38,38,0.5); }
.sbx-warn .sbx-out-head { background: rgba(220,38,38,0.10); }
.sbx-warn .sbx-label { color: #f87171; }

/* ---------- Onboarding card (#6) ---------- */
.onboard {
  position: relative; border: 1px solid var(--accent-weak-2); border-radius: var(--radius-lg);
  background: var(--accent-weak); padding: 18px 20px; margin-bottom: 16px;
}
.onboard h3 { margin: 0 0 12px; font-size: 15px; }
.onboard-x {
  position: absolute; top: 10px; right: 12px; background: transparent; border: none;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.onboard-x:hover { color: var(--text); background: transparent; }
.onboard-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 12px; }
.ob-step { display: flex; gap: 10px; align-items: flex-start; }
.ob-step .ob-n {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700;
}
.ob-step strong { font-size: 13.5px; }
.ob-step p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-secondary); }

/* ---------- Notification center (#7) ---------- */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-pill); background: #dc2626; color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; pointer-events: none;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; width: 340px; max-width: 90vw;
  max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}
.notif-head { padding: 12px 14px; font-weight: 700; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.notif-sec { padding: 9px 14px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 9px 14px; background: transparent; border: none; border-radius: 0; cursor: default; color: var(--text);
}
button.notif-item { cursor: pointer; }
button.notif-item:hover { background: var(--surface-subtle); }
.notif-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--line-strong); }
.notif-dot.attn { background: #f59e0b; }
.notif-txt { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.notif-txt small { color: var(--muted); font-size: 11px; }

/* ---------- Metrics sparklines (#13) ---------- */
.spark-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.spark-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; background: var(--surface-subtle); }
.spark-top { display: flex; align-items: baseline; justify-content: space-between; }
.spark-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.spark-num { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
.spark { width: 100%; height: 32px; display: block; margin: 6px 0 4px; }
.spark-foot { font-size: 11px; color: var(--muted); }

/* ---------- Memory: tags, source link, edit (#11) ---------- */
.mtags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.mtag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--accent-weak); color: var(--text-secondary); border: 1px solid var(--accent-weak-2);
}
.mem-src { font-size: 12px; color: var(--accent-text); }
.mem-src:hover { text-decoration: underline; }
.mem-edit label { color: var(--muted); font-size: 12px; font-weight: 600; }
.mem-more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 4px 0; }

/* ---------- Keyboard help overlay (#18) ---------- */
.help-card { max-width: 420px; }
.help-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.help-list { padding: 8px 6px; }
.help-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; font-size: 13.5px; }
.help-row kbd {
  flex: none; min-width: 92px; text-align: center; background: var(--surface-subtle);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-family: inherit; font-size: 12px; color: var(--text-secondary);
}
.help-row span { color: var(--text); }

/* ---------- Graph zoom/pan/search (#9) ---------- */
.graph-toolbar input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- Responsive: keep the compact icon rail ---------- */
@media (max-width: 860px) {
  #app { --sidebar-rail: 62px; --sidebar-expanded: min(250px, calc(100vw - 24px)); }
  .sidebar { position: sticky; padding-inline: 9px; }
  /* Avoid a hover trap where the expanded rail covers controls on narrow
     screens. Keyboard focus can still expand it for accessible navigation. */
  .sidebar:hover:not(:has(:focus-visible)) { width:var(--sidebar-rail); box-shadow:none; }
  .sidebar:hover:not(:has(:focus-visible)) .nav-group { width:42px; min-width:42px; }
  .sidebar:hover:not(:has(:focus-visible)) .side-nav a { width:42px; min-width:42px; }
  .sidebar:hover:not(:has(:focus-visible)) .side-brand .name,
  .sidebar:hover:not(:has(:focus-visible)) .side-nav .nav-label,
  .sidebar:hover:not(:has(:focus-visible)) .side-nav .nav-private,
  .sidebar:hover:not(:has(:focus-visible)) .side-action-label,
  .sidebar:hover:not(:has(:focus-visible)) .nav-group-label { opacity:0; transform:translateX(-5px); pointer-events:none; }
  .sidebar:hover:not(:has(:focus-visible)) .agent-pill,
  .sidebar:hover:not(:has(:focus-visible)) .side-user { display:none; }
  .side-brand { padding-inline: 0; }
  .side-nav a { padding-inline: 11px; }
  .content { padding: 18px; }
  .topbar { padding: 12px 16px; }
  .support-mode-banner { align-items:stretch; flex-direction:column; margin:10px 12px 0; }
  #support-mode-exit { width:100%; }
}

/* Topbar: collapse secondary actions before they compete with context controls. */
@media (max-width: 1180px) {
  .topbar .more-toggle { display:inline-flex; align-items:center; justify-content:center; }
  .more-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
    display: none; flex-direction: column; align-items: stretch; gap: 6px;
    min-width: 230px; padding: 8px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  }
  .more-wrap.open .more-menu { display: flex; }
  .more-menu > button { width:100%; min-height:44px; justify-content:flex-start; box-shadow:none; }
  .more-action-label { display:inline; }
  .more-shortcut { margin-left:auto; }
}

@media (max-width: 900px) {
  .topbar { gap:10px; }
  .topbar .top-actions { gap:8px; }
  .topbar .page-title { font-size:17px; }
  /* Icon-only where a text label would crowd the bar */
  .quick-compact .btn-label, #quick-new-task .btn-label, .workspace-field .btn-label,.company-field .btn-label { display: none; }
  .company-field { padding-left:8px; }
  .company-field select { min-width:125px; max-width:22vw; }
  #workspace-select { min-width:110px; max-width:25vw; }
}

@media (max-width: 760px) {
  .settings-shell { grid-template-columns:1fr; gap:14px; }
  .settings-nav { display:none; }
  .settings-mobile-nav { display:grid; gap:6px; color:var(--text-secondary); font-size:11px; font-weight:700; }
  .settings-mobile-nav select { width:100%; min-height:44px; margin:0; }
  .settings-grid { grid-template-columns:1fr; }
}

/* Phone: tighten grids, tables and the graph */
@media (max-width: 620px) {
  .company-invite-form { grid-template-columns:1fr; }
  .company-invite-form button { min-height:44px; }
  .company-member-row { align-items:flex-start; flex-direction:column; }
  .company-member-controls { width:100%; }
  .company-member-controls select,.company-member-controls button { min-height:44px; }
  .content { padding: 14px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi .num { font-size: 22px; }
  .navcards { grid-template-columns: 1fr 1fr; }
  .graph-page-head { align-items: flex-start; }
  .graph-page-head h2 { font-size: 27px; }
  .graph-page-head p { max-width: 42ch; }
  .graph-rebuild { width: 40px; padding: 0; justify-content: center; }
  .graph-rebuild span { display: none; }
  .graph-shell { border-radius: 16px; }
  .graph-toolbar { padding: 12px; }
  .graph-searchbox { flex-basis: calc(100% - 100px); }
  .graph-search-info { min-width: 76px; text-align: right; }
  .graph-drag-hint { display: none; }
  .graph-legend { padding: 9px 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .graph-legend::-webkit-scrollbar { display: none; }
  .graph-legend .legend-item { flex: none; min-height: 40px; }
  .graph-wrap { height: 420px; }
  .graph-live-badge { top: 10px; left: 10px; }
  .graph-zoombar { top: 10px; right: 10px; }
  .graph-zoombar button { width: 44px; height: 44px; }
  .graph-footer { align-items: flex-start; }
  .graph-footer-tip { display: none; }
  #system-metrics, .block { overflow-x: auto; }
  .modal { width: 94vw; max-height: 88vh; }
  .tabs { gap: 0; }
  .tab { padding: 8px 10px; font-size: 12.5px; }
}

@media (max-width: 400px) {
  .kpi-row, .navcards { grid-template-columns: 1fr; }
  .graph-wrap { height: 380px; }
  .graph-search-info { width: 100%; min-width: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .graph-inspector,
  #graph-svg .graph-focus-vector,
  #graph-svg .node-group,
  #graph-svg .node-aura,
  #graph-svg .node-point,
  #graph-svg .label,
  .graph-legend .legend-item { transition: none; }
}

@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; }
  .topbar .top-actions { width:100%; gap:4px; justify-content:space-between; }
  .company-field { gap:4px; padding-inline:4px; }
  .company-field::before { display:none; }
  .company-field select { min-width:72px; max-width:78px; padding-inline:4px 18px; }
  #workspace-select { min-width:84px; max-width:84px; padding-inline:6px 18px; }
}

/* ==================== UI-POLISH (docs/UI-POLISH.md) ==================== */
:root { --panel: rgba(255, 255, 255, 0.02); }
:root[data-theme="light"] { --panel: rgba(30, 27, 75, 0.03); }

/* A1 — panel: zwevende secties krijgen een thuis */
.panel {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); padding: 18px; margin-top: 24px;
  box-shadow: var(--card-sheen);
}
.panel > .ov-h:first-child { margin-top: 0; }
.activity-section {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); padding: 18px; margin-top: 24px;
  box-shadow: var(--card-sheen);
}
.activity-head .ov-h { margin: 0; }

/* A2 — KPI-kop met verankerde Tegels-knop */
.kpi-head { margin: 4px 0 12px; }
.kpi-head .ov-h { margin: 0; }
.kpi-head .ov-toolbar { margin-bottom: 0; }

/* A4 — sectiekoppen: gradient-tick + strakke caps */
.ov-h {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); margin: 30px 0 13px;
}
.ov-h::before {
  content: ""; width: 4px; height: 15px; border-radius: 2px; flex: none;
  background: linear-gradient(180deg, var(--accent-hover), var(--cyan));
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.45);
}
.ov-h .count { text-transform: none; letter-spacing: 0; }

/* A3 — health-cockpit: glass-panel i.p.v. losse lijnen */
.health-cockpit {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.05), transparent 45%), var(--panel);
  padding: 14px 16px; margin: 0 0 18px; box-shadow: var(--card-sheen);
}
.health-dot.green { box-shadow: 0 0 9px var(--success); }
.health-dot.yellow { box-shadow: 0 0 9px var(--warning); }
.health-dot.red { box-shadow: 0 0 9px var(--danger); }

/* A5 — runtime-footer als statusbalk */
.runtime-foot {
  display: flex; align-items: center; gap: 9px;
  font-family: "JetBrains Mono", SFMono-Regular, Consolas, monospace; font-size: 11.5px;
  background: var(--panel);
}
.runtime-foot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--success); box-shadow: 0 0 8px var(--success);
}

/* A6 — empty states zachter */
.empty { background: rgba(124, 58, 237, 0.03); border-color: var(--line-strong); }

/* B1 — login: aurora-orbs achter de kaart */
#login-view { position: relative; overflow: hidden; }
#login-view::before, #login-view::after {
  content: ""; position: absolute; width: 540px; height: 540px; border-radius: 50%;
  filter: blur(90px); opacity: 0.32; pointer-events: none;
}
#login-view::before { background: #7c3aed; top: -170px; left: -130px; animation: aurora-a 18s ease-in-out infinite alternate; }
#login-view::after { background: #0e7490; bottom: -190px; right: -150px; animation: aurora-b 23s ease-in-out infinite alternate; }
:root[data-theme="light"] #login-view::before, :root[data-theme="light"] #login-view::after { opacity: 0.16; }
@keyframes aurora-a { to { transform: translate(70px, 50px) scale(1.12); } }
@keyframes aurora-b { to { transform: translate(-60px, -40px) scale(1.06); } }
#login-view main { position: relative; z-index: 1; }

/* B2 — paginatitel met gradient + zachte page-in */
.topbar .page-title {
  background: linear-gradient(90deg, var(--text) 55%, var(--accent-text));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page { animation: page-in 0.26s ease; }
#page-graph { animation: none; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* B3 — KPI-tegels: accent-toplijn + lift */
.kpi::before {
  content: ""; position: absolute; top: 0; left: 14px; right: 14px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan)); opacity: 0.3; transition: opacity 0.2s;
}
.kpi { transition: transform 0.15s ease, border-color 0.15s ease; }
.kpi:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.kpi:hover::before { opacity: 0.85; }
.kpi.attn::before { background: var(--warning); }

/* B4 — press-feedback op knoppen */
button:active:not(:disabled) { transform: scale(0.97); }

/* B5 — slanke scrollbars in OLED-stijl */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-weak-2); background-clip: padding-box; }

/* B6 — selectie in brandkleur */
::selection { background: rgba(124, 58, 237, 0.45); color: #fff; }

/* B7 — modal/cmdk backdrop met blur */
.modal-overlay, .cmdk-overlay { background: rgba(2, 3, 6, 0.68); backdrop-filter: blur(6px); }

/* B8 — activity-markers met type-glow */
.activity-row.type-chat .activity-marker { box-shadow: 0 0 7px rgba(56, 189, 248, 0.55); }
.activity-row.type-task .activity-marker { box-shadow: 0 0 7px rgba(52, 211, 153, 0.55); }
.activity-row.type-change .activity-marker { box-shadow: 0 0 7px rgba(251, 191, 36, 0.55); }
.activity-row.type-memory .activity-marker { box-shadow: 0 0 7px rgba(192, 132, 252, 0.55); }
.activity-row.type-workflow .activity-marker { box-shadow: 0 0 7px rgba(251, 113, 133, 0.55); }

/* C — chat-iconen: SVG, optisch gecentreerd */
.chat-attach-btn, .chat-mic-btn { display: inline-grid; place-items: center; padding: 0; }
.chat-attach-btn svg, .chat-mic-btn svg { width: 19px; height: 19px; display: block; }
.chat-input button.primary { display: inline-grid; place-items: center; padding: 0; }
.chat-input button.primary svg { width: 19px; height: 19px; display: block; margin: 1px 1px 0 0; }
.chat-input button.primary:hover svg { filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5)); }

@media (prefers-reduced-motion: reduce) {
  #login-view::before, #login-view::after { animation: none; }
  .page { animation: none; }
}

/* ==================== ICON-SWEEP + LAYOUT-FIXES ==================== */
/* Generieke sizing voor inline SVG-iconen in knoppen/badges/chips */
button > svg { width: 14px; height: 14px; vertical-align: -2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.chip svg { width: 13px; height: 13px; flex: none; }
.badge svg { width: 11px; height: 11px; flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 13px; height: 13px; flex: none; }
#theme-toggle, #logout-button, #topbar-refresh {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
#theme-toggle svg, #logout-button svg, .more-toggle svg, #topbar-refresh svg { width: 15px; height: 15px; flex: none; }
.chg-ic svg { width: 15px; height: 15px; display: block; color: var(--muted); }
.chat-speak svg { width: 15px; height: 15px; display: block; }
.chat-attach-chip .ai svg { width: 16px; height: 16px; }
.chat-att.doc svg { width: 13px; height: 13px; flex: none; }
.chat-msg-atts .chat-att.image svg { display: none; }
.goal-title svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; color: var(--accent-text); }
.chat-goalchip > svg { width: 14px; height: 14px; flex: none; color: var(--accent-text); }
.scheduler-run svg { width: 14px; height: 14px; }
.cmdk-item .k-ic svg { width: 13px; height: 13px; }
.graph-zoombar button svg { width: 14px; height: 14px; vertical-align: -2px; }
.mem-src svg { width: 12px; height: 12px; vertical-align: -1px; }

/* Fix: chat option row (Nova wake word / read aloud) overflowed on mobile
   op smalle schermen — laat de regel wrappen i.p.v. horizontaal scrollen */
.chat-voice-options { flex-wrap: wrap; row-gap: 4px; min-width: 0; }
.chat-speech-status { flex: 1 1 140px; }
@media (max-width: 620px) {
  .chat-voice-options { gap: 8px 12px; font-size: 11px; justify-content: flex-start; }
  .chat-speech-status { flex-basis: 100%; }
}

/* Fix: checkbox-opties bij "Nieuwe taak" — leesbare hiërarchie */
.create-form .goal-opt { color: var(--text); font-weight: 500; font-size: 13px; line-height: 1.5; }
.goal-opt input { accent-color: var(--accent); margin-top: 3px; }
.goal-opt .muted { font-weight: 400; }

/* Memory-kaarten: lange inhoud ingeklapt (3 regels) met Toon meer/minder */
.mem-clamp summary { list-style: none; cursor: pointer; }
.mem-clamp summary::-webkit-details-marker { display: none; }
.mem-preview {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--text-secondary); font-size: 13px; line-height: 1.55;
}
.mem-clamp[open] .mem-preview { display: none; }
.mem-full { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.mem-toggle { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 650; color: var(--accent-text); }
.mem-toggle::after { content: "Toon meer"; }
.mem-clamp[open] .mem-toggle::after { content: "Toon minder"; }
.mem-clamp summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.goal-blocked svg, .set-line .bad svg, .chat-goalchip em svg { width: 12px; height: 12px; vertical-align: -2px; }

/* Optieblok in "Nieuwe taak" — de doel-checkboxes op een eigen, rustige plek */
.form-options {
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--panel); padding: 2px 14px; margin: 2px 0 4px;
}
.form-options .goal-opt { align-items: flex-start; gap: 11px; padding: 11px 0; margin: 0; }
.form-options .goal-opt + .goal-opt { border-top: 1px solid var(--line); }
.form-options .opt-text { display: grid; gap: 2px; }
.form-options .opt-text strong { font-size: 13px; font-weight: 600; color: var(--text); }
.form-options .opt-text small { font-size: 12px; color: var(--muted); font-weight: 400; line-height: 1.45; }

/* Memory: max 3 kaarten per rij zodat de knoppen altijd binnen de kaart passen */
#memory-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
@media (min-width: 1100px) { #memory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card-head { flex-wrap: wrap; row-gap: 8px; }
.card-head .badges { min-width: 0; }

/* Chat: gecentreerde leeskolom — op brede monitoren stonden de spraak-toggles
   (Nova wake word / read aloud) outside the viewport */
.chat-wrap { width: 100%; max-width: 980px; margin-inline: auto; }

/* Root-cause fix: checkboxes/radios erfden de tekstveld-styling
   (width:100% + padding) van de globale input-regel — daardoor stonden
   vinkje en tekst scheef en brak de spraak-optieregel in de chat.
   Native maat + accentkleur, overal in de app. */
input[type="checkbox"], input[type="radio"] {
  width: 15px; height: 15px; min-width: 15px;
  padding: 0; margin: 0; border: none; background: transparent;
  accent-color: var(--accent); flex: none; cursor: pointer;
}
.chat-voice-toggle { align-items: center; line-height: 1; }
.chat-voice-options { align-items: center; }
/* Images & Video — one creative workspace with explicit provider intent. */
.media-workspace-head { display:flex; align-items:flex-end; justify-content:space-between; gap:28px; margin-bottom:22px; }
.media-workspace-head > div:first-child { max-width:760px; }
.media-workspace-kicker { color:#a78bfa; font-size:10px; font-weight:800; letter-spacing:.18em; }
.media-workspace-head h2 { margin:7px 0 6px; font-size:clamp(34px,5vw,58px); line-height:.98; letter-spacing:-.055em; }
.media-workspace-head p { margin:0; color:var(--text-secondary); font-size:14px; line-height:1.65; }
.media-capability-status { flex:none; display:flex; align-items:center; gap:9px; min-height:38px; padding:0 13px; border:1px solid var(--line); border-radius:999px; background:var(--surface-subtle); color:var(--text-secondary); font-size:11px; font-weight:650; }
.media-capability-status > span { width:8px; height:8px; border-radius:50%; background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.1); }
.media-capability-status.limited > span { background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.1); }
.media-mode-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border-block:1px solid var(--line); }
.media-mode-tab { position:relative; min-width:0; min-height:94px; display:grid; grid-template-columns:34px minmax(0,1fr) auto; align-items:center; gap:12px; padding:14px 18px; border:0; border-right:1px solid var(--line); border-radius:0; background:transparent; color:var(--text); text-align:left; cursor:pointer; transition:background .2s ease,color .2s ease; }
.media-mode-tab:last-child { border-right:0; }
.media-mode-tab::after { content:""; position:absolute; inset:auto 18px -1px; height:2px; background:var(--media-accent,#8b5cf6); opacity:0; transform:scaleX(.55); transition:opacity .2s ease,transform .2s ease; }
.media-mode-tab:nth-child(1) { --media-accent:#8b5cf6; }
.media-mode-tab:nth-child(2) { --media-accent:#22d3ee; }
.media-mode-tab:nth-child(3) { --media-accent:#f59e0b; }
.media-mode-tab:hover { background:color-mix(in srgb,var(--media-accent) 7%,transparent); }
.media-mode-tab.active { background:linear-gradient(180deg,color-mix(in srgb,var(--media-accent) 10%,transparent),transparent); }
.media-mode-tab.active::after { opacity:1; transform:none; }
.media-mode-tab:focus-visible { z-index:2; outline:2px solid var(--media-accent); outline-offset:-2px; }
.media-mode-tab:disabled { opacity:.38; cursor:not-allowed; }
.media-mode-number { width:30px; height:30px; display:grid; place-items:center; border:1px solid color-mix(in srgb,var(--line) 52%,var(--media-accent)); border-radius:50%; color:var(--media-accent); font:750 9px/1 ui-monospace,SFMono-Regular,Menlo,monospace; }
.media-mode-tab > span:nth-child(2) { min-width:0; display:grid; gap:4px; }
.media-mode-tab strong { font-size:14px; letter-spacing:-.015em; }
.media-mode-tab small { overflow:hidden; color:var(--muted); font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.media-mode-tab > i { padding:5px 8px; border:1px solid color-mix(in srgb,var(--line) 55%,var(--media-accent)); border-radius:999px; color:var(--media-accent); font-size:9px; font-style:normal; font-weight:750; letter-spacing:.07em; text-transform:uppercase; }
.media-workspace-panel { margin-top:30px; animation:page-in .26s ease; }
.image-provider-guide { display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:14px; margin-bottom:18px; padding:15px 0; border-block:1px solid color-mix(in srgb,var(--line) 68%,#8b5cf6 32%); }
.image-provider-guide.magnific { border-color:color-mix(in srgb,var(--line) 68%,#22d3ee 32%); }
.image-provider-guide-mark { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; background:linear-gradient(145deg,#7c3aed,#db2777); color:#fff; font-size:14px; font-weight:850; box-shadow:0 10px 24px rgba(124,58,237,.2); }
.image-provider-guide.magnific .image-provider-guide-mark { background:linear-gradient(145deg,#0891b2,#2563eb); box-shadow:0 10px 24px rgba(8,145,178,.2); }
.image-provider-guide > div { min-width:0; display:grid; gap:3px; }
.image-provider-guide strong { font-size:13px; }
.image-provider-guide p { margin:0; color:var(--muted); font-size:11px; line-height:1.55; }
.image-provider-guide-output { color:#a78bfa; font:750 9px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.1em; }
.image-provider-guide.magnific .image-provider-guide-output { color:#22d3ee; }

/* Creative workspace */
.image-kicker { font-size:10px; letter-spacing:.18em; font-weight:800; color:var(--accent-text); }
.image-workspace-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:22px; }
.image-workspace-head h2 { margin:7px 0 6px; font-size:clamp(30px,4vw,48px); line-height:1.05; letter-spacing:-.045em; }
.image-workspace-head p { margin:0; color:var(--text-secondary); font-size:14px; }
.image-workspace-live { flex:none; display:flex; align-items:center; gap:8px; min-height:34px; padding:0 12px; border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--text-secondary); font-size:11px; font-weight:650; }
.image-workspace-live span { width:7px; height:7px; border-radius:50%; background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.12); }
.image-workspace-grid { display:block; width:100%; }
.image-composer { position:relative; overflow:hidden; display:flex; flex-direction:column; width:100%; max-width:none; min-height:330px; margin:0; border:0; border-top:1px solid color-mix(in srgb,var(--line) 62%,#8b5cf6 38%); border-bottom:1px solid var(--line); border-radius:0; background:linear-gradient(180deg,color-mix(in srgb,var(--surface) 76%,transparent),color-mix(in srgb,var(--surface-subtle) 48%,transparent)); box-shadow:none; }
.image-composer::before { content:""; position:absolute; z-index:0; inset:0 0 auto; height:2px; background:linear-gradient(90deg,#7c3aed,#ec4899 58%,#22d3ee); }
.image-composer-head { position:relative; z-index:1; display:flex; align-items:center; gap:11px; padding:18px 20px 8px; }
.image-composer-avatar { flex:none; width:42px; height:42px; display:grid; place-items:center; border-radius:14px; color:#fff; background:linear-gradient(145deg,#7c3aed,#db2777); box-shadow:0 10px 24px rgba(124,58,237,.24); }
.image-composer-avatar svg { width:22px; height:22px; }
.image-composer-head > div:nth-child(2) { display:grid; gap:2px; }
.image-composer-head strong { font-size:13px; }
.image-composer-head span { color:var(--muted); font-size:11px; }
.image-composer-model { margin-left:auto; padding:5px 9px; border:1px solid var(--line); border-radius:999px; background:var(--surface-subtle); }
.image-composer textarea { position:relative; z-index:1; flex:1; min-height:142px; margin:0; padding:18px 22px 12px; resize:none; border:0; border-radius:0; background:transparent; box-shadow:none; color:var(--text); font-size:17px; line-height:1.65; }
.image-composer textarea:focus { outline:0; box-shadow:none; }
.image-composer textarea::placeholder { color:color-mix(in srgb,var(--muted) 80%,transparent); }
.image-prompt-presets { position:relative; z-index:1; display:flex; flex-wrap:wrap; gap:7px; padding:0 20px 13px; }
.image-prompt-presets button { min-height:32px; padding:5px 11px; border:1px solid var(--line); border-radius:999px; background:var(--surface-subtle); color:var(--text-secondary); font-size:11px; cursor:pointer; transition:border-color .2s ease,color .2s ease,background .2s ease; }
.image-prompt-presets button:hover,.image-prompt-presets button:focus-visible { border-color:var(--accent-weak-2); background:var(--accent-weak); color:var(--text); }
.image-reference-selected { position:relative; z-index:1; min-height:34px; display:flex; align-items:center; gap:10px; margin:0 20px 13px; padding:7px 10px; border:1px dashed var(--line); border-radius:11px; background:var(--surface-subtle); font-size:11px; }
.image-reference-selected.active { border-style:solid; border-color:var(--accent-weak-2); background:var(--accent-weak); color:var(--text); }
.image-reference-selected img { width:42px; height:42px; border-radius:7px; object-fit:cover; }
.image-reference-selected span { display:grid; min-width:0; }
.image-reference-selected strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.image-reference-selected small { color:var(--muted); }
.image-reference-selected > button { margin-left:auto; width:32px; height:32px; padding:0; border:0; background:transparent; color:var(--muted); font-size:20px; }
.image-provider-controls { position:relative; z-index:1; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; padding:0 20px 12px; }
.image-provider-controls label { display:grid; gap:5px; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.image-provider-controls > [hidden],.magnific-creation-tools[hidden] { display:none!important; }
.image-provider-controls select,.image-provider-controls input { min-width:0; height:38px; padding:0 10px; font-size:12px; letter-spacing:0; text-transform:none; }
.image-size-control > span:last-child { display:flex; align-items:center; gap:5px; }
.image-size-control input { width:100%; }
.image-size-control b { color:var(--muted); font-weight:500; }
.image-provider-notice { position:relative; z-index:1; margin:-2px 20px 12px; font-size:11px; }
.magnific-creation-tools { grid-column:1/-1; display:grid; justify-items:start; gap:8px; }
.magnific-creations-list { display:grid; gap:5px; width:100%; }
.magnific-creation-row { display:flex; align-items:center; gap:8px; width:100%; padding:7px 9px; border:1px solid var(--line); border-radius:9px; font-size:11px; }
.magnific-creation-row span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.magnific-creation-row button { margin-left:auto; flex:none; }
.image-ref-doc { width:42px; height:42px; display:grid!important; place-items:center; border-radius:7px; background:var(--accent-weak); color:var(--accent-text); font-size:10px; font-weight:800; }
.image-composer-foot { position:relative; z-index:1; display:flex; align-items:center; gap:10px; min-height:68px; padding:11px 13px 11px 16px; border-top:1px solid var(--line); background:color-mix(in srgb,var(--surface-subtle) 78%,transparent); }
.image-attach-action { min-height:44px; display:flex; align-items:center; gap:7px; padding:0 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--text-secondary); font-size:12px; }
.image-attach-action svg { width:16px; height:16px; }
.image-composer-hint { margin-left:auto; color:var(--muted); font-size:10px; }
.image-generate-action { min-height:46px; display:flex; align-items:center; gap:9px; padding:0 17px; border:0; border-radius:13px; background:linear-gradient(135deg,#7c3aed,#db2777); color:#fff; box-shadow:0 10px 26px rgba(124,58,237,.25); font-size:12px; font-weight:750; }
.image-generate-action svg { width:17px; height:17px; }
.image-generate-action:disabled { opacity:.48; cursor:wait; }
.image-pipeline-strip { display:grid; grid-template-columns:minmax(190px,.7fr) minmax(560px,2fr) minmax(240px,1fr); align-items:center; gap:28px; width:100%; padding:16px 4px; border-bottom:1px solid var(--line); color:var(--text); background:transparent; }
.image-pipeline-title { display:grid; gap:3px; margin:0; }
.image-pipeline-title span { color:var(--accent-text); font-size:10px; font-weight:750; letter-spacing:.12em; text-transform:uppercase; }
.image-pipeline-title strong { font-size:16px; letter-spacing:-.02em; }
.image-pipeline-list { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0; }
.image-pipeline-list div { display:grid; gap:2px; padding:2px 18px; border-left:1px solid var(--line); font-size:11px; }
.image-pipeline-list span { color:var(--muted); }
.image-pipeline-list strong { color:var(--text-secondary); font-weight:650; }
.image-pipeline-strip > p { margin:0; color:var(--muted); font-size:11px; line-height:1.55; }
.image-library-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin:42px 0 17px; }
.image-library-head h3 { margin:4px 0 3px; font-size:25px; letter-spacing:-.03em; }
.image-library-head p { margin:0; font-size:12px; }
.image-library-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; }
.image-filter-bar { display:flex; padding:3px; border:1px solid var(--line); border-radius:11px; background:var(--surface-subtle); }
.image-filter-bar button { min-height:34px; padding:5px 11px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:11px; cursor:pointer; }
.image-filter-bar button.active { background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }
.image-gallery-count { min-width:48px; color:var(--muted); font-size:11px; text-align:right; }
.image-gallery { display:grid; grid-template-columns:minmax(0,1fr); gap:26px; }
.image-set-card { overflow:hidden; border:1px solid var(--line); border-radius:16px; background:var(--surface); box-shadow:var(--shadow-sm); }
.image-set-card.completed { border-color:color-mix(in srgb,var(--line) 72%,#8b5cf6 28%); }
.image-set-head { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; padding:20px 21px 17px; }
.image-set-head > div:first-child { min-width:0; }
.image-set-head h4 { margin:5px 0 0; max-width:54ch; font-size:15px; line-height:1.45; font-weight:650; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.image-set-model { color:var(--accent-text); font-size:10px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }
.image-set-status { flex:none; display:grid; grid-template-columns:auto auto; align-items:center; column-gap:7px; row-gap:2px; color:var(--text-secondary); font-size:11px; }
.image-set-status .status-dot { width:7px; height:7px; border-radius:50%; background:var(--muted); }
.image-set-card.completed .status-dot { background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.1); }
.image-set-card.running .status-dot,.image-set-card.queued .status-dot { background:#a78bfa; box-shadow:0 0 0 4px rgba(167,139,250,.12); animation:image-status-pulse 1.5s ease-in-out infinite; }
.image-set-card.failed .status-dot { background:#f87171; }
.image-set-status strong { grid-column:2; color:var(--muted); font-size:10px; font-weight:600; }
.image-set-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:3px; padding:3px; background:#0e0b19; }
.image-set-grid.count-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.image-set-grid.count-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.image-variant { position:relative; min-width:0; aspect-ratio:4/3; overflow:hidden; display:grid; place-items:center; padding:0; border:0; border-radius:0; background:#171325; color:#fff; cursor:pointer; }
.image-set-grid.count-1 .image-variant { grid-column:1/-1; aspect-ratio:16/9; }
.image-variant img { width:100%; height:100%; display:block; object-fit:cover; transition:transform .35s cubic-bezier(.2,.8,.2,1),filter .25s ease; }
.image-variant::after { content:""; position:absolute; inset:0; background:linear-gradient(180deg,transparent 52%,rgba(5,3,12,.52)); opacity:.7; transition:opacity .2s ease; pointer-events:none; }
.image-variant:hover img,.image-variant:focus-visible img { transform:scale(1.035); filter:saturate(1.06); }
.image-variant:hover::after,.image-variant:focus-visible::after { opacity:1; }
.image-variant:focus-visible { z-index:2; outline:3px solid #c4b5fd; outline-offset:-3px; }
.image-variant-number { position:absolute; z-index:1; left:12px; bottom:10px; font-size:10px; font-weight:800; letter-spacing:.12em; }
.image-variant-expand { position:absolute; z-index:1; right:10px; top:10px; width:31px; height:31px; display:grid; place-items:center; border:1px solid rgba(255,255,255,.25); border-radius:10px; background:rgba(8,5,18,.48); opacity:0; transform:translateY(-4px); transition:opacity .2s ease,transform .2s ease; backdrop-filter:blur(8px); }
.image-variant-expand svg { width:15px; height:15px; }
.image-variant:hover .image-variant-expand,.image-variant:focus-visible .image-variant-expand { opacity:1; transform:none; }
.image-variant.image-pending { cursor:wait; min-height:140px; align-content:center; gap:9px; background:radial-gradient(circle at 50% 45%,#453072,#171325 66%); color:#ddd6fe; font-size:11px; }
.image-variant.image-pending::after { display:none; }
.image-spark { width:34px; height:34px; display:grid; place-items:center; animation:image-pulse 1.8s ease-in-out infinite; }
.image-spark svg { width:100%; height:100%; }
.image-set-failed { grid-column:1/-1; min-height:230px; display:grid; place-content:center; justify-items:center; gap:8px; padding:28px; text-align:center; color:#fca5a5; background:radial-gradient(circle at 50% 40%,rgba(127,29,29,.26),#171018 68%); }
.image-set-failed svg { width:34px; height:34px; }
.image-set-failed span { max-width:48ch; color:#d6cbd1; font-size:12px; }
.image-set-foot { display:flex; align-items:center; gap:7px; min-width:0; padding:12px 20px; border-top:1px solid var(--line); color:var(--muted); font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.image-set-foot svg { flex:none; width:13px; height:13px; color:var(--accent-text); }
.image-set-origin { display:inline-flex; align-items:center; gap:6px; margin-top:7px; color:var(--muted); font-size:10px; }
.image-set-origin svg { width:12px; height:12px; color:var(--accent-text); }
.image-set-actions { display:flex; align-items:center; gap:10px; min-height:48px; padding:7px 10px 7px 18px; border-top:1px solid var(--line); }
.image-set-actions .image-set-foot { flex:1; min-width:0; padding:0; border:0; }
.image-reuse-prompt { flex:none; min-height:34px; display:flex; align-items:center; gap:6px; padding:5px 10px; border:1px solid var(--line); border-radius:9px; background:var(--surface-subtle); color:var(--text-secondary); font-size:10px; cursor:pointer; }
.image-reuse-prompt svg { width:13px; height:13px; }
.image-reuse-prompt:hover { border-color:var(--accent-weak-2); color:var(--text); }
.image-empty { grid-column: 1/-1; min-height: 180px; display: grid; place-content: center; text-align: center; gap: 5px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); }
.image-empty strong { color: var(--text); font-size: 17px; }
@keyframes image-pulse { 0%,100% { transform: scale(.85) rotate(-8deg); opacity:.65 } 50% { transform: scale(1.12) rotate(8deg); opacity:1 } }
@keyframes image-status-pulse { 50% { opacity:.45; transform:scale(.8); } }

/* Beeldfocus: authenticated local image URLs remain embedded inside AgentOS. */
body.viewer-open { overflow:hidden; }
.image-viewer { position:fixed; z-index:1200; inset:0; display:grid; grid-template-columns:minmax(0,1fr) minmax(290px,360px); background:rgba(5,3,12,.94); color:#fff; backdrop-filter:blur(18px); }
.image-viewer.hidden { display:none; }
.image-viewer-stage { position:relative; min-width:0; min-height:0; display:grid; place-items:center; padding:54px 70px; background:radial-gradient(circle at 50% 45%,rgba(91,62,151,.2),transparent 46%); }
.image-viewer-stage img { display:block; max-width:100%; max-height:calc(100vh - 108px); object-fit:contain; border-radius:5px; box-shadow:0 28px 90px rgba(0,0,0,.55); }
.image-viewer-close,.image-viewer-nav { position:absolute; z-index:2; width:48px; height:48px; display:grid; place-items:center; padding:0; border:1px solid rgba(255,255,255,.16); border-radius:15px; background:rgba(18,13,33,.68); color:#fff; backdrop-filter:blur(12px); }
.image-viewer-close:hover,.image-viewer-nav:hover { background:rgba(70,52,111,.8); }
.image-viewer-close:focus-visible,.image-viewer-nav:focus-visible,.image-viewer-download:focus-visible { outline:3px solid #c4b5fd; outline-offset:3px; }
.image-viewer-close svg,.image-viewer-nav svg { width:20px; height:20px; }
.image-viewer-close { top:20px; right:380px; }
.image-viewer-nav { top:50%; transform:translateY(-50%); }
.image-viewer-nav.prev { left:18px; }
.image-viewer-nav.next { right:18px; }
.image-viewer-nav:disabled { opacity:.25; cursor:default; }
.image-viewer-info { min-width:0; display:flex; flex-direction:column; align-items:flex-start; padding:clamp(74px,10vh,110px) 32px 34px; border-left:1px solid rgba(255,255,255,.1); background:rgba(15,11,27,.78); }
.image-viewer-heading { width:100%; display:flex; align-items:baseline; justify-content:space-between; gap:18px; margin-top:12px; }
.image-viewer-heading h3 { margin:0; font-size:clamp(28px,3vw,42px); letter-spacing:-.045em; }
.image-viewer-heading span { color:#a78bfa; font-size:12px; font-weight:700; }
.image-viewer-info p { margin:22px 0 12px; color:rgba(255,255,255,.77); font-size:14px; line-height:1.7; }
.image-viewer-info .muted { color:rgba(255,255,255,.48); font-size:11px; }
.image-viewer-download { width:100%; min-height:46px; display:flex; align-items:center; justify-content:center; margin-top:auto; border-radius:13px; background:linear-gradient(135deg,#7c3aed,#db2777); color:#fff; text-decoration:none; font-size:13px; font-weight:750; box-shadow:0 14px 32px rgba(124,58,237,.28); }
@media (max-width:820px) {
  .image-viewer { grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) auto; }
  .image-viewer-stage { padding:58px 54px 22px; }
  .image-viewer-stage img { max-height:calc(100vh - 300px); }
  .image-viewer-close { top:12px; right:12px; }
  .image-viewer-info { padding:20px 22px 22px; border-left:0; border-top:1px solid rgba(255,255,255,.1); }
  .image-viewer-info p { margin:10px 0 8px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  .image-viewer-download { margin-top:14px; }
}
@media (max-width:1120px) { .image-pipeline-strip { grid-template-columns:180px 1fr; } .image-pipeline-strip > p { grid-column:1/-1; } }
@media (max-width:900px) { .media-mode-tab { grid-template-columns:32px minmax(0,1fr); } .media-mode-tab > i { display:none; } }
@media (max-width:760px) { .media-workspace-head,.image-workspace-head,.image-library-head { align-items:flex-start; flex-direction:column; } .media-capability-status { align-self:flex-start; } .media-mode-tabs { grid-template-columns:1fr; border-bottom:0; } .media-mode-tab { min-height:74px; border-right:0; border-bottom:1px solid var(--line); } .media-mode-tab::after { inset:10px auto 10px -1px; width:2px; height:auto; transform:scaleY(.55); } .media-mode-tab.active::after { transform:none; } .image-provider-guide { grid-template-columns:42px minmax(0,1fr); } .image-provider-guide-output { grid-column:2; } .image-library-actions { width:100%; justify-content:flex-start; } .image-provider-controls { grid-template-columns:repeat(2,minmax(0,1fr)); } .image-composer-hint { display:none; } .image-generate-action { margin-left:auto; } }
@media (max-width:760px) { .image-pipeline-strip { grid-template-columns:1fr; gap:14px; } .image-pipeline-list { grid-template-columns:repeat(2,minmax(0,1fr)); row-gap:14px; } .image-pipeline-strip > p { grid-column:auto; } .image-set-grid,.image-set-grid.count-3 { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:620px) { .image-workspace-head h2 { font-size:32px; } .image-workspace-live { display:none; } .image-composer-head { padding-inline:14px; } .image-composer textarea { min-height:158px; padding-inline:16px; font-size:16px; } .image-prompt-presets { padding-inline:14px; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; } .image-prompt-presets::-webkit-scrollbar { display:none; } .image-prompt-presets button { flex:none; min-height:44px; } .image-reference-selected { margin-inline:14px; } .image-composer-foot { flex-wrap:wrap; padding:10px; } .image-attach-action { flex:0 0 auto; } .image-generate-action { flex:1 1 150px; justify-content:center; } .image-filter-bar { width:100%; overflow-x:auto; } .image-filter-bar button { flex:1; min-height:44px; } .image-gallery-count { display:none; } .image-set-head { gap:12px; padding:17px 16px 14px; } .image-set-status { display:none; } .image-set-grid { gap:2px; padding:2px; } .image-set-actions { padding-left:12px; } .image-set-actions .image-set-foot { display:none; } .image-reuse-prompt { margin-left:auto; min-height:44px; } .image-viewer-stage { padding-inline:48px; } .image-viewer-nav { width:44px; height:44px; } .image-viewer-nav.prev { left:3px; } .image-viewer-nav.next { right:3px; } }
@media (prefers-reduced-motion:reduce) { .media-mode-tab,.media-mode-tab::after,.media-workspace-panel,.image-variant img,.image-variant-expand { transition:none; animation:none; } .image-spark,.image-set-card .status-dot { animation:none!important; } }

/* Compact AI creation workspace; Video Studio intentionally remains a separate route. */
#page-media .media-workspace-head { align-items:center; margin-bottom:16px; }
#page-media .media-workspace-head h2 { font-size:clamp(30px,4vw,46px); }
#page-media .media-workspace-head p { max-width:680px; line-height:1.5; }
#page-media + #page-video { margin-top:0; }
.media-mode-tabs { overflow:hidden; border:1px solid var(--line); border-radius:14px; background:color-mix(in srgb,var(--surface) 72%,transparent); }
.media-mode-tab { min-height:72px; padding:10px 14px; }
.media-mode-tab:nth-child(3) { --media-accent:#ec4899; }
.media-workspace-panel { margin-top:18px; }
#media-panel-image .image-workspace-head { display:none; }
#media-panel-image .image-provider-guide { margin-bottom:12px; padding:11px 2px; }
#media-panel-image .image-composer { min-height:270px; }
#media-panel-image .image-composer-head { padding-top:13px; }
#media-panel-image .image-composer textarea { min-height:104px; padding-top:12px; }
#media-panel-image .image-library-head { margin-top:28px; }

.ai-video-workspace { display:grid; grid-template-columns:minmax(320px,.72fr) minmax(500px,1.35fr); min-height:560px; border:1px solid var(--line); border-radius:18px; overflow:hidden; background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 90%,#7c3aed 10%),var(--surface)); box-shadow:0 24px 70px rgba(0,0,0,.12); }
.ai-video-composer { min-width:0; display:flex; flex-direction:column; gap:16px; padding:clamp(20px,3vw,34px); border-right:1px solid var(--line); background:radial-gradient(circle at 15% 0,rgba(236,72,153,.12),transparent 38%); }
.ai-video-composer header { margin-bottom:3px; }
.ai-video-kicker { color:#f472b6; font-size:9px; font-weight:850; letter-spacing:.17em; }
.ai-video-composer h2 { margin:7px 0 8px; font-size:clamp(27px,3vw,40px); line-height:1; letter-spacing:-.045em; }
.ai-video-composer header p { margin:0; color:var(--text-secondary); font-size:12px; line-height:1.55; }
.ai-video-composer header a { color:#c4b5fd; font-weight:700; text-decoration:none; }
.ai-video-composer > label { display:grid; gap:7px; color:var(--text-secondary); font-size:10px; font-weight:750; letter-spacing:.04em; text-transform:uppercase; }
.ai-video-composer textarea { min-height:150px; padding:14px 15px; resize:vertical; border-radius:12px; background:color-mix(in srgb,var(--surface-subtle) 82%,transparent); font-size:14px; line-height:1.6; letter-spacing:0; text-transform:none; }
.ai-video-options { display:grid; grid-template-columns:1fr .65fr 1fr; gap:8px; }
.ai-video-options label { min-width:0; display:grid; gap:6px; color:var(--muted); font-size:9px; font-weight:750; letter-spacing:.06em; text-transform:uppercase; }
.ai-video-options select,.ai-video-options input,.ai-video-reference select { min-width:0; min-height:42px; font-size:11px; letter-spacing:0; text-transform:none; }
.ai-video-provider-state { display:flex; align-items:center; gap:8px; min-height:38px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface-subtle); color:var(--text-secondary); font-size:10px; line-height:1.4; }
.ai-video-provider-state > span { flex:none; width:7px; height:7px; border-radius:50%; background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.1); }
.ai-video-provider-state.ready > span { background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.1); }
.ai-video-provider-state a { color:var(--accent-text); }
.ai-video-credit-note { margin:0; color:var(--muted); font-size:10px; line-height:1.45; }
.ai-video-submit { min-height:48px; display:flex; align-items:center; justify-content:space-between; margin-top:auto; padding:0 16px; border:0; border-radius:12px; background:linear-gradient(135deg,#7c3aed,#db2777); color:#fff; font-size:12px; font-weight:800; box-shadow:0 13px 30px rgba(190,24,93,.22); }
.ai-video-submit:disabled { opacity:.42; cursor:not-allowed; box-shadow:none; }
.ai-video-submit b { font-size:18px; }
.ai-video-library { min-width:0; padding:clamp(20px,3vw,34px); background:color-mix(in srgb,var(--bg) 38%,transparent); }
.ai-video-library > header { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin-bottom:20px; }
.ai-video-library h3 { margin:4px 0 0; font-size:24px; letter-spacing:-.035em; }
.ai-video-gallery { display:grid; gap:22px; }
.ai-video-provider-recent { margin-top:32px; padding-top:24px; border-top:1px solid var(--line); }
.ai-video-provider-recent > header { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:8px; }
.ai-video-provider-recent h3 { font-size:19px; }
.ai-video-provider-recent > p { margin:0 0 14px; color:var(--muted); font-size:12px; line-height:1.55; }
.magnific-creation-row small { display:block; margin-top:2px; color:var(--muted); }
.ai-video-job { overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--surface); }
.ai-video-job > header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:15px 16px; }
.ai-video-job > header div { min-width:0; }
.ai-video-job > header span { color:#f472b6; font-size:9px; font-weight:800; letter-spacing:.1em; }
.ai-video-job h4 { margin:5px 0 0; font-size:13px; line-height:1.45; font-weight:650; }
.ai-video-job time { flex:none; color:var(--muted); font-size:9px; }
.ai-video-results { background:#08060d; }
.ai-video-output { margin:0; background:#050409; }
.ai-video-frame { display:grid; place-items:center; height:clamp(180px,22vw,260px); padding:10px; overflow:hidden; background:radial-gradient(circle at 50% 44%,rgba(124,58,237,.12),transparent 58%),#050409; }
.ai-video-output video { display:block; width:100%; max-width:100%; max-height:100%; aspect-ratio:16/9; object-fit:contain; background:#050409; }
.ai-video-output[data-aspect="portrait"] video { width:auto; height:100%; aspect-ratio:9/16; }
.ai-video-output[data-aspect="square"] video { width:auto; height:100%; aspect-ratio:1; }
.ai-video-output[data-aspect="social"] video { width:auto; height:100%; aspect-ratio:4/5; }
.ai-video-output.format-mismatch .ai-video-frame { box-shadow:inset 0 0 0 1px rgba(245,158,11,.65); }
.ai-video-output figcaption { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 12px; color:rgba(255,255,255,.66); font-size:9px; }
.ai-video-output figcaption strong { margin-left:auto; padding:4px 7px; border:1px solid rgba(255,255,255,.16); border-radius:999px; color:rgba(255,255,255,.82); font-size:8px; letter-spacing:.04em; }
.ai-video-output.format-mismatch figcaption strong { border-color:rgba(245,158,11,.55); color:#fcd34d; }
.ai-video-output a { color:#c4b5fd; font-weight:750; text-decoration:none; }
.ai-video-pending,.ai-video-empty { min-height:260px; display:grid; place-content:center; justify-items:center; gap:7px; padding:24px; text-align:center; color:var(--muted); }
.ai-video-pending { color:#e9d5ff; background:radial-gradient(circle at 50% 42%,rgba(124,58,237,.27),transparent 45%); }
.ai-video-pending strong,.ai-video-empty strong { color:var(--text); font-size:15px; }
.ai-video-pending small,.ai-video-empty span { font-size:10px; }
.ai-video-failed { min-height:180px; display:grid; place-content:center; justify-items:start; gap:8px; padding:24px; color:#fecaca; background:radial-gradient(circle at 18% 25%,rgba(220,38,38,.22),transparent 48%),#100709; }
.ai-video-failed strong { color:#fff; font-size:15px; }
.ai-video-failed small { color:#fca5a5; font-size:9px; font-weight:800; letter-spacing:.08em; }
.ai-video-failed span { max-width:680px; color:#fecaca; font-size:11px; line-height:1.55; overflow-wrap:anywhere; }

@media (max-width:980px) {
  .ai-video-workspace { grid-template-columns:1fr; }
  .ai-video-composer { border-right:0; border-bottom:1px solid var(--line); }
}
@media (max-width:760px) {
  #page-media .media-workspace-head { gap:12px; margin-bottom:12px; }
  .media-mode-tabs { grid-template-columns:repeat(3,minmax(190px,1fr)); overflow-x:auto; border-radius:12px; scrollbar-width:none; }
  .media-mode-tabs::-webkit-scrollbar { display:none; }
  .media-mode-tab { min-height:66px; border-right:1px solid var(--line); border-bottom:0; }
  .media-mode-tab::after { inset:auto 12px -1px; width:auto; height:2px; transform:scaleX(.55); }
  .media-mode-tab.active::after { transform:none; }
  #media-panel-image .image-provider-guide { grid-template-columns:36px minmax(0,1fr); }
  .ai-video-workspace { border-radius:14px; }
  .ai-video-composer,.ai-video-library { padding:18px 15px; }
  .ai-video-options { grid-template-columns:1fr 1fr; }
  .ai-video-options label:last-child { grid-column:1/-1; }
}
@media (max-width:520px) {
  .media-capability-status { min-height:32px; font-size:9px; }
  .ai-video-composer textarea { min-height:126px; }
  .ai-video-library > header { align-items:center; }
  .ai-video-provider-recent > header { align-items:center; }
  .ai-video-job > header { flex-direction:column; gap:6px; }
}

/* Organized media library — compact cards, isolated modes and calm lifecycle states. */
#page-media .media-workspace-head { margin-bottom:12px; }
#page-media .media-workspace-head h2 { font-size:clamp(28px,3vw,38px); letter-spacing:-.04em; }
#page-media .media-workspace-head p { font-size:12px; }
.media-mode-tab { min-height:62px; padding:9px 14px; }
.media-mode-tab small { font-size:9px; }
.media-workspace-panel { margin-top:14px; }
#media-panel-image .image-provider-guide { margin-bottom:12px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface-subtle); }
.image-workspace-grid { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(260px,.55fr); gap:14px; align-items:start; }
#media-panel-image .image-composer { min-height:0; border:1px solid var(--line); border-radius:14px; }
#media-panel-image .image-composer-head { padding:12px 14px 5px; }
.image-composer-avatar { width:36px; height:36px; border-radius:11px; }
.image-composer-avatar svg { width:18px; height:18px; }
#media-panel-image .image-composer textarea { min-height:88px; padding:10px 16px 8px; font-size:15px; line-height:1.5; resize:vertical; }
.image-prompt-presets { padding:0 14px 10px; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
.image-prompt-presets::-webkit-scrollbar { display:none; }
.image-prompt-presets button { flex:none; }
.image-provider-controls { padding:0 14px 10px; }
.image-provider-notice { margin:0 14px 10px; }
.image-reference-selected { margin:0 14px 10px; }
.image-composer-foot { min-height:58px; padding:7px 9px 7px 12px; }
.image-pipeline-strip { display:flex; flex-direction:column; align-items:stretch; gap:14px; width:auto; min-height:100%; padding:18px; border:1px solid var(--line); border-radius:14px; background:var(--surface); }
.image-pipeline-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.image-pipeline-list div { padding:0; border-left:0; }
.image-pipeline-strip > p { margin-top:auto; }
#media-panel-image .image-library-head { margin:24px 0 12px; }
.image-library-head h3 { font-size:20px; }
.image-filter-bar { max-width:100%; overflow-x:auto; scrollbar-width:none; }
.image-filter-bar::-webkit-scrollbar { display:none; }
.image-filter-bar button { flex:none; min-height:44px; }
.image-gallery { grid-template-columns:repeat(auto-fill,minmax(min(100%,240px),1fr)); gap:12px; align-items:start; }
.image-set-card { min-width:0; border-radius:13px; box-shadow:none; }
.image-set-head { gap:10px; padding:12px 13px 10px; }
.image-set-head h4 { margin-top:4px; font-size:12px; line-height:1.4; -webkit-line-clamp:2; }
.image-set-model { font-size:8px; letter-spacing:.09em; }
.image-set-origin { margin-top:5px; font-size:9px; }
.image-set-status { display:none; }
.image-set-grid,.image-set-grid.count-2,.image-set-grid.count-3 { display:block; padding:0; }
.image-set-grid.count-1 .image-variant,.image-variant { width:100%; aspect-ratio:4/3; }
.image-variant-number { left:9px; bottom:8px; }
.image-variant-count { position:absolute; z-index:1; right:9px; bottom:8px; min-width:30px; height:26px; display:grid; place-items:center; padding:0 7px; border:1px solid rgba(255,255,255,.26); border-radius:999px; background:rgba(8,5,18,.72); color:#fff; font-size:10px; font-weight:800; backdrop-filter:blur(8px); }
.image-variant.image-pending { min-height:0; aspect-ratio:4/3; }
.image-set-failed { min-height:96px; place-content:start; justify-items:start; gap:5px; padding:15px; text-align:left; background:color-mix(in srgb,var(--surface-subtle) 88%,#7f1d1d 12%); }
.image-set-failed strong { color:var(--text); font-size:12px; }
.image-set-failed span { color:var(--text-secondary); font-size:10px; }
.image-set-actions { min-height:48px; gap:6px; padding:6px 7px 6px 11px; flex-wrap:wrap; }
.image-set-actions .image-set-foot { display:none; }
.image-reuse-prompt,.media-card-action { min-height:44px; padding:7px 10px; white-space:nowrap; }
.media-card-action.danger { border:1px solid color-mix(in srgb,#dc2626 48%,var(--line)); background:color-mix(in srgb,#dc2626 10%,var(--surface)); color:#ef4444; }
.media-card-actions { display:flex; justify-content:flex-end; gap:7px; min-height:48px; padding:6px 8px; border-top:1px solid var(--line); }
.media-trash-placeholder { min-height:112px; display:grid; place-content:center; gap:4px; padding:18px; background:var(--surface-subtle); color:var(--muted); text-align:center; }
.media-trash-placeholder strong { color:var(--text); font-size:13px; }
.media-trash-placeholder span { font-size:10px; }
.image-set-card.deleted,.ai-video-job.deleted { border-style:dashed; box-shadow:none; }
.media-inline-notice { grid-column:1/-1; min-height:92px; display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:8px 12px; padding:16px; border:1px dashed var(--line); border-radius:13px; background:var(--surface-subtle); color:var(--text-secondary); font-size:11px; text-align:center; }
.media-inline-notice strong { color:var(--text); }

.ai-video-workspace { grid-template-columns:minmax(280px,.58fr) minmax(0,1.42fr); min-height:0; border-radius:15px; }
.ai-video-composer { gap:12px; padding:20px; }
.ai-video-composer h2 { font-size:30px; }
.ai-video-composer textarea { min-height:112px; }
.ai-video-library { padding:20px; }
.ai-video-library > header { align-items:flex-start; margin-bottom:14px; }
.ai-video-library > header p { margin:4px 0 0; font-size:10px; }
.media-library-tools { display:flex; align-items:center; justify-content:flex-end; gap:6px; flex-wrap:wrap; }
.ai-video-gallery { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.ai-video-job { min-width:0; border-radius:12px; }
.ai-video-job > header { gap:10px; padding:11px 12px 9px; }
.ai-video-job h4 { font-size:11px; -webkit-line-clamp:2; display:-webkit-box; -webkit-box-orient:vertical; overflow:hidden; }
.ai-video-frame { height:220px; }
.ai-video-output video { object-fit:contain; }
.ai-video-pending,.ai-video-empty { min-height:150px; padding:18px; }
.ai-video-failed { min-height:96px; place-content:start; gap:5px; padding:15px; background:color-mix(in srgb,var(--surface-subtle) 88%,#7f1d1d 12%); }
.ai-video-failed strong { color:var(--text); font-size:12px; }
.ai-video-failed span { color:var(--text-secondary); font-size:10px; }
.ai-video-provider-recent { margin-top:22px; padding-top:18px; }

@media (max-width:1080px) {
  .image-workspace-grid { grid-template-columns:1fr; }
  .image-pipeline-strip { min-height:0; }
  .ai-video-gallery { grid-template-columns:1fr; }
}
@media (max-width:760px) {
  #page-media .media-workspace-head h2 { font-size:28px; }
  .media-mode-tabs { grid-template-columns:repeat(3,minmax(0,1fr)); overflow:visible; }
  .media-mode-tab { min-height:58px; display:flex; justify-content:center; padding:8px; border-right:1px solid var(--line); }
  .media-mode-number,.media-mode-tab small,.media-mode-tab > i { display:none; }
  .media-mode-tab strong { font-size:10px; line-height:1.25; text-align:center; }
  #media-panel-image .image-provider-guide { grid-template-columns:34px minmax(0,1fr); }
  .image-provider-guide-output { display:none; }
  .image-provider-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ai-video-workspace { grid-template-columns:1fr; }
  .ai-video-library > header { flex-direction:column; }
  .media-library-tools { width:100%; justify-content:flex-start; }
}
@media (max-width:520px) {
  .image-gallery { grid-template-columns:1fr; }
  .image-filter-bar { width:100%; }
  .image-filter-bar button { min-height:44px; }
  .image-composer-foot { flex-wrap:wrap; }
  .image-generate-action { flex:1 1 160px; justify-content:center; }
  .ai-video-composer,.ai-video-library { padding:14px; }
  .ai-video-options { grid-template-columns:1fr 1fr; }
  .ai-video-options label:last-child { grid-column:1/-1; }
  .ai-video-frame { height:190px; }
  .ai-video-output figcaption { gap:7px; }
}

/* Social Media — native project automation */
.social-head { display:flex; align-items:flex-end; justify-content:space-between; gap:28px; margin-bottom:22px; }
.social-head-actions { display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.social-head h2 { margin:7px 0; font-size:clamp(30px,4vw,48px); line-height:1.04; letter-spacing:-.045em; }
.social-head p { max-width:760px; margin:0; color:var(--text-secondary); font-size:14px; line-height:1.65; }
.social-kicker { color:var(--accent); font-size:10px; font-weight:800; letter-spacing:.15em; }
.social-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); margin-bottom:20px; border:1px solid var(--line); border-radius:16px; overflow:hidden; background:var(--surface); }
.social-stats div { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:68px; padding:14px 18px; border-right:1px solid var(--line); }
.social-stats div:last-child { border-right:0; }
.social-stats span { color:var(--text-secondary); font-size:11px; font-weight:650; }
.social-stats strong { font-size:23px; letter-spacing:-.04em; }
.social-analytics-panel { margin-bottom:28px; padding:22px; border:1px solid var(--line); border-radius:20px; background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 7%,var(--surface)),var(--surface) 48%); box-shadow:0 18px 60px rgba(0,0,0,.045); }
.social-analytics-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:18px; }
.social-analytics-head h3 { margin:5px 0 4px; font-size:23px; letter-spacing:-.03em; }
.social-analytics-head p { max-width:680px; margin:0; color:var(--text-secondary); font-size:11px; line-height:1.55; }
.social-analytics-head label { display:flex; flex-direction:column; gap:6px; min-width:150px; color:var(--text-secondary); font-size:10px; font-weight:750; }
.social-analytics-head input { margin:0; background:var(--bg); }
.social-analytics-summary { display:grid; grid-template-columns:repeat(auto-fit,minmax(128px,1fr)); gap:8px; margin-bottom:20px; }
.social-analytics-summary > div { min-width:0; padding:14px; border:1px solid var(--line); border-radius:13px; background:color-mix(in srgb,var(--surface) 92%,transparent); }
.social-analytics-summary span { display:block; overflow:hidden; color:var(--text-secondary); font-size:9px; font-weight:760; letter-spacing:.06em; text-overflow:ellipsis; text-transform:uppercase; white-space:nowrap; }
.social-analytics-summary strong { display:block; margin-top:5px; font-size:22px; letter-spacing:-.04em; }
.social-analytics-grid { display:grid; grid-template-columns:minmax(270px,.8fr) minmax(0,1.2fr); gap:18px; }
.social-channel-health,.social-content-performance { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.social-channel-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.social-channel-row strong,.social-content-row strong { display:block; font-size:12px; }
.social-channel-row small,.social-content-row small { color:var(--text-secondary); font-size:9px; }
.social-channel-row .social-review-evidence { display:block; margin-top:4px; }
.social-channel-row .social-review-evidence.verified { color:#16a36a; font-weight:760; }
.social-channel-actions { display:flex; align-items:center; gap:7px; }
.social-health-pill { padding:4px 7px; border-radius:999px; background:rgba(161,161,170,.12); color:var(--text-secondary); font-size:9px; font-weight:800; text-transform:uppercase; }
.social-health-pill.healthy { background:rgba(52,211,153,.12); color:#16a36a; }
.social-health-pill.error,.social-health-pill.disconnected { background:rgba(248,113,113,.12); color:#ef5c5c; }
.social-health-pill.stale { background:rgba(251,191,36,.12); color:#d29413; }
.social-channel-actions button { min-height:32px; padding:6px 9px; font-size:9px; }
.social-content-row { display:grid; grid-template-columns:minmax(0,1fr) repeat(2,minmax(72px,auto)); gap:12px; align-items:center; padding:12px 2px; border-bottom:1px solid var(--line); }
.social-content-row > span { color:var(--text-secondary); font-size:10px; text-align:right; }
.social-content-row > span b { display:block; color:var(--text); font-size:12px; }
.social-create-layout { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(260px,.65fr); gap:14px; margin-bottom:34px; }
.social-campaign-composer,.social-idea-control { padding:22px; border:1px solid var(--line); border-radius:18px; background:var(--surface); }
.social-campaign-composer { box-shadow:0 18px 60px rgba(0,0,0,.06); }
.social-step { display:flex; align-items:center; gap:12px; margin-bottom:20px; }
.social-step > span { display:grid; place-items:center; flex:none; width:34px; height:34px; border:1px solid color-mix(in srgb,var(--accent) 35%,var(--line)); border-radius:50%; color:var(--accent); font-size:10px; font-weight:800; }
.social-step div { display:flex; flex-direction:column; gap:2px; }
.social-step strong { font-size:14px; }
.social-step small { color:var(--text-secondary); font-size:11px; }
.social-form-grid,.social-post-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.social-form-grid label,.social-post-fields label,.social-idea-control label { display:flex; flex-direction:column; gap:7px; color:var(--text-secondary); font-size:10px; font-weight:750; letter-spacing:.035em; }
.social-form-grid .wide,.social-post-fields .wide { grid-column:1/-1; }
.social-form-grid input,.social-form-grid select,.social-form-grid textarea,.social-post-fields input,.social-post-fields textarea,.social-idea-control input,.social-idea-control select,.social-inline-action input { margin:0; border-color:var(--line); background:var(--bg); color:var(--text); font-size:13px; font-weight:500; letter-spacing:0; }
.social-campaign-composer > button { display:flex; align-items:center; justify-content:space-between; width:100%; margin-top:16px; }
.social-idea-control { display:flex; flex-direction:column; gap:14px; background:linear-gradient(155deg,color-mix(in srgb,var(--accent) 8%,var(--surface)),var(--surface) 55%); }
.social-idea-control .social-step { margin-bottom:2px; }
.social-idea-control > p { margin:auto 0 0; color:var(--text-secondary); font-size:11px; line-height:1.55; }
.social-section-title { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; padding-bottom:12px; border-bottom:1px solid var(--line); }
.social-section-title h3 { margin:5px 0 0; font-size:21px; letter-spacing:-.025em; }
.social-ideas-section { margin-bottom:36px; }
.social-ideas { display:flex; flex-direction:column; }
.social-idea { display:grid; grid-template-columns:48px minmax(0,1fr) auto; align-items:center; gap:18px; padding:19px 4px; border-bottom:1px solid var(--line); }
.social-idea.converted { opacity:.62; }
.social-idea-index { color:var(--text-secondary); font-size:11px; font-variant-numeric:tabular-nums; }
.social-idea-copy h4 { margin:5px 0; font-size:16px; letter-spacing:-.02em; }
.social-idea-copy p { margin:6px 0; color:var(--text-secondary); font-size:12px; line-height:1.55; }
.social-idea-copy small { color:var(--text-secondary); }
.social-hook { display:block; color:var(--text); font-size:12px; }
.social-meta { display:flex; flex-wrap:wrap; gap:6px; }
.social-meta span { padding:3px 7px; border:1px solid var(--line); border-radius:999px; color:var(--text-secondary); font-size:9px; font-weight:750; text-transform:uppercase; letter-spacing:.04em; }
.social-idea > button { white-space:nowrap; }
.social-converted-label { color:var(--text-secondary); font-size:10px; font-weight:700; }
.social-empty { display:flex; flex-direction:column; align-items:center; gap:5px; padding:36px 18px; border:1px dashed var(--line); border-radius:14px; color:var(--text-secondary); text-align:center; }
.social-empty strong { color:var(--text); }
.social-posts { display:flex; flex-direction:column; gap:14px; margin-top:14px; }
.social-post { padding:20px; border:1px solid var(--line); border-radius:18px; background:var(--surface); box-shadow:0 12px 44px rgba(0,0,0,.045); }
.social-post > header { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:18px; }
.social-status { padding:6px 10px; border-radius:999px; background:color-mix(in srgb,var(--accent) 12%,transparent); color:var(--accent); font-size:10px; font-weight:800; }
.social-post.status-published .social-status,.social-post.status-approved .social-status { background:rgba(52,211,153,.12); color:#16a36a; }
.social-post.status-changes_requested .social-status,.social-post.status-rejected .social-status { background:rgba(248,113,113,.12); color:#ef5c5c; }
.social-post footer { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:17px; padding-top:15px; border-top:1px solid var(--line); }
.social-safety { display:flex; align-items:center; gap:8px; color:var(--text-secondary); font-size:10px; }
.social-safety i { width:7px; height:7px; border-radius:50%; background:#a1a1aa; }
.social-safety.passed i { background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.1); }
.social-safety.flagged i { background:#fb7185; box-shadow:0 0 0 4px rgba(251,113,133,.1); }
.social-post-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:7px; }
.social-post-actions button { min-height:34px; padding:7px 11px; font-size:10px; }
.social-post-actions .danger { color:#ef5c5c; }
.social-post-actions .social-archive { color:var(--text-secondary); }
.social-inline-action { display:flex; align-items:center; gap:5px; }
.social-inline-action input { width:185px; min-height:34px; padding:6px 8px; font-size:10px; }
.social-publish-controls { display:flex; align-items:center; flex-wrap:wrap; gap:6px; padding:6px; border:1px solid color-mix(in srgb,var(--accent) 25%,var(--line)); border-radius:11px; background:color-mix(in srgb,var(--accent) 5%,var(--surface)); }
.social-publish-controls select { width:auto; min-width:150px; min-height:34px; margin:0; padding-block:6px; font-size:10px; }
.social-connect-link { color:var(--accent); font-size:10px; font-weight:750; text-decoration:none; }
.social-post.status-publishing .social-status { background:rgba(59,130,246,.12); color:#3b82f6; }
.social-post.status-publish_failed .social-status { background:rgba(248,113,113,.12); color:#ef5c5c; }
.social-media-field { min-width:0; margin:0; padding:0; border:0; }
.social-media-field > legend,.tiktok-publish-controls legend { margin-bottom:7px; color:var(--text-secondary); font-size:10px; font-weight:750; letter-spacing:.035em; }
.social-asset-picker { border:1px solid var(--line); border-radius:12px; background:var(--bg); }
.social-asset-picker > summary { padding:11px 13px; color:var(--text); font-size:12px; font-weight:650; cursor:pointer; }
.social-asset-picker > small,.social-asset-picker > p { display:block; margin:0; padding:0 13px 12px; color:var(--text-secondary); font-size:10px; line-height:1.5; }
.social-media-options { display:grid; grid-template-columns:repeat(auto-fill,minmax(112px,1fr)); gap:8px; max-height:360px; padding:0 12px 12px; overflow:auto; }
.social-selected-media { display:flex; gap:7px; margin-bottom:8px; overflow:auto; scroll-snap-type:x proximity; }
.social-selected-media img,.social-selected-media video { flex:0 0 112px; width:112px; aspect-ratio:9/12; border:1px solid var(--line); border-radius:10px; background:#050505; object-fit:cover; scroll-snap-align:start; }
.social-media-option { position:relative; display:flex!important; flex-direction:column!important; gap:6px!important; min-width:0; padding:7px; border:1px solid var(--line); border-radius:10px; background:var(--surface); cursor:pointer; }
.social-media-option img,.social-media-video { width:100%; aspect-ratio:1; border-radius:7px; object-fit:cover; background:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
.social-media-video { display:grid; place-items:center; color:var(--accent); font-size:22px; }
.social-media-option span { overflow:hidden; color:var(--text-secondary); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.social-media-option input { display:inline-block; width:auto; min-height:0; margin:0 3px 0 0; vertical-align:middle; }
.tiktok-publish-controls { align-items:stretch; flex-direction:column; width:min(100%,680px); padding:12px; }
.tiktok-publish-controls > label { display:grid; grid-template-columns:minmax(120px,.35fr) minmax(180px,1fr); align-items:center; gap:10px; color:var(--text-secondary); font-size:10px; font-weight:700; }
.tiktok-publish-controls > label select { width:100%; }
.tiktok-creator-row,.tiktok-action-row { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.tiktok-creator-row span { color:var(--text-secondary); font-size:10px; }
.tiktok-publish-controls fieldset { display:flex; align-items:center; flex-wrap:wrap; gap:8px 13px; margin:0; padding:9px 10px; border:1px solid var(--line); border-radius:9px; }
.tiktok-publish-controls fieldset legend { padding:0 4px; }
.tiktok-publish-controls fieldset label,.tiktok-consent { display:flex!important; grid-template-columns:none!important; align-items:flex-start!important; gap:6px!important; color:var(--text)!important; font-size:10px!important; font-weight:550!important; }
.tiktok-publish-controls input[type="checkbox"] { flex:none; width:15px; min-height:15px; margin:0; accent-color:var(--accent); }
.tiktok-consent { padding:9px 10px; border-radius:9px; background:color-mix(in srgb,var(--accent) 8%,var(--surface)); line-height:1.4; }
.tiktok-action-row input { flex:1; min-width:180px; margin:0; }
.social-asset-picker summary:focus-visible,.social-media-option:focus-within,.tiktok-publish-controls input:focus-visible,.tiktok-publish-controls select:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
#social-channel-vault-form details { padding:10px 12px; border:1px solid var(--line); border-radius:10px; }
#social-channel-vault-form summary { cursor:pointer; color:var(--text-secondary); font-size:11px; font-weight:700; }
#social-channel-vault-form details label { margin-top:10px; }
#social-publishing-status .social-connector-summary { display:flex; flex-direction:column; gap:4px; padding:12px; margin-bottom:8px; border:1px solid var(--line); border-radius:10px; background:var(--surface-subtle); }
#social-publishing-status .set-line > span:last-child { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:6px; }
.social-channel-form-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
#social-publishing-status .social-missing-channel > span:last-child { display:flex; align-items:center; justify-content:flex-end; gap:8px; }
#social-publishing-status .social-missing-channel button { padding:6px 10px; min-height:32px; }
@media (max-width:900px) { .social-create-layout,.social-analytics-grid { grid-template-columns:1fr; } .social-stats,.social-analytics-summary { grid-template-columns:repeat(2,1fr); } .social-stats div:nth-child(2) { border-right:0; } .social-stats div:nth-child(-n+2) { border-bottom:1px solid var(--line); } .social-post footer { align-items:flex-start; flex-direction:column; } .social-post-actions { justify-content:flex-start; } }
@media (max-width:680px) { .social-head,.social-analytics-head { align-items:flex-start; flex-direction:column; } .social-head-actions { width:100%; } .social-head-actions button { flex:1; min-height:44px; } .social-head h2 { font-size:32px; } .social-analytics-head label { width:100%; } .social-form-grid,.social-post-fields { grid-template-columns:1fr; } .social-form-grid .wide,.social-post-fields .wide { grid-column:auto; } .social-idea { grid-template-columns:32px minmax(0,1fr); } .social-idea > button,.social-converted-label { grid-column:2; justify-self:start; } .social-post { padding:15px; } .social-post > header { align-items:flex-start; flex-direction:column; } .social-post-actions,.social-inline-action,.social-publish-controls { width:100%; } .social-post-actions button,.social-idea > button,.social-publish-controls select,.social-channel-actions button { min-height:44px; } .social-inline-action input { flex:1; width:auto; min-height:44px; } .tiktok-publish-controls > label { grid-template-columns:1fr; } .tiktok-action-row { align-items:stretch; flex-direction:column; } .tiktok-action-row input,.tiktok-action-row button { width:100%; min-height:44px; } .social-content-row { grid-template-columns:minmax(0,1fr) auto; } .social-content-row > span:last-child { display:none; } }

/* Video Studio — wide editorial workspace, not a wall of generic cards. */
.video-kicker { color:#f59e0b; font-size:10px; font-weight:800; letter-spacing:.18em; }
.video-studio-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:20px; }
.video-studio-head h2 { margin:7px 0 6px; font-size:clamp(30px,4vw,48px); line-height:1.05; letter-spacing:-.045em; }
.video-studio-head p { max-width:720px; margin:0; color:var(--text-secondary); font-size:14px; line-height:1.55; }
.video-open-editor { flex:none; display:flex; align-items:center; gap:12px; min-height:46px; padding:0 17px; border:1px solid color-mix(in srgb,var(--line) 55%,#f59e0b); border-radius:13px; background:linear-gradient(135deg,#f59e0b,#ea580c); color:#fff; text-decoration:none; font-size:12px; font-weight:750; box-shadow:0 12px 28px rgba(234,88,12,.2); }
.video-runtime-strip { display:flex; align-items:center; gap:10px; min-height:44px; margin-bottom:18px; padding:0 15px; border:1px solid var(--line); border-radius:12px; background:var(--surface-subtle); color:var(--text-secondary); font-size:11px; }
.video-runtime-strip i { width:8px; height:8px; border-radius:50%; background:#f87171; box-shadow:0 0 0 4px rgba(248,113,113,.1); }
.video-runtime-strip.online i { background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.1); }
.video-studio-layout { display:grid; grid-template-columns:minmax(360px,.82fr) minmax(500px,1.35fr); gap:0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.video-brief { display:flex; flex-direction:column; gap:18px; padding:24px 28px 28px 0; border-right:1px solid var(--line); }
.video-brief-title,.video-queue-head > div { display:flex; align-items:flex-start; gap:12px; }
.video-brief-title > span,.video-queue-head > div > span { display:grid; place-items:center; width:28px; height:28px; border:1px solid color-mix(in srgb,var(--line) 50%,#f59e0b); border-radius:50%; color:#f59e0b; font:700 9px/1 monospace; }
.video-brief-title div,.video-queue-head > div > div { display:grid; gap:2px; }
.video-brief-title strong,.video-queue-head strong { font-size:14px; }
.video-brief-title small,.video-queue-head small { color:var(--muted); font-size:10px; }
.video-brief label { display:grid; gap:7px; color:var(--text-secondary); font-size:11px; font-weight:650; }
.video-brief textarea { min-height:190px; padding:15px; border-radius:12px; background:var(--surface-subtle); font-size:14px; line-height:1.6; }
.video-options { display:grid; grid-template-columns:1.25fr 1fr .8fr; gap:9px; }
.video-options select,.video-options input { min-height:42px; font-size:11px; }
.video-submit { display:flex; align-items:center; justify-content:space-between; min-height:48px; padding:0 17px; border:0; border-radius:12px; background:linear-gradient(135deg,#f59e0b,#ea580c); color:#fff; font-size:12px; font-weight:750; }
.video-queue-wrap { min-width:0; padding:24px 0 28px 28px; }
.video-queue-head { display:flex; align-items:flex-start; justify-content:space-between; gap:15px; margin-bottom:18px; }
.video-instructions { display:grid; gap:0; }
.video-instruction { padding:18px 0; border-top:1px solid var(--line); }
.video-instruction:first-child { border-top:0; padding-top:0; }
.video-item-top { display:flex; align-items:center; gap:8px; color:var(--text-secondary); font-size:10px; }
.video-item-top time { margin-left:auto; color:var(--muted); }
.video-status-dot { width:7px; height:7px; border-radius:50%; background:#94a3b8; }
.status-pending_approval .video-status-dot { background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.1); }
.status-approved .video-status-dot,.status-claimed .video-status-dot { background:#60a5fa; }
.status-planned .video-status-dot,.status-completed .video-status-dot { background:#34d399; }
.status-failed .video-status-dot,.status-rejected .video-status-dot { background:#f87171; }
.video-instruction > p { margin:10px 0; color:var(--text); font-size:13px; line-height:1.55; }
.video-project-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:12px; }
.video-revision-panel { display:grid; gap:0; margin-top:12px; padding:4px 14px; border:1px solid var(--line); border-radius:14px; background:var(--surface-subtle); }
.video-revision-panel > span { padding:12px 0; color:var(--muted); font-size:12px; }
.video-revision-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:11px 0; border-top:1px solid var(--line); }
.video-revision-row:first-child { border-top:0; }
.video-revision-row div { display:grid; gap:3px; min-width:0; }
.video-revision-row strong { font-size:12px; }
.video-revision-row span,.video-revision-row em { color:var(--muted); font-size:11px; font-style:normal; }
@media (max-width:640px) { .video-revision-row { align-items:flex-start; flex-direction:column; } .video-revision-row button { width:100%; } }
.video-item-meta { display:flex; flex-wrap:wrap; gap:6px; }
.video-item-meta span { padding:4px 7px; border:1px solid var(--line); border-radius:999px; background:var(--surface-subtle); color:var(--muted); font-size:9px; }
.video-item-actions { display:flex; gap:8px; margin-top:13px; }
.video-item-actions button { min-height:34px; padding:5px 11px; font-size:10px; }
.video-note { display:block; margin-top:9px; color:var(--muted); }
.video-project-link { display:inline-flex; margin-top:11px; color:var(--accent); font-size:11px; font-weight:700; text-decoration:none; }
.video-project-link:hover { text-decoration:underline; }
.video-empty { min-height:180px; display:grid; place-content:center; gap:4px; text-align:center; color:var(--muted); }
.video-empty strong { color:var(--text); font-size:15px; }
@media (max-width:980px) { .video-studio-layout { grid-template-columns:1fr; } .video-brief { padding-right:0; border-right:0; border-bottom:1px solid var(--line); } .video-queue-wrap { padding-left:0; } }
@media (max-width:680px) { .video-studio-head { align-items:flex-start; flex-direction:column; } .video-open-editor { width:100%; justify-content:space-between; } .video-options { grid-template-columns:1fr; } }

/* Chat command center — wide, conversational and voice-aware. */
#page-chat { min-width:0; }
.chat-wrap {
  position:relative; width:100%; max-width:none; height:calc(100dvh - 128px); min-height:580px; margin-inline:0;
  display:grid; grid-template-columns:264px minmax(0,1fr);
  overflow:hidden; border:1px solid var(--line); border-radius:22px;
  background:
    radial-gradient(circle at 12% -15%,rgba(124,58,237,.15),transparent 34%),
    linear-gradient(180deg,color-mix(in srgb,var(--surface) 96%,transparent),color-mix(in srgb,var(--bg) 94%,transparent));
  box-shadow:0 26px 80px rgba(0,0,0,.22),var(--card-sheen);
}
.chat-stage { position:relative; min-width:0; min-height:0; display:flex; flex-direction:column; }
.chat-history {
  min-width:0; min-height:0; display:flex; flex-direction:column; padding:16px 12px 12px;
  border-right:1px solid var(--line); background:color-mix(in srgb,var(--bg) 72%,var(--surface));
}
.chat-history-head { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:2px 6px 14px; }
.chat-history-head > span { display:grid; gap:2px; }
.chat-history-head small { color:var(--accent-text); font-size:8px; font-weight:850; letter-spacing:.16em; }
.chat-history-head strong { font-size:14px; letter-spacing:-.02em; }
.chat-history-close { display:none; width:44px; height:44px; padding:0; place-items:center; border:1px solid var(--line); background:transparent; color:var(--text-secondary); }
.chat-history-close svg { width:17px; height:17px; }
.chat-new-thread {
  min-height:44px; display:flex; align-items:center; gap:9px; margin-bottom:14px; padding:0 12px;
  border:1px solid rgba(167,139,250,.3); border-radius:12px; background:var(--accent-weak); color:var(--text); box-shadow:none;
}
.chat-new-thread:hover { border-color:var(--accent-text); background:rgba(124,58,237,.22); box-shadow:none; }
.chat-new-thread svg { width:16px; height:16px; }
.chat-new-thread span { font-size:10.5px; }
.chat-history-list { min-height:0; flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:3px; }
.chat-history-group { padding:10px 8px 4px; color:var(--muted); font-size:8px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.chat-history-item {
  position:relative; width:100%; min-height:86px; display:grid; grid-template-columns:minmax(0,1fr) 32px; align-items:center; gap:2px;
  border:1px solid transparent; border-radius:13px; background:transparent; color:var(--text); overflow:hidden;
}
.chat-history-item:hover { border-color:var(--line); background:rgba(255,255,255,.04); box-shadow:none; }
.chat-history-item.active { border-color:rgba(167,139,250,.28); background:var(--accent-weak); }
.chat-history-open {
  min-width:0; min-height:84px; display:grid; align-content:center; gap:4px; padding:10px 4px 10px 11px;
  border:0; border-radius:12px 0 0 12px; background:transparent; color:inherit; text-align:left; box-shadow:none;
}
.chat-history-open:hover,.chat-history-open:focus-visible { background:transparent; box-shadow:none; }
.chat-history-open:focus-visible { outline:2px solid rgba(167,139,250,.7); outline-offset:-3px; }
.chat-history-open strong { overflow:hidden; font-size:10.5px; font-weight:720; letter-spacing:-.01em; text-overflow:ellipsis; white-space:nowrap; }
.chat-history-summary {
  min-height:2.7em; overflow:hidden; display:-webkit-box; color:var(--text-secondary); font-size:8.75px; font-style:normal; line-height:1.35;
  -webkit-box-orient:vertical; -webkit-line-clamp:2;
}
.chat-history-meta { color:var(--muted); font-size:7.75px; font-weight:700; letter-spacing:.02em; }
.chat-history-delete {
  width:30px; height:30px; display:grid; place-items:center; padding:0; margin-right:5px; border:1px solid transparent;
  border-radius:9px; background:transparent; color:var(--muted); box-shadow:none; opacity:.45; transition:opacity .16s ease,color .16s ease,background .16s ease,border-color .16s ease;
}
.chat-history-delete svg { width:15px; height:15px; }
.chat-history-item:hover .chat-history-delete,.chat-history-delete:focus-visible { opacity:1; }
.chat-history-delete:hover,.chat-history-delete:focus-visible { border-color:rgba(248,113,113,.28); background:rgba(248,113,113,.1); color:#fca5a5; box-shadow:none; }
.chat-history-delete:disabled { cursor:wait; opacity:.35; }
.chat-history-empty { margin:auto; padding:22px 12px; color:var(--muted); font-size:10px; line-height:1.55; text-align:center; }
.chat-history-foot { display:flex; justify-content:space-between; gap:10px; padding:12px 7px 2px; border-top:1px solid var(--line); color:var(--muted); font-size:8px; }
.chat-history-toggle { display:none; flex:none; width:44px; height:44px; padding:0; place-items:center; border:1px solid var(--line); background:var(--surface-subtle); color:var(--text-secondary); }
.chat-history-toggle svg { width:18px; height:18px; }
.chat-history-backdrop { position:absolute; inset:0; z-index:42; border:0; border-radius:0; background:rgba(2,3,6,.64); backdrop-filter:blur(3px); }
.chat-command-head {
  flex:none; display:flex; align-items:center; justify-content:space-between; gap:12px;
  min-height:84px; padding:15px 20px; border-bottom:1px solid var(--line);
  background:color-mix(in srgb,var(--surface) 82%,transparent); backdrop-filter:blur(18px);
}
.chat-command-identity { min-width:0; flex:1; display:flex; align-items:center; gap:13px; }
.chat-command-mark {
  flex:none; width:46px; height:46px; display:grid; place-items:center; border:1px solid rgba(167,139,250,.35);
  border-radius:15px; color:#ddd6fe; background:linear-gradient(145deg,rgba(124,58,237,.86),rgba(79,70,229,.62));
  box-shadow:0 10px 28px rgba(124,58,237,.22),inset 0 1px 0 rgba(255,255,255,.18);
}
.chat-command-mark svg { width:24px; height:24px; }
.chat-command-identity > span:last-child { min-width:0; display:grid; gap:2px; }
.chat-command-identity small { color:var(--accent-text); font-size:9px; font-weight:850; letter-spacing:.16em; }
.chat-command-identity strong { overflow:hidden; color:var(--text); font-size:15px; letter-spacing:-.015em; text-overflow:ellipsis; white-space:nowrap; }
.chat-command-identity em { overflow:hidden; color:var(--muted); font-size:10.5px; font-style:normal; text-overflow:ellipsis; white-space:nowrap; }
.chat-agent-picker { position:relative; flex:none; }
.chat-agent-trigger {
  min-width:170px; min-height:46px; display:grid; grid-template-columns:31px minmax(0,1fr) 15px; align-items:center; gap:8px;
  padding:6px 9px; border:1px solid var(--line); border-radius:13px; color:var(--text); background:var(--surface-subtle); box-shadow:none; text-align:left;
}
.chat-agent-trigger:hover,.chat-agent-trigger:focus-visible,.chat-agent-trigger[aria-expanded="true"] { border-color:rgba(167,139,250,.48); background:rgba(124,58,237,.08); box-shadow:0 0 0 3px rgba(124,58,237,.07); }
.chat-agent-avatar {
  width:31px; height:31px; display:grid; place-items:center; border:1px solid rgba(167,139,250,.32); border-radius:50%;
  color:#ede9fe; background:linear-gradient(145deg,rgba(124,58,237,.72),rgba(79,70,229,.42)); font-size:11px; font-weight:850;
}
.chat-agent-copy { min-width:0; display:grid; gap:0; }
.chat-agent-copy small { color:var(--accent-text); font-size:7px; font-weight:850; letter-spacing:.14em; }
.chat-agent-copy strong,.chat-agent-copy em { overflow:hidden; line-height:1.2; text-overflow:ellipsis; white-space:nowrap; }
.chat-agent-copy strong { font-size:10.5px; }
.chat-agent-copy em { color:var(--muted); font-size:8px; font-style:normal; }
.chat-agent-chevron { width:15px; height:15px; color:var(--muted); transition:transform .18s ease; }
.chat-agent-trigger[aria-expanded="true"] .chat-agent-chevron { transform:rotate(180deg); }
.chat-agent-menu {
  position:absolute; z-index:72; top:calc(100% + 9px); left:0; width:min(430px,calc(100vw - 32px)); max-height:min(620px,76vh); overflow:auto;
  padding:8px; border:1px solid var(--line-strong); border-radius:16px; background:color-mix(in srgb,var(--surface) 97%,#111827 3%);
  box-shadow:0 24px 70px rgba(0,0,0,.44); backdrop-filter:blur(22px);
}
.chat-agent-menu-head { position:sticky; z-index:2; top:-8px; display:grid; gap:7px; padding:10px 9px 12px; border-bottom:1px solid var(--line); background:inherit; }
.chat-agent-menu-head strong { font-size:11px; }
.chat-agent-menu-head small { color:var(--muted); font-size:9px; }
.chat-agent-group { display:block; padding:12px 9px 5px; color:var(--muted); font-size:7.5px; font-weight:850; letter-spacing:.14em; text-transform:uppercase; }
.chat-agent-option { width:100%; min-height:59px; display:grid; grid-template-columns:34px minmax(0,1fr) auto; align-items:center; gap:10px; padding:8px 9px; border:1px solid transparent; border-radius:11px; color:var(--text); background:transparent; box-shadow:none; text-align:left; }
.chat-agent-option:hover,.chat-agent-option:focus-visible { border-color:var(--line); background:rgba(255,255,255,.04); box-shadow:none; }
.chat-agent-option[aria-selected="true"] { border-color:rgba(167,139,250,.3); background:rgba(124,58,237,.11); }
.chat-agent-option .chat-agent-avatar { width:34px; height:34px; }
.chat-agent-option-copy { min-width:0; display:grid; gap:2px; }
.chat-agent-option-copy strong { font-size:10.5px; }
.chat-agent-option-copy small { overflow:hidden; color:var(--muted); font-size:8.5px; text-overflow:ellipsis; white-space:nowrap; }
.chat-agent-option b { align-self:start; padding:3px 6px; border:1px solid var(--line); border-radius:999px; color:var(--text-secondary); font-size:7px; font-weight:750; }
.chat-model-picker { position:relative; flex:none; }
.chat-model-trigger {
  min-width:178px; min-height:46px; display:grid; grid-template-columns:30px minmax(0,1fr) 16px; align-items:center; gap:8px;
  padding:7px 9px; border:1px solid rgba(167,139,250,.26); border-radius:13px; color:var(--text);
  background:linear-gradient(145deg,rgba(124,58,237,.12),rgba(79,70,229,.06)); box-shadow:none; text-align:left;
}
.chat-model-trigger:hover,.chat-model-trigger:focus-visible,.chat-model-trigger[aria-expanded="true"] {
  border-color:rgba(167,139,250,.52); background:linear-gradient(145deg,rgba(124,58,237,.2),rgba(79,70,229,.1)); box-shadow:0 0 0 3px rgba(124,58,237,.08);
}
.chat-model-trigger:disabled { cursor:wait; opacity:.7; }
.chat-model-icon { width:30px; height:30px; display:grid; place-items:center; border:1px solid rgba(167,139,250,.28); border-radius:10px; color:#c4b5fd; background:rgba(124,58,237,.14); }
.chat-model-icon svg { width:16px; height:16px; }
.chat-model-copy { min-width:0; display:grid; gap:1px; }
.chat-model-copy small { color:var(--accent-text); font-size:7.5px; font-weight:850; letter-spacing:.15em; }
.chat-model-copy strong { overflow:hidden; font-size:10.5px; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.chat-model-chevron { width:15px; height:15px; color:var(--muted); transition:transform .18s ease; }
.chat-model-trigger[aria-expanded="true"] .chat-model-chevron { transform:rotate(180deg); }
.chat-model-menu {
  position:absolute; z-index:70; top:calc(100% + 9px); right:0; width:min(390px,calc(100vw - 32px)); max-height:min(590px,72vh); overflow:auto;
  padding:7px; border:1px solid var(--line-strong); border-radius:16px; background:color-mix(in srgb,var(--surface) 97%,#111827 3%);
  box-shadow:0 24px 70px rgba(0,0,0,.42),0 0 0 1px rgba(255,255,255,.025); backdrop-filter:blur(22px);
}
.chat-model-menu-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 9px 10px; border-bottom:1px solid var(--line); }
.chat-model-menu-head span { color:var(--text); font-size:10px; font-weight:800; }
.chat-model-menu-head small { color:var(--muted); font-size:8.5px; }
.chat-model-menu [role="option"] {
  width:100%; min-height:67px; display:grid; grid-template-columns:12px minmax(0,1fr) auto; align-items:center; gap:10px;
  padding:9px; border:1px solid transparent; border-radius:11px; color:var(--text); background:transparent; box-shadow:none; text-align:left;
}
.chat-model-menu [role="option"]:hover,.chat-model-menu [role="option"]:focus-visible { border-color:var(--line); background:rgba(255,255,255,.045); box-shadow:none; }
.chat-model-menu [role="option"][aria-selected="true"] { border-color:rgba(167,139,250,.3); background:rgba(124,58,237,.12); }
.chat-model-menu [role="option"]:disabled { cursor:not-allowed; opacity:.46; }
.chat-model-option-mark { width:8px; height:8px; border:1px solid var(--line-strong); border-radius:50%; background:transparent; }
.chat-model-menu [aria-selected="true"] .chat-model-option-mark { border-color:#c4b5fd; background:#a78bfa; box-shadow:0 0 0 4px rgba(167,139,250,.12); }
.chat-model-option-copy { min-width:0; display:grid; gap:2px; }
.chat-model-option-copy strong { font-size:10.5px; }
.chat-model-option-copy small,.chat-model-option-copy em { overflow:hidden; color:var(--muted); font-size:8.5px; font-style:normal; line-height:1.35; text-overflow:ellipsis; white-space:nowrap; }
.chat-model-option-copy em { color:var(--text-secondary); }
.chat-model-menu [role="option"] > b { align-self:start; padding:3px 6px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:7.5px; letter-spacing:.04em; }
.chat-model-empty { margin:0; padding:14px; color:var(--muted); font-size:10px; text-align:center; }
.chat-runtime {
  flex:none; display:flex; align-items:center; gap:10px; min-width:238px; padding:9px 12px;
  border:1px solid var(--line); border-radius:13px; background:var(--surface-subtle);
}
.chat-runtime > i { flex:none; width:8px; height:8px; border-radius:50%; background:var(--success); box-shadow:0 0 0 5px rgba(52,211,153,.1); }
.chat-runtime.busy > i { background:var(--warning); box-shadow:0 0 0 5px rgba(251,191,36,.1); animation:chat-runtime-pulse 1.4s ease-in-out infinite; }
.chat-runtime > span { min-width:0; display:grid; gap:1px; }
.chat-runtime strong { color:var(--text); font-size:10.5px; }
.chat-runtime small { overflow:hidden; color:var(--muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.chat-team-trigger { min-height:46px; display:flex; align-items:center; gap:7px; padding:8px 10px; border:1px solid var(--line); border-radius:13px; color:var(--text-secondary); background:var(--surface-subtle); box-shadow:none; }
.chat-team-trigger:hover,.chat-team-trigger[aria-expanded="true"] { border-color:rgba(167,139,250,.4); color:var(--text); background:rgba(124,58,237,.09); box-shadow:none; }
.chat-team-trigger svg { width:18px; height:18px; }
.chat-team-trigger span { font-size:9px; font-weight:750; }
.chat-team-trigger i { min-width:18px; height:18px; display:grid; place-items:center; border-radius:999px; color:#ddd6fe; background:rgba(124,58,237,.18); font-size:7.5px; font-style:normal; }
.chat-team-backdrop { position:absolute; z-index:41; inset:0; border:0; border-radius:inherit; background:rgba(3,3,7,.42); backdrop-filter:blur(2px); }
.chat-team-drawer { position:absolute; z-index:42; top:0; right:0; bottom:0; width:min(390px,92vw); padding:0 14px 18px; overflow:auto; border-left:1px solid var(--line-strong); background:color-mix(in srgb,var(--surface) 98%,#111827 2%); box-shadow:-24px 0 70px rgba(0,0,0,.36); transform:translateX(105%); transition:transform .24s ease-out; }
.chat-stage.team-open .chat-team-drawer { transform:translateX(0); }
.chat-team-head { position:sticky; z-index:2; top:0; display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:76px; padding:12px 2px; border-bottom:1px solid var(--line); background:inherit; }
.chat-team-head > span { display:grid; gap:2px; }
.chat-team-head small { color:var(--accent-text); font-size:8px; font-weight:850; letter-spacing:.15em; }
.chat-team-head strong { font-size:15px; }
.chat-team-head button { width:38px; height:38px; display:grid; place-items:center; padding:0; border:1px solid var(--line); border-radius:11px; color:var(--muted); background:transparent; box-shadow:none; }
.chat-team-head button svg { width:17px; height:17px; }
.chat-team-intro { margin:14px 2px 8px; color:var(--muted); font-size:9.5px; line-height:1.5; }
.chat-team-list { display:grid; gap:8px; }
.chat-team-card { display:grid; grid-template-columns:35px minmax(0,1fr); gap:10px; padding:10px; border:1px solid var(--line); border-radius:13px; background:var(--surface-subtle); }
.chat-team-card.active { border-color:rgba(167,139,250,.32); background:rgba(124,58,237,.08); }
.chat-team-card-copy { min-width:0; display:grid; gap:4px; }
.chat-team-card-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.chat-team-card-head strong { overflow:hidden; font-size:10.5px; text-overflow:ellipsis; white-space:nowrap; }
.chat-team-card-head span { flex:none; color:var(--muted); font-size:7.5px; }
.chat-team-card-copy > small { overflow:hidden; color:var(--muted); font-size:8.5px; text-overflow:ellipsis; white-space:nowrap; }
.chat-team-missions { display:grid; gap:4px; margin:2px 0; padding:0; list-style:none; }
.chat-team-missions li { min-width:0; display:grid; grid-template-columns:6px minmax(0,1fr) auto; align-items:center; gap:6px; color:var(--text-secondary); font-size:8px; }
.chat-team-missions i { width:5px; height:5px; border-radius:50%; background:var(--warning); }
.chat-team-missions span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-team-missions em { color:var(--muted); font-size:7px; font-style:normal; text-transform:capitalize; }
.chat-agent-policy { display:flex; align-items:center; gap:6px; margin-top:2px; }
.chat-agent-policy label { color:var(--muted); font-size:7.5px; }
.chat-agent-policy select { min-height:28px; flex:1; padding:3px 24px 3px 7px; border-radius:8px; font-size:8.5px; }
@keyframes chat-runtime-pulse { 50% { opacity:.45; transform:scale(.82); } }

.nova-voice-stage {
  --voice-level:.12; --voice-surface:#15141c; --voice-accent:#9485d8; --voice-line:rgba(196,190,222,.22);
  position:absolute; z-index:35; inset:84px 0 0; display:grid; place-items:center; overflow:hidden;
  padding:clamp(20px,4vw,52px); color:var(--text); isolation:isolate;
  background:linear-gradient(180deg,rgba(5,5,8,.94),rgba(8,8,12,.97));
  backdrop-filter:blur(18px); animation:nova-stage-enter .24s ease-out both;
}
.nova-voice-atmosphere,.nova-voice-atmosphere i { position:absolute; inset:0; pointer-events:none; }
.nova-voice-atmosphere { z-index:-1; overflow:hidden; }
.nova-voice-atmosphere::before {
  content:""; position:absolute; inset:0; opacity:.42;
  background:linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.018) 1px,transparent 1px);
  background-size:48px 48px; mask-image:linear-gradient(to bottom,transparent,#000 20%,#000 78%,transparent);
}
.nova-voice-atmosphere i {
  width:min(620px,66vw); height:min(620px,66vw); margin:auto; border-radius:50%;
  background:rgba(105,87,175,.13); filter:blur(100px); opacity:.68;
}
.nova-voice-shell { width:min(680px,100%); display:grid; justify-items:center; gap:clamp(14px,2.2vh,24px); }
.nova-voice-heading { width:100%; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.nova-voice-kicker { display:inline-flex; align-items:center; gap:8px; color:#d4cfee; font-size:9px; font-weight:750; letter-spacing:.16em; }
.nova-voice-kicker i { width:6px; height:6px; border-radius:50%; background:#9b8ee0; box-shadow:0 0 0 4px rgba(155,142,224,.09); }
.nova-voice-privacy { color:#8f8b9c; font-size:10px; }
.nova-cosmos-wrap { position:relative; width:clamp(280px,36vmin,360px); aspect-ratio:1; display:grid; place-items:center; }
.nova-cosmos {
  position:relative; width:88%; aspect-ratio:1; display:grid; place-items:center; border-radius:50%;
  filter:drop-shadow(0 28px 48px rgba(0,0,0,.46));
}
.nova-cosmos-surface {
  position:absolute; inset:8%; overflow:hidden; border:1px solid rgba(216,211,235,.2); border-radius:50%;
  background:
    radial-gradient(circle at 38% 30%,rgba(255,255,255,.14),transparent 24%),
    radial-gradient(circle at 62% 68%,rgba(119,99,192,.24),transparent 42%),
    linear-gradient(145deg,#262331,#111118 58%,#1b1825);
  box-shadow:inset 0 1px rgba(255,255,255,.08),inset 18px -22px 52px rgba(0,0,0,.34);
  transform:scale(calc(1 + var(--voice-level) * .025)); transition:transform .16s ease-out;
}
.nova-cosmos-surface::after {
  content:""; position:absolute; inset:0; border-radius:inherit; opacity:.55;
  background:linear-gradient(118deg,transparent 24%,rgba(255,255,255,.055) 48%,transparent 67%);
}
.nova-cosmos-halo { position:absolute; inset:2%; border:1px solid rgba(169,158,213,.2); border-radius:50%; opacity:.72; }
.nova-voice-signal { position:absolute; border:1px solid var(--voice-line); border-radius:50%; opacity:.5; }
.nova-voice-signal.signal-outer { inset:-1%; }
.nova-voice-signal.signal-inner { inset:14%; }
.nova-cosmos-core {
  position:relative; z-index:4; width:20%; aspect-ratio:1; display:flex; align-items:center; justify-content:center; gap:4px;
  border:1px solid rgba(215,209,239,.36); border-radius:50%; background:rgba(11,10,16,.78);
  box-shadow:0 12px 30px rgba(0,0,0,.34),inset 0 1px rgba(255,255,255,.08);
  transform:scale(calc(1 + var(--voice-level) * .09)); transition:transform .14s ease-out;
}
.nova-cosmos-core i {
  width:3px; height:20%; border-radius:3px; background:#bbb2e5; opacity:.78;
  transform:scaleY(calc(.55 + var(--voice-level) * 1.4)); transition:transform .12s ease-out;
}
.nova-cosmos-core i:nth-child(2) { height:34%; }
.nova-voice-copy { max-width:600px; display:grid; justify-items:center; gap:7px; text-align:center; }
.nova-voice-copy strong { color:#f2f0f7; font-size:clamp(21px,2.6vw,28px); font-weight:650; line-height:1.18; letter-spacing:-.025em; text-wrap:balance; }
.nova-voice-copy span { color:#aaa6b5; font-size:12px; line-height:1.55; }
.nova-voice-actions { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:10px; min-height:48px; }
.nova-voice-actions button { min-height:46px; display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:9px 15px; border-radius:12px; font-size:10.5px; box-shadow:none; }
.nova-voice-stop { border:1px solid rgba(160,146,219,.38); color:#e4e0f4; background:rgba(126,105,201,.14); }
.nova-voice-stop > span { width:9px; height:9px; border-radius:2px; background:#b2a8dc; }
.nova-voice-stop:hover,.nova-voice-stop:focus-visible { border-color:rgba(188,176,233,.62); background:rgba(126,105,201,.22); box-shadow:0 0 0 3px rgba(148,133,216,.08); }
.nova-voice-retry { border:1px solid rgba(160,146,219,.38); color:#e4e0f4; background:rgba(126,105,201,.14); }
.nova-voice-retry:hover,.nova-voice-retry:focus-visible { border-color:rgba(188,176,233,.62); background:rgba(126,105,201,.22); box-shadow:0 0 0 3px rgba(148,133,216,.08); }
.nova-voice-end { border:1px solid rgba(255,255,255,.12); color:#aaa6b5; background:rgba(255,255,255,.035); }
.nova-voice-end:hover,.nova-voice-end:focus-visible { border-color:rgba(196,190,222,.34); color:#f2f0f7; background:rgba(255,255,255,.065); box-shadow:0 0 0 3px rgba(148,133,216,.06); }
.nova-voice-end svg { width:16px; height:16px; }
.nova-voice-stage:not([data-state="listening"]) .nova-voice-stop { display:none; }
.nova-voice-stage:not([data-state="error"]) .nova-voice-retry { display:none; }
.nova-voice-stage[data-state="listening"] .signal-outer { animation:nova-signal-listen 2.2s ease-out infinite; }
.nova-voice-stage[data-state="thinking"] .signal-inner { animation:nova-signal-think 1.55s ease-in-out infinite; }
.nova-voice-stage[data-state="thinking"] .nova-cosmos-core { animation:nova-core-think 1.55s ease-in-out infinite; }
.nova-voice-stage[data-state="speaking"] .nova-cosmos-core i { animation:nova-bar-speak .86s ease-in-out infinite alternate; }
.nova-voice-stage[data-state="speaking"] .nova-cosmos-core i:nth-child(2) { animation-delay:.14s; }
.nova-voice-stage[data-state="speaking"] .nova-cosmos-core i:nth-child(3) { animation-delay:.28s; }
.nova-voice-stage[data-layout="compact"] {
  place-items:end; padding:18px; background:linear-gradient(135deg,transparent 52%,rgba(3,3,10,.28));
  backdrop-filter:none; pointer-events:none;
}
.nova-voice-stage[data-layout="compact"] .nova-voice-atmosphere { display:none; }
.nova-voice-stage[data-layout="compact"] .nova-voice-shell {
  width:min(390px,calc(100% - 4px)); min-height:112px; grid-template-columns:96px minmax(0,1fr) 46px;
  grid-template-areas:"cosmos copy actions"; align-items:center; justify-items:stretch; gap:12px; padding:10px 11px;
  border:1px solid rgba(196,190,222,.18); border-radius:16px; pointer-events:auto;
  background:rgba(15,14,20,.96); box-shadow:0 20px 50px rgba(0,0,0,.46),inset 0 1px rgba(255,255,255,.045);
}
.nova-voice-stage[data-layout="compact"] .nova-voice-heading { display:none; }
.nova-voice-stage[data-layout="compact"] .nova-cosmos-wrap { grid-area:cosmos; width:92px; }
.nova-voice-stage[data-layout="compact"] .nova-cosmos { width:88%; filter:drop-shadow(0 12px 24px rgba(0,0,0,.4)); }
.nova-voice-stage[data-layout="compact"] .nova-voice-copy {
  grid-area:copy; min-width:0; justify-items:start; gap:4px; text-align:left;
}
.nova-voice-stage[data-layout="compact"] .nova-voice-copy strong { font-size:12px; line-height:1.35; letter-spacing:-.01em; }
.nova-voice-stage[data-layout="compact"] .nova-voice-copy span {
  display:-webkit-box; overflow:hidden; color:#a8a5b7; font-size:9px; line-height:1.45;
  -webkit-box-orient:vertical; -webkit-line-clamp:2;
}
.nova-voice-stage[data-layout="compact"] .nova-voice-actions { grid-area:actions; min-height:46px; }
.nova-voice-stage[data-layout="compact"] .nova-voice-stop { display:none; }
.nova-voice-stage[data-layout="compact"] .nova-voice-retry { display:none; }
.nova-voice-stage[data-layout="compact"] .nova-voice-end {
  width:46px; height:46px; min-height:46px; padding:0; border-radius:50%; font-size:0;
}
.nova-voice-stage[data-layout="compact"] .nova-voice-end svg { width:18px; height:18px; }
@keyframes nova-stage-enter { from { opacity:0; transform:scale(1.008); } to { opacity:1; transform:scale(1); } }
@keyframes nova-signal-listen { 0% { opacity:.5; transform:scale(.94); } 75%,100% { opacity:0; transform:scale(1.08); } }
@keyframes nova-signal-think { 50% { opacity:.85; transform:scale(.97); } }
@keyframes nova-core-think { 50% { border-color:rgba(196,190,222,.52); } }
@keyframes nova-bar-speak { to { transform:scaleY(calc(.8 + var(--voice-level) * 1.55)); opacity:1; } }

.chat-thread { padding:24px clamp(18px,5vw,64px) 28px; gap:18px; scroll-behavior:smooth; }
.chat-empty { width:min(850px,100%); max-width:none; padding:32px 0; }
.chat-empty-orb {
  width:64px; height:64px; display:grid; place-items:center; margin:0 auto 17px;
  border:1px solid rgba(167,139,250,.32); border-radius:21px; color:#c4b5fd;
  background:linear-gradient(145deg,rgba(124,58,237,.28),rgba(34,211,238,.07)); box-shadow:0 20px 55px rgba(124,58,237,.16);
}
.chat-empty-orb svg { width:31px; height:31px; }
.chat-empty-kicker { color:var(--accent-text); font-size:9px; font-weight:850; letter-spacing:.18em; }
.chat-empty h3 { margin:8px 0 8px; font-size:clamp(24px,3vw,34px); line-height:1.1; letter-spacing:-.045em; }
.chat-empty > p { max-width:620px; margin:0 auto; color:var(--text-secondary); font-size:13px; line-height:1.65; }
.chat-starters { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-top:26px; text-align:left; }
.chat-starters button {
  min-height:86px; display:grid; align-content:center; gap:5px; padding:14px 15px; border:1px solid var(--line);
  border-radius:14px; background:color-mix(in srgb,var(--surface-subtle) 82%,transparent); color:var(--text); box-shadow:none;
  transition:border-color .2s ease,background .2s ease,transform .2s ease;
}
.chat-starters button:hover,.chat-starters button:focus-visible { border-color:var(--accent-weak-2); background:var(--accent-weak); box-shadow:none; transform:translateY(-1px); }
.chat-starters button span { font-size:11.5px; font-weight:750; }
.chat-starters button small { color:var(--muted); font-size:9.5px; font-weight:500; line-height:1.45; }

.chat-msg { align-items:flex-start; gap:10px; }
.chat-msg.user { flex-direction:row; justify-content:flex-end; }
.chat-msg.user .chat-message-avatar { order:2; }
.chat-msg.user .chat-message-body { order:1; }
.chat-message-avatar {
  flex:none; width:32px; height:32px; display:grid; place-items:center; margin-top:18px; border:1px solid var(--line);
  border-radius:10px; background:var(--surface-subtle); color:var(--accent-text); font-size:10px; font-weight:800;
}
.chat-message-avatar svg { width:17px; height:17px; }
.chat-msg.user .chat-message-avatar { color:#fff; border-color:rgba(139,92,246,.35); background:linear-gradient(145deg,#8b5cf6,#6d28d9); }
.chat-message-body { min-width:0; max-width:min(82%,850px); }
.chat-message-meta { display:flex; align-items:center; gap:7px; min-height:18px; margin:0 4px 3px; color:var(--muted); font-size:9px; }
.chat-msg.user .chat-message-meta { justify-content:flex-end; }
.chat-message-meta strong { color:var(--text-secondary); font-size:9.5px; }
.chat-message-role { color:var(--muted); }
.chat-message-route,.chat-message-delegated { padding:2px 5px; border:1px solid var(--line); border-radius:999px; font-size:7.5px; }
.chat-message-route { color:#c4b5fd; background:rgba(124,58,237,.08); }
.chat-message-delegated { color:var(--text-secondary); }
.chat-bubble { max-width:none; padding:12px 15px; border-radius:16px; font-size:13.5px; line-height:1.62; box-shadow:var(--card-sheen); }
.chat-msg.agent .chat-bubble { border-bottom-left-radius:6px; background:color-mix(in srgb,var(--surface) 92%,transparent); }
.chat-msg.user .chat-bubble { border-bottom-right-radius:6px; background:linear-gradient(135deg,#7c3aed,#5b48d6); box-shadow:0 10px 28px rgba(91,72,214,.18); }
.chat-msg.agent .chat-bubble.typing { min-height:43px; padding-inline:17px; }

.chat-composer {
  position:relative; flex:none; margin:0 16px 16px; border:1px solid var(--line-strong); border-radius:18px;
  background:color-mix(in srgb,var(--surface) 94%,transparent); box-shadow:0 18px 48px rgba(0,0,0,.24),var(--card-sheen);
  transition:border-color .2s ease,box-shadow .2s ease;
}
.chat-recording-panel {
  min-height:64px; display:flex; align-items:center; gap:12px; margin:9px 9px 0; padding:9px 11px;
  border:1px solid rgba(248,113,113,.28); border-radius:13px; background:rgba(127,29,29,.1);
}
.chat-recording-dot { flex:none; width:10px; height:10px; border-radius:50%; background:var(--danger); box-shadow:0 0 0 6px rgba(248,113,113,.1); animation:micpulse 1.15s ease-in-out infinite; }
.chat-recording-copy { min-width:0; display:grid; gap:2px; }
.chat-recording-copy strong { color:var(--text); font-size:11px; }
.chat-recording-copy small { overflow:hidden; color:var(--muted); font-size:8.5px; text-overflow:ellipsis; white-space:nowrap; }
.chat-wave { height:25px; display:flex; align-items:center; gap:3px; margin-left:auto; }
.chat-wave i { width:3px; height:8px; border-radius:4px; background:var(--danger); animation:chat-wave 1s ease-in-out infinite; }
.chat-wave i:nth-child(2),.chat-wave i:nth-child(4) { animation-delay:.12s; }
.chat-wave i:nth-child(3) { animation-delay:.24s; }
@keyframes chat-wave { 50% { height:23px; opacity:.55; } }
.chat-recording-panel time { min-width:38px; color:var(--text-secondary); font:10px ui-monospace,monospace; }
.chat-recording-panel button { min-height:40px; padding:7px 11px; border:1px solid rgba(248,113,113,.34); background:rgba(248,113,113,.12); color:#fecaca; font-size:9px; box-shadow:none; }
.chat-recording-panel button:hover { background:rgba(248,113,113,.2); box-shadow:none; }
.chat-composer:focus-within { border-color:rgba(167,139,250,.55); box-shadow:0 18px 48px rgba(0,0,0,.24),0 0 0 3px rgba(124,58,237,.08); }
.chat-composer .chat-attach-strip:not(:empty) { padding:10px 12px 0; }
.chat-composer .chat-ac { bottom:calc(100% + 8px); left:0; right:auto; width:min(520px,calc(100vw - 60px)); max-width:none; }
.chat-input { display:flex; align-items:flex-end; gap:8px; margin:0; padding:10px 11px 7px; border:0; }
.chat-input textarea {
  min-height:46px; max-height:180px; padding:11px 8px 9px; border:0; border-radius:0; background:transparent;
  box-shadow:none; font-size:14px; line-height:1.55;
}
.chat-input textarea:focus { outline:0; border:0; box-shadow:none; }
.chat-input textarea::placeholder { color:color-mix(in srgb,var(--muted) 82%,transparent); }
.chat-attach-btn,.chat-mic-btn,.chat-input button.primary { width:46px; height:46px; min-width:46px; border-radius:13px; }
.chat-attach-btn,.chat-mic-btn { color:var(--text-secondary); background:transparent; }
.chat-attach-btn:hover,.chat-mic-btn:hover { color:var(--text); background:rgba(255,255,255,.07); }
.chat-mic-btn.recording { color:#fecaca; background:rgba(248,113,113,.13); }
.chat-mic-btn.listening { color:#ddd6fe; border-color:rgba(167,139,250,.44); background:rgba(124,58,237,.12); }
.chat-input button.primary { background:linear-gradient(145deg,#8b5cf6,#6d28d9); box-shadow:0 8px 22px rgba(109,40,217,.22); }
.chat-composer-foot { min-height:36px; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:0 13px 9px 14px; }
.chat-voice-options { min-height:0; display:flex; flex:1; justify-content:flex-start; gap:8px; padding:0; font-size:10px; }
.chat-speech-status {
  flex:none; display:inline-flex; align-items:center; gap:7px; min-width:0; margin:0; padding:5px 8px;
  border:1px solid var(--line); border-radius:999px; color:var(--text-secondary); background:var(--surface-subtle); overflow:visible;
}
.chat-speech-status::before { content:""; flex:none; width:6px; height:6px; border-radius:50%; background:var(--success); }
.chat-speech-status[data-state="armed"]::before { background:var(--accent-text); box-shadow:0 0 0 4px rgba(167,139,250,.1); }
.chat-speech-status[data-state="listening"]::before { background:var(--accent-text); box-shadow:0 0 0 4px rgba(167,139,250,.1); animation:chat-runtime-pulse 1.2s ease-in-out infinite; }
.chat-speech-status[data-state="working"]::before { background:var(--warning); }
.chat-speech-status[data-state="error"]::before,.chat-speech-status[data-state="unsupported"]::before { background:var(--danger); }
.chat-voice-toggle {
  display:inline-flex; align-items:center; gap:6px; min-height:28px; padding:4px 8px; border:1px solid transparent;
  border-radius:999px; color:var(--muted); font-size:9.5px; font-weight:650;
}
.chat-voice-toggle:hover { color:var(--text); background:rgba(255,255,255,.04); }
.chat-voice-toggle:has(input:checked) { border-color:rgba(167,139,250,.25); color:var(--accent-text); background:var(--accent-weak); }
.chat-voice-engine { align-self:center; color:var(--muted); font-size:9px; white-space:nowrap; }
.chat-input-hint { flex:none; color:var(--muted); font-size:9px; white-space:nowrap; }
.chat-input-hint kbd { padding:1px 4px; border:1px solid var(--line); border-bottom-color:var(--line-strong); border-radius:4px; background:var(--surface-subtle); color:var(--text-secondary); font:8.5px ui-monospace,monospace; }

@media (max-width:900px) {
  .chat-wrap { height:calc(100dvh - 116px); min-height:520px; grid-template-columns:minmax(0,1fr); border-radius:18px; }
  .chat-stage { grid-column:1; grid-row:1; }
  .chat-history {
    position:absolute; z-index:45; inset:0 auto 0 0; width:min(310px,86vw); border-right:1px solid var(--line-strong);
    box-shadow:24px 0 70px rgba(0,0,0,.4); transform:translateX(-105%); transition:transform .24s ease-out;
  }
  .chat-wrap.history-open .chat-history { transform:translateX(0); }
  .chat-history-close,.chat-history-toggle { display:grid; }
  .chat-command-head { min-height:72px; padding:12px 14px; }
  .chat-command-mark { width:42px; height:42px; }
  .chat-command-identity { display:none; }
  .chat-runtime { display:none; }
  .chat-agent-trigger { min-width:160px; }
  .chat-model-trigger { min-width:154px; }
  .chat-runtime small,.chat-command-identity em { display:none; }
  .chat-thread { padding:20px 18px 24px; }
  .chat-starters { grid-template-columns:1fr; width:min(480px,100%); margin-inline:auto; }
  .chat-starters button { min-height:64px; }
  .chat-message-body { max-width:88%; }
  .chat-input-hint { display:none; }
  .chat-voice-engine { display:none; }
  .nova-voice-stage { inset:72px 0 0; }
  .nova-cosmos-wrap { width:clamp(250px,42vmin,330px); }
}
@media (max-width:620px) {
  #page-chat { margin:-4px; }
  .chat-wrap { height:calc(100dvh - 102px); min-height:480px; border-radius:15px; }
  .chat-command-head { min-height:64px; }
  .chat-command-mark { width:38px; height:38px; border-radius:12px; }
  .chat-command-mark svg { width:21px; height:21px; }
  .chat-command-identity strong { max-width:34vw; font-size:12px; }
  .chat-command-identity small { font-size:8px; }
  .chat-runtime { display:none; }
  .chat-runtime strong { font-size:9px; }
  .chat-runtime small { display:none; }
  .chat-model-trigger { min-width:138px; min-height:44px; grid-template-columns:28px minmax(0,1fr) 14px; padding:6px 7px; }
  .chat-agent-trigger { min-width:112px; min-height:44px; grid-template-columns:28px minmax(0,1fr) 12px; padding:6px 7px; }
  .chat-agent-avatar { width:28px; height:28px; }
  .chat-agent-copy em,.chat-agent-copy small { display:none; }
  .chat-agent-menu { position:fixed; z-index:90; inset:70px 8px max(8px,env(safe-area-inset-bottom)); width:auto; max-height:none; }
  .chat-team-trigger { width:44px; padding:0; justify-content:center; }
  .chat-team-trigger span { display:none; }
  .chat-team-trigger i { position:absolute; margin:-30px 0 0 27px; }
  .chat-model-icon { width:28px; height:28px; }
  .chat-model-menu { right:-2px; }
  .chat-model-menu-head small { display:none; }
  .chat-thread { padding:16px 10px 20px; gap:14px; }
  .chat-empty { padding:18px 4px; }
  .chat-empty-orb { width:52px; height:52px; margin-bottom:12px; border-radius:17px; }
  .chat-empty h3 { font-size:24px; }
  .chat-empty > p { font-size:12px; }
  .chat-starters { margin-top:18px; }
  .chat-starters button { min-height:60px; padding:11px 13px; }
  .chat-message-avatar { width:28px; height:28px; margin-top:17px; border-radius:9px; }
  .chat-message-body { max-width:calc(100% - 38px); }
  .chat-bubble { padding:10px 12px; font-size:13px; }
  .chat-composer { margin:0 7px 7px; border-radius:15px; }
  .chat-input { gap:3px; padding:7px 7px 4px; }
  .chat-input textarea { min-height:44px; padding-inline:6px; font-size:16px; }
  .chat-attach-btn,.chat-mic-btn,.chat-input button.primary { width:44px; height:44px; min-width:44px; }
  .chat-composer-foot { align-items:flex-start; padding:2px 8px 8px; }
  .chat-voice-options { width:100%; flex-wrap:wrap; gap:5px; }
  .chat-speech-status { flex:1 1 100%; }
  .chat-voice-toggle { min-height:32px; }
  .chat-recording-panel { gap:9px; }
  .chat-recording-copy small,.chat-wave { display:none; }
  .chat-recording-panel button { min-height:44px; margin-left:auto; }
  .nova-voice-stage { inset:64px 0 0; padding:18px 14px max(18px,env(safe-area-inset-bottom)); }
  .nova-voice-shell { gap:13px; }
  .nova-voice-heading { padding-inline:2px; }
  .nova-voice-privacy { display:none; }
  .nova-cosmos-wrap { width:clamp(190px,58vw,230px); }
  .nova-voice-copy strong { font-size:21px; }
  .nova-voice-copy span { max-width:310px; font-size:11px; }
  .nova-voice-actions { width:100%; }
  .nova-voice-actions button { min-height:46px; }
  .nova-voice-stage[data-layout="compact"] { padding:10px; }
  .nova-voice-stage[data-layout="compact"] .nova-voice-shell {
    width:100%; min-height:94px; grid-template-columns:76px minmax(0,1fr) 44px; gap:9px; padding:8px 9px; border-radius:18px;
  }
  .nova-voice-stage[data-layout="compact"] .nova-cosmos-wrap { width:74px; }
  .nova-voice-stage[data-layout="compact"] .nova-voice-end { width:44px; height:44px; min-height:44px; }
}
@media (prefers-reduced-motion:reduce) {
  .chat-thread { scroll-behavior:auto; }
  .chat-runtime.busy > i,.chat-speech-status[data-state="listening"]::before,.chat-mic-btn.recording { animation:none; }
  .chat-starters button { transition:none; }
  .chat-history { transition:none; }
  .chat-model-chevron { transition:none; }
  .chat-recording-dot,.chat-wave i { animation:none; }
  .nova-voice-stage,.nova-voice-stage * { animation:none!important; transition:none!important; }
}

/* MXG Design — a wide working surface with a real preview and editor. */
.prototype-kicker { color:#a78bfa; font-size:10px; font-weight:850; letter-spacing:.18em; }
.prototype-head { display:flex; align-items:flex-end; justify-content:space-between; gap:28px; margin-bottom:22px; }
.prototype-head h2 { margin:7px 0 7px; font-size:clamp(32px,4.4vw,52px); line-height:1; letter-spacing:-.052em; }
.prototype-head p { max-width:760px; margin:0; color:var(--text-secondary); font-size:14px; line-height:1.6; }
.prototype-head-actions { flex:none; display:grid; gap:9px; min-width:230px; }
.prototype-runtime { flex:none; display:flex; align-items:center; gap:10px; min-width:230px; padding:11px 13px; border:1px solid var(--line); border-radius:13px; background:var(--surface-subtle); }
.prototype-runtime i { width:8px; height:8px; border-radius:50%; background:#94a3b8; }
.prototype-runtime.online i { background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.1); }
.prototype-runtime.offline i { background:#f87171; box-shadow:0 0 0 4px rgba(248,113,113,.1); }
.prototype-runtime span { display:grid; gap:2px; }
.prototype-runtime strong { font-size:11px; }
.prototype-runtime small { color:var(--muted); font-size:9px; }
.prototype-visual-launch { display:flex; align-items:center; justify-content:space-between; min-height:46px; padding:0 15px; border:1px solid #8b5cf6; border-radius:12px; background:linear-gradient(135deg,#8b5cf6,#6d28d9); color:#fff; font-size:11px; font-weight:800; box-shadow:0 12px 30px rgba(109,40,217,.25); }
.prototype-visual-launch:hover { border-color:#b9a4ff; transform:translateY(-1px); }
.prototype-create { display:grid; grid-template-columns:minmax(340px,1.25fr) minmax(210px,.72fr) minmax(180px,.62fr); gap:13px 20px; margin-bottom:26px; padding:24px 0; border-block:1px solid var(--line); }
.prototype-create-copy { grid-row:span 2; display:grid; align-content:start; gap:7px; padding-right:42px; }
.prototype-create-copy > span { color:#a78bfa; font-size:9px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.prototype-create-copy strong { max-width:360px; font-size:20px; line-height:1.18; letter-spacing:-.03em; }
.prototype-create-copy small { max-width:390px; color:var(--muted); font-size:11px; line-height:1.65; }
.prototype-create label,.prototype-agent-form label { display:grid; gap:6px; color:var(--text-secondary); font-size:10px; font-weight:750; }
.prototype-create input,.prototype-create select,.prototype-create textarea,.prototype-agent-form textarea { margin:0; background:var(--surface-subtle); font-size:12px; }
.prototype-brief-field { grid-column:2/4; }
.prototype-create > button { grid-column:3; display:flex; align-items:center; justify-content:space-between; min-height:43px; }
.prototype-workspace { display:grid; grid-template-columns:280px minmax(0,1fr); min-height:700px; border:1px solid var(--line); border-radius:18px; overflow:hidden; background:var(--surface); box-shadow:0 24px 70px rgba(0,0,0,.08); }
.prototype-library { min-width:0; padding:17px 13px; border-right:1px solid var(--line); background:color-mix(in srgb,var(--surface-subtle) 74%,var(--surface)); }
.prototype-library-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:0 4px 13px; }
.prototype-library-head > div { display:flex; align-items:center; gap:8px; }
.prototype-library-head span { color:var(--text-secondary); font-size:10px; font-weight:750; text-transform:uppercase; letter-spacing:.08em; }
.prototype-library-head strong { display:grid; place-items:center; min-width:22px; height:22px; padding:0 6px; border-radius:999px; background:color-mix(in srgb,var(--accent) 12%,transparent); color:var(--accent); font-size:10px; }
.prototype-search { width:100%; min-height:39px; margin:0 0 11px; border-radius:10px; background:var(--surface); font-size:11px; }
.prototype-list { display:grid; gap:4px; }
.prototype-list-item { width:100%; display:grid; grid-template-columns:38px minmax(0,1fr) auto; align-items:center; gap:10px; min-height:58px; padding:8px; border:1px solid transparent; border-radius:11px; background:transparent; color:var(--text); text-align:left; box-shadow:none; }
.prototype-list-item:hover { border-color:var(--line); background:var(--surface); transform:none; }
.prototype-list-item.active { border-color:color-mix(in srgb,var(--accent) 40%,var(--line)); background:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
.prototype-thumb { position:relative; display:grid; place-items:center; width:38px; height:38px; overflow:hidden; border:1px solid #ffffff18; border-radius:9px; background:linear-gradient(145deg,#25213d,#0e1019); }
.prototype-thumb i { position:absolute; inset:5px; border:1px solid #ffffff1c; border-radius:4px; }
.prototype-thumb b { position:relative; color:#c4b5fd; font-size:12px; }
.prototype-list-copy { min-width:0; display:grid; gap:3px; }
.prototype-list-copy strong { overflow:hidden; font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.prototype-list-copy small { overflow:hidden; color:var(--muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.prototype-list-arrow { color:var(--muted); font-size:19px; }
.prototype-list-empty { display:grid; gap:4px; padding:28px 10px; color:var(--muted); font-size:10px; text-align:center; }
.prototype-list-empty strong { color:var(--text); font-size:12px; }
.prototype-editor { min-width:0; padding:21px; }
.prototype-empty { min-height:650px; display:grid; place-content:center; justify-items:center; gap:6px; text-align:center; }
.prototype-empty > span { color:#a78bfa; font-size:9px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }
.prototype-empty strong { font-size:20px; letter-spacing:-.03em; }
.prototype-empty p { max-width:470px; margin:2px 0 0; color:var(--muted); font-size:11px; line-height:1.6; }
.prototype-editor-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:16px; }
.prototype-editor-head > div:first-child { min-width:0; }
.prototype-editor-head > div:first-child > span { color:#a78bfa; font-size:9px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.prototype-editor-head h3 { margin:5px 0 4px; font-size:22px; letter-spacing:-.035em; }
.prototype-editor-head p { max-width:720px; margin:0; color:var(--muted); font-size:10px; line-height:1.5; }
.prototype-editor-actions { flex:none; display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.prototype-editor-actions button { min-height:36px; padding:7px 10px; font-size:10px; }
.prototype-editor-actions .prototype-visual-open { display:flex; align-items:center; gap:9px; border:1px solid #8b5cf6; background:linear-gradient(135deg,#8b5cf6,#6d28d9); color:#fff; box-shadow:0 9px 22px rgba(109,40,217,.24); }
.prototype-editor-actions .prototype-visual-open:hover { border-color:#a78bfa; transform:translateY(-1px); }
.prototype-agent-form { display:grid; gap:10px; margin-bottom:15px; padding:15px; border:1px solid color-mix(in srgb,var(--accent) 35%,var(--line)); border-radius:13px; background:color-mix(in srgb,var(--accent) 6%,var(--surface-subtle)); }
.prototype-agent-form textarea { min-height:82px; resize:vertical; }
.prototype-agent-form > div { display:flex; align-items:center; justify-content:space-between; gap:15px; }
.prototype-agent-form small { color:var(--muted); font-size:9px; line-height:1.5; }
.prototype-agent-form button { flex:none; }
.prototype-stage { overflow:hidden; border:1px solid var(--line); border-radius:14px; background:#fff; }
.prototype-stage-bar { height:38px; display:flex; align-items:center; justify-content:space-between; padding:0 12px; border-bottom:1px solid var(--line); background:var(--surface-subtle); color:var(--muted); font-size:9px; text-transform:uppercase; letter-spacing:.06em; }
.prototype-stage-bar span { display:flex; align-items:center; gap:7px; }
.prototype-stage-bar i { width:6px; height:6px; border-radius:50%; background:#34d399; box-shadow:0 0 0 3px rgba(52,211,153,.12); }
.prototype-stage iframe { display:block; width:100%; height:620px; border:0; background:#fff; }
.prototype-code { display:grid; gap:0; margin-top:15px; overflow:hidden; border:1px solid var(--line); border-radius:14px; background:#090b12; }
.prototype-code-head,.prototype-code-footer { display:flex; align-items:center; justify-content:space-between; gap:15px; padding:11px 13px; background:#11141d; color:#aeb6c7; }
.prototype-code-head > div { display:flex; align-items:center; gap:8px; }
.prototype-code-head span { color:#a78bfa; font-size:9px; text-transform:uppercase; letter-spacing:.1em; }
.prototype-code-head strong { color:#f5f7fb; font-size:11px; }
.prototype-code-head small,.prototype-code-footer span { font-size:9px; }
.prototype-code textarea { width:100%; min-height:440px; margin:0; padding:18px; border:0; border-block:1px solid #ffffff12; border-radius:0; outline:0; resize:vertical; background:#090b12; color:#d8dee9; font:12px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace; tab-size:2; }
.prototype-code textarea:focus { box-shadow:inset 0 0 0 2px #8b5cf6; }
.prototype-code-footer button { min-height:36px; padding:7px 11px; font-size:10px; }
.prototype-editor-open { overflow:hidden; }
.prototype-visual-shell { position:fixed; z-index:1200; inset:12px; display:grid; grid-template-rows:auto minmax(0,1fr); overflow:hidden; border:1px solid #ffffff24; border-radius:18px; background:#080a10; box-shadow:0 35px 120px #000c; }
.prototype-visual-shell.hidden { display:none; }
.prototype-visual-bar { display:flex; align-items:center; justify-content:space-between; gap:18px; min-height:62px; padding:10px 14px 10px 18px; border-bottom:1px solid #ffffff16; background:linear-gradient(90deg,#121522,#0c0e16); color:#f7f7fb; }
.prototype-visual-bar > div { display:flex; align-items:center; gap:10px; min-width:0; }
.prototype-visual-bar > div:first-child { display:grid; grid-template-columns:auto auto; column-gap:10px; }
.prototype-visual-bar span { grid-row:1/3; align-self:center; padding:6px 8px; border:1px solid #8b5cf655; border-radius:7px; color:#b9a4ff; font-size:8px; font-weight:850; letter-spacing:.12em; }
.prototype-visual-bar strong { overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.prototype-visual-bar small { color:#8f96a8; font-size:9px; }
.prototype-visual-bar button { min-height:38px; padding:7px 12px; font-size:10px; }
.prototype-visual-close { border:1px solid #ffffff22; background:#ffffff0d; color:#fff; }
.prototype-visual-shell iframe { display:block; width:100%; height:100%; border:0; background:#0b0d14; }
@media (max-width:1050px) { .prototype-create { grid-template-columns:1fr 1fr; } .prototype-create-copy { grid-column:1/-1; grid-row:auto; padding-right:0; } .prototype-brief-field { grid-column:1/-1; } .prototype-create > button { grid-column:2; } .prototype-workspace { grid-template-columns:230px minmax(0,1fr); } .prototype-editor-head { flex-direction:column; } .prototype-editor-actions { justify-content:flex-start; } }
@media (max-width:760px) { .prototype-head { align-items:flex-start; flex-direction:column; } .prototype-head-actions,.prototype-runtime,.prototype-visual-launch { width:100%; } .prototype-create { grid-template-columns:1fr; } .prototype-brief-field,.prototype-create > button { grid-column:auto; } .prototype-workspace { display:block; border-radius:14px; } .prototype-library { border-right:0; border-bottom:1px solid var(--line); } .prototype-list { grid-auto-flow:column; grid-auto-columns:minmax(220px,80vw); overflow-x:auto; padding-bottom:5px; scroll-snap-type:x proximity; } .prototype-list-item { scroll-snap-align:start; } .prototype-editor { padding:14px; } .prototype-editor-actions,.prototype-editor-actions button { width:100%; } .prototype-editor-actions button { min-height:44px; } .prototype-agent-form > div { align-items:flex-start; flex-direction:column; } .prototype-agent-form button { width:100%; min-height:44px; } .prototype-stage iframe { height:520px; } .prototype-code-head { align-items:flex-start; flex-direction:column; } .prototype-visual-shell { inset:0; border:0; border-radius:0; } .prototype-visual-bar { align-items:flex-start; flex-direction:column; padding:10px; } .prototype-visual-bar > div { width:100%; } .prototype-visual-bar > div:last-child button { flex:1; min-height:44px; } }

/* Private trading workstation */
.nav-private { margin-left:auto; padding:2px 5px; border:1px solid color-mix(in srgb,var(--accent) 46%,var(--line)); border-radius:999px; color:var(--accent-text); background:var(--accent-weak); font-size:7px; font-weight:850; letter-spacing:.08em; }
#page-trading { min-height:calc(100vh - 78px); margin:-24px -32px; padding:28px 32px 44px; color:#f4f4f8; background:radial-gradient(circle at 78% 0%,rgba(124,58,237,.18),transparent 34%),radial-gradient(circle at 8% 20%,rgba(139,92,246,.06),transparent 28%),linear-gradient(180deg,#050509,#090a10 64%,#050509); }
.trading-head { display:flex; align-items:flex-start; justify-content:space-between; gap:28px; margin-bottom:20px; padding:25px 0; border-bottom:1px solid var(--line); }
.trading-head > div:first-child { max-width:720px; }
.trading-kicker { color:var(--accent-text); font-size:9px; font-weight:850; letter-spacing:.13em; }
.trading-head h2 { margin:8px 0 7px; font-size:28px; letter-spacing:-.04em; }
.trading-head p { margin:0; color:var(--muted); font-size:11px; line-height:1.65; }
#page-trading .trading-head { border-color:#222438; }
#page-trading .trading-head p,#page-trading .trading-unavailable p { color:#91a0af; }
#page-trading .trading-actions .secondary { border-color:#30465b; background:#131e2a; color:#f4f7fa; }
#page-trading .trading-actions .primary { border:1px solid rgba(167,139,250,.34); background:linear-gradient(135deg,var(--accent-hover),var(--accent)); color:#fff; box-shadow:0 10px 28px rgba(124,58,237,.2); }
.trading-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:8px; }
.trading-actions a { display:inline-flex; align-items:center; min-height:38px; padding:8px 12px; border-radius:10px; text-decoration:none; }
.trading-runtime { display:inline-flex; align-items:center; gap:7px; min-height:38px; padding:0 12px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:9px; font-weight:750; white-space:nowrap; }
#page-trading .trading-runtime { border-color:#30465b; color:#91a0af; background:#0e1620; }
.trading-runtime i { width:7px; height:7px; border-radius:50%; background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.12); }
.trading-runtime.is-live { color:#22c55e; border-color:rgba(34,197,94,.28); }
.trading-runtime.is-live i { background:#22c55e; box-shadow:0 0 0 4px rgba(34,197,94,.12); }
.trading-frame-shell { overflow:hidden; width:100%; min-height:760px; border:1px solid var(--line); border-radius:18px; background:#080b10; box-shadow:0 24px 70px rgba(0,0,0,.16); }
#page-trading .trading-frame-shell { border-color:rgba(124,58,237,.25); box-shadow:0 26px 80px rgba(0,0,0,.42),0 0 54px rgba(124,58,237,.08); }
.trading-frame-shell iframe { display:block; width:100%; min-height:760px; border:0; background:#080b10; }
.trading-unavailable { min-height:420px; display:grid; place-content:center; justify-items:center; gap:7px; border:1px dashed var(--line); border-radius:18px; text-align:center; }
#page-trading .trading-unavailable { border-color:#30465b; background:#0e1620; }
.trading-unavailable strong { font-size:18px; }
.trading-unavailable p { max-width:520px; margin:0; color:var(--muted); font-size:11px; }
@media (max-width:900px) { #page-trading { margin:-18px; padding:22px 18px 34px; } .trading-head { flex-direction:column; } .trading-actions { width:100%; justify-content:flex-start; } .trading-frame-shell,.trading-frame-shell iframe { min-height:680px; } }
@media (max-width:760px) { #page-trading { margin:-14px; padding:18px 14px 30px; } }

/* Visual Review Inbox */
.review-shell { display:grid; gap:22px; width:100%; }
.review-hero { position:relative; isolation:isolate; overflow:hidden; display:flex; align-items:flex-end; justify-content:space-between; gap:32px; min-height:240px; padding:clamp(26px,4vw,52px); border:1px solid color-mix(in srgb,var(--accent) 32%,var(--line)); border-radius:22px; background:linear-gradient(125deg,rgba(124,58,237,.18),rgba(12,13,19,.82) 45%,rgba(34,211,238,.07)),var(--surface); box-shadow:var(--card-sheen),0 28px 90px rgba(0,0,0,.28); }
.review-hero::before { content:""; position:absolute; z-index:-1; width:440px; height:440px; right:-150px; top:-230px; border:1px solid rgba(167,139,250,.22); border-radius:50%; box-shadow:0 0 0 55px rgba(124,58,237,.04),0 0 0 120px rgba(34,211,238,.025); }
.review-hero-copy { max-width:760px; }
.review-kicker { display:block; color:var(--accent-text); font-size:9px; font-weight:850; letter-spacing:.16em; }
.review-hero h2 { max-width:690px; margin:10px 0 12px; font-size:clamp(30px,4.5vw,58px); line-height:.98; letter-spacing:-.055em; }
.review-hero p { max-width:66ch; margin:0; color:var(--text-secondary); font-size:13px; line-height:1.75; }
.review-proof { display:flex; flex-wrap:wrap; gap:9px 18px; margin-top:22px; color:var(--muted); font-size:10px; font-weight:700; }
.review-proof span { display:inline-flex; align-items:center; gap:7px; }
.review-proof i { width:6px; height:6px; border-radius:50%; background:var(--success); box-shadow:0 0 0 4px rgba(52,211,153,.09); }
.review-hero-actions { position:relative; z-index:1; display:flex; flex:none; flex-direction:column; gap:9px; width:min(210px,100%); }
.review-hero-actions button { min-height:44px; }
.review-dropzone { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:15px; min-height:100px; padding:19px 22px; border:1px dashed color-mix(in srgb,var(--accent-text) 55%,var(--line)); border-radius:16px; background:color-mix(in srgb,var(--accent) 5%,var(--surface)); cursor:pointer; transition:border-color .18s ease,background .18s ease,transform .18s ease; }
.review-dropzone:hover,.review-dropzone.is-dragging { border-color:var(--accent-text); background:color-mix(in srgb,var(--accent) 11%,var(--surface)); transform:translateY(-1px); }
.review-dropzone:focus-visible { outline:2px solid var(--accent-text); outline-offset:3px; }
.review-drop-icon { display:grid; place-items:center; width:52px; height:52px; border:1px solid rgba(167,139,250,.24); border-radius:14px; background:rgba(124,58,237,.12); color:var(--accent-text); }
.review-drop-icon svg { width:24px; height:24px; }
.review-dropzone > span:nth-child(2) { display:grid; gap:3px; }
.review-dropzone strong { font-size:13px; }
.review-dropzone small { color:var(--muted); font-size:10px; }
.review-drop-cta { padding:7px 11px; border:1px solid var(--line); border-radius:9px; color:var(--text-secondary); background:var(--surface-subtle); font-size:10px; font-weight:800; }
.review-upload-status { margin-top:-10px; padding:10px 13px; border:1px solid currentColor; border-radius:10px; background:var(--surface); font-size:11px; }
.review-library-head { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-top:5px; padding-bottom:12px; border-bottom:1px solid var(--line); }
.review-library-head h3 { margin:4px 0 0; font-size:20px; letter-spacing:-.03em; }
.review-library-head > span { color:var(--muted); font-size:10px; font-weight:750; }
.review-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:12px; align-items:start; }
.review-card { min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:13px; background:var(--surface); box-shadow:var(--card-sheen); }
.review-preview { position:relative; display:grid; place-items:center; aspect-ratio:16/10; overflow:hidden; border-bottom:1px solid var(--line); background:linear-gradient(135deg,#080910,#10121b); }
.review-preview img { width:100%; height:100%; display:block; object-fit:contain; }
.review-preview > span { position:absolute; right:10px; bottom:10px; padding:5px 8px; border:1px solid rgba(255,255,255,.14); border-radius:7px; color:#fff; background:rgba(3,3,5,.76); opacity:0; transform:translateY(4px); font-size:9px; font-weight:800; backdrop-filter:blur(8px); transition:opacity .18s ease,transform .18s ease; }
.review-preview:hover > span,.review-preview:focus-visible > span { opacity:1; transform:none; }
.review-card-body { display:grid; gap:6px; padding:11px; }
.review-card-title { display:flex; align-items:center; gap:8px; min-width:0; }
.review-card-title strong { overflow:hidden; flex:1; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.review-used { flex:none; padding:3px 6px; border:1px solid rgba(52,211,153,.24); border-radius:999px; color:var(--success); background:rgba(52,211,153,.07); font-size:8px; font-weight:800; }
.review-card-body > small { color:var(--muted); font-size:9px; }
.review-card-actions { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px; margin-top:4px; }
.review-card-actions [data-review-share] { grid-column:1/-1; }
.review-card-actions button { min-height:44px; padding:7px 9px; font-size:10px; }
.review-empty { grid-column:1/-1; min-height:260px; display:grid; place-content:center; justify-items:center; gap:7px; border:1px dashed var(--line); border-radius:16px; color:var(--muted); text-align:center; }
.review-empty strong { color:var(--text); font-size:14px; }
.review-empty span { font-size:10px; }
.review-empty-error { border-color:color-mix(in srgb,var(--danger) 45%,var(--line)); }
:root[data-theme="light"] .review-hero { background:linear-gradient(125deg,rgba(124,58,237,.12),rgba(255,255,255,.9) 46%,rgba(34,211,238,.08)),var(--surface); }
:root[data-theme="light"] .review-preview { background:#eef0f6; }
@media (max-width:1050px) { .review-hero { align-items:flex-start; flex-direction:column; } .review-hero-actions { width:100%; flex-direction:row; } .review-hero-actions button { flex:1; } }
@media (max-width:760px) { .review-hero { min-height:0; padding:24px 20px; border-radius:16px; } .review-hero h2 { font-size:36px; } .review-hero-actions { flex-direction:column; } .review-dropzone { grid-template-columns:auto minmax(0,1fr); padding:16px; } .review-drop-cta { display:none; } .review-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .review-preview { aspect-ratio:4/3; } }
@media (max-width:520px) { .review-grid { grid-template-columns:1fr; } }
@media (prefers-reduced-motion:reduce) { .review-dropzone,.review-preview > span { transition:none; } }

/* Agent Constellation + Agent Studio (Plan 21) */
.agent-constellation { position:relative; isolation:isolate; overflow:hidden; padding:0; border-color:color-mix(in srgb,var(--accent) 26%,var(--line)); background:radial-gradient(circle at 50% 0,rgba(124,58,237,.12),transparent 34%),linear-gradient(145deg,color-mix(in srgb,var(--surface) 96%,#070911),color-mix(in srgb,var(--surface) 94%,#111827)); box-shadow:var(--card-sheen),0 28px 80px rgba(0,0,0,.22); }
.agent-constellation::before { content:""; position:absolute; inset:0; z-index:-1; opacity:.24; background-image:linear-gradient(rgba(148,163,184,.08) 1px,transparent 1px),linear-gradient(90deg,rgba(148,163,184,.08) 1px,transparent 1px); background-size:32px 32px; mask-image:linear-gradient(to bottom,#000,transparent 82%); }
.constellation-head { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; padding:22px 24px 18px; border-bottom:1px solid var(--line); }
.constellation-kicker { display:block; color:var(--accent-text); font-size:9px; font-weight:850; letter-spacing:.17em; }
.constellation-head h3 { margin:5px 0 4px; font-size:22px; letter-spacing:-.035em; }
.constellation-head p { margin:0; color:var(--muted); font-size:10px; }
.constellation-actions { display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.constellation-count { margin-right:4px; color:var(--text-secondary); font-size:10px; font-weight:800; }
.constellation-stage { position:relative; min-height:550px; padding:28px 24px 18px; }
.constellation-wires { position:absolute; inset:0; z-index:0; width:100%; height:100%; pointer-events:none; overflow:visible; }
.wire-base,.wire-energy { fill:none; stroke-linecap:round; }
.wire-base { stroke:color-mix(in srgb,var(--accent-text) 18%,var(--line)); stroke-width:1.15; }
.wire-energy { opacity:0; stroke:#7c3aed; stroke-width:2; stroke-dasharray:2 12; filter:drop-shadow(0 0 5px rgba(124,58,237,.8)); }
.wire-energy.is-queued { opacity:.38; stroke:#60a5fa; }
.wire-energy.is-active { opacity:.95; stroke:url(#none); stroke:#22d3ee; animation:agent-current 1.45s linear infinite; animation-delay:var(--wire-delay); }
.motion-paused .wire-energy,.constellation-stage.motion-paused .wire-energy { animation-play-state:paused; }
@keyframes agent-current { to { stroke-dashoffset:-28; } }
.constellation-team { position:relative; z-index:1; display:grid; gap:42px; }
.constellation-root { display:flex; justify-content:center; min-height:142px; }
.constellation-business-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; align-items:start; }
.constellation-business-group { min-width:0; padding:15px; border:1px solid color-mix(in srgb,var(--line) 82%,#22d3ee); border-radius:14px; background:color-mix(in srgb,var(--surface) 91%,transparent); }
.constellation-business-group > h3 { margin:0 0 13px; color:var(--muted); font-size:9px; font-weight:850; letter-spacing:.14em; text-transform:uppercase; }
.constellation-business-group .constellation-children { grid-template-columns:repeat(2,minmax(140px,1fr)); gap:14px 10px; }
.constellation-business-group:last-child:nth-child(odd) { grid-column:1/-1; }
.constellation-children { display:grid; grid-template-columns:repeat(3,minmax(150px,1fr)); align-items:start; gap:26px 15px; }
.constellation-private-lane { display:grid; grid-template-columns:minmax(130px,1fr) minmax(150px,240px) minmax(130px,1fr); align-items:center; gap:18px; margin-top:2px; padding-top:18px; border-top:1px solid color-mix(in srgb,#f59e0b 28%,var(--line)); }
.constellation-private-lane > span { color:#fbbf24; font-size:8px; font-weight:850; letter-spacing:.14em; }
.constellation-private-lane .constellation-node { grid-column:2; }
.constellation-node { min-width:0; text-align:center; }
.agent-character { position:relative; display:flex; align-items:center; justify-content:center; gap:10px; width:100%; min-height:98px; padding:10px; border:1px solid transparent; border-radius:16px; color:var(--text); background:transparent; text-align:left; box-shadow:none; transition:border-color .18s ease,background .18s ease,transform .18s ease; }
.agent-character:hover { border-color:color-mix(in srgb,var(--agent-color,var(--accent-text)) 38%,var(--line)); background:color-mix(in srgb,var(--agent-color,var(--accent-text)) 7%,var(--surface)); transform:translateY(-2px); }
.agent-character[aria-pressed="true"] { border-color:color-mix(in srgb,var(--agent-color,var(--accent-text)) 58%,var(--line)); background:color-mix(in srgb,var(--agent-color,var(--accent-text)) 11%,var(--surface)); box-shadow:0 0 0 1px color-mix(in srgb,var(--agent-color,var(--accent-text)) 12%,transparent),0 12px 35px rgba(0,0,0,.2); }
.agent-character:focus-visible { outline:2px solid var(--agent-color,var(--accent-text)); outline-offset:3px; }
.constellation-node.is-root { width:min(330px,100%); }
.constellation-node.is-root .agent-character { min-height:120px; }
.constellation-node.is-root .agent-portrait { width:100px; height:100px; }
.agent-character-copy { display:grid; gap:2px; min-width:0; }
.agent-character-copy strong { font-size:13px; letter-spacing:-.015em; }
.agent-character-copy > small { overflow:hidden; color:var(--muted); font-size:8px; text-transform:uppercase; text-overflow:ellipsis; white-space:nowrap; letter-spacing:.09em; }
.agent-status { display:inline-flex; align-items:center; gap:5px; margin-top:4px; color:var(--muted); font-size:8px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.agent-status i { width:5px; height:5px; border-radius:50%; background:#64748b; }
.agent-status-active { color:#67e8f9; }.agent-status-active i { background:#22d3ee; box-shadow:0 0 9px #22d3ee; }
.agent-portrait { display:block; flex:none; width:76px; height:76px; overflow:visible; color:var(--agent-color,#a78bfa); filter:drop-shadow(0 8px 16px rgba(0,0,0,.24)); }
.agent-portrait.is-compact { width:42px; height:42px; }
.agent-portrait-ring { fill:color-mix(in srgb,currentColor 6%,transparent); stroke:color-mix(in srgb,currentColor 36%,transparent); stroke-width:1; }
.agent-portrait-shell { fill:color-mix(in srgb,currentColor 10%,var(--surface)); stroke:url(#portrait); stroke:currentColor; stroke-opacity:.72; stroke-width:1.4; }
.agent-portrait-motif { fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.agent-orbit { stroke-dasharray:2 4; opacity:.6; }
.agent-portrait-sol { --agent-color:#fbbf24; }.agent-portrait-terra { --agent-color:#34d399; }.agent-portrait-luna { --agent-color:#60a5fa; }
.agent-portrait-atlas { --agent-color:#22d3ee; }.agent-portrait-sage { --agent-color:#c084fc; }.agent-portrait-scout { --agent-color:#a3e635; }
.agent-portrait-hermes { --agent-color:#f59e0b; }.agent-portrait-custom { --agent-color:#a78bfa; }
.constellation-node:has(.agent-portrait-sol),.agent-roster-item:has(.agent-portrait-sol),.agent-workspace-identity:has(.agent-portrait-sol) { --agent-color:#fbbf24; }
.constellation-node:has(.agent-portrait-terra),.agent-roster-item:has(.agent-portrait-terra),.agent-workspace-identity:has(.agent-portrait-terra) { --agent-color:#34d399; }
.constellation-node:has(.agent-portrait-luna),.agent-roster-item:has(.agent-portrait-luna),.agent-workspace-identity:has(.agent-portrait-luna) { --agent-color:#60a5fa; }
.constellation-node:has(.agent-portrait-atlas),.agent-roster-item:has(.agent-portrait-atlas),.agent-workspace-identity:has(.agent-portrait-atlas) { --agent-color:#22d3ee; }
.constellation-node:has(.agent-portrait-sage),.agent-roster-item:has(.agent-portrait-sage),.agent-workspace-identity:has(.agent-portrait-sage) { --agent-color:#c084fc; }
.constellation-node:has(.agent-portrait-scout),.agent-roster-item:has(.agent-portrait-scout),.agent-workspace-identity:has(.agent-portrait-scout) { --agent-color:#a3e635; }
.constellation-node:has(.agent-portrait-hermes),.agent-roster-item:has(.agent-portrait-hermes),.agent-workspace-identity:has(.agent-portrait-hermes) { --agent-color:#f59e0b; }
.agent-missions { display:grid; gap:5px; margin:5px 10px 0; }
.agent-mission { display:grid; grid-template-columns:6px minmax(0,1fr) auto; align-items:center; gap:6px; min-height:31px; padding:5px 8px; border:1px solid var(--line); border-radius:8px; color:var(--text-secondary); background:color-mix(in srgb,var(--surface) 90%,transparent); box-shadow:none; font-size:8px; text-align:left; }
.agent-mission > span { width:5px; height:5px; border-radius:50%; background:#64748b; }.agent-mission-active > span { background:#22d3ee; box-shadow:0 0 7px #22d3ee; }
.agent-mission small { color:var(--muted); font-size:7px; text-transform:uppercase; }.agent-rest { display:block; margin-top:3px; color:var(--muted); font-size:8px; }
.constellation-detail { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(280px,1fr); align-items:center; gap:22px; min-height:118px; padding:16px 24px; border-top:1px solid var(--line); background:color-mix(in srgb,var(--surface) 84%,transparent); backdrop-filter:blur(14px); }
.constellation-detail-agent { display:flex; align-items:center; gap:12px; min-width:0; }.constellation-detail-agent > div { display:grid; gap:2px; }
.constellation-detail-agent span { color:var(--muted); font-size:8px; font-weight:800; text-transform:uppercase; letter-spacing:.1em; }.constellation-detail-agent strong { font-size:12px; }.constellation-detail-agent p { margin:2px 0 0; color:var(--text-secondary); font-size:9px; line-height:1.55; }
.constellation-detail dl { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:0; }.constellation-detail dl div { min-width:0; padding:8px; border-left:1px solid var(--line); }
.constellation-detail dt { color:var(--muted); font-size:7px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }.constellation-detail dd { overflow:hidden; margin:3px 0 0; font-size:8px; text-overflow:ellipsis; white-space:nowrap; }
.constellation-error { position:absolute; inset:30px; display:grid; place-content:center; justify-items:center; gap:7px; color:var(--muted); text-align:center; }.constellation-error strong { color:var(--text); font-size:14px; }.constellation-error span { font-size:9px; }.constellation-error button { margin-top:8px; }

.agent-studio-page { display:grid; gap:18px; }
.agent-studio-hero { position:relative; isolation:isolate; overflow:hidden; display:flex; align-items:flex-end; justify-content:space-between; gap:32px; min-height:210px; padding:clamp(26px,4vw,44px); border:1px solid color-mix(in srgb,var(--accent) 34%,var(--line)); border-radius:22px; background:linear-gradient(125deg,rgba(124,58,237,.18),rgba(12,13,19,.84) 48%,rgba(34,211,238,.07)),var(--surface); box-shadow:var(--card-sheen),0 28px 90px rgba(0,0,0,.24); }
.agent-studio-hero::after { content:""; position:absolute; z-index:-1; width:450px; height:450px; right:-150px; top:-250px; border:1px solid rgba(167,139,250,.2); border-radius:50%; box-shadow:0 0 0 55px rgba(124,58,237,.035),0 0 0 115px rgba(34,211,238,.02); }
.agent-studio-hero > div { max-width:760px; }.agent-studio-hero h2 { margin:9px 0 10px; font-size:clamp(32px,4.2vw,56px); line-height:.98; letter-spacing:-.055em; }.agent-studio-hero p { max-width:68ch; margin:0; color:var(--text-secondary); font-size:12px; line-height:1.7; }.agent-studio-hero button { flex:none; min-height:44px; }
.agent-studio-shell { display:grid; grid-template-columns:minmax(210px,250px) minmax(420px,1fr) minmax(210px,250px); min-height:670px; overflow:hidden; border:1px solid var(--line); border-radius:20px; background:var(--surface); box-shadow:var(--card-sheen),0 20px 65px rgba(0,0,0,.18); }
.agent-studio-roster,.agent-profile-panel { min-width:0; padding:18px; background:color-mix(in srgb,var(--surface-subtle) 78%,var(--surface)); }
.agent-studio-roster { border-right:1px solid var(--line); }.agent-profile-panel { display:flex; flex-direction:column; gap:20px; border-left:1px solid var(--line); }
.agent-search { position:relative; display:block; }.agent-search svg { position:absolute; left:11px; top:50%; width:15px; height:15px; color:var(--muted); transform:translateY(-50%); }.agent-search input { width:100%; min-height:42px; padding-left:35px; }
.agent-roster-list { display:grid; gap:18px; margin-top:20px; }.agent-roster-group { display:grid; gap:6px; }.agent-roster-group h3 { margin:0 0 3px 5px; color:var(--muted); font-size:8px; font-weight:850; text-transform:uppercase; letter-spacing:.12em; }
.agent-profile-capabilities,.agent-profile-guidance { display:grid; gap:8px; margin-top:16px; }.agent-profile-capabilities > div { display:flex; flex-wrap:wrap; gap:6px; }.agent-profile-skill { padding:5px 8px; border:1px solid color-mix(in srgb,var(--line) 84%,#22d3ee); border-radius:999px; color:var(--text); background:color-mix(in srgb,var(--surface) 88%,transparent); font-size:10px; text-transform:capitalize; }.agent-profile-guidance strong { font-size:11px; }.agent-profile-guidance p { margin:0; color:var(--muted); font-size:11px; line-height:1.55; }
.agent-roster-item { display:flex; align-items:center; gap:9px; width:100%; min-height:56px; padding:7px 8px; border:1px solid transparent; border-radius:11px; color:var(--text); background:transparent; box-shadow:none; text-align:left; }
.agent-roster-item:hover,.agent-roster-item.is-selected { border-color:color-mix(in srgb,var(--agent-color,var(--accent-text)) 35%,var(--line)); background:color-mix(in srgb,var(--agent-color,var(--accent-text)) 8%,var(--surface)); }.agent-roster-item.is-selected { box-shadow:inset 2px 0 0 var(--agent-color,var(--accent-text)); }
.agent-roster-item > span { display:grid; min-width:0; gap:2px; }.agent-roster-item strong { overflow:hidden; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }.agent-roster-item small { color:var(--muted); font-size:7px; text-transform:uppercase; letter-spacing:.06em; }.agent-roster-item > i { width:5px; height:5px; margin-left:auto; border-radius:50%; background:#34d399; }.agent-roster-item.is-archived { opacity:.56; }.agent-roster-item.is-archived > i { background:#64748b; }.agent-roster-empty { padding:22px 8px; color:var(--muted); font-size:9px; text-align:center; }
.agent-workspace { display:flex; flex-direction:column; min-width:0; padding:22px; }.agent-workspace-head { min-height:105px; }.agent-workspace-identity { display:flex; align-items:center; gap:14px; }.agent-workspace-identity > div { min-width:0; }.agent-workspace-identity span { color:var(--agent-color,var(--accent-text)); font-size:8px; font-weight:850; letter-spacing:.11em; }.agent-workspace-identity h2 { margin:4px 0 3px; font-size:22px; letter-spacing:-.035em; }.agent-workspace-identity p { margin:0; color:var(--text-secondary); font-size:9px; line-height:1.5; }
.agent-quality-panel { display:grid; gap:12px; margin:0 0 16px; padding:15px; border:1px solid color-mix(in srgb,var(--agent-color,var(--accent-text)) 24%,var(--line)); border-radius:13px; background:linear-gradient(135deg,color-mix(in srgb,var(--agent-color,var(--accent-text)) 7%,var(--surface)),var(--surface-subtle)); }
.agent-quality-panel > header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }.agent-quality-panel h3 { margin:3px 0 0; font-size:14px; }.agent-quality-confidence { padding:4px 7px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:7px; font-weight:850; text-transform:uppercase; letter-spacing:.06em; }.quality-emerging,.quality-established { color:#34d399; border-color:rgba(52,211,153,.24); background:rgba(52,211,153,.06); }
.agent-quality-summary { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:13px; }.agent-quality-summary > strong { font-size:28px; line-height:1; letter-spacing:-.05em; }.agent-quality-summary > strong small { color:var(--muted); font-size:9px; letter-spacing:0; }.agent-quality-summary p { margin:0; color:var(--muted); font-size:8px; line-height:1.5; }
.agent-quality-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; margin:0; }.agent-quality-metrics div { min-width:0; padding:8px; border:1px solid var(--line); border-radius:9px; background:color-mix(in srgb,var(--surface) 84%,transparent); }.agent-quality-metrics dt { color:var(--muted); font-size:7px; font-weight:800; text-transform:uppercase; }.agent-quality-metrics dd { display:grid; gap:2px; margin:3px 0 0; font-size:13px; font-weight:800; }.agent-quality-metrics dd small { overflow:hidden; color:var(--muted); font-size:6px; font-weight:600; text-overflow:ellipsis; white-space:nowrap; }
.agent-quality-patterns { display:grid; gap:6px; }.agent-quality-patterns > strong { font-size:8px; }.agent-quality-patterns > div { display:flex; flex-wrap:wrap; gap:5px; }.agent-quality-patterns span { padding:4px 6px; border-radius:6px; color:#fbbf24; background:rgba(245,158,11,.08); font-size:7px; text-transform:capitalize; }.agent-quality-recommendations { display:grid; gap:4px; margin:0; padding-left:16px; color:var(--text-secondary); font-size:8px; line-height:1.45; }.agent-quality-empty { display:grid; gap:3px; color:var(--muted); font-size:8px; }.agent-quality-empty strong { color:var(--text); font-size:10px; }
.task-quality-feedback { display:grid; gap:9px; margin:14px 0 0; padding:13px; border:1px solid color-mix(in srgb,var(--accent-text) 22%,var(--line)); border-radius:11px; background:color-mix(in srgb,var(--accent) 6%,var(--surface)); }.task-quality-feedback > div:first-child { display:grid; gap:3px; }.task-quality-feedback strong { font-size:11px; }.task-quality-feedback span { color:var(--muted); font-size:8px; line-height:1.45; }.task-quality-feedback textarea { min-height:62px; resize:vertical; }.task-quality-actions { display:flex; flex-wrap:wrap; gap:6px; }.task-quality-actions button.active { border-color:#34d399; color:#34d399; background:rgba(52,211,153,.08); }
.agent-document-tabs { display:flex; overflow-x:auto; gap:5px; padding:4px; border:1px solid var(--line); border-radius:11px; background:var(--surface-subtle); scrollbar-width:thin; }.agent-document-tabs button { flex:1 0 auto; min-height:34px; padding:6px 9px; border:0; border-radius:7px; color:var(--muted); background:transparent; box-shadow:none; font-size:8px; }.agent-document-tabs button[aria-selected="true"] { color:var(--text); background:var(--surface); box-shadow:0 2px 10px rgba(0,0,0,.14); }
.agent-editor-meta { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; padding:18px 2px 10px; }.agent-editor-meta > div { display:grid; gap:3px; }.agent-editor-meta strong { font-size:12px; }.agent-editor-meta span { color:var(--muted); font-size:8px; }.agent-editor-label { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
.agent-document-editor { flex:1; width:100%; min-height:380px; padding:18px; resize:vertical; border:1px solid var(--line); border-radius:12px; color:var(--text); background:color-mix(in srgb,var(--surface-subtle) 64%,var(--surface)); font:11px/1.72 var(--mono,ui-monospace,SFMono-Regular,Menlo,monospace); tab-size:2; }.agent-document-editor:focus { border-color:var(--accent-text); outline:2px solid color-mix(in srgb,var(--accent-text) 22%,transparent); outline-offset:1px; }.agent-document-editor:disabled { opacity:.6; }
.agent-editor-actions { position:sticky; bottom:0; display:flex; align-items:center; justify-content:space-between; gap:16px; padding-top:14px; background:linear-gradient(transparent,var(--surface) 22%); }.agent-editor-actions > span { font-size:9px; }.agent-editor-actions button { min-height:42px; }
.agent-profile-panel h3 { margin:4px 0 0; font-size:16px; }.agent-profile-panel dl { display:grid; gap:12px; margin:0; }.agent-profile-panel dl div { display:grid; gap:3px; padding-bottom:10px; border-bottom:1px solid var(--line); }.agent-profile-panel dt { color:var(--muted); font-size:7px; font-weight:850; text-transform:uppercase; letter-spacing:.09em; }.agent-profile-panel dd { margin:0; color:var(--text-secondary); font-size:9px; }.agent-profile-status { display:inline-flex; padding:3px 7px; border:1px solid rgba(52,211,153,.2); border-radius:999px; color:#34d399; background:rgba(52,211,153,.06); font-size:7px; font-weight:850; text-transform:uppercase; }.agent-profile-status-archived { border-color:var(--line); color:var(--muted); background:var(--surface-subtle); }
.agent-boundary-note { padding:13px; border:1px solid color-mix(in srgb,var(--accent-text) 25%,var(--line)); border-radius:11px; background:color-mix(in srgb,var(--accent) 7%,var(--surface)); }.agent-boundary-note strong { font-size:9px; }.agent-boundary-note p,.agent-system-lock { margin:5px 0 0; color:var(--muted); font-size:8px; line-height:1.55; }.agent-lifecycle { width:100%; min-height:42px; margin-top:auto; }
.agent-create-modal { width:min(560px,100%); }.agent-create-modal > p { margin:0 0 16px; color:var(--text-secondary); font-size:10px; line-height:1.6; }.agent-create-modal label { display:grid; gap:6px; margin-bottom:12px; font-size:9px; }.agent-create-modal textarea { min-height:90px; }.agent-create-modal fieldset { display:grid; gap:8px; margin:4px 0 14px; padding:0; border:0; }.agent-create-modal legend { margin-bottom:7px; font-size:9px; font-weight:800; }.agent-route-option { display:grid!important; grid-template-columns:auto 1fr; align-items:center; gap:10px!important; min-height:60px; margin:0!important; padding:10px 12px; border:1px solid var(--line); border-radius:10px; }.agent-route-option input { width:16px; height:16px; }.agent-route-option span { display:grid; gap:2px; }.agent-route-option strong { font-size:10px; }.agent-route-option small { color:var(--muted); font-size:8px; }
:root[data-theme="light"] .agent-constellation { background:radial-gradient(circle at 50% 0,rgba(124,58,237,.11),transparent 38%),linear-gradient(145deg,#fff,#f6f7fb); }:root[data-theme="light"] .agent-studio-hero { background:linear-gradient(125deg,rgba(124,58,237,.11),rgba(255,255,255,.92) 48%,rgba(34,211,238,.07)),var(--surface); }
@media (max-width:1100px) { .constellation-business-groups { grid-template-columns:1fr; }.constellation-business-group:last-child:nth-child(odd) { grid-column:auto; }.constellation-children { grid-template-columns:repeat(2,minmax(150px,1fr)); }.agent-studio-shell { grid-template-columns:220px minmax(0,1fr); }.agent-profile-panel { grid-column:1/-1; display:grid; grid-template-columns:1fr 1.5fr 1.2fr; align-items:start; border-top:1px solid var(--line); border-left:0; }.agent-profile-panel dl { grid-template-columns:repeat(4,1fr); gap:8px; }.agent-profile-panel dl div { border-bottom:0; border-left:1px solid var(--line); padding:4px 8px; } }
@media (max-width:767px) { .constellation-head { flex-direction:column; padding:19px 17px 15px; }.constellation-actions { justify-content:flex-start; }.constellation-stage { min-height:0; padding:18px 14px; }.constellation-wires { display:none; }.constellation-team { gap:18px; }.constellation-root { position:relative; min-height:0; padding-bottom:18px; }.constellation-root::after { content:""; position:absolute; left:50%; bottom:-18px; width:1px; height:36px; background:linear-gradient(#22d3ee,transparent); }.constellation-business-group { padding:12px; }.constellation-business-group .constellation-children,.constellation-children { display:grid; grid-template-columns:1fr; gap:10px; padding-left:13px; border-left:1px solid color-mix(in srgb,#22d3ee 35%,var(--line)); }.constellation-node.is-root { width:100%; }.agent-character,.constellation-node.is-root .agent-character { justify-content:flex-start; min-height:88px; }.constellation-node.is-root .agent-portrait { width:78px; height:78px; }.constellation-private-lane { grid-template-columns:1fr; }.constellation-private-lane .constellation-node { grid-column:1; }.constellation-detail { grid-template-columns:1fr; padding:15px 17px; }.constellation-detail dl { grid-template-columns:repeat(3,1fr); }.agent-studio-hero { min-height:0; align-items:flex-start; flex-direction:column; padding:24px 20px; border-radius:16px; }.agent-studio-hero h2 { font-size:37px; }.agent-studio-hero button { width:100%; }.agent-studio-shell { display:block; overflow:visible; min-height:0; border-radius:15px; }.agent-studio-roster { max-height:300px; overflow:auto; border-right:0; border-bottom:1px solid var(--line); }.agent-roster-list { grid-template-columns:repeat(2,minmax(0,1fr)); }.agent-workspace { padding:17px; }.agent-workspace-head { min-height:96px; }.agent-document-tabs button { min-height:44px; }.agent-editor-meta { align-items:flex-start; flex-direction:column; gap:5px; }.agent-document-editor { min-height:420px; font-size:16px; }.agent-editor-actions { bottom:0; z-index:2; margin:0 -17px -17px; padding:22px 17px 14px; border-top:1px solid var(--line); }.agent-profile-panel { display:grid; grid-template-columns:1fr; border-top:1px solid var(--line); }.agent-profile-panel dl { grid-template-columns:repeat(2,1fr); }.agent-profile-panel dl div { border-left:0; border-bottom:1px solid var(--line); }.agent-lifecycle { margin-top:0; }.agent-create-modal input,.agent-create-modal textarea { font-size:16px; } }
@media (max-width:767px) { .agent-quality-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:420px) { .agent-roster-list { grid-template-columns:1fr; }.constellation-actions .constellation-count { width:100%; }.constellation-detail dl { grid-template-columns:1fr; }.constellation-detail dl div { border-left:0; border-top:1px solid var(--line); }.agent-quality-summary { grid-template-columns:1fr; }.agent-quality-metrics { grid-template-columns:1fr 1fr; } }
@media (prefers-reduced-motion:reduce) { .wire-energy,.agent-character { animation:none!important; transition:none!important; }.wire-energy.is-active { stroke-dasharray:none; }.agent-character:hover { transform:none; } }

/* ---------- Global Nova drawer (Plan 03 phase 3; legacy class names retained) ---------- */
.jarvice-fab {
  position: fixed; right: max(22px,env(safe-area-inset-right)); bottom: max(22px,env(safe-area-inset-bottom)); z-index: 60;
  width: 56px; height: 56px; min-width:56px; min-height:56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-2, #22d3ee));
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.jarvice-fab svg { width: 24px; height: 24px; }
.jarvice-fab:focus-visible { outline: 2px solid var(--accent-2, #22d3ee); outline-offset: 3px; }
.jarvice-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width:min(520px,100vw); height:100dvh; display:flex; flex-direction:column; overflow:hidden;
  background:color-mix(in srgb,var(--surface) 97%,var(--bg)); border-left:1px solid var(--line-strong);
  box-shadow:-24px 0 72px rgba(0,0,0,.5);
  transform:translateX(0); transition:transform .2s ease-out;
}
.jarvice-drawer.hidden { display: none; }
.jarvice-drawer-head {
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  min-height:76px; padding:max(12px,env(safe-area-inset-top)) 14px 12px 16px;
  border-bottom:1px solid var(--line); flex:0 0 auto;
  background:linear-gradient(135deg,rgba(124,58,237,.08),transparent 48%),var(--surface);
}
.jarvice-drawer-identity { min-width:0; display:flex; align-items:center; gap:11px; }
.jarvice-drawer-mark {
  flex:none; width:40px; height:40px; display:grid; place-items:center;
  border:1px solid rgba(167,139,250,.3); border-radius:12px; color:#ddd6fe;
  background:linear-gradient(145deg,rgba(124,58,237,.52),rgba(79,70,229,.2));
  box-shadow:inset 0 1px rgba(255,255,255,.1);
}
.jarvice-drawer-mark svg { width:20px; height:20px; }
.jarvice-drawer-identity > span:last-child { min-width:0; display:grid; grid-template-columns:auto 1fr; align-items:center; column-gap:7px; }
.jarvice-drawer-identity small {
  grid-column:1/-1; display:flex; align-items:center; gap:6px; color:var(--accent-text);
  font-size:9px; font-weight:800; letter-spacing:.12em;
}
.jarvice-drawer-identity small i { width:6px; height:6px; border-radius:50%; background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.08); }
.jarvice-drawer-identity strong { font-size:15px; letter-spacing:-.02em; }
.jarvice-drawer-identity em { overflow:hidden; color:var(--muted); font-size:11px; font-style:normal; text-overflow:ellipsis; white-space:nowrap; }
.jarvice-drawer-close {
  width:44px; height:44px; min-width:44px; min-height:44px; display:grid; place-items:center;
  background: none; border: 1px solid transparent; color: var(--muted, #9aa); cursor: pointer;
  padding:0; border-radius:11px;
}
.jarvice-drawer-close svg { width:18px; height:18px; }
.jarvice-drawer-close:hover,.jarvice-drawer-close:focus-visible { border-color:var(--line); background: rgba(255,255,255,.06); color: inherit; }
.jarvice-drawer-body { flex: 1 1 auto; min-height: 0; display: flex; overflow: hidden; }
/* The relocated canonical chat becomes a deliberate one-column compact surface. */
.jarvice-drawer-body .chat-wrap {
  width:100%; height:100%; min-height:0; grid-template-columns:minmax(0,1fr);
  border:0; border-radius:0; background:var(--bg); box-shadow:none;
}
.jarvice-drawer-body .chat-stage { width:100%; overflow:hidden; }
.jarvice-drawer-body .chat-history {
  position:absolute; z-index:48; inset:0 auto 0 0; width:100%; padding:18px 16px 14px;
  border-right:0; background:color-mix(in srgb,var(--surface) 98%,var(--bg));
  box-shadow:18px 0 54px rgba(0,0,0,.38); visibility:hidden; pointer-events:none;
  transform:translateX(-102%); transition:transform .2s ease-out,visibility 0s linear .2s;
}
.jarvice-drawer-body .chat-wrap.history-open .chat-history {
  visibility:visible; pointer-events:auto; transform:translateX(0);
  transition:transform .2s ease-out,visibility 0s;
}
.jarvice-drawer-body .chat-history-close,.jarvice-drawer-body .chat-history-toggle { display:grid; }
.jarvice-drawer-body .chat-history-head small { font-size:10px; }
.jarvice-drawer-body .chat-history-head strong { font-size:16px; }
.jarvice-drawer-body .chat-new-thread { min-height:46px; }
.jarvice-drawer-body .chat-new-thread span { font-size:13px; }
.jarvice-drawer-body .chat-history-search { min-height:44px; margin-bottom:12px; }
.jarvice-drawer-body .chat-history-search input { font-size:13px; }
.jarvice-drawer-body .chat-history-item { min-height:88px; grid-template-columns:minmax(0,1fr) 40px; }
.jarvice-drawer-body .chat-history-open { min-height:86px; }
.jarvice-drawer-body .chat-history-open strong { font-size:13px; }
.jarvice-drawer-body .chat-history-summary { font-size:11.5px; }
.jarvice-drawer-body .chat-history-meta { font-size:10px; }
.jarvice-drawer-body .chat-history-delete { width:40px; height:40px; opacity:.72; }
.jarvice-drawer-body .chat-command-head {
  min-height:64px; justify-content:flex-start; gap:6px; padding:8px 10px;
  background:color-mix(in srgb,var(--surface) 94%,transparent); backdrop-filter:blur(14px);
}
.jarvice-drawer-body .chat-history-toggle,
.jarvice-drawer-body .chat-team-trigger,
.jarvice-drawer-body .chat-model-trigger { width:44px; min-width:44px; min-height:44px; padding:0; border-radius:11px; }
.jarvice-drawer-body .chat-agent-picker { min-width:0; max-width:none; flex:1 1 auto; }
.jarvice-drawer-body .chat-agent-trigger {
  width:100%; min-width:0; min-height:46px; grid-template-columns:32px minmax(0,1fr) 15px;
  gap:7px; padding:5px 7px; border-color:transparent; background:transparent;
}
.jarvice-drawer-body .chat-agent-copy small,.jarvice-drawer-body .chat-agent-copy em { display:none; }
.jarvice-drawer-body .chat-agent-copy strong { font-size:13px; }
.jarvice-drawer-body .chat-model-trigger { grid-template-columns:1fr; place-items:center; }
.jarvice-drawer-body .chat-model-copy,.jarvice-drawer-body .chat-model-chevron { display:none; }
.jarvice-drawer-body .chat-model-icon { width:30px; height:30px; display:grid; border:0; background:transparent; }
.jarvice-drawer-body .chat-runtime { display:none; }
.jarvice-drawer-body .chat-team-trigger { justify-content:center; }
.jarvice-drawer-body .chat-team-trigger span { display:none; }
.jarvice-drawer-body .chat-agent-menu {
  left:-50px; width:min(440px,calc(100vw - 28px)); max-height:min(620px,calc(100dvh - 160px));
}
.jarvice-drawer-body .chat-model-menu { width:min(390px,calc(100vw - 28px)); max-height:min(590px,calc(100dvh - 160px)); }
.jarvice-drawer-body .chat-thread {
  padding:20px 16px 24px; gap:18px;
  background:radial-gradient(circle at 50% -20%,rgba(124,58,237,.07),transparent 38%),var(--bg);
}
.jarvice-drawer-body .chat-empty { width:100%; padding:24px 4px; }
.jarvice-drawer-body .chat-empty-orb { width:50px; height:50px; border-radius:15px; box-shadow:none; }
.jarvice-drawer-body .chat-empty-kicker { font-size:9px; }
.jarvice-drawer-body .chat-empty h3 { margin:9px 0; font-size:26px; line-height:1.08; }
.jarvice-drawer-body .chat-empty > p { max-width:42ch; font-size:14px; line-height:1.55; }
.jarvice-drawer-body .chat-starters { grid-template-columns:1fr; gap:7px; margin-top:20px; }
.jarvice-drawer-body .chat-starters button { min-height:58px; padding:11px 13px; border-radius:11px; }
.jarvice-drawer-body .chat-starters button span { font-size:12px; }
.jarvice-drawer-body .chat-starters button small { font-size:11px; line-height:1.4; }
.jarvice-drawer-body .chat-msg { gap:9px; }
.jarvice-drawer-body .chat-message-avatar { width:30px; height:30px; margin-top:20px; border-radius:9px; font-size:10px; }
.jarvice-drawer-body .chat-message-body { max-width:calc(100% - 38px); }
.jarvice-drawer-body .chat-message-meta { margin-bottom:4px; font-size:10px; }
.jarvice-drawer-body .chat-bubble { max-width:100%; padding:12px 14px; border-radius:14px; font-size:14px; line-height:1.6; }
.jarvice-drawer-body .chat-composer {
  margin:0 10px 10px; border-radius:15px; background:var(--surface);
  box-shadow:0 12px 30px rgba(0,0,0,.22);
}
.jarvice-drawer-body .chat-input { min-width:0; gap:7px; padding:8px 9px 7px; }
.jarvice-drawer-body .chat-input textarea { min-width:0; min-height:44px; padding:10px 6px; font-size:16px; line-height:1.45; }
.jarvice-drawer-body .chat-attach-btn,
.jarvice-drawer-body .chat-mic-btn,
.jarvice-drawer-body .chat-input button.primary { flex:0 0 44px; width:44px; min-width:44px; height:44px; border-radius:11px; }
.jarvice-drawer-body .chat-composer-foot { min-height:34px; padding:0 10px 8px; }
.jarvice-drawer-body .chat-voice-options { gap:6px; font-size:10px; }
.jarvice-drawer-body .chat-input-hint,.jarvice-drawer-body .chat-voice-engine { display:none; }
.jarvice-drawer-body .chat-team-drawer {
  width:100%; padding:0 16px 18px; border-left:0; background:color-mix(in srgb,var(--surface) 98%,var(--bg));
}
.jarvice-drawer-body .chat-team-head button { width:44px; height:44px; }
.jarvice-drawer-body .nova-voice-stage { inset:64px 0 0; }
@media (max-width: 760px) {
  body.nova-drawer-modal-open { overflow:hidden; }
  .jarvice-fab { right:max(14px,env(safe-area-inset-right)); bottom:max(14px,env(safe-area-inset-bottom)); }
  .jarvice-drawer { inset:0; width:100vw; max-width:none; border-left:none; }
  .jarvice-drawer-head { padding-right:max(10px,env(safe-area-inset-right)); padding-left:max(14px,env(safe-area-inset-left)); }
  .jarvice-drawer-body { padding-bottom:env(safe-area-inset-bottom); }
  .jarvice-drawer-body .chat-thread { padding:18px 12px 22px; }
  .jarvice-drawer-body .chat-empty h3 { font-size:24px; }
  .jarvice-drawer-body .chat-message-avatar { display:none; }
  .jarvice-drawer-body .chat-message-body { max-width:94%; }
  .jarvice-drawer-body .chat-composer { margin:0 7px max(7px,env(safe-area-inset-bottom)); }
  .jarvice-drawer-body .chat-composer-foot { display:none; }
  .jarvice-drawer-body .chat-history,.jarvice-drawer-body .chat-team-drawer {
    padding-right:max(14px,env(safe-area-inset-right)); padding-left:max(14px,env(safe-area-inset-left));
  }
}
@media (prefers-reduced-motion:reduce) {
  .jarvice-drawer,.jarvice-drawer-body .chat-history { transition:none; }
}

/* Nova FAB approval badge (Plan 03 phase 5) */
.jarvice-fab { position: fixed; }
.jarvice-fab-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
  padding: 0 5px; border-radius: 10px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; line-height: 1;
  color: #fff; background: #e11d48; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.jarvice-fab-badge.hidden { display: none; }

/* ---------- Google Workspace overview (Plan 04 phase 6) ---------- */
.google-overview { margin-top: 18px; }
.google-overview.hidden { display: none; }
.google-overview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.google-overview-kicker { font-size: 11px; letter-spacing: .08em; color: var(--muted, #9aa); }
.google-overview-body { margin-top: 12px; }
.google-overview-empty, .google-overview-error, .google-overview-loading { color: var(--muted, #9aa); padding: 10px 0; }
.google-accounts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.google-account { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border, #2a2a38); border-radius: 10px; }
.google-account-actions { display: flex; gap: 6px; }
.google-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.google-section { border: 1px solid var(--border, #2a2a38); border-radius: 10px; padding: 10px 12px; }
.google-section h4 { margin: 0 0 8px; font-size: 13px; }
.google-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px;
  border-top: 1px solid rgba(255,255,255,.04); }
.google-row:first-of-type { border-top: none; }
.google-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Gmail Management ---------- */
.gmail-page {
  --gmail-accent: #c4b5fd;
  --gmail-accent-strong: #8b5cf6;
  --gmail-success: #34d399;
  display: grid;
  gap: 18px;
}
.gmail-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  padding: 30px;
  border: 1px solid color-mix(in srgb, var(--gmail-accent-strong) 28%, var(--border));
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 12%, rgba(139,92,246,.2), transparent 34%),
    linear-gradient(135deg, rgba(139,92,246,.09), rgba(15,23,42,.02));
}
.gmail-hero::after {
  content: "";
  position: absolute;
  inset: auto -68px -94px auto;
  width: 230px;
  aspect-ratio: 1;
  border: 1px solid rgba(196,181,253,.12);
  border-radius: 50%;
  pointer-events: none;
}
.gmail-hero-copy { position: relative; z-index: 1; max-width: 760px; }
.gmail-kicker {
  display: block;
  color: var(--gmail-accent);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: .14em;
}
.gmail-hero h2 {
  margin: 6px 0 9px;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.04;
  letter-spacing: -.04em;
}
.gmail-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}
.gmail-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.gmail-connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--surface, var(--panel)) 86%, transparent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.gmail-connection::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
}
.gmail-connection.is-connected { color: var(--gmail-success); }
.gmail-connection.is-ready { color: #60a5fa; }
.gmail-connection.is-error { color: #fb7185; }
.gmail-connection.is-loading { color: var(--text-secondary); }
.gmail-metadata-notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-left: 3px solid var(--gmail-accent-strong);
  border-radius: 5px 14px 14px 5px;
  background: color-mix(in srgb, var(--gmail-accent-strong) 9%, var(--surface, var(--panel)));
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.gmail-metadata-notice svg { flex: 0 0 17px; width: 17px; margin-top: 1px; color: var(--gmail-accent); }
.gmail-metadata-notice strong { color: var(--text-primary); }
.google-workspace-services {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.google-workspace-services > .gmail-summary-loading,
.google-workspace-services > .gmail-error { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 18px; background: var(--surface, var(--panel)); }
.google-workspace-service {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface, var(--panel));
}
.google-workspace-service-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--gmail-accent);
  background: rgba(139,92,246,.12);
  font-weight: 850;
}
.google-workspace-service.is-calendar .google-workspace-service-icon { color: #60a5fa; background: rgba(59,130,246,.12); }
.google-workspace-service.is-drive .google-workspace-service-icon { color: #34d399; background: rgba(16,185,129,.12); }
.google-workspace-service.is-sheets .google-workspace-service-icon { color: #22c55e; background: rgba(34,197,94,.12); }
.google-workspace-service-copy { min-width: 0; }
.google-workspace-service-copy span,
.google-workspace-service-copy strong,
.google-workspace-service-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.google-workspace-service-copy span { color: var(--text-secondary); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.google-workspace-service-copy strong { margin: 3px 0; font-size: 14px; }
.google-workspace-service-copy small { color: var(--text-secondary); font-size: 10px; }
.google-workspace-service-count { padding-left: 12px; border-left: 1px solid var(--border); text-align: right; }
.google-workspace-service-count strong,
.google-workspace-service-count span { display: block; }
.google-workspace-service-count strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.google-workspace-service-count span { color: var(--text-secondary); font-size: 9px; }
.gmail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface, var(--panel));
  overflow: hidden;
}
.gmail-summary-item {
  position: relative;
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
}
.gmail-summary-item:last-child { border-right: 0; }
.gmail-summary-item > span,
.gmail-summary-item > strong,
.gmail-summary-item > small { display: block; }
.gmail-summary-item > span {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.gmail-summary-item > strong {
  overflow: hidden;
  margin-bottom: 5px;
  font-size: clamp(19px, 2vw, 28px);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gmail-summary-item > small { color: var(--text-secondary); font-size: 10px; }
.gmail-summary-loading,
.gmail-error { grid-column: 1 / -1; padding: 22px; }
.gmail-summary-loading { display: flex; align-items: center; gap: 9px; color: var(--text-secondary); }
.gmail-error { display: grid; gap: 5px; color: #fb7185; }
.gmail-error span { color: var(--text-secondary); font-size: 12px; }
.gmail-accounts-section,
.google-sheets-workspace,
.gmail-compose,
.gmail-inbox {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface, var(--panel));
  overflow: hidden;
}
.gmail-section-head,
.gmail-inbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.gmail-section-head h3,
.gmail-inbox-head h3 { margin: 4px 0 0; font-size: 17px; }
.gmail-section-note { color: var(--text-secondary); font-size: 10px; }
.gmail-accounts { display: grid; }
.gmail-account {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.gmail-account:last-child { border-bottom: 0; }
.gmail-account-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--gmail-accent-strong) 35%, var(--border));
  border-radius: 11px;
  color: var(--gmail-accent);
  background: rgba(139,92,246,.1);
  font-weight: 800;
}
.gmail-account-copy { min-width: 0; }
.gmail-account-copy strong,
.gmail-account-copy span,
.gmail-account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gmail-account-copy strong { margin-bottom: 3px; font-size: 13px; }
.gmail-account-copy span,
.gmail-account-copy small { color: var(--text-secondary); font-size: 10px; line-height: 1.5; }
.gmail-account-actions { display: flex; gap: 7px; }
.google-sheets-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.4fr); min-height: 330px; }
.google-sheets-browser { min-width: 0; border-right: 1px solid var(--border); }
.google-sheets-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.google-sheets-toolbar label { display: grid; gap: 5px; width: min(100%, 220px); margin: 0; color: var(--text-secondary); font-size: 9px; font-weight: 720; letter-spacing: .04em; text-transform: uppercase; }
.google-sheets-toolbar input { width: 100%; margin: 0; font-size: 11px; letter-spacing: 0; text-transform: none; }
.google-sheets-toolbar > span { flex: 0 0 auto; padding-bottom: 10px; color: var(--text-secondary); font-size: 9px; }
.google-sheets-list { display: grid; max-height: 420px; overflow-y: auto; }
.google-sheet-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; width: 100%; padding: 14px 18px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text-primary); text-align: left; }
.google-sheet-item:hover,
.google-sheet-item:focus-visible { background: rgba(34,197,94,.06); }
.google-sheet-item.is-selected { background: rgba(34,197,94,.1); box-shadow: inset 3px 0 #22c55e; }
.google-sheet-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(34,197,94,.12); color: #4ade80; font-weight: 850; }
.google-sheet-copy { min-width: 0; }
.google-sheet-copy strong,
.google-sheet-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.google-sheet-copy strong { margin-bottom: 3px; font-size: 12px; }
.google-sheet-copy span { color: var(--text-secondary); font-size: 9px; }
.google-sheet-item > time { color: var(--text-secondary); font-size: 9px; }
.google-sheet-preview-shell { display: grid; grid-template-rows: auto minmax(190px, 1fr) auto; min-width: 0; }
.google-sheet-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.google-sheet-preview-head strong { display: block; overflow: hidden; max-width: min(46vw, 500px); margin-top: 4px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.google-sheet-preview { min-width: 0; overflow: auto; background: color-mix(in srgb, var(--surface, var(--panel)) 90%, #22c55e 2%); }
.google-sheet-preview table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 10px; }
.google-sheet-preview td { min-width: 96px; max-width: 260px; padding: 9px 11px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.google-sheet-preview tr:first-child td { position: sticky; top: 0; z-index: 1; background: color-mix(in srgb, var(--surface, var(--panel)) 94%, #22c55e 6%); color: var(--text-primary); font-weight: 740; }
.google-sheet-preview-shell > p { margin: 0; padding: 10px 18px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 9px; line-height: 1.5; }
.gmail-compose-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .65fr); }
.gmail-compose-form { display: grid; gap: 13px; padding: 20px; border-right: 1px solid var(--border); }
.gmail-compose-form label { display: grid; gap: 6px; margin: 0; color: var(--text-secondary); font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.gmail-compose-form input,
.gmail-compose-form select,
.gmail-compose-form textarea { width: 100%; margin: 0; color: var(--text-primary); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.gmail-compose-form textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.gmail-compose-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gmail-draft-policy { padding: 22px; background: color-mix(in srgb, var(--gmail-accent-strong) 5%, transparent); }
.gmail-draft-policy h4 { margin: 8px 0; font-size: 16px; line-height: 1.35; }
.gmail-draft-policy p { margin: 0; color: var(--text-secondary); font-size: 11px; line-height: 1.6; }
.gmail-drafts-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 11px; }
.gmail-drafts-head span { color: var(--text-secondary); }
.gmail-drafts { display: grid; }
.gmail-draft { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.gmail-draft:last-child { border-bottom: 0; }
.gmail-draft-main { min-width: 0; }
.gmail-draft-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; color: var(--text-secondary); font-size: 10px; }
.gmail-draft-status { padding: 3px 7px; border-radius: 999px; color: #fbbf24; background: rgba(251,191,36,.12); font-weight: 750; text-transform: capitalize; }
.gmail-draft-status.is-sent { color: #34d399; background: rgba(52,211,153,.12); }
.gmail-draft-status.is-rejected,
.gmail-draft-status.is-reconciliation_required { color: #fb7185; background: rgba(251,113,133,.12); }
.gmail-draft h4 { margin: 0 0 5px; font-size: 13px; }
.gmail-draft-to { display: block; overflow: hidden; color: var(--text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.gmail-draft details { margin-top: 10px; }
.gmail-draft details summary { color: var(--gmail-accent); font-size: 10px; cursor: pointer; }
.gmail-draft-body { margin: 9px 0 0; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--text-secondary) 6%, transparent); color: var(--text-secondary); font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.gmail-draft-actions { display: flex; align-items: center; gap: 7px; }
.gmail-search-form {
  display: grid;
  grid-template-columns: auto minmax(180px, 320px) auto auto;
  align-items: center;
  gap: 7px;
  min-width: min(100%, 520px);
  margin: 0;
}
.gmail-search-form > svg { width: 17px; color: var(--text-secondary); }
.gmail-search-form input { min-width: 0; margin: 0; }
.gmail-query-state { min-height: 35px; padding: 10px 20px; border-bottom: 1px solid var(--border); font-size: 10px; }
.gmail-messages { display: grid; }
.gmail-message {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 13px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background-color .16s ease;
}
.gmail-message:last-child { border-bottom: 0; }
.gmail-message:hover { background: color-mix(in srgb, var(--gmail-accent-strong) 4%, transparent); }
.gmail-message-state {
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-secondary) 36%, transparent);
}
.gmail-message.is-unread .gmail-message-state { background: var(--gmail-accent-strong); box-shadow: 0 0 0 4px rgba(139,92,246,.12); }
.gmail-message-main { min-width: 0; }
.gmail-message-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.gmail-message-top strong { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.gmail-message.is-unread .gmail-message-top strong { color: var(--gmail-accent); }
.gmail-message-top time { flex: 0 0 auto; color: var(--text-secondary); font-size: 10px; }
.gmail-message-from { display: block; margin-top: 4px; color: var(--text-secondary); font-size: 11px; }
.gmail-message p { overflow: hidden; margin: 8px 0; color: var(--text-secondary); font-size: 11px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.gmail-labels { display: flex; gap: 5px; flex-wrap: wrap; }
.gmail-labels span {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-secondary) 9%, transparent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .03em;
}
.gmail-empty {
  display: grid;
  gap: 5px;
  padding: 22px 20px;
  color: var(--text-secondary);
  font-size: 12px;
}
.gmail-empty strong { color: var(--text-primary); }
.gmail-empty .mini-spin { margin-right: 8px; }
@media (max-width: 1100px) {
  .google-workspace-services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .gmail-compose-layout { grid-template-columns: 1fr; }
  .google-sheets-layout { grid-template-columns: 1fr; }
  .google-sheets-browser { border-right: 0; border-bottom: 1px solid var(--border); }
  .gmail-compose-form { border-right: 0; border-bottom: 1px solid var(--border); }
  .gmail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gmail-summary-item:nth-child(2) { border-right: 0; }
  .gmail-summary-item:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .gmail-inbox-head { align-items: stretch; flex-direction: column; }
  .gmail-search-form { min-width: 0; width: 100%; grid-template-columns: auto minmax(0, 1fr) auto auto; }
}
@media (max-width: 720px) {
  .google-workspace-services { grid-template-columns: 1fr; }
  .gmail-hero { align-items: stretch; flex-direction: column; padding: 20px; border-radius: 18px; }
  .gmail-hero-actions { justify-content: flex-start; }
  .gmail-hero-actions .secondary { flex: 1 1 120px; }
  .gmail-summary { grid-template-columns: 1fr; }
  .gmail-summary-item { border-right: 0; border-bottom: 1px solid var(--border); }
  .gmail-summary-item:nth-child(2) { border-right: 0; }
  .gmail-summary-item:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .gmail-summary-item:last-child { border-bottom: 0; }
  .gmail-section-head { align-items: flex-start; }
  .google-sheets-toolbar { align-items: stretch; flex-direction: column; }
  .google-sheets-toolbar label { width: 100%; }
  .google-sheets-toolbar > span { padding-bottom: 0; }
  .google-sheet-item { grid-template-columns: auto minmax(0, 1fr); padding-inline: 16px; }
  .google-sheet-item > time { grid-column: 2; }
  .google-sheet-preview-head { align-items: flex-start; flex-direction: column; }
  .google-sheet-preview-head strong { max-width: 80vw; }
  .gmail-account { grid-template-columns: auto minmax(0, 1fr); padding: 15px 16px; }
  .gmail-account-actions { grid-column: 1 / -1; }
  .gmail-account-actions button { flex: 1; }
  .gmail-compose-form { padding: 16px; }
  .gmail-compose-actions { align-items: stretch; flex-direction: column; }
  .gmail-draft { grid-template-columns: 1fr; padding: 15px 16px; }
  .gmail-draft-actions button { flex: 1; }
  .gmail-inbox-head { padding: 16px; }
  .gmail-search-form { grid-template-columns: auto minmax(0, 1fr); }
  .gmail-search-form button { width: 100%; }
  .gmail-search-form button:first-of-type { grid-column: 1 / 2; }
  .gmail-search-form button:last-of-type { grid-column: 2 / 3; }
  .gmail-query-state { padding-inline: 16px; }
  .gmail-message { padding: 15px 16px; }
  .gmail-message-top { align-items: flex-start; flex-direction: column; gap: 4px; }
  .gmail-message p { white-space: normal; }
}

/* ---------- System tools & permissions ---------- */
.system-tools-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.system-tools-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.system-tools-head .ov-h { margin: 0 0 5px; }
.system-tools-count {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.system-tools-size {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}
.system-tools-size select {
  width: auto;
  min-width: 72px;
  min-height: 44px;
  margin: 0;
  padding-block: 0;
}
.system-tools-grid { align-items: stretch; }
.system-tool-card {
  min-height: 148px;
  max-height: 180px;
  overflow: hidden;
}
.system-tool-card .card-prompt {
  display: -webkit-box;
  overflow: hidden;
  max-height: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.system-tools-empty { grid-column: 1 / -1; min-height: 118px; }
.system-tools-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.system-tools-pagination button {
  min-width: 96px;
  min-height: 44px;
}
.system-tools-pagination button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.system-tools-page-status {
  min-width: 92px;
  color: var(--text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
@media (max-width: 620px) {
  .system-tools-head { align-items: stretch; flex-direction: column; }
  .system-tools-size { justify-content: space-between; width: 100%; }
  .system-tools-size select { margin-left: auto; }
  .system-tools-pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .system-tools-pagination button { min-width: 0; width: 100%; }
}

/* ---------- Financial Overview (Plan 09) ---------- */
.finance-page { --finance-accent: #a78bfa; --finance-positive: #34d399; }
.finance-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 28px;
  padding: 28px; border: 1px solid color-mix(in srgb, var(--finance-accent) 24%, var(--border));
  border-radius: 24px; background:
    radial-gradient(circle at 84% 16%, rgba(139,92,246,.18), transparent 34%),
    linear-gradient(135deg, rgba(139,92,246,.08), rgba(15,23,42,.03));
}
.finance-hero h2 { max-width: 720px; margin: 5px 0 8px; font-size: clamp(27px, 3vw, 44px); line-height: 1.04; letter-spacing: -.04em; }
.finance-hero p { max-width: 720px; margin: 0; color: var(--text-secondary); line-height: 1.6; }
.finance-kicker { display: block; color: var(--finance-accent); font-size: 11px; font-weight: 750; letter-spacing: .14em; }
.finance-controls { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.finance-controls label { min-width: 155px; margin: 0; font-size: 11px; color: var(--text-secondary); }
.finance-controls input { margin-top: 5px; }
.finance-controls .button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.finance-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 14px; margin: 18px 0; }
.finance-currency, .finance-state, .finance-table-panel, .finance-import-panel, .finance-approval-panel {
  border: 1px solid var(--border); border-radius: 18px; background: var(--surface, var(--panel));
}
.finance-currency { padding: 18px; min-height: 190px; }
.finance-currency header, .finance-table-panel > header, .finance-approval-panel > header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.finance-currency header > span { padding: 5px 9px; border-radius: 8px; background: rgba(139,92,246,.14); color: var(--finance-accent); font-weight: 800; }
.finance-currency header small { color: var(--text-secondary); }
.finance-metric { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.finance-metric span { color: var(--text-secondary); font-size: 12px; }
.finance-metric strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.finance-metric.positive strong { color: var(--finance-positive); }
.finance-metric.accent strong { color: var(--finance-accent); }
.finance-currency footer { display: flex; justify-content: space-between; gap: 10px; padding-top: 12px; color: var(--text-secondary); font-size: 11px; }
.finance-currency footer .overdue { color: #fb7185; font-weight: 700; }
.finance-skeleton { opacity: .55; background: linear-gradient(90deg, var(--surface) 25%, rgba(139,92,246,.12) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.finance-state { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 22px; color: var(--text-secondary); }
.finance-state strong { color: var(--text-primary); }
.finance-state.compact { padding: 14px; font-size: 12px; }
.finance-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); gap: 16px; align-items: start; }
.finance-main, .finance-side { display: grid; gap: 16px; }
.finance-table-panel { overflow: hidden; }
.finance-table-panel > header, .finance-import-panel, .finance-approval-panel { padding: 18px; }
.finance-table-panel h3, .finance-import-panel h3, .finance-approval-panel h3 { margin: 3px 0 0; }
.finance-count { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: rgba(139,92,246,.12); color: var(--finance-accent); font-weight: 750; }
.finance-table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.finance-table-wrap table { width: 100%; border-collapse: collapse; min-width: 650px; }
.finance-table-wrap th, .finance-table-wrap td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 12px; }
.finance-table-wrap th { color: var(--text-secondary); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.finance-table-wrap tr:last-child td { border-bottom: 0; }
.finance-table-wrap td small { display: block; margin-top: 3px; color: var(--text-secondary); }
.finance-table-wrap .num { text-align: right; font-variant-numeric: tabular-nums; }
.finance-empty-row { color: var(--text-secondary); text-align: center !important; padding: 26px !important; }
.finance-status-badge { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: rgba(148,163,184,.12); color: var(--text-secondary); font-size: 10px; font-weight: 700; text-transform: capitalize; }
.finance-status-badge.status-paid, .finance-status-badge.status-applied { background: rgba(52,211,153,.12); color: #34d399; }
.finance-status-badge.status-issued, .finance-status-badge.status-due { background: rgba(96,165,250,.12); color: #60a5fa; }
.finance-status-badge.status-waiting_for_approval { background: rgba(251,191,36,.12); color: #fbbf24; }
.finance-import-panel > p { color: var(--text-secondary); line-height: 1.55; }
.finance-import-panel form { display: grid; gap: 10px; margin-top: 14px; }
.finance-import-panel label { margin: 0; }
.finance-import-panel input[type="file"] { width: 100%; margin-top: 6px; }
.finance-format { margin-top: 14px; color: var(--text-secondary); font-size: 11px; }
.finance-format code { display: block; margin-top: 8px; white-space: normal; line-height: 1.5; }
.finance-import { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.finance-import:first-child { margin-top: 8px; }
.finance-import div { min-width: 0; }
.finance-import strong, .finance-import span { display: block; }
.finance-import strong { font-size: 12px; }
.finance-import span { margin-top: 5px; color: var(--text-secondary); font-size: 10px; }
@media (max-width: 980px) { .finance-layout { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .finance-hero { align-items: stretch; flex-direction: column; padding: 20px; border-radius: 18px; }
  .finance-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .finance-controls label { grid-column: 1 / -1; }
  .finance-summary { grid-template-columns: 1fr; }
}

/* Keep the corrected command-center layout after legacy chat declarations. */
.chat-command-head { min-height:68px; justify-content:flex-start; gap:9px; padding:10px 14px; }
.chat-agent-picker { min-width:0; flex:1 1 250px; max-width:320px; }
.chat-agent-trigger { width:100%; min-width:0; min-height:46px; grid-template-columns:32px minmax(0,1fr) 16px; padding:6px 10px; }
.chat-agent-copy small,.chat-model-copy small { font-size:10px; line-height:1.2; }
.chat-agent-copy strong,.chat-model-copy strong,.chat-agent-option-copy strong { font-size:12px; }
.chat-agent-copy em,.chat-agent-option-copy small { font-size:11px; }
.chat-agent-menu-head strong { font-size:13px; }
.chat-agent-menu-head small { font-size:11px; }
.chat-agent-group,.chat-agent-option b { font-size:10px; }
.chat-agent-option[hidden],.chat-agent-group[hidden] { display:none; }
.chat-runtime { min-width:0; max-width:205px; padding:8px 10px; }
.chat-team-card-head strong { font-size:12px; }
.chat-team-card-head span,.chat-team-card-copy > small,.chat-team-missions li,.chat-team-missions em { font-size:10.5px; }
@media (max-width:1100px) { .chat-runtime { display:none; } .chat-agent-picker { max-width:none; } }
@media (max-width:700px) {
  .chat-command-head { gap:7px; padding:9px 10px; }
  .chat-agent-picker { flex:1 1 auto; min-width:104px; }
  .chat-agent-trigger { min-width:0; }
  .chat-model-picker { flex:0 0 44px; }
  .chat-model-trigger { width:44px; min-width:44px; min-height:44px; display:grid; grid-template-columns:1fr; place-items:center; padding:0; }
  .chat-model-copy,.chat-model-chevron { display:none; }
  .chat-model-icon { display:grid; }
  .chat-team-trigger { width:44px; min-width:44px; padding:0; }
  .chat-team-trigger span { display:none; }
  .chat-agent-option b { display:none; }
}
