:root {
  /* Liber Veda — licht Studio-vlak, oranje merkaccent (parity Live #ff7a00) */
  --bg: #f7f8fa;
  --bg-soft: #f3f0eb;
  --surface: #ffffff;
  --line: #e2ddd4;
  --line-strong: #c4b8a8;
  --text: #0f172a;
  --muted: #57534e;
  --accent: #ff7a00;
  --accent-hover: #e66e00;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e0;
  --orange-rgb: 255, 122, 0;
  --ink: #111827;
  --warn: #c2410c;
  --warn-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --ok: #0f766e;
  --ok-soft: #ccfbf1;
  --touch: #ff7a00;
  --touch-soft: #fff1e0;
  --meter-track: #e5e7eb;
  --font-ui: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0b0f19;
  --bg-soft: #121826;
  --surface: #111827;
  --line: #243044;
  --line-strong: #3a4a63;
  --text: #e8eef8;
  --muted: #94a3b8;
  --accent: #ff7a00;
  --accent-hover: #ff9440;
  --accent-ink: #0b0f19;
  --accent-soft: rgba(255, 122, 0, 0.16);
  --orange-rgb: 255, 122, 0;
  --ink: #f8fafc;
  --warn: #fb923c;
  --warn-soft: rgba(251, 146, 60, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --touch: #ff7a00;
  --touch-soft: rgba(255, 122, 0, 0.18);
  --meter-track: #1e293b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* display:flex/grid op componenten mag [hidden] niet overrulen */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  accent-color: var(--accent);
  background:
    radial-gradient(1000px 520px at 12% -12%, rgba(var(--orange-rgb), 0.12), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(34, 211, 238, 0.06), transparent 50%),
    var(--bg);
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(1000px 520px at 12% -12%, rgba(var(--orange-rgb), 0.14), transparent 55%),
    var(--bg);
}
.login-gate[hidden] { display: none !important; }
.login-card {
  width: min(440px, 100%);
  padding: 2.5rem 2.1rem;
  /* Donkere kaart: wit Liber Veda altijd leesbaar */
  background: #12151c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: rise 0.45s ease;
  color: #e8eef8;
}
/* Logo: Liber Veda wit · Studio oranje (zelfde stijl als elders) */
.login-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.5rem;
  margin: 0 0 0.75rem;
  font-family: var(--font-ui);
  line-height: 1.05;
}
.login-brand .brand-liber {
  color: #ffffff;
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.login-brand .brand-studio {
  color: var(--accent);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.login-card .sub {
  color: var(--muted);
  margin: 0 0 1.6rem;
  line-height: 1.5;
  font-size: 1.05rem;
}
.login-card .hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 500;
}
.login-card .hint.mono,
.setup-backup {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  word-break: break-all;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  white-space: pre-wrap;
}
.login-card .info {
  margin: 0 0 0.75rem;
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 600;
}
.login-card .btn {
  width: 100%;
}
.login-card label,
.modal-form label {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 700;
}
.login-card input {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1.35rem;
  letter-spacing: 0.28em;
  text-align: center;
  background: var(--bg-soft);
  border: 2px solid var(--line-strong);
  color: var(--text);
  border-radius: 12px;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
}
.login-card .pw-field {
  position: relative;
  margin-bottom: 1rem;
}
.login-card .pw-field input {
  margin-bottom: 0;
  padding-right: 3rem;
  letter-spacing: 0.12em;
  text-align: left;
}
.login-card .pw-field input.pw-visible {
  letter-spacing: 0.02em;
  font-family: var(--font-ui);
}
.login-card .pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.login-card .pw-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.login-card .totp-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.login-card .totp-qr-wrap[hidden] {
  display: none !important;
}
.login-card #setup-totp-qr {
  display: block;
  width: 200px;
  height: 200px;
}
.login-card #setup-totp-qr img,
.login-card #setup-totp-qr canvas,
.login-card #setup-totp-qr table {
  display: block;
  margin: 0 auto;
  max-width: 200px;
  height: auto !important;
}
.btn, .login-card button {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.98rem;
  border: 0;
  cursor: pointer;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
}
.btn:hover, .login-card button:hover { background: var(--accent-hover); }
.login-card button { width: 100%; }
.login-card .verify-row .btn.primary { width: auto; }
.btn.ghost {
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--line-strong);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.ghost.danger { color: var(--danger); border-color: #fca5a5; }
.btn.heal {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
}
.btn.heal:hover { background: #0d9488; }
.btn.heal:disabled { opacity: 0.55; }

.boot-fallback {
  position: fixed;
  inset: auto 1rem 1rem auto;
  z-index: 2000;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.context-switcher {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 2rem;
  padding: 0 0.45rem 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  box-sizing: border-box;
}
.context-select {
  min-width: 8.5rem;
  max-width: 12rem;
  height: 1.55rem;
  padding: 0 0.15rem;
  font-size: 0.8rem;
}
.env-pill {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
  line-height: 1.2;
}
.env-pill.remote { color: #9a3412; background: var(--warn-soft); }

.command-pane { width: 100%; }
.nav-toggle {
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
}
.tree-pane.collapsed {
  width: 52px;
  min-width: 52px;
}
.tree-pane.collapsed .pane-title,
.tree-pane.collapsed .nav-body,
.tree-pane.collapsed #btn-refresh-system { display: none; }
.tree-pane.collapsed .pane-head { justify-content: center; padding: 0.75rem 0.4rem; }
.studio:has(.tree-pane.collapsed) {
  grid-template-columns: 52px minmax(0, 1fr) minmax(300px, 360px);
}

.nav-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.explorer-block {
  display: flex;
  flex-direction: column;
  min-height: 10rem;
  max-height: 42vh;
  margin: 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel, var(--bg-soft));
  overflow: hidden;
}
.explorer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
}
.explorer-block .file-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.context-card {
  margin: 0.65rem 0.65rem 0.35rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.context-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.context-detail {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

.system-nav {
  padding: 0.45rem 0.5rem 0.85rem;
  display: grid;
  gap: 0.4rem;
  overflow: auto;
  flex: 1;
  max-height: none;
  border-bottom: 0;
}
.sys-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 0.45rem;
  align-items: start;
  padding: 0.55rem 0.55rem 0.5rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid transparent;
}
.sys-item:hover { border-color: var(--line); }
.sys-actions {
  display: flex;
  gap: 0.25rem;
  grid-column: 2 / -1;
  margin-top: 0.35rem;
}
.sys-action {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  width: 2rem;
  height: 1.85rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.sys-action:hover { border-color: var(--accent); background: var(--accent-soft); }
.sys-action:disabled { opacity: 0.4; cursor: not-allowed; }
.sys-action.power-on { color: var(--ok); }
.sys-action.power-off { color: var(--danger); }
.sys-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.35rem;
  background: var(--line-strong);
}
.sys-dot.online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.sys-dot.offline, .sys-dot.stopped, .sys-dot.errored { background: var(--danger); }
.sys-dot.unknown { background: var(--warn); }
.sys-name { font-weight: 800; font-size: 0.84rem; color: var(--ink); }
.sys-meta { font-size: 0.72rem; color: var(--muted); font-weight: 600; margin-top: 0.1rem; }
.sys-port {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}
.pane-head.sub {
  border-top: 0;
  padding-top: 0.55rem;
}
.tree-pane .file-tree { max-height: none; flex: 1; }

.history-panel {
  width: 100%;
  margin: 2.5rem 0 0;
  padding: 1.75rem 0 3rem;
  border-top: 1px solid var(--line);
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0 1rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.history-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.history-log {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: none;
  overflow: visible;
  padding: 0;
}
.history-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.5;
}
.history-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.history-group.linked {
  padding: 0 0 0 0.85rem;
  border-left: 3px solid var(--accent);
}
.history-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.55rem;
}
.history-group-label {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}
.history-group-meta {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.history-group-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.history-step {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.history-group.linked .history-step {
  padding: 0.7rem 0 0.7rem 0.15rem;
  border-bottom: 1px dashed var(--line);
}
.history-group.linked .history-step:last-child,
.history-step:last-child {
  border-bottom: 0;
}
.history-step .h-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}
.history-step .h-title {
  margin: 0.3rem 0 0;
  font-weight: 800;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
}
.history-step.compact .h-title {
  font-size: 0.9rem;
  font-weight: 700;
}
.history-step .h-msg {
  margin: 0.35rem 0 0;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.history-step .h-files {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--accent-hover);
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}
.history-step.level-ok .h-top span:first-child { color: var(--ok); }
.history-step.level-error .h-top span:first-child { color: var(--danger); }
.history-step.level-warn .h-top span:first-child { color: #b45309; }

.setup-panel {
  margin: 0;
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--bg-soft);
  text-align: center;
}
.setup-panel[hidden] + .verify-block {
  border-radius: 12px;
  border-top: 1px solid var(--line);
}
.setup-title {
  margin: 0 0 0.35rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}
.setup-hint { margin: 0 0 0.85rem; font-size: 0.9rem; color: var(--muted); }
.setup-qr {
  display: block;
  margin: 0 auto 0.85rem;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}
.setup-toggle { width: 100%; margin: 0.65rem 0 0; }
.secret-box {
  text-align: left;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.setup-secret {
  display: block;
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  margin: 0.35rem 0 0.55rem;
  color: var(--text);
  user-select: all;
}

.login-form { display: grid; gap: 0; }
.verify-block {
  margin: 0 0 0.35rem;
  padding: 1.05rem 1rem 1.15rem;
  border: 2px solid var(--accent);
  border-radius: 0 0 12px 12px;
  background: var(--accent-soft);
  text-align: left;
}
.verify-title {
  margin: 0 0 0.35rem;
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--accent-hover);
}
.verify-block label {
  display: block;
  margin: 0 0 0.55rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
}
.verify-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: stretch;
}
.verify-row input {
  margin: 0;
  text-align: center;
  letter-spacing: 0.28em;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-mono);
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}
.verify-row .btn.primary {
  width: auto;
  min-width: 8.5rem;
  margin: 0;
  border-radius: 10px;
  white-space: nowrap;
}
.verify-help {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}
@media (max-width: 480px) {
  .verify-row {
    grid-template-columns: 1fr;
  }
  .verify-row .btn.primary { width: 100%; }
}

.error {
  color: #7f1d1d;
  background: var(--danger-soft);
  border: 1px solid #fca5a5;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  margin-top: 0.75rem;
  padding: 0.75rem 0.85rem;
  font-weight: 600;
}
.info {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.35rem 0 0;
  line-height: 1.4;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: fade 0.3s ease;
}
.app[hidden] { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.15rem;
  min-height: 3.35rem;
  height: 3.35rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  overflow: hidden;
}
html[data-theme="dark"] .topbar {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  min-width: 0;
  line-height: 1;
}
.server-ident {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.08rem;
  min-width: 0;
  max-width: 16rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid rgba(var(--orange-rgb), 0.35);
  border-radius: 8px;
  background: var(--accent-soft);
  line-height: 1.1;
}
.server-ident-kicker {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-hover);
}
.server-ident-value {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.host-monitor {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.18rem;
  min-width: 8.6rem;
  padding-right: 0.15rem;
}
.host-meter {
  display: grid;
  grid-template-columns: 1.7rem minmax(3.4rem, 1fr) 2.4rem;
  align-items: center;
  gap: 0.28rem;
}
.host-meter-label {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.host-meter-track {
  display: block;
  height: 0.42rem;
  border-radius: 999px;
  background: var(--meter-track);
  overflow: hidden;
}
.host-meter-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.35s ease, background-color 0.25s ease;
}
.host-meter[data-level="ok"] .host-meter-fill { background: #16a34a; }
.host-meter[data-level="warn"] .host-meter-fill { background: #d97706; }
.host-meter[data-level="hot"] .host-meter-fill {
  background: #dc2626;
  box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45);
  animation: host-hot-pulse 1.2s ease-out infinite;
}
.host-meter-val {
  font-size: 0.66rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
}
.btn-theme {
  min-width: 2.4rem;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  font-size: 1rem;
  line-height: 1;
}
.btn-theme .theme-ico-dark { display: none; }
html[data-theme="dark"] .btn-theme .theme-ico-light { display: none; }
html[data-theme="dark"] .btn-theme .theme-ico-dark { display: inline; }
@keyframes host-hot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}
.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  font-family: var(--font-ui);
  white-space: nowrap;
  line-height: 1;
}
.brand-mark .brand-liber {
  /* Merknaam: wit */
  color: #ffffff;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-mark .brand-studio {
  /* Product: oranje */
  color: var(--accent);
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
/* Licht thema: donkere chip zodat wit Liber Veda leesbaar blijft */
html[data-theme="light"] .brand-mark,
html:not([data-theme="dark"]) .brand-mark {
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: #12151c;
}
.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.top-cluster {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  height: 2rem;
}
.top-cluster + .top-cluster:not(.context-switcher) {
  padding-left: 0.65rem;
  border-left: 1px solid var(--line);
}
.top-cluster.context-switcher {
  margin-left: 0.1rem;
}
.topbar .btn {
  height: 2rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar .btn.compact {
  padding: 0 0.7rem;
}
.topbar .btn.heal {
  padding: 0 0.85rem;
}
.topbar .site-pick-label {
  font-size: 0.65rem;
}
.topbar .site-select {
  min-width: 8.5rem;
  max-width: 12rem;
  height: 1.55rem;
  padding: 0 0.2rem;
  font-size: 0.8rem;
}
.site-pick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.35rem 0.2rem 0.65rem;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}
.site-pick-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.site-select {
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
  min-width: 11rem;
  max-width: 16rem;
  padding: 0.35rem 0.25rem;
  cursor: pointer;
}
.site-select.full {
  width: 100%;
  min-width: 0;
  max-width: none;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.35rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
}
.status-pill.ok { color: var(--ok); background: var(--ok-soft); border-color: #99f6e4; }
.status-pill.warn { color: var(--danger); background: var(--danger-soft); border-color: #fca5a5; }
.status-pill.soft {
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}
.status-pill.busy {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #93c5fd;
}

/* Technische tellers/status uit de hoofdrij — subtiel in de onderbalk */
.top-cluster.top-status {
  display: none !important;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.65rem;
  padding: 0 0.85rem;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.96);
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--muted);
}
.statusbar .status-left,
.statusbar .status-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex-wrap: wrap;
}
.statusbar .status-right {
  justify-content: flex-end;
  opacity: 0.92;
}
.status-dot-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 650;
  color: var(--muted);
}
.status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.status-dot-label.ok .status-dot { background: var(--ok); }
.status-dot-label.warn .status-dot { background: #f59e0b; }
.status-dot-label.offline .status-dot { background: #94a3b8; }
.status-dot-label.busy .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.18);
}
.status-mini {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-mini.ok { color: var(--ok); }
.status-mini.warn { color: var(--danger); }
.status-mini.busy { color: var(--accent); }
.status-mini.soft { color: var(--muted); }

.desktop-update-banner {
  display: none !important;
}

.studio {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(300px, 360px);
  grid-template-areas: "tree stream agent";
}
.studio.nav-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) minmax(300px, 360px);
}
.tree-pane { grid-area: tree; }
.stream-stage { grid-area: stream; }
.agent-pane { grid-area: agent; }

.tree-pane {
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--line);
}
.pane-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.icon-btn {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  width: 2.1rem;
  height: 2.1rem;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
}
.file-tree {
  overflow: auto;
  padding: 0.5rem 0.4rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.tree-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}
.tree-item:hover { background: var(--bg-soft); }
.tree-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}
.tree-item.touched {
  background: var(--touch-soft);
  color: var(--touch);
  font-weight: 800;
}
.tree-item.touched::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--touch);
  margin-left: auto;
}
.tree-item .ico { color: var(--muted); width: 1rem; flex-shrink: 0; font-weight: 700; }
.tree-children { margin-left: 0.8rem; border-left: 2px solid var(--line); }

/* Eén doorlopende stream — geen nested scrollkaders */
.stream-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  overflow: auto;
  overflow-anchor: none;
  scroll-behavior: smooth;
}
.agent-busy-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1.5rem;
  background: linear-gradient(90deg, var(--accent-soft), #eef4ff 55%, var(--accent-soft));
  background-size: 200% 100%;
  border-bottom: 1px solid #93c5fd;
  color: var(--accent-hover);
  font-weight: 800;
  font-size: 0.9rem;
  animation: busy-shimmer 2.2s linear infinite;
}
.agent-busy-bar[hidden] {
  display: none !important;
}
.agent-busy-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: busy-pulse 1s ease-in-out infinite, ping 1.4s ease-out infinite;
  flex-shrink: 0;
}
.stream {
  width: min(48rem, 100%);
  margin: 0 auto;
  padding: 2rem 1.75rem 4rem;
}
.stream-intro {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.stream-intro h1 {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  margin: 0 0 0.55rem;
  color: var(--ink);
  letter-spacing: -0.04em;
  line-height: 1.15;
}
.stream-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
  font-weight: 500;
}
.stream-intro.hidden { display: none; }

.stream-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Stream items: typografie, geen kaarten */
.stream-item {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.25s ease;
}
.stream-item:last-child { border-bottom: 0; }
.stream-item .label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.45rem;
}
.stream-item .body {
  font-size: 1.12rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text);
  font-weight: 500;
  margin: 0;
}
.stream-item.report .body {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--ink);
}
.stream-item.end-report-card .body.end-report {
  white-space: normal;
  font-size: 0.95rem;
  font-weight: 500;
}
.end-report-title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  font-weight: 800;
}
.end-report-section {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.end-report ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}
.stream-item.deploy-card-item .body.deploy-card {
  white-space: normal;
  font-size: 0.95rem;
  font-weight: 500;
}
.deploy-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.deploy-file-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}
.deploy-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: var(--ok-soft, #ccfbf1);
  color: var(--ok, #0f766e);
}
.deploy-file-link {
  border: 0;
  background: transparent;
  color: var(--accent-hover);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  cursor: pointer;
  text-align: left;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.deploy-url {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.stream-item.tips .body { padding: 0; }
.stream-item.tips ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}
.stream-item.tips li::marker { color: var(--accent); }
.stream-item.action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  border-bottom: 0;
  padding-top: 1.4rem;
}
.stream-item.action .body {
  flex: 1 1 100%;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--accent-hover);
}
.stream-item.action .btn { margin: 0; }

.stream-code {
  width: min(48rem, 100%);
  margin: 0 auto 3rem;
  padding: 0 1.75rem;
  min-height: 55vh;
  display: flex;
  flex-direction: column;
}
.stream-code[hidden] {
  display: none !important;
}
.stream-code-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0 0.65rem;
  flex-wrap: wrap;
}
.stream-code-path {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  word-break: break-all;
}
.btn.compact {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}
.stream-code .monaco {
  flex: 1;
  min-height: 50vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

/* Agent-kolom */
.agent-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}
.agent-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}
.agent-mode {
  margin: 0.35rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
}
.agent-mode.live { color: var(--accent-hover); }
.agent-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
}
.agent-pulse.live {
  background: var(--accent);
  animation: busy-pulse 1s ease-in-out infinite;
}
.agent-status {
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0.75rem 1rem;
  max-height: 22%;
  overflow: auto;
  overflow-anchor: none;
}
.agent-status-empty {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}
.agent-status-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}
.agent-status-list li.done { color: var(--ok); }
.agent-status-list li.active {
  color: var(--accent-hover);
  font-weight: 800;
}
.agent-chat {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.agent-msg {
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 600;
}
.agent-msg.user {
  background: var(--accent-soft);
  color: var(--accent-hover);
  align-self: flex-end;
  max-width: 92%;
}
.agent-msg.agent {
  background: var(--bg);
  color: var(--ink);
  align-self: stretch;
  border: 1px solid var(--line);
}

.agent-pane .composer {
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  padding: 0.75rem;
  flex: 0 0 auto;
  display: grid;
  gap: 0.65rem;
}
.agent-pane .composer textarea {
  min-height: 88px;
  font-size: 0.95rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  resize: none;
  width: 100%;
  font-family: var(--font-ui);
  color: var(--text);
  font-weight: 500;
  outline: none;
}
.composer-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}
.composer-row .btn.primary { width: auto; min-width: 6.5rem; }
.quiet-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.monaco { flex: 1; min-height: 0; }

.modal-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 2rem);
}
.modal-dialog.ssh-dialog { max-width: 940px; }
.modal-dialog.ports-dialog { max-width: 720px; }
.modal-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }

.ports-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}
.ports-toolbar input[type="search"] { flex: 1; min-width: 0; }
.ports-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding-right: 2px;
  margin-top: 0.35rem;
}
.ports-group-title {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ports-tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}
@media (min-width: 640px) {
  .ports-tiles { grid-template-columns: 1fr 1fr; }
}
.ports-tile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem 0.65rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}
.ports-tile.is-core {
  border-color: rgba(255, 122, 0, 0.45);
  box-shadow: inset 3px 0 0 rgba(255, 122, 0, 0.85);
}
.ports-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.ports-status.is-up { background: #22c55e; }
.ports-status.is-down { background: #ef4444; }
.ports-status.is-unknown { background: #94a3b8; }
.ports-tile-body { min-width: 0; }
.ports-tile-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.25;
}
.ports-tile-meta {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}
.ports-tile-port {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent-hover, #ff7a00);
  white-space: nowrap;
}
.ports-tile-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}
.ports-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.modal-form {
  display: grid;
  gap: 0.55rem;
  padding: 1.3rem 1.35rem 1.4rem;
}
.modal-form h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.modal-form h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 800;
}
.modal-form .hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  font-weight: 500;
}
.modal-form input,
.modal-form textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 2px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  font-weight: 500;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}
.modal-actions.wrap { margin: 0.35rem 0 0.65rem; }

.ssh-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.35rem;
}
.ssh-col {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: var(--bg-soft);
  min-height: 0;
}
.ssh-inventory-summary {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.ssh-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.ssh-list-head h3 { margin: 0; }
.ssh-host-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  max-height: 22rem;
  overflow: auto;
}
.ssh-group { margin: 0.55rem 0 0.25rem; }
.ssh-group-title {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ssh-host-list .ssh-item {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  margin-bottom: 0.3rem;
  background: var(--surface);
  font-weight: 700;
  display: grid;
  gap: 0.1rem;
}
.ssh-host-list .ssh-item .site-title {
  color: var(--ink);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.ssh-host-list .ssh-item .site-meta {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.ssh-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  text-transform: uppercase;
}
.ssh-badge.online { color: var(--ok); border-color: #99f6e4; background: var(--ok-soft); }
.ssh-badge.ssh { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.ssh-host-list .ssh-item:hover { border-color: var(--line-strong); }
.ssh-host-list .ssh-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ssh-host-list .ssh-item.active .site-title { color: var(--accent-hover); }
.ssh-host-list .ssh-empty {
  opacity: 0.7;
  cursor: default;
  padding: 0.5rem 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
#ssh-site-filter {
  margin-bottom: 0.5rem;
}
.ssh-host-form, .ssh-sync-form { display: grid; gap: 0.35rem; }
.ssh-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.ssh-active {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 700;
}
.ssh-remote-list {
  max-height: 160px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem;
  margin-bottom: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.ssh-remote-list .remote-item {
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.ssh-remote-list .remote-item:hover { background: var(--bg-soft); }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes busy-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(var(--orange-rgb), 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(var(--orange-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--orange-rgb), 0); }
}
@keyframes busy-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 1100px) {
  .studio {
    grid-template-columns: minmax(180px, 210px) minmax(0, 1fr) minmax(280px, 320px);
  }
  .topbar {
    gap: 0.75rem;
    padding: 0 0.75rem;
  }
  .top-actions { gap: 0.45rem; }
  .topbar .context-select,
  .topbar .site-select {
    min-width: 7rem;
    max-width: 9.5rem;
  }
  .server-ident { max-width: 11rem; }
  .host-monitor { min-width: 7.4rem; }
}
@media (max-width: 860px) {
  .studio {
    grid-template-columns: 1fr;
    grid-template-rows: 120px minmax(0, 1fr) minmax(280px, 40vh);
    grid-template-areas:
      "tree"
      "stream"
      "agent";
  }
  .stream { padding: 1.25rem 1.1rem 3rem; }
}
@media (max-width: 900px) {
  .ssh-layout { grid-template-columns: 1fr; }
}

/* Fullscreen Live Preview — geen nestscroll / mini-kader */
body.preview-open {
  overflow: hidden;
}
.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: #0b1220;
}
.preview-overlay[hidden] { display: none !important; }
.preview-overlay-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  background: rgba(15, 23, 42, 0.96);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}
.preview-overlay-title h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
}
.preview-overlay .preview-hint {
  margin: 0.2rem 0 0;
  padding: 0;
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}
.preview-overlay .preview-controls {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  max-width: 36rem;
  min-width: 0;
}
.preview-overlay .preview-controls input {
  min-width: 10rem;
  flex: 1;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: #111827;
  color: #f8fafc;
}
.device-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  flex-shrink: 0;
}
.device-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.device-btn:hover { color: #e2e8f0; }
.device-btn.active {
  background: var(--accent);
  color: #fff;
}
.preview-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0.85rem;
  background:
    radial-gradient(circle at 20% 0%, rgba(var(--orange-rgb), 0.22), transparent 45%),
    #0b1220;
  overflow: auto;
}
.preview-device {
  margin: 0 auto;
  width: 100%;
  height: 100%;
  max-width: 100%;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: max-width 0.25s ease, height 0.25s ease, border-radius 0.2s ease;
}
.preview-device[data-device="desktop"] {
  max-width: 100%;
  border-radius: 8px;
}
.preview-device[data-device="tablet"] {
  max-width: 768px;
  height: min(100%, 1024px);
  border-radius: 18px;
  align-self: center;
}
.preview-device[data-device="mobile"] {
  max-width: 390px;
  height: min(100%, 844px);
  border-radius: 28px;
  align-self: center;
}
.preview-overlay .preview-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
  display: block;
}

/* Data / State inspector */
.data-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.data-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}
.data-autofix { margin-left: 0; }
.data-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 0.36fr) 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.data-files-col,
.data-editor-col {
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 1rem 1.5rem;
}
.data-files-col { border-right: 1px solid var(--line); }
.data-editor {
  width: 100%;
  min-height: 22rem;
  height: calc(100% - 2rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
  background: #0b1220;
  color: #d7e3f4;
  resize: vertical;
}
.watcher-event {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-start !important;
}
.watcher-event .sev {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--danger);
}
@media (max-width: 960px) {
  .data-layout { grid-template-columns: 1fr; }
  .data-files-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 36vh;
  }
  .preview-overlay-bar {
    flex-wrap: wrap;
  }
}

.audit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.audit-card {
  padding: 0.85rem 1.1rem 1.4rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 12rem;
}
.audit-card:nth-child(2n) { border-right: 0; }
.audit-card-wide {
  grid-column: 1 / -1;
  border-right: 0;
}
.audit-summary {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
}
.audit-summary.warn { color: var(--warn); }
.audit-summary.ok { color: var(--ok); }
.audit-detail {
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: #0b1220;
  color: #d7e3f4;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow: auto;
}
.sec-sev {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  width: 3.2rem;
  flex-shrink: 0;
}
.sec-sev.high { color: var(--danger); }
.sec-sev.medium { color: var(--warn); }
.sec-sev.low, .sec-sev.info { color: var(--muted); }
.dashboard-audit {
  margin: 0.75rem 0 0.25rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}
.dashboard-audit h4 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.dashboard-audit .dash-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.2rem 0;
  color: var(--ink);
}
.dashboard-audit .dash-row span:last-child { color: var(--muted); font-family: var(--font-mono); font-size: 0.72rem; }

.composer-attachments,
.msg-attach-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 0.55rem;
}
.composer-attachments[hidden] { display: none !important; }
.msg-attach-gallery { margin-top: 0.55rem; }
.attach-preview-card {
  position: relative;
  width: 7.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.attach-preview-media {
  position: relative;
  height: 4.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.08)),
    var(--bg, #f3f4f6);
  cursor: zoom-in;
  overflow: hidden;
}
.attach-preview-media img,
.attach-preview-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-kind-glyph {
  font-size: 1.45rem;
  line-height: 1;
}
.attach-media-badge {
  position: absolute;
  inset: auto auto 0.35rem 0.35rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.attach-audio-inline {
  width: calc(100% - 0.5rem);
  max-width: 100%;
  margin: 0 0.25rem;
  height: 1.8rem;
}
.attach-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.5rem 0.5rem;
}
.attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ink);
}
.attach-chip-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}
.attach-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  font-size: 0.95rem;
}
.attach-remove:hover { background: #b91c1c; }
.attach-preview-dialog .attach-preview-stage {
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a0a;
  border-radius: 0.75rem;
  overflow: hidden;
}
.attach-preview-stage img,
.attach-preview-stage video {
  max-width: 100%;
  max-height: min(70vh, 32rem);
  display: block;
}
.attach-preview-stage audio { width: min(100%, 28rem); }
.desktop-update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #86efac;
  background: linear-gradient(90deg, #ecfdf5, #f0fdf4 55%, #fff);
  color: var(--ink);
}
.desktop-update-banner[hidden] { display: none !important; }
.desktop-update-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.desktop-update-copy strong { font-size: 0.88rem; }
.desktop-update-text {
  color: var(--muted);
  font-size: 0.78rem;
}
.desktop-update-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.desktop-update-progress {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
@media (max-width: 720px) {
  .desktop-update-banner {
    flex-direction: column;
    align-items: stretch;
  }
}
.composer-input-wrap {
  position: relative;
  display: block;
}
.composer-input-wrap textarea {
  width: 100%;
  padding-right: 5.6rem;
}
.attach-btn,
.voice-btn {
  position: absolute;
  bottom: 0.55rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.attach-btn { right: 3.05rem; }
.voice-btn { right: 0.55rem; }
.attach-btn:hover,
.voice-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.attach-btn.has-files {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.voice-btn.listening {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
  animation: busy-pulse 1s ease-in-out infinite;
}
.attach-icon,
.voice-icon { font-size: 1rem; line-height: 1; }
.composer.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 0.75rem;
}
.collab-peer-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.stream-item.e2e-fail .body { color: var(--danger); }
.stream-item.e2e-ok .end-report-title { color: var(--ok); }
.btn.danger:disabled { opacity: 0.45; }

/* One-click copy op feedberichten */
.stream-item.has-copy,
.agent-msg.has-copy,
.history-step.has-copy {
  position: relative;
  padding-right: 2.4rem;
}
.copy-wrap {
  position: absolute;
  top: 0.55rem;
  right: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.stream-item:hover .copy-wrap,
.agent-msg:hover .copy-wrap,
.history-step:hover .copy-wrap,
.copy-wrap:focus-within,
.copy-btn.copied {
  opacity: 1;
}
.copy-btn {
  width: 1.85rem;
  height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.copy-btn:hover {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.copy-btn.copied {
  color: var(--ok);
  border-color: #99f6e4;
  background: var(--ok-soft);
}
.copy-icon {
  font-weight: 700;
  transform: translateY(-0.5px);
}
.copy-toast {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.agent-msg-body {
  white-space: pre-wrap;
}
@media (hover: none) {
  .copy-wrap { opacity: 0.85; }
}

.stream-item.task-report-card {
  padding: 1.25rem 2.4rem 1.35rem 0;
}
.stream-item.task-report-card .task-report {
  white-space: normal;
  font-size: 0.98rem;
  font-weight: 500;
}
.task-report .end-report-title {
  margin: 0 0 0.75rem;
}
.task-report .end-report-section {
  margin: 1rem 0 0.4rem;
}
.task-report ul {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.28rem;
}
.task-report-prose {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--text);
}
.task-report-actions {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.task-report-action-note {
  margin: 0 0 0.55rem;
  font-weight: 700;
  color: var(--ink);
}
.task-report-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.stream-item.task-report-card .copy-wrap {
  opacity: 1;
}
.stream-item.task-report-card .copy-btn {
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.05rem;
}

/* Stage tabs: Output / Terminal / Git */
.stage-tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 0.15rem;
  padding: 0.45rem 1rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.stage-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 0.9rem 0.65rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.stage-tab:hover { color: var(--ink); }
.stage-tab.active {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
}
.stage-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.stage-panel[hidden] { display: none !important; }

/* Live terminal */
.terminal-toolbar,
.git-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0f172a08, transparent);
  flex-shrink: 0;
}
.term-proc-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.term-process {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--ink);
  min-width: 11rem;
}
.term-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
}
.term-output {
  flex: 1;
  margin: 0;
  padding: 0.9rem 1.1rem 2rem;
  overflow: auto;
  background: #0b1220;
  color: #d7e3f4;
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-output .term-err { color: #fca5a5; }
.term-output .term-proc-head {
  color: #7dd3fc;
  font-weight: 600;
  margin-top: 0.75rem;
}
.term-output .term-proc-head:first-child { margin-top: 0; }

/* Git panel */
.git-branch {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-hover);
  padding: 0.2rem 0.45rem;
  background: var(--accent-soft);
  border-radius: 4px;
}
.git-commit-msg {
  flex: 1;
  min-width: 12rem;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #fff);
}
.git-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 0.38fr) 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.git-files-col,
.git-diff-col {
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 1rem 1.5rem;
}
.git-files-col {
  border-right: 1px solid var(--line);
}
.git-col-title {
  margin: 0.4rem 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.git-diff-path {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  margin-left: 0.35rem;
}
.git-file-list,
.git-log-list {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
}
.git-file-list li,
.git-log-list li {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.84rem;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
}
.git-file-list li:hover,
.git-log-list li:hover,
.git-file-list li.active {
  background: var(--accent-soft);
}
.git-file-status {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  width: 1.6rem;
  flex-shrink: 0;
}
.git-file-status.modified { color: #ca8a04; }
.git-file-status.added { color: var(--ok, #16a34a); }
.git-file-status.deleted { color: var(--danger, #dc2626); }
.git-log-list li {
  flex-direction: column;
  gap: 0.1rem;
  cursor: default;
}
.git-log-meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.git-diff {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: #0b1220;
  color: #d7e3f4;
  border-radius: 8px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.75rem;
  line-height: 1.4;
  overflow: auto;
  white-space: pre;
  min-height: 12rem;
}
.git-diff .diff-add { color: #86efac; }
.git-diff .diff-del { color: #fca5a5; }
.git-diff .diff-hunk { color: #7dd3fc; }
.git-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0.25rem;
}

@media (max-width: 960px) {
  .git-layout {
    grid-template-columns: 1fr;
  }
  .git-files-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 40vh;
  }
}
