/* Conduit — MoHaHa Studios
   Dark studio surface: content is bright, chrome recedes. */

:root {
  --bg:        #0b0c0f;
  --bg-1:      #121419;
  --bg-2:      #171a21;
  --bg-3:      #1e222b;
  --line:      #262b36;
  --line-soft: #1c2029;

  --text:      #e8eaf0;
  --text-dim:  #9aa2b4;
  --text-mute: #6b7385;

  --accent:      #5b8cff;
  --accent-soft: #2a3a63;
  --accent-glow: rgba(91, 140, 255, 0.16);
  --good:      #3ecf8e;
  --warn:      #f5a623;
  --bad:       #f2555a;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;

  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --sidebar: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #2a2f3a; border-radius: 6px; border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #39404e; }

/* ─────────────────────────────────────────────── sign in */

.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(1000px 600px at 50% -10%, #16203a 0%, var(--bg) 60%);
}
.gate-card {
  width: 340px; padding: 32px 28px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.gate-mark {
  font-size: 22px; font-weight: 700; letter-spacing: 0.18em; text-align: center;
}
.gate-sub {
  margin: 6px 0 24px; text-align: center;
  color: var(--text-mute); font-size: 12.5px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 12px; color: var(--text-dim);
}

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { background: #262b36; border-color: #333a48; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #6f9bff, #5b8cff 55%, #7a63ff);
  border-color: transparent; color: #08101f;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-wide { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-ghost { background: transparent; }

.err {
  margin-top: 12px; padding: 8px 10px;
  background: rgba(242, 85, 90, .1);
  border: 1px solid rgba(242, 85, 90, .3);
  border-radius: var(--r-sm);
  color: #ffb3b6; font-size: 12.5px;
}

/* ─────────────────────────────────────────────── shell */

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100vh; }

.side {
  display: flex; flex-direction: column;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.brand {
  padding: 18px 20px 16px;
  font-size: 15px; font-weight: 700; letter-spacing: .16em;
  border-bottom: 1px solid var(--line-soft);
}
.brand span { display: block; margin-top: 3px;
  font-size: 10.5px; font-weight: 400; letter-spacing: .05em; color: var(--text-mute); }

.nav { padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--text-dim); cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.nav button:hover { background: var(--bg-2); color: var(--text); }
.nav button.on { background: var(--accent-glow); color: #cfdcff; }
.nav .ico { width: 16px; text-align: center; opacity: .85; }
.nav .tally {
  margin-left: auto; padding: 1px 6px;
  background: var(--bg-3); border-radius: 20px;
  font-size: 11px; color: var(--text-mute);
}

.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line-soft); }

.gpus { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.gpu {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); font-size: 11.5px;
  white-space: nowrap;
}
.gpu .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #384054; flex: none;
}
.gpu.busy .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.gpu .what { margin-left: auto; color: var(--text-mute); font-size: 11px; }

.whoami { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.whoami .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #0a1020;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}

.main { overflow-y: auto; }
.view { padding: 24px 28px 60px; max-width: 1500px; }

.head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.head h1 { margin: 0; font-size: 19px; font-weight: 650; }
.head p { margin: 2px 0 0; color: var(--text-mute); font-size: 12.5px; }
.head .spacer { flex: 1; }

.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.panel + .panel { margin-top: 16px; }
.panel h2 {
  margin: 0 0 14px; font-size: 13px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 180px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 20px; font-size: 12.5px; color: var(--text-dim); cursor: pointer;
}
.chip.on { background: var(--accent-glow); border-color: var(--accent-soft); color: #cfdcff; }

/* ─────────────────────────────────────────────── gallery */

.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}
.card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden; cursor: pointer;
  transition: transform .14s, border-color .14s;
}
.card:hover { transform: translateY(-2px); border-color: #39415a; }
.card .frame {
  aspect-ratio: 1; background: #0e1015;
  display: grid; place-items: center; overflow: hidden;
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .glyph { font-size: 32px; opacity: .3; }
.card .meta {
  padding: 7px 9px;
  font-size: 11.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .tag {
  position: absolute; top: 7px; left: 7px;
  padding: 2px 7px; border-radius: 5px;
  background: rgba(10, 12, 18, .82); backdrop-filter: blur(6px);
  font-size: 10.5px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .05em;
}

/* library: selection, detail panel, periods */

.lib-split { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
@media (max-width: 1180px) { .lib-split { grid-template-columns: 1fr; } }

.detail {
  position: sticky; top: 24px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px; font-size: 12.5px;
  max-height: calc(100vh - 60px); overflow-y: auto;
}
.detail h3 { margin: 0 0 4px; font-size: 13.5px; word-break: break-word; }
.detail .thumb { width: 100%; border-radius: var(--r-sm); margin-bottom: 12px; display: block; }
.detail dl { margin: 0; display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; }
.detail dt { color: var(--text-mute); font-size: 11.5px; }
.detail dd { margin: 0; word-break: break-word; }
.detail .prompt {
  margin: 12px 0 0; padding: 9px 10px;
  background: var(--bg-2); border-radius: var(--r-sm);
  color: var(--text-dim); line-height: 1.5; max-height: 190px; overflow-y: auto;
}
.detail .acts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.selbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--accent-glow); border: 1px solid var(--accent-soft);
  border-radius: var(--r);
}
.selbar .spacer { flex: 1; }
.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12.5px; }

.card .pick {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 20px; height: 20px; border-radius: 5px;
  background: rgba(10,12,18,.75); border: 1px solid var(--line);
  display: grid; place-items: center; cursor: pointer;
  font-size: 12px; color: transparent;
}
.card.picked { border-color: var(--accent); }
.card.picked .pick { background: var(--accent); border-color: var(--accent); color: #0a1020; }

.period-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-group .yr { color: var(--text-mute); font-size: 11.5px; margin-right: 2px; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 22px; color: var(--text-mute); font-size: 12.5px;
}

.empty {
  padding: 60px 20px; text-align: center; color: var(--text-mute);
}
.empty .glyph { font-size: 40px; opacity: .25; display: block; margin-bottom: 10px; }

/* ─────────────────────────────────────────────── jobs */

.jobs { display: flex; flex-direction: column; gap: 10px; }
.job {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 15px;
}
.job-top { display: flex; align-items: center; gap: 10px; }
.job .kind {
  padding: 2px 8px; border-radius: 5px; font-size: 11px;
  background: var(--bg-3); color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .05em;
}
.job .title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .state { margin-left: auto; font-size: 12px; }
.state-queued  { color: var(--text-mute); }
.state-running { color: var(--accent); }
.state-done    { color: var(--good); }
.state-error   { color: var(--bad); }
.state-cancelled { color: var(--text-mute); }
.state-rejected { color: var(--warn); }

.bar {
  height: 4px; margin-top: 10px;
  background: var(--bg-3); border-radius: 3px; overflow: hidden;
}
.bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), #8ab0ff);
  transition: width .3s ease;
}
.job .sub {
  margin-top: 7px; display: flex; gap: 10px; align-items: center;
  font-size: 11.5px; color: var(--text-mute);
}
.job .sub .gpubadge {
  padding: 1px 6px; background: var(--bg-3); border-radius: 4px;
}
.job .oops {
  margin-top: 8px; padding: 7px 9px;
  background: rgba(242, 85, 90, .08); border-radius: var(--r-sm);
  font-size: 11.5px; color: #ffb3b6;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-word;
}

.chain {
  margin-top: 10px; padding-left: 13px;
  border-left: 2px solid var(--line);
  display: flex; flex-direction: column; gap: 7px;
}
.chain-row { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.chain-row .nm { min-width: 110px; color: var(--text-dim); }
.chain-row .steps { display: flex; gap: 5px; }
.step {
  padding: 1px 7px; border-radius: 4px;
  background: var(--bg-3); font-size: 10.5px; color: var(--text-mute);
}
.step.on  { background: rgba(62, 207, 142, .14); color: var(--good); }
.step.bad { background: rgba(242, 85, 90, .14); color: var(--bad); }

/* ─────────────────────────────────────────────── drop zone */

.drop {
  border: 1.5px dashed var(--line);
  border-radius: var(--r);
  padding: 34px 20px; text-align: center;
  color: var(--text-mute); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-glow); }
.drop .glyph { font-size: 30px; display: block; margin-bottom: 8px; opacity: .5; }
.drop img { max-height: 200px; border-radius: var(--r-sm); }

/* ─────────────────────────────────────────────── overlay */

.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(6, 7, 10, .86); backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
}
.overlay-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
}
.overlay-bar .name { font-size: 13px; }
.overlay-bar .spacer { flex: 1; }
.overlay-body { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 20px; }
.overlay-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); }
#viewer { width: 100%; height: 100%; }
#viewer canvas { display: block; border-radius: var(--r); }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast div {
  padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--bg-3); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 12.5px;
  animation: rise .2s ease;
}
.toast div.bad { border-color: rgba(242,85,90,.4); color: #ffb3b6; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.hint { color: var(--text-mute); font-size: 11.5px; margin-top: 6px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
}

.gpu .tele { margin-left: auto; flex: none; color: var(--text-mute); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.gpu .tele.hot { color: var(--warn); }
.gpu.dead { opacity: .55; border-color: rgba(242,85,90,.35); }
.gpu.dead .dot { background: var(--bad); }
.gpu .what { margin-left: 0; }
select[multiple] { padding: 6px; height: auto; }

/* ─────────────────────────────────────────────── studio

   Three columns: the assets rail, the model, the property panel. The middle
   column is the only one that grows, and it has to be able to shrink below its
   content or the WebGL canvas pins the grid open (hence min-width: 0). */

.view-full { max-width: none; height: 100%; display: flex; flex-direction: column; }

.studio {
  flex: 1; min-height: 520px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 320px;
  gap: 14px;
}
@media (max-width: 1280px) {
  .studio { grid-template-columns: 200px minmax(0, 1fr); }
  .studio-props { grid-column: 1 / -1; }
}

.studio-rail, .studio-props, .studio-stage {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-width: 0;
}

/* assets rail */

.studio-rail { display: flex; flex-direction: column; padding: 10px; }
.studio-rail input {
  width: 100%; padding: 7px 9px; margin-bottom: 8px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text); font-size: 12.5px;
}
.st-assetlist { overflow-y: auto; flex: 1; max-height: calc(100vh - 220px); }

.st-asset {
  display: grid;
  grid-template-columns: 20px 1fr;
  grid-template-areas: "ico nm" "ico sub";
  gap: 0 8px;
  width: 100%; padding: 7px 8px; margin-bottom: 2px;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm);
  text-align: left; cursor: pointer; color: var(--text-dim);
}
.st-asset:hover { background: var(--bg-2); color: var(--text); }
.st-asset.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.st-asset .glyph { grid-area: ico; align-self: center; opacity: .5; }
.st-asset .nm { grid-area: nm; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-asset .sub { grid-area: sub; font-size: 10.5px; color: var(--text-mute); }

/* stage */

.studio-stage { display: flex; flex-direction: column; overflow: hidden; }
.st-stagehead {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
}
.st-title { font-size: 12.5px; color: var(--text-dim); word-break: break-all; }
.st-viewport { flex: 1; min-height: 420px; position: relative; background: #0e1015; }
.st-viewport canvas { display: block; width: 100%; height: 100%; }
.st-loading {
  position: absolute; inset: 0; display: grid; place-content: center;
  justify-items: center; gap: 10px; color: var(--text-mute); font-size: 12.5px;
}

/* property panel */

.studio-props { display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tabs button {
  flex: 1; padding: 10px 4px;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-mute); font-size: 11.5px; cursor: pointer;
}
.tabs button:hover { color: var(--text-dim); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

.st-panel {
  flex: 1; overflow-y: auto; padding: 14px; font-size: 12.5px;
  max-height: calc(100vh - 230px);
}
.st-panel dl { margin: 0; display: grid; grid-template-columns: 84px 1fr; gap: 6px 10px; }
.st-panel dt { color: var(--text-mute); font-size: 11.5px; }
.st-panel dd { margin: 0; word-break: break-word; }
.st-panel h4 { margin: 16px 0 8px; font-size: 12px; color: var(--text-dim); font-weight: 600; }
.st-panel textarea, .st-panel input[type=text] {
  width: 100%; padding: 7px 9px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text); font-size: 12.5px; resize: vertical;
}
.st-panel input[type=range] { width: 100%; accent-color: var(--accent); }
.st-panel .path { font-size: 11px; color: var(--text-mute); word-break: break-all; }
.st-panel .acts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.st-panel .prompt {
  margin-top: 10px; padding: 9px 10px; background: var(--bg-3);
  border-radius: var(--r-sm); font-size: 11.5px; color: var(--text-dim);
}

.saved { font-size: 11.5px; color: var(--text-mute); }

/* parts list */

.st-partbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--text-mute); font-size: 11.5px; }
.st-partbar .spacer { flex: 1; }

.st-parts { border: 1px solid var(--line-soft); border-radius: var(--r-sm); overflow: hidden; }
.st-part {
  display: grid; grid-template-columns: 12px 1fr auto 26px;
  align-items: center; gap: 8px;
  padding: 7px 9px; cursor: pointer; border-bottom: 1px solid var(--line-soft);
}
.st-part:last-child { border-bottom: none; }
.st-part:hover { background: var(--bg-2); }
.st-part.on { background: var(--accent-soft); }
.st-part .dot { width: 10px; height: 10px; border-radius: 50%; }
.st-part .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-part .sub { font-size: 10.5px; color: var(--text-mute); }
.st-part .eye {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 13px; padding: 0;
}
.st-part .eye.off { color: var(--text-mute); opacity: .5; }

/* part editor */

.st-editor { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.st-editor h4 { margin-top: 0; }

.st-swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.st-swatches .sw {
  width: 22px; height: 22px; border-radius: var(--r-sm);
  border: 1px solid var(--line); cursor: pointer;
  background: var(--bg-3); color: var(--text-mute); font-size: 10px; padding: 0;
}
.st-swatches .sw.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent-glow); }

.st-vec { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.st-axis { display: flex; align-items: center; gap: 4px; }
.st-axis span { color: var(--text-mute); font-size: 11px; width: 9px; }
.st-axis input {
  width: 100%; min-width: 0; padding: 5px 6px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text); font-size: 11.5px;
}

/* related files and history */

.st-related { display: flex; flex-direction: column; gap: 4px; }
.st-rel {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 6px 8px; background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); cursor: pointer; text-align: left; color: var(--text-dim);
}
.st-rel:hover:not([disabled]) { border-color: var(--accent); color: var(--text); }
.st-rel[disabled] { cursor: default; opacity: .55; }
.st-rel .role {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-mute); background: var(--bg-3);
  padding: 2px 5px; border-radius: 3px;
}
.st-rel .nm { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-rel .sub { font-size: 10.5px; color: var(--text-mute); }

.st-timeline { display: flex; flex-direction: column; gap: 6px; }
.st-event {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 8px;
  padding: 8px 10px; background: var(--bg-2);
  border-left: 2px solid var(--line); border-radius: var(--r-sm);
}
.st-event.state-done { border-left-color: var(--good); }
.st-event.state-error { border-left-color: var(--bad); }
.st-event.state-running { border-left-color: var(--accent); }
.st-event .kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-mute);
}
.st-event .nm { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.st-event .sub { grid-column: 1 / -1; font-size: 10.5px; color: var(--text-mute); }
.st-event .oops { grid-column: 1 / -1; }

/* ─────────────────────────────────────────────── service banner */

.banner {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 28px -6px;
  padding: 10px 14px;
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: var(--r-sm);
  color: var(--text-dim); font-size: 12.5px;
}
.banner .glyph { color: var(--warn); font-size: 15px; }
.banner .spacer { flex: 1; }

/* ───────────────────────────────── generation studio (Skapa)

   The same three-column reading order as the studio view: what you set on the
   left, the work in the middle, what you picked on the right. Everything here
   is namespaced .gen-* so the library and studio keep their own vocabulary. */

.gen {
  flex: 1; min-height: 560px;
  display: grid;
  grid-template-columns: 344px minmax(0, 1fr) 320px;
  gap: 14px;
}
@media (max-width: 1400px) {
  .gen { grid-template-columns: 320px minmax(0, 1fr); }
  .gen-side { grid-column: 1 / -1; max-height: 340px; }
}
@media (max-width: 900px) { .gen { grid-template-columns: 1fr; } }

.gen-composer, .gen-stage, .gen-side {
  background: linear-gradient(180deg, #15181f 0%, var(--bg-1) 46%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
  min-width: 0; overflow: hidden;
  display: flex; flex-direction: column;
}

/* ── composer ── */

.gen-scroll {
  flex: 1; overflow-y: auto;
  padding: 15px 15px 6px;
  display: flex; flex-direction: column; gap: 15px;
}
.gen-block { display: flex; flex-direction: column; gap: 9px; }
.gen-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-mute);
}
.gen-count, .gen-dims {
  margin-left: auto; letter-spacing: 0; text-transform: none;
  font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.gen-prompt { min-height: 92px; background: var(--bg-2); font-size: 13px; }
.gen-frags .chip { padding: 4px 9px; font-size: 11.5px; }

/* folds — the settings that are usually right stay out of the way */

.gen-fold { gap: 0; }
.gen-fold > summary {
  list-style: none; cursor: pointer; padding: 2px 0;
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-mute);
}
.gen-fold > summary::-webkit-details-marker { display: none; }
.gen-fold > summary::before { content: '▸'; font-size: 10px; transition: transform .15s; }
.gen-fold[open] > summary::before { transform: rotate(90deg); }
.gen-fold > summary:hover { color: var(--text-dim); }
.gen-fold > *:not(summary) { margin-top: 10px; }
.gen-pill {
  margin-left: auto; padding: 1px 7px; border-radius: 20px;
  background: var(--bg-3); color: var(--text-mute); font-size: 10.5px;
  letter-spacing: 0;
}
.gen-pill.on { background: var(--accent-soft); color: #cfdcff; }

/* model picker — the model carries its own settings, so it is a choice with
   consequences and gets more room than a dropdown would give it */

.gen-models { display: flex; flex-direction: column; gap: 5px; max-height: 232px; overflow-y: auto; }
.gen-model {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  padding: 7px 10px; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r); color: var(--text-dim);
  transition: border-color .14s, color .14s, background .14s;
}
.gen-model:hover { border-color: #39415a; color: var(--text); }
.gen-model.on {
  border-color: var(--accent); color: var(--text);
  background: linear-gradient(90deg, var(--accent-glow), transparent 72%);
}
.gen-model .nm { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-model .fam {
  padding: 2px 7px; border-radius: 20px; background: var(--bg-3);
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute);
}
.gen-model.on .fam { background: var(--accent-soft); color: #cfdcff; }
.gen-preset {
  padding: 8px 10px; line-height: 1.45; font-size: 11.5px; color: var(--text-dim);
  background: rgba(91, 140, 255, .06);
  border: 1px solid var(--accent-soft); border-radius: var(--r-sm);
}

/* format */

.gen-ratios { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.gen-ratio {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 6px; min-width: 0; padding: 8px 2px 5px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); cursor: pointer; color: var(--text-mute); font-size: 9.5px;
}
.gen-ratio i { border: 1.5px solid currentColor; border-radius: 2px; opacity: .55; }
.gen-ratio:hover { color: var(--text-dim); border-color: #39415a; }
.gen-ratio.on { color: #cfdcff; border-color: var(--accent); background: var(--accent-glow); }
.gen-ratio.on i { opacity: 1; }

.gen-seg {
  display: flex; gap: 3px; padding: 3px;
  background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}
.gen-seg button {
  flex: 1; padding: 6px 4px; border: 0; border-radius: 5px;
  background: none; color: var(--text-mute); cursor: pointer;
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.gen-seg button:hover { color: var(--text); }
.gen-seg button.on { background: var(--bg-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* loras */

.gen-loras { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.gen-lora {
  padding: 7px 9px; background: var(--bg-2);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}
.gen-lora.on { border-color: var(--accent-soft); background: var(--accent-glow); }
.gen-lora .top { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.gen-lora .box {
  width: 15px; height: 15px; flex: none; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg-3);
  display: grid; place-items: center; font-size: 10px; color: transparent;
}
.gen-lora.on .box { background: var(--accent); border-color: var(--accent); color: #0a1020; }
.gen-lora .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-lora .w { margin-left: auto; font-size: 11px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.gen-lora input[type=range] { width: 100%; margin-top: 7px; accent-color: var(--accent); }

/* advanced */

.gen-slider, .gen-seed {
  display: grid; grid-template-columns: 62px 1fr 44px;
  align-items: center; gap: 9px; font-size: 12px; color: var(--text-dim);
}
.gen-slider input[type=range] { width: 100%; accent-color: var(--accent); }
.gen-slider b { text-align: right; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.gen-seed input { font-variant-numeric: tabular-nums; }

/* fire button — pinned, because it is the one thing you always came here for */

.gen-go {
  flex: none; padding: 12px 16px 14px;
  border-top: 1px solid var(--line-soft);
  background: rgba(11, 12, 15, .55); backdrop-filter: blur(8px);
}
.gen-fire {
  padding: 11px 14px; font-size: 13.5px; border: 0;
  background: linear-gradient(135deg, #6f9bff, #5b8cff 50%, #7a63ff);
  box-shadow: 0 6px 20px rgba(91, 140, 255, .26);
  transition: filter .15s, box-shadow .15s, opacity .15s;
}
.gen-fire:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 8px 26px rgba(91, 140, 255, .4); }
.gen-fire kbd {
  font: inherit; font-size: 10.5px; opacity: .62;
  background: rgba(0, 0, 0, .18); padding: 1px 6px; border-radius: 4px;
}
.gen-note { margin-top: 8px; font-size: 11px; color: var(--text-mute); line-height: 1.45; }

/* ── stage ── */

.gen-stagehead {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-bottom: 1px solid var(--line);
}
.gen-stagehead .spacer { flex: 1; }
.gen-state { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; }
.gen-state::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: #3a4256;
}
.gen-state.busy::before {
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.gen-state.done::before { background: var(--good); }
.gen-state.bad::before  { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.gen-substate, .gen-elapsed {
  font-size: 11.5px; color: var(--text-mute); font-variant-numeric: tabular-nums;
}

.gen-canvas {
  flex: 1; overflow-y: auto; padding: 16px;
  background: radial-gradient(760px 380px at 50% -10%, rgba(91, 140, 255, .07), transparent 70%);
}
.gen-tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); }

.gen-tile {
  position: relative; overflow: hidden; cursor: pointer;
  background: #0e1015; border: 1px solid var(--line-soft); border-radius: var(--r);
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.gen-tile:hover { transform: translateY(-3px); border-color: #3f4864; box-shadow: 0 14px 32px rgba(0,0,0,.45); }
.gen-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 14px 32px rgba(0,0,0,.5); }
.gen-tile img { display: block; width: 100%; height: 100%; object-fit: cover; animation: fadein .45s ease; }
@keyframes fadein { from { opacity: 0; transform: scale(1.015); } }
.gen-tile .acts {
  position: absolute; inset: auto 0 0 0; display: flex; gap: 6px; padding: 8px;
  background: linear-gradient(transparent, rgba(6, 7, 10, .9));
  opacity: 0; transition: opacity .16s;
}
.gen-tile:hover .acts, .gen-tile.on .acts { opacity: 1; }
.gen-tile .acts .btn { flex: 1; background: rgba(20, 23, 30, .82); backdrop-filter: blur(6px); }

/* a tile that does not exist yet, shaped like the one that will */

.gen-skel {
  position: relative; border-radius: var(--r); border: 1px solid var(--line-soft); overflow: hidden;
  background: linear-gradient(100deg, var(--bg-2) 20%, #242939 38%, var(--bg-2) 56%);
  background-size: 280% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -180% 0; } }
.gen-skel span {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-mute); font-size: 11.5px;
}

/* ── inspector ── */

.gen-side { padding: 14px; overflow-y: auto; display: block; font-size: 12.5px; }
.gen-side h3 { margin: 0 0 10px; font-size: 12px; color: var(--text-dim); font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; }
.gen-side .shot { width: 100%; border-radius: var(--r-sm); display: block; margin-bottom: 12px; }
.gen-side dl { margin: 0; display: grid; grid-template-columns: 74px 1fr; gap: 6px 10px; }
.gen-side dt { color: var(--text-mute); font-size: 11.5px; }
.gen-side dd { margin: 0; word-break: break-word; font-variant-numeric: tabular-nums; }
.gen-side .prompt {
  margin: 12px 0 0; padding: 9px 10px; background: var(--bg-2);
  border-radius: var(--r-sm); color: var(--text-dim); line-height: 1.5;
  max-height: 160px; overflow-y: auto;
}
.gen-side .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.gen-run {
  display: block; width: 100%; text-align: left; margin-bottom: 6px; padding: 9px 10px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); cursor: pointer; color: inherit;
}
.gen-run:hover { border-color: var(--accent); }
.gen-run .p {
  font-size: 11.5px; color: var(--text-dim); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gen-run .m { margin-top: 4px; display: flex; gap: 8px; font-size: 10.5px; color: var(--text-mute); }
.gen-run .strip { display: flex; gap: 3px; margin-top: 6px; }
.gen-run .strip img { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; }

/* health pills in the view header */

.gen-health { display: flex; gap: 6px; flex-wrap: wrap; }
.gen-health .pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--text-dim);
}
.gen-health .pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.gen-health .pill.bad { border-color: rgba(242, 85, 90, .35); color: #ffb3b6; }
.gen-health .pill.bad i { background: var(--bad); }
