/* FaceStudio: a quiet media workspace. Neutral surfaces keep the reference images central. */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --raised: #eef1f5;
  --line: #d4dbe4;
  --line-soft: #e4e8ee;
  --text: #18212c;
  --muted: #617083;
  --faint: #748194;
  --accent: #315dce;
  --accent-hi: #244cba;
  --accent-ink: #ffffff;
  --ok: #247354;
  --risk: #93601b;
  --bad: #b74343;
  --radius: 8px;
  --font: "Golos Text", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- workspace navigation ---------- */
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; background: var(--accent); color: white; padding: 12px 20px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.top { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 216px; display: flex; flex-direction: column; padding: 32px 18px 20px; background: #fff; border-right: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 20px; text-decoration: none; letter-spacing: -.7px; padding: 0 6px; }
.brand small { display: block; font-size: 11px; font-weight: 400; letter-spacing: .1px; color: var(--muted); margin-top: 2px; }
.brand-mark { display: flex; gap: 4px; align-items: center; width: 30px; height: 36px; transform: skewY(-13deg); }
.brand-mark i { display: block; width: 11px; height: 30px; border-radius: 3px; background: var(--accent); }
.brand-mark i:last-child { height: 22px; background: #95abe4; }
.tabs { display: flex; flex-direction: column; gap: 7px; margin-top: 48px; }
.tabs a { display: flex; align-items: center; gap: 13px; min-height: 45px; padding: 10px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; }
.tabs svg, .icon-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; flex-shrink: 0; }
.tabs a:hover { color: var(--text); background: var(--bg); }
.tabs a.on { color: var(--accent); background: #edf2ff; }
.tab-count:empty { display: none; }
.tab-count { margin-left: auto; min-width: 21px; padding: 1px 6px; border-radius: 5px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; }
.sidebar-note { margin-top: auto; padding: 40px 14px 22px; color: #8e9bab; }
.studio-symbol { font-size: 32px; font-weight: 700; letter-spacing: -2px; color: #dce2ea; }
.sidebar-note p { font-size: 12px; line-height: 1.7; margin: 7px 0; }
.top-right { border-top: 1px solid var(--line-soft); padding-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.gpu { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px; text-decoration: none; color: var(--muted); font-size: 11px; }
.gpu-bar { position: relative; width: 100%; height: 4px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.gpu-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: #849bc7; transition: width .4s; }
.gpu-bar b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .55; }
.gpu.busy .gpu-bar i { background: var(--risk); }
.icon-link { display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-decoration: none; color: var(--muted); border-radius: 8px; }
.icon-link:hover, .icon-link.on { color: var(--accent); background: #edf2ff; }
.workspace-top { height: 76px; margin-left: 216px; padding: 0 38px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.workspace-top strong { color: var(--text); font-weight: 500; }
.breadcrumb-slash { margin: 0 14px; color: #b6becb; }
.connection { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.connection i { height: 6px; width: 6px; border-radius: 50%; background: var(--ok); }
.connection.offline i { background: var(--risk); }

/* ---------- layout ---------- */
main { padding: 32px 38px 64px; max-width: 1900px; margin: 0 0 0 216px; outline: none; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 30px; line-height: 1.25; font-weight: 600; letter-spacing: -1px; margin: 0; }
.page-head { margin-bottom: 28px; }
.page-head p { font-size: 13px; margin: 8px 0 0; }
.page-title { margin-right: auto; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 22px; }
.panel h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.empty { padding: 80px 30px; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.7; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 16px; font-weight: 600; margin-bottom: 6px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raised); }
.btn.danger { color: var(--bad); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
input[type=text], input[type=password], input[type=number], select {
  height: 38px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; min-width: 0;
}
select { padding-right: 6px; }
input:focus, select:focus { border-color: var(--accent); outline: none; }
label.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
label.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 2px; }
.seg button { border: 0; background: none; height: 28px; padding: 0 11px; border-radius: 5px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--raised); color: var(--text); }
.seg button .n { color: var(--faint); margin-left: 4px; }

.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; background: var(--raised); color: var(--muted); }
.chip.ok { background: rgba(92, 197, 150, .16); color: var(--ok); }
.chip.risk { background: rgba(227, 172, 82, .16); color: var(--risk); }
.chip.skip, .chip.bad { background: rgba(226, 114, 114, .16); color: var(--bad); }
.chip.run { background: #edf2ff; color: var(--accent-hi); }

.bar { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .5s; }
.warn-list { margin: 0; padding: 0; list-style: none; }
.warn-list li { color: var(--risk); padding-left: 16px; position: relative; }
.warn-list li::before { content: ""; position: absolute; left: 3px; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--risk); }
.error-text { color: var(--bad); white-space: pre-wrap; }

/* ---------- drop zone ---------- */
.drop {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #f0f4ff; color: var(--text); }
.drop strong { color: var(--text); font-weight: 600; }
.drop input { display: none; }
.source-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.source-option { display: flex; flex-direction: column; min-width: 0; }
.source-option h3 { margin: 0; font-size: 14px; font-weight: 600; }
.source-option p { margin: 6px 0 12px; }
.source-option .drop { margin-top: auto; padding: 20px 12px; }

/* ---------- models ---------- */
.models { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 28px; align-items: start; }
.model-list { display: flex; flex-direction: column; gap: 8px; }
.model-item {
  display: flex; align-items: center; gap: 12px; padding: 11px; border-radius: 9px; text-decoration: none;
  border: 1px solid transparent;
}
.model-item:hover { background: var(--panel); }
.model-item.on { background: #fff; border-color: #becdee; box-shadow: inset 3px 0 0 var(--accent); }
.cover { width: 45px; height: 58px; border-radius: 6px; background: var(--raised) center/cover no-repeat; flex: none; }
.model-item .name { font-weight: 600; }
.model-item .sub { font-size: 11px; line-height: 1.5; margin-top: 3px; color: var(--muted); }
.new-model { display: flex; gap: 8px; margin-bottom: 12px; }
.new-model input { flex: 1; }
.model-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.model-head h1 { font-size: 23px; font-weight: 600; letter-spacing: -.5px; margin: 0; }
.base-figure { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.base-figure .big { font-size: 30px; font-weight: 600; line-height: 1; }
.base-figure .cap { color: var(--muted); font-size: 12.5px; }
.sheet { max-height: 340px; overflow: auto; padding-right: 3px; display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 6px; }
.sheet figure { margin: 0; position: relative; }
.sheet img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 5px; background: var(--raised); }
.sheet figcaption { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; margin-top: 12px; }
.source { position: relative; }
.source img, .source .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: var(--raised); }
.source .kind { position: absolute; left: 4px; bottom: 4px; font-size: 10.5px; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,.65); color: #fff; }
.source .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; opacity: 0; }
.source:hover .x, .source .x:focus-visible { opacity: 1; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* ---------- reel / result tiles (9:16, the format of the material) ---------- */
.tiles { display: grid; align-items: start; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tile { position: relative; cursor: pointer; border-radius: var(--radius); outline-offset: 3px; }
.tile .pic {
  box-shadow: 0 2px 4px #18212c08;
  position: relative; aspect-ratio: 9/16; border-radius: 6px; overflow: hidden; background: var(--raised);
  border: 2px solid transparent;
}
.tile .pic img { transition: filter .15s; width: 100%; height: 100%; object-fit: cover; }
.tile.sel .pic { border-color: var(--accent); }
.tile .tick {
  position: absolute; top: 7px; left: 7px; width: 20px; height: 20px; border-radius: 5px;
  border: 1.5px solid rgba(255,255,255,.75); background: rgba(0,0,0,.35);
}
.tile.sel .tick { background: var(--accent); border-color: var(--accent); }
.tile.sel .tick::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tile .corner { position: absolute; top: 7px; right: 7px; }
/* Badges sit on bright video frames: give them a solid dark plate. */
.tile .corner .chip, .tile .corner.chip { background: rgba(255, 255, 255, .94); }
.tile .play {
  position: absolute; right: 7px; bottom: 7px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.tile .play:hover { background: var(--accent); color: var(--accent-ink); }
.tile .meta { padding: 12px 2px 0; }
.tile .title { font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .facts { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.tile .why { font-size: 11.5px; color: var(--risk); margin-top: 2px; line-height: 1.3; }
.tile.skip .why { color: var(--bad); }
.tile.skip .pic img { opacity: .45; filter: grayscale(.6); }
.tile .spin { position: absolute; inset: auto 10px 10px 10px; }
.score { font-size: 22px; font-weight: 600; line-height: 1.1; }
.score.good { color: var(--ok); }
.score.fair { color: var(--risk); }
.score.weak { color: var(--bad); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.selbar {
  position: sticky; bottom: 16px; z-index: 10; margin-top: 18px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid #ccd6e6; border-radius: 12px; padding: 16px;
  box-shadow: 0 8px 32px #18212c12;
}

/* ---------- queue ---------- */
.job { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; }
.job .thumb { width: 64px; aspect-ratio: 9/16; border-radius: 5px; background: var(--raised) center/cover no-repeat; }
.job h3 { margin: 0; font-size: 15px; font-weight: 600; }
.steps { display: flex; gap: 4px; margin: 10px 0 8px; flex-wrap: wrap; }
.steps span { font-size: 12px; padding: 3px 8px; border-radius: 4px; background: var(--bg); color: var(--faint); }
.steps span.done { color: var(--muted); }
.steps span.now { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.list { display: flex; flex-direction: column; }
.list .li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 9px 2px; border-top: 1px solid var(--line-soft); }
.list .li:first-child { border-top: 0; }
.gpu-panel .bar { height: 10px; position: relative; overflow: visible; }
.gpu-panel .bar i { border-radius: 5px; background: var(--muted); }
.gpu-panel .bar b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
pre.log { max-height: 60vh; overflow: auto; background: var(--bg); padding: 12px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; }

/* ---------- viewer (the one bold piece: drag the seam between original and result) ---------- */
dialog { border: 0; padding: 0; color: var(--text); }
dialog::backdrop { background: rgba(10, 10, 12, .82); }
.viewer { width: min(1100px, 96vw); max-height: 96vh; background: var(--panel); border-radius: 12px; }
.viewer[open] { display: flex; flex-direction: column; }
.v-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.v-head .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-body { display: flex; justify-content: center; gap: 14px; padding: 14px; background: #141416; min-height: 0; }
.v-stage { position: relative; height: min(70vh, 860px); aspect-ratio: 9/16; user-select: none; touch-action: none; }
.v-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 6px; }
.v-stage .res { clip-path: inset(0 0 0 var(--cut, 50%)); }
.v-stage.side { display: flex; gap: 10px; aspect-ratio: auto; }
.v-stage.side .res { clip-path: none; }
.v-stage.side .pane { position: relative; height: 100%; aspect-ratio: var(--ar, 9/16); }
.seam { position: absolute; top: 0; bottom: 0; left: var(--cut, 50%); width: 0; cursor: ew-resize; }
.seam::before { color: #fff; content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.seam span {
  position: absolute; top: 50%; left: -17px; width: 34px; height: 34px; margin-top: -17px; border-radius: 50%;
  background: #fff; color: #18212c; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.seam:focus-visible span { outline: 2px solid var(--accent); outline-offset: 2px; }
.v-label { color: #fff; position: absolute; top: 10px; padding: 3px 8px; border-radius: 4px; background: rgba(0,0,0,.6); font-size: 12px; pointer-events: none; }
.v-label.l { left: 10px; }
.v-label.r { right: 10px; }
.v-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.v-foot input[type=range] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.v-time { font-size: 12.5px; color: var(--muted); min-width: 92px; }
.v-path { font-size: 12px; color: var(--faint); word-break: break-all; }

.modal { width: min(560px, 94vw); background: var(--panel); border-radius: 12px; padding: 20px; }
.modal.wide { width: min(1000px, 96vw); }
.modal h2 { margin: 0 0 12px; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal video { max-height: 72vh; margin: 0 auto; border-radius: 6px; }

/* ---------- uploads + toasts ---------- */
.uploads {
  position: fixed; right: 16px; bottom: 16px; z-index: 30; width: 320px; max-height: 50vh; overflow: auto;
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  box-shadow: 0 12px 40px #18212c25;
}
.uploads h4 { margin: 0 0 8px; font-size: 13px; }
.up { font-size: 12.5px; margin-top: 8px; }
.up .nm { display: flex; justify-content: space-between; gap: 8px; }
.up .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .bar { height: 4px; margin-top: 4px; }
.up.err .nm { color: var(--bad); }
.toasts { position: fixed; left: 16px; bottom: 16px; z-index: 40; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, 90vw); }
.toast { background: var(--raised); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 24px #18212c16; }
.toast.err { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

.login { max-width: 360px; margin: 12vh auto; }
.login h1 { font-size: 20px; margin: 0 0 14px; }

/* ---------- references and generation ---------- */
.library { min-width: 0; }
.library-heading { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 18px; }
.library-heading h2 { font-size: 13px; font-weight: 500; margin: 0; }
.new-model { margin-bottom: 20px; gap: 6px; }
.new-model input { width: 120px; font-size: 12px; }
.new-model .btn { padding: 0 12px; font-size: 12px; }
#model-detail { min-width: 0; }
#model-detail > .stack > * + * { margin-top: 20px; }
.model-head { gap: 8px; margin-bottom: 22px; }
.model-head .btn { height: 32px; font-size: 12px; padding: 0 10px; }
.reference-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(210px, 1fr); gap: 18px; }
.panel-heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; }
.panel-heading h2 { margin: 0; }
.panel-heading .chip { font-size: 10px; height: 19px; font-weight: 400; }
.base-figure { gap: 26px; }
.base-figure .big { font-size: 28px; letter-spacing: -1px; }
.base-figure .cap { font-size: 11px; margin-top: 5px; }
#md-base p { line-height: 1.7; }
.body-reference { height: 210px; width: 100%; object-fit: contain; background: var(--bg); border-radius: 7px; }
.body-placeholder { height: 168px; display: grid; place-items: center; background: #f5f7fa; border-radius: 7px; }
.person-outline { width: 52px; height: 90px; border: 2px solid #b4c1d4; border-radius: 22px 22px 12px 12px; position: relative; margin-top: 35px; }
.person-outline::before { content: ''; position: absolute; width: 27px; height: 27px; border: 2px solid #b4c1d4; border-radius: 50%; top: -37px; left: 9px; }
.person-outline::after { content: ''; position: absolute; width: 2px; height: 25px; bottom: 0; left: 23px; background: #b4c1d4; }
.body-panel p { font-size: 11.5px; line-height: 1.65; }
.body-panel .btn { width: 100%; height: 34px; font-size: 12px; }
.source-option { padding: 18px; background: #f7f8fa; border-radius: 9px; }
.source-option .drop { background: #fff; border-color: #c6d1e3; font-size: 12px; padding: 24px 12px; }
.source-option p { line-height: 1.65; font-size: 12px; }
.source-option h3 { font-size: 15px; }
.source-option h3::before { content: '+'; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 6px; background: #e7edf9; color: var(--accent); font-weight: 400; }
.sources { grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); max-height: 240px; overflow: auto; }
.source .x { opacity: .8; }
.source .x:hover { opacity: 1; background: var(--bad); }
.reference-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; max-height: 60vh; overflow: auto; }
.reference-choice { padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 9px; text-align: left; cursor: pointer; min-width: 0; }
.reference-choice:hover { border-color: var(--accent); }
.reference-choice img { width: 100%; height: 170px; object-fit: contain; background: var(--bg); border-radius: 5px; }
.reference-choice span { display: block; padding: 8px 4px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reel-selbar { display: block; position: sticky; }
.selection-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.selection-controls > strong { font-size: 12px; }
.selection-controls select { max-width: 230px; }
.generation-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-option { background: #fff; border: 1px solid var(--line-soft); border-radius: 8px; padding: 13px 14px; text-align: left; cursor: pointer; }
.mode-option.on { border-color: #6e8fdc; background: #f1f5ff; box-shadow: inset 0 0 0 1px #6e8fdc; }
.mode-title { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.mode-title strong { font-size: 13px; font-weight: 500; }
.mode-title .small { font-size: 10px; color: var(--muted); }
.mode-hint { display: block; font-size: 11px; line-height: 1.5; margin-top: 5px; color: var(--muted); }
.generate-action { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 14px; }
.generate-action .small { max-width: 570px; font-size: 11px; }
.mode-warning { color: var(--risk); }
.result-mode { font-size: 10px; color: var(--accent); margin: 5px 0; }
.tile .score { float: right; font-size: 17px; margin-left: 8px; }
#res-filters { width: 100%; margin-top: 10px; }
#res-filters select { max-width: 260px; font-size: 12px; }
#reel-seg { width: 100%; margin-top: 8px; }
#res-summary { font-size: 12px; }
.job + .job { margin-top: 12px; }
.job > div { min-width: 0; }
.job .bar { margin-top: 12px; }
.list .li { padding: 16px 2px; }
.gpu-panel { background: #f0f3f9; }
.uploads { background: white; width: 350px; }
.upload-heading { display: flex; justify-content: space-between; gap: 12px; }
.upload-hint { font-size: 11px; line-height: 1.6; margin: 14px 0 0; }
.up { margin-top: 14px; }
.up.err .small { margin-top: 4px; }
.up.err .btn { margin-left: 8px; }
.toast { background: white; }
.toasts { left: 236px; }
.login-page .top, .login-page .workspace-top { display: none; }
.login-page main { margin: 0; max-width: none; min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login { width: min(460px,100%); max-width: none; margin: 0; padding: 46px; box-shadow: 0 20px 70px #18212c0a; }
.login-brand { color: var(--accent); font-weight: 700; font-size: 17px; margin-bottom: 50px; letter-spacing: -.5px; }
.login h1 { font-size: 29px; line-height: 1.2; letter-spacing: -1px; }
.login p { font-size: 13px; line-height: 1.7; margin-bottom: 28px; }
.login input, .login .btn { height: 44px; }
.login-page .toasts { left: 16px; }
@media (min-width: 1700px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); } }
@media (max-width: 1250px) {
  .top { width: 180px; padding-left: 12px; padding-right: 12px; }
  .brand { font-size: 18px; gap: 8px; }
  main { margin-left: 180px; padding: 26px 24px 55px; }
  .workspace-top { margin-left: 180px; padding: 0 24px; }
  .models { grid-template-columns: 205px minmax(0, 1fr); gap: 20px; }
  .reference-grid { grid-template-columns: minmax(0, 1.4fr) minmax(180px, 1fr); gap: 12px; }
  .panel { padding: 18px; }
  .model-head .spacer { flex-basis: 10px; }
  .model-head h1 { margin-right: auto; }
  .body-reference { height: 180px; }
  .source-options { gap: 12px; }
  .source-option { padding: 14px; }
  .toasts { left: 200px; }
}
@media (max-width: 1050px) {
  .models { grid-template-columns: 1fr; }
  .library { background: #edf0f5; padding: 16px; border-radius: 10px; }
  .library-heading { margin: 0 0 12px; }
  .new-model { max-width: 330px; margin-bottom: 14px; }
  .model-list { flex-direction: row; overflow-x: auto; padding-bottom: 3px; }
  .model-item { min-width: 200px; max-width: 240px; }
  .reference-grid { grid-template-columns: minmax(0, 1.65fr) minmax(210px, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .mode-option { padding: 10px; }
}
@media (max-width: 760px) {
  .top { position: sticky; inset: 0 0 auto; width: 100%; padding: 14px 18px 8px; height: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: 1fr auto; gap: 13px; }
  .brand { font-size: 19px; padding: 0; }
  .brand small, .sidebar-note, .gpu, .icon-link span { display: none; }
  .brand-mark { height: 25px; width: 24px; }
  .brand-mark i { width: 9px; height: 24px; }
  .brand-mark i:last-child { height: 18px; }
  .top-right { border: 0; padding: 0; grid-column: 2; grid-row: 1; }
  .icon-link { padding: 4px; }
  .tabs { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; margin: 0; gap: 4px; }
  .tabs a { min-height: 35px; font-size: 12px; gap: 7px; padding: 8px 12px; flex: 1; justify-content: center; }
  .tabs svg { width: 16px; height: 16px; }
  .tab-count { margin-left: 0; min-width: 16px; padding: 0 4px; font-size: 9px; }
  .workspace-top { margin: 0; height: 47px; padding: 0 20px; }
  main { margin: 0; padding: 24px 20px 50px; }
  .page-head h1 { font-size: 26px; }
  .page-head { margin-bottom: 22px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(145px,1fr)); gap: 18px 12px; }
  .toasts { left: 16px; }
  .selbar { bottom: 8px; }
  #reel-selbar { position: relative; bottom: auto; }
  .generation-options { gap: 6px; }
  .mode-title { align-items: flex-start; flex-direction: column; gap: 3px; }
  .mode-title strong { font-size: 12px; }
  .mode-hint { font-size: 10px; }
  .v-head { gap: 7px; flex-wrap: wrap; }
  .v-head .score { font-size: 18px; }
  .v-head .t { max-width: 190px; font-size: 12px; }
  .v-stage { height: min(57vh, 650px); max-width: 85vw; }
  .v-stage.side { height: min(45vh, 68vw); }
  .v-foot { gap: 8px; }
  .viewer { max-height: 96dvh; }
  .v-body { flex-shrink: 0; }
  .viewer[open] { overflow: auto; }
}
@media (max-width: 480px) {
  .tabs a { padding: 8px 5px; gap: 5px; }
  main { padding: 22px 14px 40px; }
  .workspace-top { padding: 0 16px; }
  .page-head h1 { font-size: 24px; }
  .page-head p { font-size: 12px; }
  .reference-grid, .source-options { grid-template-columns: 1fr; }
  .body-reference { height: 220px; }
  .body-placeholder { height: 145px; }
  .panel { padding: 17px; }
  .model-head .btn { font-size: 11px; padding: 0 8px; }
  .model-head h1 { font-size: 21px; }
  .model-head .spacer { display: none; }
  .model-head h1 { flex: 1 1 65%; }
  .selection-controls { gap: 8px; }
  .selection-controls > .spacer { display: none; }
  .selection-controls select { flex: 1; max-width: none; }
  .generation-options { grid-template-columns: 1fr; }
  .mode-title { flex-direction: row; align-items: center; }
  .mode-hint { margin-top: 3px; font-size: 11px; }
  .generate-action { flex-direction: column; align-items: stretch; gap: 12px; }
  #reel-seg { overflow-x: auto; }
  .seg { white-space: nowrap; }
  .seg button { font-size: 11px; padding: 0 9px; }
  #res-filters { gap: 8px; }
  #res-filters select { max-width: 100%; flex: 1 1 45%; }
  .uploads { right: 10px; bottom: 10px; width: calc(100% - 20px); }
  .job { grid-template-columns: 45px minmax(0,1fr); gap: 10px; }
  .job .thumb { width: 45px; }
  .job > button { grid-column: 2; justify-self: end; }
  .login { padding: 30px; }
  .login-brand { margin-bottom: 35px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.upload-controls { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.upload-controls .small { font-size: 10px; }
.upload-controls .btn { height: 24px; padding: 0 7px; }
