/* HPC Submitter — layout and theme.
   Two themes driven by [data-theme] on <html>; every colour is a token. */

/* Light is the default theme; dark is opt-in via [data-theme="dark"].
   Every colour is a token, so the two blocks below are the whole palette. */
:root {
  --bg:            #f4f6f9;
  --bg-raised:     #ffffff;
  --bg-sunken:     #eceff4;
  --bg-input:      #ffffff;
  --bg-hover:      #e8ecf2;
  --border:        #d8dee7;
  --border-strong: #bcc5d1;
  --text:          #1a1f27;
  --text-dim:      #55606e;
  --text-faint:    #7a8594;
  --accent:        #1f6feb;
  --accent-hover:  #1a5fd0;
  --accent-soft:   rgba(31, 111, 235, 0.10);
  --good:          #1a7f37;
  --good-soft:     rgba(26, 127, 55, 0.10);
  --warn:          #9a6700;
  --warn-soft:     rgba(154, 103, 0, 0.12);
  --bad:           #cf222e;
  --bad-soft:      rgba(207, 34, 46, 0.10);
  --wait:          #8250df;
  --wait-soft:     rgba(130, 80, 223, 0.10);
  --gpu:           #0f766e;
  --gpu-soft:      rgba(15, 118, 110, 0.10);
  --shadow:        0 6px 20px rgba(16, 24, 40, 0.12);
  --radius:        8px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --header-h: 56px;
}

html[data-theme="dark"] {
  --bg:            #0f1115;
  --bg-raised:     #16191f;
  --bg-sunken:     #0b0d10;
  --bg-input:      #1b1f26;
  --bg-hover:      #21262e;
  --border:        #262c35;
  --border-strong: #333b46;
  --text:          #e4e7ec;
  --text-dim:      #98a1ae;
  --text-faint:    #667080;
  --accent:        #4c8dff;
  --accent-hover:  #6aa1ff;
  --accent-soft:   rgba(76, 141, 255, 0.14);
  --good:          #3fb950;
  --good-soft:     rgba(63, 185, 80, 0.14);
  --warn:          #d9a13b;
  --warn-soft:     rgba(217, 161, 59, 0.14);
  --bad:           #f0616d;
  --bad-soft:      rgba(240, 97, 109, 0.14);
  --wait:          #a371f7;
  --wait-soft:     rgba(163, 113, 247, 0.14);
  --gpu:           #2dd4bf;
  --gpu-soft:      rgba(45, 212, 191, 0.14);
  --shadow:        0 8px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

/* The hidden attribute must win over any author display rule below.
   Without this, `.field { display: flex }` and friends override the UA
   stylesheet's `[hidden] { display: none }` and the element stays visible —
   which is how the modal ended up on screen with no handlers attached. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

code, .mono, pre, textarea.mono, input[spellcheck="false"] { font-family: var(--mono); }
code { font-size: 0.92em; }

/* ─────────────────────────────── top bar ─────────────────────────────── */

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.brand-mark { color: var(--accent); font-size: 20px; letter-spacing: -2px; }
.brand h1 { font-size: 14px; font-weight: 650; margin: 0; letter-spacing: 0.01em; }
.brand-sub { margin: 0; font-size: 11px; color: var(--text-faint); }
.brand-sub code { color: var(--text-dim); }

.tabs { display: flex; gap: 2px; background: var(--bg-sunken); padding: 3px; border-radius: var(--radius); }
.tab {
  border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 12.5px; font-weight: 550;
  padding: 6px 16px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.is-active { background: var(--accent); color: #fff; }
.tab-count {
  background: rgba(255,255,255,0.22); border-radius: 999px;
  padding: 0 6px; font-size: 10.5px; font-variant-numeric: tabular-nums;
}
.tab:not(.is-active) .tab-count { background: var(--accent-soft); color: var(--accent); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.status {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--text-dim);
  padding: 4px 10px; background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dot-ok   { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.dot-bad  { background: var(--bad);  box-shadow: 0 0 0 3px var(--bad-soft); }
.dot-idle { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ─────────────────────────────── buttons ─────────────────────────────── */

.btn {
  font: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--text); background: var(--bg-input);
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--text-faint); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-xs { padding: 2px 7px; font-size: 11px; font-weight: 500; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--bg-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-accent { background: var(--good); border-color: var(--good); color: #fff; }
.btn-accent:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger { color: var(--bad); border-color: var(--bad-soft); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }

.is-spinning .spin-target { display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────── panels ─────────────────────────────── */

.panel { display: none; height: calc(100vh - var(--header-h)); overflow: hidden; }
.panel.is-active { display: grid; }

#panel-files   { grid-template-columns: minmax(300px, 27%) 1fr; }
#panel-builder { grid-template-columns: 1fr minmax(400px, 42%); }
#panel-monitor { grid-template-columns: 1fr; }
#panel-monitor.has-output { grid-template-columns: 1fr minmax(380px, 44%); }

/* ───────────────────────────── file browser ──────────────────────────── */

.sidebar {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
  min-width: 0;
}

.root-switch { display: flex; gap: 4px; padding: 10px 12px 0; }
.root-btn {
  flex: 1; font: inherit; font-size: 12px; font-weight: 550;
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
  background: var(--bg-sunken); border: 1px solid var(--border); color: var(--text-dim);
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.root-btn:hover { color: var(--text); }
.root-btn.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.sidebar-actions { display: flex; gap: 5px; padding: 10px 12px; flex-wrap: wrap; }
.sidebar-actions .btn { flex: 1 1 auto; justify-content: center; }
.sidebar-actions .btn-ghost { flex: 0 0 auto; }

.path-bar { display: flex; gap: 5px; padding: 0 12px 8px; }
.path-bar input { flex: 1; min-width: 0; }

.crumbs {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
  padding: 0 12px 8px; font-size: 11.5px; color: var(--text-faint);
}
.crumb { color: var(--text-dim); cursor: pointer; padding: 1px 4px; border-radius: 4px; }
.crumb:hover { background: var(--bg-hover); color: var(--accent); }
.crumb-sep { color: var(--text-faint); opacity: 0.5; }

.listing { flex: 1; overflow-y: auto; border-top: 1px solid var(--border); padding: 4px 0; }
.row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; cursor: pointer; font-size: 12.5px;
  border-left: 2px solid transparent;
}
.row:hover { background: var(--bg-hover); }
.row.is-selected { background: var(--accent-soft); border-left-color: var(--accent); }
.row-icon { width: 15px; text-align: center; flex: none; opacity: 0.85; font-size: 12px; }
.row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.is-dir .row-name { font-weight: 550; }
.row-size { font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; flex: none; }
.row-menu {
  flex: none; opacity: 0; border: 0; background: transparent; cursor: pointer;
  color: var(--text-dim); padding: 0 2px; font-size: 13px; border-radius: 4px;
}
.row:hover .row-menu { opacity: 1; }
.row-menu:hover { color: var(--accent); background: var(--bg-input); }
.row-link { color: var(--wait); font-size: 10px; }

.empty, .hint { padding: 18px 14px; color: var(--text-faint); font-size: 12px; text-align: center; }
.hint { padding: 6px 0; text-align: left; }

.storage { border-top: 1px solid var(--border); padding: 8px 12px; font-size: 10.5px; color: var(--text-faint); }
.storage-row { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
.storage-row b { font-weight: 550; color: var(--text-dim); }

/* ─────────────────────────────── viewer ─────────────────────────────── */

.viewer { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.viewer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-raised); min-height: 47px;
}
.viewer-title { min-width: 0; flex: 1; }
.viewer-name { font-size: 13px; font-weight: 600; font-family: var(--mono); display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta { font-size: 10.5px; color: var(--text-faint); }
.viewer-actions { display: flex; gap: 5px; flex: none; }
.viewer-body { flex: 1; overflow: auto; }

.viewer-body pre { margin: 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.6; }
.viewer-body pre code { background: none; padding: 0; }
.viewer-body textarea {
  width: 100%; height: 100%; border: 0; resize: none; outline: none;
  padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--bg-sunken); color: var(--text);
}

.placeholder { padding: 40px; color: var(--text-dim); max-width: 560px; }
.placeholder-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.placeholder-list { padding-left: 18px; font-size: 12.5px; line-height: 1.9; color: var(--text-dim); }

.banner {
  margin: 12px 16px; padding: 9px 12px; border-radius: 6px; font-size: 12px;
  background: var(--warn-soft); border: 1px solid var(--warn); color: var(--text);
}

/* ─────────────────────────────── builder ────────────────────────────── */

.form-col { overflow-y: auto; padding: 16px; min-width: 0; }

.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-dim); margin: 0; flex: none;
}
.card-head .switch, .card-head .segmented { margin-left: auto; }

.rule { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.grid + .grid, .grid + .field, .field + .grid, .field + .field { margin-top: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.label { font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.label em { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); font-weight: 400; }
.label-row { display: flex; align-items: center; gap: 8px; }
.label-row .label { flex: 1; }
.label-actions { display: flex; gap: 4px; align-items: center; }
.field small { font-size: 10.5px; color: var(--text-faint); line-height: 1.45; }
.warn-text { color: var(--warn); }

input[type="text"], input[type="number"], select, textarea {
  font: inherit; font-size: 12.5px;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 6px 9px; width: 100%; min-width: 0; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.55; }
select { cursor: pointer; appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%),
                    linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.mini-select { width: auto; padding: 3px 24px 3px 7px; font-size: 11.5px; }

.input-row { display: flex; gap: 5px; }
.input-row input { flex: 1; }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.check input { width: auto; margin: 0; accent-color: var(--accent); cursor: pointer; }
.check-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 34px; height: 19px; border-radius: 999px; background: var(--bg-sunken);
  border: 1px solid var(--border-strong); position: relative; transition: 0.15s; flex: none;
}
.switch-knob {
  position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--text-faint); transition: 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(15px); background: #fff; }
.switch-label { font-size: 12px; font-weight: 550; color: var(--text-dim); }
.switch input:checked ~ .switch-label { color: var(--accent); }

.segmented { display: flex; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.segmented button {
  border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 11.5px; font-weight: 550;
  padding: 4px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--accent); color: #fff; }

.note-inline {
  font-size: 11.5px; color: var(--text-dim); background: var(--accent-soft);
  border-left: 2px solid var(--accent); border-radius: 0 6px 6px 0;
  padding: 8px 11px; margin-bottom: 12px; line-height: 1.55;
}

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.chip {
  font: inherit; font-size: 11px; font-family: var(--mono);
  background: var(--bg-sunken); border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 999px; padding: 3px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip:hover { border-color: var(--text-faint); color: var(--text); }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-meta { font-size: 9.5px; opacity: 0.72; }
.chip.is-restricted { border-style: dashed; }
.chip-free { color: var(--good); font-size: 9.5px; font-weight: 700; }

.env-rows { display: flex; flex-direction: column; gap: 5px; }
.env-row { display: flex; gap: 5px; align-items: center; }
.env-row input:first-child { flex: 0 0 34%; }
.env-row input:nth-child(2) { flex: 1; }

/* ─────────────────────────── script preview ─────────────────────────── */

.preview-col {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-raised); border-left: 1px solid var(--border);
}
.preview-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.preview-head h2 {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-dim); margin: 0; flex: 1;
}
.preview-head-actions { display: flex; gap: 4px; align-items: center; }

.preview-meta {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 9px 14px 0; font-size: 10.5px;
}
.meta-pill {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 9px; color: var(--text-dim);
  font-family: var(--mono); font-size: 10.5px;
}
.meta-pill b { color: var(--text); font-weight: 600; }
.meta-pill.is-gpu { background: var(--gpu-soft); border-color: var(--gpu); color: var(--gpu); }
.meta-pill.is-array { background: var(--wait-soft); border-color: var(--wait); color: var(--wait); }

.preview-messages { padding: 9px 14px 0; display: flex; flex-direction: column; gap: 5px; }
.msg {
  font-size: 11.5px; line-height: 1.5; padding: 7px 10px;
  border-radius: 6px; border-left: 2px solid;
}
.msg-warn { background: var(--warn-soft); border-color: var(--warn); }
.msg-note { background: var(--accent-soft); border-color: var(--accent); color: var(--text-dim); }
.msg-error { background: var(--bad-soft); border-color: var(--bad); }

.preview-code {
  flex: 1; overflow: auto; margin: 10px 0 0;
  padding: 12px 14px; background: var(--bg-sunken);
  border-top: 1px solid var(--border); font-size: 12px; line-height: 1.6;
}
.preview-code code { background: none; padding: 0; }

.submit-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-top: 1px solid var(--border); background: var(--bg-raised);
}
.submit-target {
  flex: 1; min-width: 0; font-size: 10.5px; color: var(--text-faint);
  font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.submit-actions { display: flex; gap: 6px; flex: none; }

/* ─────────────────────────────── monitor ────────────────────────────── */

.monitor-col { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.monitor-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-raised);
}
.monitor-summary { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; font-size: 11.5px; }
.monitor-actions { display: flex; gap: 8px; align-items: center; flex: none; }

.jobs-wrap { flex: 1; overflow: auto; }
.jobs { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.jobs thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-raised); border-bottom: 1px solid var(--border);
  text-align: left; padding: 8px 12px; font-size: 10.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint);
  white-space: nowrap;
}
.jobs td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.jobs tbody tr:hover { background: var(--bg-hover); }
.jobs tbody tr.is-selected { background: var(--accent-soft); }
.jobs tbody tr.is-done td { color: var(--text-faint); }
.right { text-align: right; }
.jobs td.right { white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; font-family: var(--mono);
  padding: 2px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.badge-r    { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.badge-qw   { background: var(--wait-soft); border-color: var(--wait); color: var(--wait); }
.badge-hqw  { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.badge-Eqw  { background: var(--bad-soft);  border-color: var(--bad);  color: var(--bad); }
.badge-done { background: var(--bg-sunken); border-color: var(--border-strong); color: var(--text-faint); }
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-r .badge-dot { animation: pulse 1.6s infinite; }

.job-name { font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.job-id { font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); }
.job-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.job-script { font-size: 10px; color: var(--text-faint); font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

.gpu-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--gpu-soft); border: 1px solid var(--gpu); color: var(--gpu);
  border-radius: 5px; padding: 2px 8px; font-size: 11px; font-weight: 650;
  font-family: var(--mono); white-space: nowrap;
}
.gpu-badge.is-pending { background: transparent; border-style: dashed;
  border-color: var(--border-strong); color: var(--text-faint); font-weight: 500; }
.gpu-req { font-size: 10px; color: var(--text-faint); font-family: var(--mono); display: block; margin-top: 2px; }
.gpu-none { color: var(--text-faint); font-size: 11px; }

.task-mini { font-size: 10.5px; color: var(--text-dim); font-family: var(--mono); white-space: nowrap; }
.task-mini b { color: var(--good); }
.node-cell { font-size: 11px; font-family: var(--mono); color: var(--text-dim); }
.node-more { color: var(--text-faint); font-size: 10px; }
.time-cell { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-sub { font-size: 10px; color: var(--text-faint); display: block; }

/* ─────────────────────────── output panel ───────────────────────────── */

.output-col { display: none; flex-direction: column; min-width: 0;
  background: var(--bg-raised); border-left: 1px solid var(--border); }
#panel-monitor.has-output .output-col { display: flex; }
.output-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.output-head > div:first-child { flex: 1; min-width: 0; }
.output-title { font-size: 12.5px; font-weight: 600; font-family: var(--mono); display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-meta { font-size: 10.5px; color: var(--text-faint); }
.output-actions { display: flex; gap: 5px; align-items: center; flex: none; }
.output-actions .mini-select { max-width: 180px; }
.output-body {
  flex: 1; overflow: auto; margin: 0; padding: 12px 14px;
  background: var(--bg-sunken); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.output-body .gpu-line { color: var(--gpu); font-weight: 600; }
.output-body .err-line { color: var(--bad); }

/* ──────────────────────────── toasts, modal ─────────────────────────── */

.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast {
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent); border-radius: 6px;
  padding: 10px 13px; font-size: 12.5px; box-shadow: var(--shadow);
  animation: slide-in 0.16s ease-out;
}
.toast-ok  { border-left-color: var(--good); }
.toast-bad { border-left-color: var(--bad); }
.toast-warn{ border-left-color: var(--warn); }
.toast b { display: block; margin-bottom: 2px; font-size: 12px; }
.toast pre { margin: 5px 0 0; font-size: 11px; color: var(--text-dim);
  white-space: pre-wrap; max-height: 140px; overflow: auto; }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 20px; width: min(460px, 100%); box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; font-size: 14px; }
.modal-message { margin: 0 0 12px; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.modal-message code { word-break: break-all; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ─────────────────────────────── scrollbars ─────────────────────────── */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px;
  border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

@media (max-width: 1100px) {
  #panel-builder { grid-template-columns: 1fr; }
  .preview-col { border-left: 0; border-top: 1px solid var(--border); }
  #panel-files { grid-template-columns: minmax(240px, 34%) 1fr; }
}
