/* Voicebox Studio - shared styles. One accent colour, one font family, no gradients, no side stripes. */

:root {
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #f0ebe1;
  --surface-3: #e7e0d3;
  --input-bg: #fffefb;
  --ink: #22201c;
  --ink-2: #5d574d;
  --ink-3: #686258;
  --line: #e3dccf;
  --line-strong: #cfc6b6;
  --accent: #0f6e66;
  --accent-hover: #0c5c55;
  --accent-text: #0f6e66;
  --accent-soft: #dfeeeb;
  --accent-ring: rgba(15, 110, 102, 0.35);
  --focus: #0f6e66;
  --on-accent: #ffffff;
  --danger: #a8372a;
  --danger-soft: #f7e3df;
  --danger-line: #e5b9b1;
  --danger-fill: #a8372a;
  --on-danger: #ffffff;
  --warn: #8a5d00;
  --warn-soft: #f8ecd2;
  --warn-line: #e6cf9c;
  --ok: #2e7d4f;
  --dot-online: #2e9b5a;
  --dot-busy: #d99a1e;
  --dot-offline: #a8a196;
  --shadow: 0 8px 28px rgba(40, 32, 20, 0.16);
  --shadow-sm: 0 1px 2px rgba(40, 32, 20, 0.08);
  --radius: 10px;
  --radius-sm: 7px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Naskh Arabic", "Noto Sans Devanagari", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171614;
    --surface: #201f1c;
    --surface-2: #2a2825;
    --surface-3: #34322e;
    --input-bg: #1b1a18;
    --ink: #ece7de;
    --ink-2: #b3ac9f;
    --ink-3: #a09a8e;
    --line: #34312c;
    --line-strong: #48443d;
    --accent: #0f6e66;
    --accent-hover: #138077;
    --accent-text: #5cc3b7;
    --accent-soft: #173a36;
    --accent-ring: rgba(92, 195, 183, 0.4);
    --focus: #5cc3b7;
    --danger: #e4776a;
    --danger-soft: #3a211d;
    --danger-line: #6b352d;
    --danger-fill: #b5483a;
    --on-danger: #ffffff;
    --warn: #e0b45a;
    --warn-soft: #362b17;
    --warn-line: #5f4a20;
    --ok: #6cc28f;
    --dot-online: #43b26f;
    --dot-busy: #e3a93a;
    --dot-offline: #6f6a62;
    --shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171614;
  --surface: #201f1c;
  --surface-2: #2a2825;
  --surface-3: #34322e;
  --input-bg: #1b1a18;
  --ink: #ece7de;
  --ink-2: #b3ac9f;
  --ink-3: #a09a8e;
  --line: #34312c;
  --line-strong: #48443d;
  --accent: #0f6e66;
  --accent-hover: #138077;
  --accent-text: #5cc3b7;
  --accent-soft: #173a36;
  --accent-ring: rgba(92, 195, 183, 0.4);
  --focus: #5cc3b7;
  --danger: #e4776a;
  --danger-soft: #3a211d;
  --danger-line: #6b352d;
  --danger-fill: #b5483a;
  --on-danger: #ffffff;
  --warn: #e0b45a;
  --warn-soft: #362b17;
  --warn-line: #5f4a20;
  --ok: #6cc28f;
  --dot-online: #43b26f;
  --dot-busy: #e3a93a;
  --dot-offline: #6f6a62;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
input, select, textarea, button, code, pre, kbd, samp { font-family: var(--font); font-size: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14.5px; }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
[hidden], .hidden { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* ------------------------------------------------------------------ app shell */
#app {
  display: grid; height: 100vh; min-width: 900px;
  grid-template-rows: 52px minmax(0, 1fr);
  grid-template-columns: 180px minmax(0, 1fr);
}
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; color: var(--ink); text-decoration: none; }
.brand-mark { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.server-dots { display: flex; align-items: center; gap: 4px; min-width: 0; }
.server-dot {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 99px;
  border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer; font-size: 12.5px; max-width: 160px;
}
.server-dot:hover { background: var(--surface-2); border-color: var(--line); }
.server-dot .dot-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--dot-offline); }
.dot-online { background: var(--dot-online); }
.dot-busy { background: var(--dot-busy); }
.dot-offline { background: var(--dot-offline); }
.dot-error { background: var(--dot-offline); box-shadow: 0 0 0 2px var(--danger-line); }
.dot-disabled { background: transparent; border: 1.5px solid var(--dot-offline); }
.queue-summary { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.queue-summary:hover { color: var(--ink); text-decoration: underline; }
.topbar .spacer { flex: 1; }

.sidenav {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--bg);
}
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.nav-item .nav-count { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.nav-foot { margin-top: auto; padding: 10px 6px 2px; display: flex; flex-direction: column; gap: 6px; }
.nav-foot select { width: 100%; height: 28px; font-size: 12.5px; }
.nav-foot .field-label { font-size: 11.5px; }

main#main { overflow-y: auto; overflow-x: hidden; min-width: 0; position: relative; }
#banners:empty { display: none; }
#view { padding: 20px 24px 56px; max-width: 1480px; min-width: 0; }
.view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 24px;
  border-bottom: 1px solid var(--warn-line); background: var(--warn-soft); color: var(--ink);
}
.banner.banner-error { background: var(--danger-soft); border-bottom-color: var(--danger-line); }
.banner .banner-text { flex: 1 1 320px; min-width: 0; }
.banner .banner-title { font-weight: 650; }
.banner .banner-sub { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.banner input { width: min(420px, 100%); }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.page-sub { color: var(--ink-2); margin-top: 2px; }

/* ------------------------------------------------------------------ layout helpers */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.row.nowrap { flex-wrap: nowrap; }
.row.top { align-items: flex-start; }
.row.end { justify-content: flex-end; }
.row > .grow, .grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack.tight { gap: 6px; }
.spacer { flex: 1 1 auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap-text { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wrap-any { overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }
.text-accent { color: var(--accent-text); }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-width: 0;
}
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 650; margin-right: auto; }
.card-sub { color: var(--ink-2); font-size: 12.5px; }
.card-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.section-title { font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin: 4px 0 2px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 550; line-height: 1; cursor: pointer; white-space: nowrap;
  text-decoration: none; user-select: none; transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { background: var(--surface-3); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-danger); }
.btn.danger:hover:not(:disabled) { filter: brightness(0.93); }
.btn.danger-text { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: 6px; }
.btn.lg { height: 38px; padding: 0 16px; font-size: 14.5px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn.playing { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-ring); }
.btn.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-ring); }
.btn.is-busy { cursor: progress; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font: inherit; }

/* ------------------------------------------------------------------ inputs */
input[type="text"], input[type="number"], input[type="password"], input[type="url"], input[type="search"],
input[type="email"], input:not([type]), select, textarea {
  height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--ink); font-size: 13.5px; min-width: 0; max-width: 100%;
}
select { padding-right: 6px; cursor: pointer; }
textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-ring); outline-offset: 0; border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; cursor: pointer; }
input[type="number"] { width: 110px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > input, .field > select, .field > textarea, .field > .row > select, .field > .row > input { width: 100%; }
.field > input[type="checkbox"] { width: auto; }
.field > .seg, .field > .switch { align-self: flex-start; }
.field-label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.field-hint { font-size: 12px; color: var(--ink-2); }
.field-error { font-size: 12px; color: var(--danger); }
.field-error:empty { display: none; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); flex-shrink: 0; max-width: 100%; }
.seg-btn {
  border: 0; background: transparent; color: var(--ink-2); height: 30px; padding: 0 11px;
  font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line-strong); }
.seg-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.seg-btn.on { background: var(--accent); color: var(--on-accent); }
.seg-btn:disabled { opacity: .5; cursor: not-allowed; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 32px; height: 18px; border-radius: 9px; background: var(--line-strong); position: relative; flex-shrink: 0; transition: background-color .15s; }
.switch-track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-label { font-size: 13.5px; }

details > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); user-select: none; }
details > summary:hover { color: var(--ink); }
details[open] > summary { margin-bottom: 10px; }

/* ------------------------------------------------------------------ pills, badges, notes */
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid transparent;
}
.pill-done, .pill-online, .pill-ok { background: var(--accent-soft); color: var(--accent-text); }
.pill-failed, .pill-error { background: var(--danger-soft); color: var(--danger); }
.pill-active, .pill-busy, .pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-queued { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.pill-draft { background: transparent; border: 1px dashed var(--line-strong); color: var(--ink-3); }
.pill-cancelled, .pill-skipped, .pill-offline { background: var(--surface-2); color: var(--ink-3); }
.badge { display: inline-flex; align-items: center; flex: none; white-space: nowrap; height: 19px; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }

.note { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--ink); }
.note-warn { background: var(--warn-soft); border-color: var(--warn-line); }
.note-error { background: var(--danger-soft); border-color: var(--danger-line); }
.note-ok { background: var(--accent-soft); border-color: var(--accent-ring); }

/* ------------------------------------------------------------------ states */
.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-title { font-size: 16px; font-weight: 650; color: var(--ink); }
.empty-text { max-width: 480px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px 12px; color: var(--ink-2); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: 8px; padding: 14px 16px; }
.error-title { font-weight: 650; color: var(--danger); }
.error-text { margin: 4px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.error-text:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ progress */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s ease; }

/* ------------------------------------------------------------------ tables */
.tbl-wrap { width: 100%; overflow-x: auto; min-width: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 650; color: var(--ink-2); padding: 7px 10px;
  border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: transparent;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.clickable { cursor: pointer; }
.tbl.compact td { padding: 5px 8px; }
.tbl-empty td { text-align: center; color: var(--ink-2); padding: 24px 10px; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn + .btn { margin-left: 4px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.pager-info { font-size: 12.5px; color: var(--ink-2); padding: 0 6px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ toasts, modals, popovers */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  transition: opacity .18s, transform .18s; animation: toast-in .18s ease;
}
.toast.leaving { opacity: 0; transform: translateY(4px); }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; padding-top: 3px; }
.toast-error { background: var(--danger-soft); border-color: var(--danger-line); }
.toast-ok { background: var(--accent-soft); border-color: var(--accent-ring); }
.toast-warn { background: var(--warn-soft); border-color: var(--warn-line); }
.toast-close { border: 0; background: none; color: var(--ink-2); cursor: pointer; padding: 4px; border-radius: 5px; display: inline-flex; }
.toast-close:hover { background: var(--surface-3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.modal-back { position: fixed; inset: 0; z-index: 900; background: rgba(24, 20, 14, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: calc(100vh - 32px); display: flex; flex-direction: column; min-width: 0; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0 18px; }
.modal-title { font-size: 16px; margin-right: auto; }
.modal-body { padding: 14px 18px; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.confirm-msg { white-space: pre-wrap; overflow-wrap: anywhere; }

.popover { position: absolute; z-index: 950; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; box-shadow: var(--shadow); padding: 4px; max-width: min(380px, calc(100vw - 16px)); max-height: 60vh; overflow: auto; }
.menu { display: flex; flex-direction: column; min-width: 190px; }
.menu-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--ink); text-align: left; cursor: pointer; font-size: 13.5px; width: 100%;
}
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-item.danger { color: var(--danger); }
.menu-icon-slot { width: 15px; height: 15px; flex-shrink: 0; }
.menu-label { flex: 1; min-width: 0; }
.menu-hint { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu-heading { font-size: 11.5px; font-weight: 650; color: var(--ink-3); padding: 6px 10px 2px; }

/* ------------------------------------------------------------------ route errors */
.route-error { max-width: 720px; }
.route-error .error-text { font-size: 13px; }

/* ------------------------------------------------------------------ voice form */
.voice-form { min-width: 0; }
.vf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; align-items: start; }
.vf-compact .vf-grid { gap: 8px 10px; }
.vf-grid > .span-2 { grid-column: 1 / -1; }
.vf-grid > .span-2:empty { display: none; }
.vf-model { font-size: 12.5px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; line-height: 1.6; }
.vf-model:empty { display: none; }
.vf-model .pill { margin-right: 4px; }
.vf-warn { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.vf-warn:empty { display: none; }
.vf-engine-note:empty { display: none; }
.vf-seed { flex-wrap: nowrap; }
.vf-seed .vf-seed-input { width: 130px; flex: 0 1 130px; }
.vf-effects-json { width: 100%; margin-top: 6px; font-size: 12.5px; }
.vf-changes:empty { display: none; }
.vf-changes .field-hint { color: var(--warn); }
.vf-size .seg { width: 100%; }
.vf-size .seg-btn { flex: 1; }
.vf-advanced { border-top: 1px solid var(--line); padding-top: 10px; }

/* ------------------------------------------------------------------ script view */
.projectbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.projectbar select { min-width: 220px; max-width: 380px; flex: 0 1 auto; height: 34px; font-weight: 600; }
.projectbar .proj-meta { color: var(--ink-2); font-size: 12.5px; margin-left: 4px; }
.script-cols {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "script voice" "run voice"; gap: 16px; align-items: start;
}
.sc-script { grid-area: script; }
.sc-voice { grid-area: voice; }
.sc-run { grid-area: run; }
.run-bar {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px 16px; box-shadow: var(--shadow-sm);
}
.run-bar-progress { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.para-card { scroll-margin-top: 110px; }
.script-text { width: 100%; min-height: 300px; height: 360px; font-size: 15px; line-height: 1.65; }
.split-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
.split-controls input[type="number"] { width: 100%; }
.split-stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.split-stats .stat-main { font-weight: 650; }
.split-preview { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.split-preview ol { margin: 0; padding: 6px 10px 6px 40px; }
.split-preview li { padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.split-preview li:last-child { border-bottom: 0; }
.split-preview .chars { color: var(--ink-3); font-size: 11.5px; margin-left: 6px; white-space: nowrap; }
.dirty-note { font-size: 12.5px; color: var(--warn); }

.run-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.run-stats { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.run-stats b { color: var(--ink); font-weight: 650; }
.parallel-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.para-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.para-toolbar select { height: 30px; }
.para-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.para {
  display: grid; grid-template-columns: 22px 40px minmax(0, 1fr) 132px auto; gap: 4px 10px;
  align-items: start; padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.para:last-child { border-bottom: 0; }
.para:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.para.selected { background: var(--accent-soft); }
.para.playing { background: var(--accent-soft); }
.para .para-check { padding-top: 3px; }
.para .para-num { color: var(--ink-3); font-size: 12.5px; padding-top: 2px; font-variant-numeric: tabular-nums; text-align: right; }
.para-text {
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 14px; cursor: text;
  border-radius: 5px; padding: 1px 4px; margin: -1px -4px; min-width: 0; unicode-bidi: plaintext;
}
.para-text:hover { background: var(--surface-2); }
.para.skipped .para-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.para-edit { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.para-edit textarea { width: 100%; min-height: 84px; font-size: 14px; }
.para-meta { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.para-meta .pill { align-self: flex-start; }
.para-err { color: var(--danger); font-size: 12px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; grid-column: 3 / -1; }
.para-actions { display: flex; gap: 2px; align-items: center; }
.para-actions .btn.icon { width: 28px; height: 28px; }
.para-override { font-size: 11.5px; color: var(--accent-text); }
.para-note { color: var(--warn); font-size: 12px; overflow-wrap: anywhere; grid-column: 3 / -1; }
.takes-list { display: flex; flex-direction: column; min-width: 280px; }
.take-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.take-row:hover { background: var(--surface-2); }
.take-row .take-info { flex: 1; min-width: 0; font-size: 12.5px; }
.take-row .take-info b { font-weight: 650; }
.export-results { display: flex; flex-direction: column; gap: 6px; }
.export-results a { overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ queue view */
.srv-name { font-weight: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.srv-url { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.srv-err { font-size: 12px; color: var(--danger); overflow-wrap: anywhere; margin-top: 2px; }
.srv-gpu { font-size: 12.5px; }
.tbl tr.srv-sub td.srv-queue { padding-top: 0; font-size: 12.5px; }
.tbl tr:has(+ tr.srv-sub) td { border-bottom-color: transparent; }
.srv-queue-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.srv-queue-label { font-weight: 650; color: var(--ink-2); }
.srv-queue-text { min-width: 0; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.job-text { max-width: 420px; overflow-wrap: anywhere; font-size: 13px; unicode-bidi: plaintext; }
.job-err { font-size: 12px; color: var(--danger); overflow-wrap: anywhere; max-width: 320px; }
.job-times { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.tbl td.job-para { min-width: 180px; }
.job-meta { font-size: 12px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.tbl .q-narrow { display: none; }
.add-server-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px 12px; }
.token-found { font-size: 12.5px; color: var(--accent-text); }

/* ------------------------------------------------------------------ team mode (SPEC 10.6) */
.auth-root { min-height: 100vh; background: var(--bg); }
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px 26px 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.auth-brand { font-weight: 700; font-size: 17px; color: var(--ink); margin-bottom: 4px; }
.auth-title { font-size: 17px; font-weight: 650; }
.auth-sub { color: var(--ink-2); font-size: 13px; }
.auth-card input { width: 100%; }
.auth-error { min-height: 1.45em; color: var(--danger); font-size: 13px; overflow-wrap: anywhere; }
.auth-error:empty { min-height: 0; }
.auth-submit { width: 100%; justify-content: center; }
.user-box { display: flex; align-items: center; min-width: 0; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; max-width: 260px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.user-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 550; unicode-bidi: plaintext; }
.role-pill {
  display: inline-flex; align-items: center; flex: none; height: 19px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 650; background: var(--surface-2); color: var(--ink-2);
}
.role-pill.role-admin { background: var(--accent-soft); color: var(--accent-text); }
.status-pill-revoked { background: var(--danger-soft); color: var(--danger); }
.acct-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; align-items: center; }
.acct-label { color: var(--ink-2); font-size: 13px; }
.owner-cell { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; unicode-bidi: plaintext; }
.tbl td.owner-cell { min-width: 84px; }
.page-head > .page-head-text { margin-right: auto; min-width: 0; }
.owner-select { max-width: 220px; }
.q-ahead { font-size: 13.5px; }
.q-ahead b { font-weight: 650; }
.team-name { font-weight: 600; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.team-sub { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.team-row-off td { color: var(--ink-3); }
.team-add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.team-secret {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.team-secret-value { font-size: 17px; font-weight: 650; letter-spacing: 0.02em; user-select: all; overflow-wrap: anywhere; min-width: 0; }
.team-choice { display: flex; flex-direction: column; gap: 8px; }
.team-choice label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.team-choice input { margin-top: 3px; }

/* ------------------------------------------------------------------ narrow widths (down to 900 px) */
@media (max-width: 1220px) {
  .script-cols { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "script" "voice" "run"; }
}
@media (max-width: 1180px) {
  /* Queue jobs table: project, server and failed tries move under the paragraph; Move/Cancel become one menu. */
  .tbl .q-wide { display: none; }
  .tbl div.q-narrow { display: block; }
  .tbl .btn.q-narrow { display: inline-flex; }
  .job-times { white-space: normal; min-width: 96px; }
}
@media (max-width: 1100px) {
  #view { padding: 16px 16px 48px; }
  .banner { padding: 10px 16px; }
  .split-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .para { grid-template-columns: 22px 34px minmax(0, 1fr) auto; }
  .para .para-meta { grid-column: 3; grid-row: 2; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .para .para-actions { grid-column: 4; grid-row: 1; }
  .server-dot .dot-name { display: none; }
  .add-server-grid { grid-template-columns: minmax(0, 1fr); }
  .team-add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-btn { max-width: 190px; }
}
