/* Video Pipeline - dark studio theme.
   Tokens first; everything below uses them. Spacing follows a 4/8 px grid. */
:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --bg-elev: #101115;
  --surface: #14161b;
  --surface-2: #1a1d23;
  --surface-3: #21252c;
  --border: #23262d;
  --border-2: #2f333b;
  --border-3: #3b4049;
  --text: #ecedf0;
  --text-2: #a5aab4;
  --text-3: #6e7480;
  --accent: #6c66f2;
  --accent-hover: #7b76ff;
  --accent-text: #9b97ff;
  --accent-soft: rgba(108, 102, 242, .15);
  --accent-line: rgba(124, 118, 255, .42);
  --success: #3dd598;
  --success-soft: rgba(61, 213, 152, .12);
  --success-line: rgba(61, 213, 152, .3);
  --warn: #f2b443;
  --warn-soft: rgba(242, 180, 67, .12);
  --warn-line: rgba(242, 180, 67, .32);
  --danger: #f2616b;
  --danger-soft: rgba(242, 97, 107, .12);
  --danger-line: rgba(242, 97, 107, .34);
  --info: #5ba8ff;
  --ai: #c3b5ff;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55), 0 4px 14px rgba(0, 0, 0, .35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 236px;
  --topbar-h: 56px;
  --panel-w: 540px;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
::selection { background: rgba(124, 118, 255, .35); }
.num { font-variant-numeric: tabular-nums; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 16px; height: 16px; flex: none; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.icon.filled { fill: currentColor; stroke-width: 1.2; }
.spin { animation: spin 1s linear infinite; }
.spacer { flex: 1; }
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--r);
  background: var(--accent); color: #fff; font-weight: 500;
}
.skip-link:focus { top: 12px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2e36; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #363b45; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 14px 12px 12px; background: var(--bg-elev); border-right: 1px solid var(--border); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; color: var(--text); border-radius: var(--r); }
.logo { width: 30px; height: 30px; flex: none; border-radius: 8px; filter: drop-shadow(0 4px 12px rgba(108, 102, 242, .35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; transition: background .12s, color .12s;
}
.nav-item .icon { color: var(--text-3); transition: color .12s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item[aria-current="page"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
.nav-item[aria-current="page"] .icon { color: var(--accent-text); }
.nav-label { flex: 1; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-2);
}
.nav-badge.running { background: var(--accent); color: #fff; box-shadow: none; }
.nav-count { color: var(--text-3); font-size: 12px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.signout { color: var(--text-3); }
.disk { padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 4px; }
.disk-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.disk-head .icon { color: var(--text-3); width: 15px; height: 15px; }
.disk-pct { margin-left: auto; color: var(--text-3); font-weight: 400; }
.meter { height: 6px; margin: 10px 0 8px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; width: 0; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #5a55e0, #8a86ff); transition: width .4s var(--ease); }
.disk.warn .meter span { background: var(--warn); }
.disk.low .meter span { background: var(--danger); }
.disk-text { font-size: 12px; color: var(--text-3); }
.disk.low .disk-text { color: var(--danger); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: rgba(12, 13, 16, .84); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(150%) blur(14px); backdrop-filter: saturate(150%) blur(14px);
}
.topbar-logo { display: none; width: 26px; height: 26px; }
.title-block { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.title-block h1 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.page-sub { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.conn, .topbar-disk {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12.5px; white-space: nowrap;
}
.topbar-disk .icon { width: 14px; height: 14px; color: var(--text-3); }
.topbar-disk.low { color: var(--danger); border-color: var(--danger-line); }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.conn.live .conn-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.conn.down { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.conn.down .conn-dot { background: var(--warn); animation: blink 1.1s ease-in-out infinite; }
.topbar-signout { display: none; }
.content { flex: 1; min-width: 0; padding: 22px 28px 64px; outline: none; }
body.has-tray[data-view="library"] .content { padding-bottom: 128px; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r); font-size: 13.5px; font-weight: 500; line-height: 1;
  white-space: nowrap; cursor: pointer; user-select: none; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s, opacity .12s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(0, 0, 0, .4); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-3); }
.btn-ghost, .btn-ghost-danger { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-ghost-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn-danger:hover:not(:disabled) { background: #ff707a; }
.btn.danger-hover:hover:not(:disabled) { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.btn-sm { height: 28px; padding: 0 10px; gap: 6px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn .btn-spin { display: none; }
.btn.busy .btn-spin { display: inline-block; animation: spin 1s linear infinite; }
.btn.busy .btn-plus { display: none; }
.input, .select {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--r);
  background: var(--surface); color: var(--text); font-size: 13.5px; transition: border-color .12s, box-shadow .12s;
}
.input:hover, .select:hover { border-color: var(--border-3); }
.input:focus, .select:focus, .search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a5aab4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
}
.select option { background: var(--surface-2); color: var(--text); }
.select-sm { width: auto; height: 30px; font-size: 12.5px; padding-left: 10px; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.check {
  appearance: none; -webkit-appearance: none; position: relative; z-index: 1; flex: none; width: 16px; height: 16px; margin: 0;
  border: 1.5px solid #4a505b; border-radius: 4px; background: var(--surface); cursor: pointer;
  background-repeat: no-repeat; background-position: center; background-size: 12px; transition: background-color .1s, border-color .1s;
}
.check:hover { border-color: #737a87; }
.check:checked, .check:indeterminate { background-color: var(--accent); border-color: var(--accent); }
.check:checked {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.check:indeterminate {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}
.check:focus-visible { outline-offset: 2px; }
.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background .12s, color .12s;
}
.seg-btn:hover { background: var(--surface-2); color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2), 0 1px 2px rgba(0, 0, 0, .35); }
.seg-count { color: var(--text-3); font-size: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none; height: 20px; padding: 0 7px; border-radius: 5px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; }
.badge-ai { color: var(--ai); background: rgba(160, 140, 255, .1); border-color: rgba(160, 140, 255, .3); }
.badge-real { color: var(--text-3); background: transparent; border-color: var(--border); }
.badge-ok { color: var(--success); background: var(--success-soft); border-color: var(--success-line); }
.badge-full { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); font-weight: 500; }
.badge-q { justify-content: center; width: 52px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.badge-uhd { color: #dcdaff; background: var(--accent-soft); border-color: var(--accent-line); }
.ar { display: inline-block; flex: none; border: 1.5px solid currentColor; border-radius: 2px; opacity: .75; }
.ar-land { width: 15px; height: 9px; }
.ar-wide { width: 13px; height: 10px; }
.ar-vert { width: 9px; height: 15px; }
.ar-tall { width: 10px; height: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border: 1px solid; border-radius: 12px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; stroke-width: 2; }
.chip-queued { color: #a4adbd; background: rgba(164, 173, 189, .08); border-color: rgba(164, 173, 189, .22); }
.chip-running { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.chip-done { color: var(--success); background: var(--success-soft); border-color: var(--success-line); }
.chip-failed { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.chip-cancelled { color: #8b919c; background: transparent; border-color: var(--border-3); }
.bar { position: relative; display: block; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--text-3); transition: width .5s var(--ease); }
.bar-accent .bar-fill { background: linear-gradient(90deg, #5a55e0, #8a86ff); }
.bar-success .bar-fill { background: var(--success); }
.bar-danger .bar-fill { background: var(--danger); }
.bar-muted .bar-fill { background: #474c56; }
.bar.indeterminate .bar-fill { width: 30%; animation: indeterminate 1.3s ease-in-out infinite; }
.bar-lg { height: 6px; border-radius: 3px; }

/* ---------------------------------------------------------------- shared blocks */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; min-width: 0; }
.toolbar-meta { margin-left: auto; color: var(--text-3); font-size: 13px; white-space: nowrap; }
.toolbar-meta:empty { display: none; }
.view-library .toolbar #lib-refresh { margin-left: auto; }
.view-library .toolbar-meta:not(:empty) ~ #lib-refresh, .view-library .toolbar-meta:not(:empty) ~ #lib-clear { margin-left: 0; }
.search { position: relative; display: flex; align-items: center; flex: 1; max-width: 440px; min-width: 0; }
.search > .icon { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 36px 0 35px; border: 1px solid var(--border-2); border-radius: var(--r);
  background: var(--surface); color: var(--text); font-size: 13.5px; transition: border-color .12s, box-shadow .12s;
}
.search input::placeholder { color: var(--text-3); }
.search input:hover { border-color: var(--border-3); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search kbd {
  position: absolute; right: 9px; padding: 1px 6px; border: 1px solid var(--border-2); border-radius: 4px;
  background: var(--surface-2); color: var(--text-3); font: 11px/16px var(--mono); pointer-events: none;
}
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.empty {
  display: flex; flex-direction: column; align-items: center; padding: 64px 24px; text-align: center;
  border: 1px dashed var(--border-2); border-radius: var(--r-xl);
  background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(108, 102, 242, .07), transparent 70%);
}
.empty-icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 16px; border-radius: 14px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); box-shadow: var(--shadow-sm);
}
.empty-icon .icon { width: 22px; height: 22px; }
.empty-danger .empty-icon { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.empty-title { font-size: 15px; font-weight: 600; }
.empty-text { max-width: 400px; margin-top: 6px; color: var(--text-2); font-size: 13.5px; }
.empty-action { margin-top: 20px; }
.skeleton-list { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.skeleton-row { display: flex; align-items: center; gap: 18px; height: 52px; padding: 0 16px; }
.skeleton-row + .skeleton-row { border-top: 1px solid var(--border); }
.sk {
  display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--surface-2) 0%, #262a32 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.sk-a { width: 52px; }
.sk-c { width: 64px; margin-left: auto; }

/* ---------------------------------------------------------------- library */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.filters:empty { display: none; }
.filter { display: flex; align-items: center; gap: 8px; }
.filter-label { color: var(--text-3); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.lib-group { margin-bottom: 32px; }
.group-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.group-count { color: var(--text-3); font-size: 12.5px; font-weight: 400; letter-spacing: 0; }
.topic { margin-bottom: 18px; }
.topic-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px 2px; color: var(--text-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
}
.topic-count { color: var(--text-3); font-weight: 500; }
.folder-list { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.folder + .folder { border-top: 1px solid var(--border); }
.folder { position: relative; }
.folder.has-sel::before { content: ""; position: absolute; left: 0; top: 0; width: 2px; height: 48px; background: var(--accent); z-index: 1; }
.folder-head {
  display: grid; grid-template-columns: 16px 52px minmax(0, 1fr) 84px 72px 72px; align-items: center; gap: 14px;
  width: 100%; height: 48px; padding: 0 18px 0 14px; border: 0; background: transparent; color: var(--text);
  font-size: 13.5px; text-align: left; cursor: pointer; transition: background .12s;
}
.folder-head:hover { background: var(--surface-2); }
.folder-head:focus-visible { outline-offset: -2px; border-radius: var(--r-lg); }
.chev { display: inline-grid; place-items: center; color: var(--text-3); }
.chev .icon { transition: transform .16s var(--ease); }
.folder.open > .folder-head .chev .icon { transform: rotate(90deg); }
.folder.open > .folder-head { background: var(--surface-2); }
.folder-name { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-2); }
.folder-aspect { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-ratio { color: var(--text-3); font-size: 12.5px; }
.sel-pill {
  display: inline-flex; align-items: center; height: 20px; margin-left: auto; padding: 0 8px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.folder-stat { color: var(--text-3); font-size: 12.5px; text-align: right; white-space: nowrap; }
.stat-dur { color: var(--text-2); font-weight: 500; }
.sel-word { margin-left: .3em; }
.folder-body { border-top: 1px solid var(--border); background: #111317; padding: 4px 0 8px; }
.scene-head { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 18px 0 46px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.scene-head label { cursor: pointer; }
.scene-head-meta { margin-left: auto; color: var(--text-3); font-weight: 400; }
.scene-list { margin: 0; padding: 0; list-style: none; }
.scene {
  position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) 92px 64px 60px; align-items: center; gap: 14px;
  min-height: 40px; padding: 0 18px 0 46px; transition: background .1s;
}
.scene:hover { background: rgba(255, 255, 255, .025); }
.scene.selected { background: rgba(108, 102, 242, .08); }
.scene-label { display: flex; align-items: baseline; gap: 10px; min-width: 0; cursor: pointer; }
.scene-label::after { content: ""; position: absolute; inset: 0; }
.scene-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--text); white-space: nowrap; }
.scene-file { min-width: 0; overflow: hidden; color: var(--text-3); font: 12px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.scene-res, .scene-clips, .scene-dur { color: var(--text-3); font-size: 12.5px; text-align: right; white-space: nowrap; }
.scene-dur { color: var(--text-2); }

/* selection tray */
.tray {
  position: fixed; z-index: 30; left: calc(var(--sidebar-w) + 28px); right: 28px; bottom: 20px; display: flex; justify-content: center;
  pointer-events: none; opacity: 0; transform: translateY(14px); visibility: hidden;
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s linear .18s;
}
.tray.show { opacity: 1; transform: none; visibility: visible; transition: opacity .18s var(--ease), transform .18s var(--ease); }
.tray-inner {
  position: relative; display: flex; align-items: center; gap: 16px; width: 100%; max-width: 960px; padding: 10px 10px 10px 12px;
  pointer-events: auto; border: 1px solid var(--border-3); border-radius: 14px; background: rgba(28, 31, 38, .94);
  box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
}
.tray-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tray-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 9px;
  border-radius: 14px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
.tray-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.3; }
.tray-label { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.tray-stats { display: flex; align-items: center; gap: 14px; min-width: 0; overflow: hidden; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.tray-stats.loading, .tray-stats.error { color: var(--text-3); }
.tray-stat { display: inline-flex; align-items: center; gap: 6px; }
.tray-stat .icon { width: 13px; height: 13px; color: var(--text-3); }
.tray-stat.warn, .tray-stat.warn .icon { color: var(--warn); }
.tray-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.opt-summary { margin-left: 3px; padding-left: 9px; border-left: 1px solid var(--border-3); color: var(--text-3); font-size: 12.5px; font-weight: 400; }
#opt-btn[aria-expanded="true"] { background: var(--surface-3); border-color: var(--border-3); }
#opt-btn.invalid { border-color: var(--danger-line); }
#opt-btn.invalid .opt-summary { color: var(--danger); }
.popover-anchor { position: relative; }
.popover {
  position: absolute; right: 0; bottom: calc(100% + 14px); z-index: 40; width: 440px; padding: 18px;
  border: 1px solid var(--border-3); border-radius: var(--r-lg); background: #1d2027; box-shadow: var(--shadow-lg);
  animation: pop-in .15s var(--ease);
}
.pop-head { margin-bottom: 16px; }
.pop-title { font-size: 14px; font-weight: 600; }
.pop-sub { margin-top: 2px; color: var(--text-3); font-size: 12.5px; }
.pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.field label, .field .label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.hint { margin-top: 6px; color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.hint.error { color: var(--danger); }
.input-affix { position: relative; }
.input-affix .input { padding-right: 44px; }
.affix { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12px; pointer-events: none; }
.pop-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-2); }

/* ---------------------------------------------------------------- queue */
.tabs { display: flex; gap: 2px; width: 100%; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none; height: 38px; margin-bottom: -1px; padding: 0 12px;
  border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 500; cursor: pointer; transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:focus-visible { outline-offset: -4px; border-radius: var(--r-sm); }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: 9px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 600;
}
.tab[aria-pressed="true"] .tab-count { background: var(--accent-soft); color: var(--accent-text); }
.queue { container-type: inline-size; container-name: queue; }
.q-colhead, .q-row {
  display: grid; grid-template-columns: 116px minmax(0, 1fr) 210px 118px 84px 132px; align-items: center; gap: 16px; padding: 0 18px;
  grid-template-areas: "chip main stage started dur actions";
}
.q-table { overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.q-colhead {
  height: 36px; border-bottom: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
}
.q-colhead > :nth-child(5) { text-align: right; }
.q-section + .q-section { border-top: 1px solid var(--border); }
.q-section-title {
  display: flex; align-items: center; gap: 8px; height: 34px; margin: 0; padding: 0 18px; border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .018); color: var(--text-2); font-size: 12px; font-weight: 600;
}
.q-section-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600;
}
.q-list { margin: 0; padding: 0; list-style: none; }
.q-row { position: relative; min-height: 62px; padding-top: 11px; padding-bottom: 11px; transition: background .12s; }
.q-row + .q-row { border-top: 1px solid var(--border); }
.q-row:hover { background: var(--surface-2); }
.q-row.selected { background: #1a1b2a; }
.q-row.selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.q-open { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; }
.q-open:focus-visible { outline-offset: -2px; border-radius: var(--r); }
.q-chip { grid-area: chip; display: flex; }
.q-main { grid-area: main; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.q-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.q-title { overflow: hidden; color: var(--text); font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.q-id { flex: none; color: var(--text-3); font-size: 12px; }
.q-path { overflow: hidden; color: var(--text-3); font: 12px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.q-stage { grid-area: stage; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.q-stage-top { display: flex; justify-content: space-between; gap: 8px; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.q-stage-label { overflow: hidden; text-overflow: ellipsis; }
.q-stage-count { color: var(--text-3); }
.q-running .q-stage-label { color: var(--text); }
.q-failed .q-stage-label { color: var(--danger); }
.q-started { grid-area: started; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.q-dur { grid-area: dur; color: var(--text-2); font-size: 12.5px; text-align: right; white-space: nowrap; }
.q-running .q-dur { color: var(--text); }
.q-actions { grid-area: actions; position: relative; z-index: 1; display: flex; justify-content: flex-end; gap: 2px; }
.q-actions .btn-icon { color: var(--text-3); }
.q-actions .btn-icon:hover:not(:disabled) { color: var(--text); }
.q-actions .btn-ghost-danger:hover:not(:disabled) { color: var(--danger); }
.q-actions .btn:disabled { opacity: .3; }
@container queue (max-width: 900px) {
  .q-colhead, .q-row { grid-template-columns: 112px minmax(0, 1fr) 170px 76px auto; grid-template-areas: "chip main stage dur actions"; gap: 14px; }
  .q-col-started, .q-started { display: none; }
}
@container queue (max-width: 720px) {
  .q-colhead { display: none; }
  .q-row {
    grid-template-columns: 106px minmax(0, 1fr) 124px; grid-template-areas: "chip main actions" "chip stage actions";
    align-items: start; row-gap: 10px; padding-top: 14px; padding-bottom: 14px;
  }
  .q-chip { padding-top: 0; }
  .q-actions { margin-top: -2px; }
  .q-dur { display: none; }
  .q-queued .q-stage .bar { display: none; }
}
@container queue (max-width: 480px) {
  .q-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "chip actions" "main main" "stage stage"; padding: 14px; }
}

/* detail panel */
.panel {
  position: fixed; z-index: 25; top: var(--topbar-h); right: 0; bottom: 0; display: flex; flex-direction: column;
  width: var(--panel-w); max-width: 100vw; border-left: 1px solid var(--border); background: var(--bg-elev);
  box-shadow: -28px 0 60px rgba(0, 0, 0, .4); transform: translateX(100%); visibility: hidden;
  transition: transform .24s var(--ease), visibility 0s linear .24s;
}
.panel.open { transform: none; visibility: visible; transition: transform .24s var(--ease); }
.panel-scrim {
  position: fixed; z-index: 24; top: var(--topbar-h); right: 0; bottom: 0; left: 0; background: rgba(4, 5, 7, .55);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s;
}
body.panel-open .panel-scrim { opacity: 1; visibility: visible; transition: opacity .2s ease; }
@media (min-width: 1280px) {
  body.panel-open[data-view="queue"] .content { padding-right: calc(var(--panel-w) + 28px); }
  .panel-scrim { display: none; }
}
.panel-inner { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.panel-head { display: flex; flex-direction: column; gap: 6px; padding: 14px 20px 18px 24px; border-bottom: 1px solid var(--border); }
.panel-head-top { display: flex; align-items: center; gap: 10px; min-height: 34px; margin-right: -8px; }
.panel-id { color: var(--text-3); font-size: 12.5px; }
.panel-back { display: none; margin-left: -10px; }
.panel-title { margin-top: 2px; font-size: 19px; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; }
.panel-path { color: var(--text-3); font: 12px/1.5 var(--mono); word-break: break-all; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.panel-actions:empty { display: none; }
.panel-body { display: flex; flex: 1; flex-direction: column; gap: 24px; min-height: 0; padding: 20px 24px 32px; overflow-y: auto; }
.panel-body > * { flex-shrink: 0; }
.meta-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--border);
}
.meta-item { min-width: 0; padding: 10px 14px; background: var(--surface); }
.meta-item:last-child { grid-column: 1 / -1; }
.meta-item dt { margin-bottom: 3px; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.meta-item dd { overflow: hidden; color: var(--text); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.panel-section { display: flex; flex-direction: column; gap: 12px; }
.stepper { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; padding: 4px 0 0; list-style: none; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px; min-width: 0; text-align: center; }
.step::before { content: ""; position: absolute; top: 13px; right: calc(50% + 18px); width: calc(100% - 36px); height: 2px; border-radius: 1px; background: var(--border-2); }
.step:first-child::before { display: none; }
.step-done::before { background: var(--success); }
.step-running::before { background: linear-gradient(90deg, var(--success), var(--accent)); }
.step-failed::before { background: linear-gradient(90deg, var(--success), var(--danger)); }
.step-node {
  position: relative; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--border-3); border-radius: 50%;
  background: var(--bg-elev); color: var(--text-3); font-size: 11.5px; font-weight: 600;
}
.step-node .icon { width: 14px; height: 14px; stroke-width: 2.8; }
.step-done .step-node { border-color: var(--success); background: var(--success); color: #05291a; }
.step-running .step-node { border-color: var(--accent); background: #19193a; box-shadow: 0 0 0 4px rgba(108, 102, 242, .16); }
.step-failed .step-node { border-color: var(--danger); background: var(--danger); color: #2c0609; }
.step-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); animation: pulse 1.4s ease-in-out infinite; }
.step-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; max-width: 100%; }
.step-label { overflow: hidden; color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.step-pending .step-label { color: var(--text-3); }
.step-running .step-label { color: var(--text); font-weight: 600; }
.step-failed .step-label { color: var(--danger); }
.step-count { color: var(--text-3); font-size: 11.5px; }
.step-running .step-count { color: var(--accent-text); }
.stage-now { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.now-accent { border-color: rgba(124, 118, 255, .3); background: linear-gradient(180deg, rgba(108, 102, 242, .09), rgba(108, 102, 242, 0) 80%), var(--surface); }
.now-success { border-color: rgba(61, 213, 152, .22); }
.now-danger { border-color: rgba(242, 97, 107, .25); }
.now-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.now-title { font-size: 14px; font-weight: 600; }
.now-danger .now-title { color: var(--danger); }
.now-success .now-title { color: var(--success); }
.now-count { color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.now-eta { color: var(--text-3); font-size: 12.5px; }
.now-eta:empty { display: none; }
.banner { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid; border-radius: var(--r-lg); }
.banner > .icon { width: 18px; height: 18px; margin-top: 1px; }
.banner-danger { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.banner-body { min-width: 0; }
.banner-title { font-size: 13.5px; font-weight: 600; }
.banner-text { margin-top: 3px; color: #f4c6ca; font-size: 13px; overflow-wrap: anywhere; }
.section-head, .section-toggle { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; font-weight: 600; }
.section-head .icon, .section-toggle > .icon { width: 15px; height: 15px; color: var(--text-3); }
.section-count { color: var(--text-3); font-size: 12px; font-weight: 500; }
.section-toggle { width: calc(100% + 16px); height: 34px; margin: -6px -8px 0; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; cursor: pointer; }
.section-toggle:hover { background: var(--surface-2); }
.section-toggle .chev .icon { width: 15px; height: 15px; transition: transform .16s var(--ease); }
.section-toggle[aria-expanded="false"] .chev .icon { transform: rotate(-90deg); }
.log-section { gap: 8px; }
.log {
  max-height: 320px; margin: 0; padding: 12px 14px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r);
  background: #08090b; color: #c2c7d0; font: 12px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.log-empty, .outputs-empty { padding: 14px; border: 1px dashed var(--border-2); border-radius: var(--r); color: var(--text-3); font-size: 13px; }
.live-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: blink 1.6s ease-in-out infinite; }
.outputs { display: flex; flex-direction: column; gap: 8px; }
.output {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "thumb main" "thumb actions"; gap: 2px 14px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
}
.output-thumb {
  position: relative; grid-area: thumb; display: grid; place-items: center; width: 96px; height: 54px; padding: 0; overflow: hidden;
  border: 1px solid var(--border-2); border-radius: var(--r); background: #050607; color: #fff; cursor: pointer; transition: border-color .12s;
}
.output-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.output-play {
  position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(10, 11, 14, .6); border: 1px solid rgba(255, 255, 255, .2); transition: background .12s;
}
.output-play .icon { width: 11px; height: 11px; margin-left: 2px; }
.output-thumb:hover { border-color: var(--accent-line); }
.output-thumb:hover .output-play { background: var(--accent); border-color: transparent; }
.output-main { grid-area: main; min-width: 0; }
.output-name { overflow: hidden; font-size: 13.5px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.output-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; color: var(--text-3); font-size: 12.5px; }
.output-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------------------------------------------------------------- videos */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.video-grid > .empty { grid-column: 1 / -1; }
.vcard { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.vcard:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); }
.vthumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; border: 0; border-bottom: 1px solid var(--border); background: #050607; cursor: pointer; }
.vthumb video { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.vthumb:focus-visible { outline-offset: -3px; }
.vplay {
  position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border: 1px solid rgba(255, 255, 255, .2); border-radius: 50%; background: rgba(10, 11, 14, .55); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: .85; transition: opacity .15s, transform .15s var(--ease), background .15s;
}
.vplay .icon { width: 18px; height: 18px; margin-left: 3px; }
.vthumb:hover .vplay, .vthumb:focus-visible .vplay { opacity: 1; transform: scale(1.06); background: var(--accent); border-color: transparent; }
.vdur { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 11.5px; font-weight: 600; }
.vbody { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 12px 14px 2px; }
.vhead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vtitle { flex: 1; min-width: 0; overflow: hidden; font-size: 13.5px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.vsub { overflow: hidden; color: var(--text-2); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.vmeta { color: var(--text-3); font-size: 12px; }
.vactions { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 14px; }
.vactions .btn-ghost { padding: 0 8px; }
.vcard-skeleton { gap: 10px; padding-bottom: 16px; }
.vcard-skeleton .vthumb-sk { height: auto; aspect-ratio: 16 / 9; border-radius: 0; }
.vcard-skeleton .sk-b { width: 60%; margin: 6px 14px 0; }
.vcard-skeleton .sk-c { width: 34%; margin: 0 14px; }

/* ---------------------------------------------------------------- overlays */
body.modal-open { overflow: hidden; }
.modal-scrim {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px;
  background: rgba(4, 5, 7, .7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in .15s ease;
}
.modal {
  width: 100%; max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--border-3); border-radius: var(--r-xl);
  background: #191c22; box-shadow: var(--shadow-lg); animation: modal-in .2s var(--ease);
}
.modal-sm { max-width: 440px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 1000px; }
.confirm { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 16px; padding: 22px 22px 18px; }
.confirm-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-icon .icon { width: 19px; height: 19px; }
.confirm-title { margin-top: 1px; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.confirm-msg { margin-top: 6px; color: var(--text-2); font-size: 13.5px; }
.confirm-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal-player { overflow: hidden; }
.player-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 12px 20px; }
.player-titles { flex: 1; min-width: 0; }
.player-title { overflow: hidden; font-size: 15px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.player-sub { margin-top: 2px; color: var(--text-3); font-size: 12.5px; }
.player-stage { display: flex; align-items: center; justify-content: center; min-height: 200px; background: #000; }
.player-video { display: block; width: 100%; height: auto; max-height: calc(100vh - 230px); background: #000; }
.player-video:focus-visible { outline-offset: -3px; }
.player-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px 14px 20px; border-top: 1px solid var(--border); }
.player-path { flex: 1; min-width: 0; overflow: hidden; color: var(--text-3); font: 12px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.toasts {
  position: fixed; z-index: 70; top: calc(var(--topbar-h) + 14px); right: 18px; display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 10px 12px 14px; pointer-events: auto;
  border: 1px solid var(--border-3); border-radius: var(--r-lg); background: #20232a; box-shadow: var(--shadow-md);
  animation: toast-in .22s var(--ease);
}
.toast.leaving { animation: toast-out .16s ease forwards; }
.toast-icon { display: grid; place-items: center; padding-top: 1px; }
.toast-icon .icon { width: 18px; height: 18px; }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-color: var(--danger-line); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--info); }
.toast-warn .toast-icon { color: var(--warn); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13.5px; font-weight: 600; }
.toast-msg { margin-top: 2px; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.toast-action { display: inline-block; margin-top: 6px; color: var(--accent-text); font-size: 13px; font-weight: 500; }
.toast-action:hover { text-decoration: underline; }
.toast-close { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-3); cursor: pointer; }
.toast-close:hover { background: var(--surface-3); color: var(--text); }

/* ---------------------------------------------------------------- login */
.auth-body {
  display: grid; place-items: center; min-height: 100vh; padding: 24px 16px;
  background: radial-gradient(720px 420px at 50% -8%, rgba(108, 102, 242, .2), transparent 70%), var(--bg);
}
.auth-card { width: 100%; max-width: 384px; padding: 34px 30px 28px; border: 1px solid var(--border-2); border-radius: var(--r-xl); background: rgba(20, 22, 27, .92); box-shadow: var(--shadow-lg); }
.auth-logo { display: block; width: 44px; height: 44px; margin: 0 auto 20px; border-radius: 11px; filter: drop-shadow(0 8px 24px rgba(108, 102, 242, .45)); }
.auth-title { font-size: 20px; font-weight: 600; letter-spacing: -.02em; text-align: center; }
.auth-sub { margin: 6px 0 26px; color: var(--text-2); font-size: 13.5px; text-align: center; }
.auth-error {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 10px 12px; border: 1px solid var(--danger-line);
  border-radius: var(--r); background: var(--danger-soft); color: #f6c7cb; font-size: 13px;
}
.auth-error .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--danger); }
.auth-form .field { margin-bottom: 18px; }
.auth-form .input { height: 40px; font-size: 14px; }
.auth-form .btn { width: 100%; height: 40px; font-size: 14px; }
.auth-foot { margin-top: 20px; color: var(--text-3); font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .opt-summary { display: none; }
}
@media (max-width: 1100px) {
  .folder-head { grid-template-columns: 16px 52px minmax(0, 1fr) 72px 64px; }
  .stat-clips { display: none; }
  .scene { grid-template-columns: 16px minmax(0, 1fr) 64px 60px; }
  .scene-res { display: none; }
}
@media (max-width: 899px) {
  :root { --topbar-h: 54px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 45; top: auto; right: 0; bottom: 0; left: 0; height: auto; flex-direction: row; padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); border-right: 0; background: rgba(16, 17, 21, .94);
    -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex: 1; flex-direction: row; justify-content: space-around; gap: 4px; }
  .nav-item { position: relative; flex: 1; flex-direction: column; justify-content: center; gap: 3px; height: 54px; padding: 0; font-size: 11px; text-align: center; }
  .nav-item .icon { width: 21px; height: 21px; }
  .nav-label { flex: none; }
  .nav-item:hover { background: transparent; }
  .nav-item[aria-current="page"] { background: transparent; box-shadow: none; }
  .nav-badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; font-size: 10.5px; }
  .nav-count { display: none; }
  .topbar { gap: 10px; padding: 0 12px 0 16px; }
  .topbar-logo { display: block; }
  .page-sub { display: none; }
  .topbar-signout { display: block; }
  .content { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  body.has-tray[data-view="library"] .content { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
  .toolbar { flex-wrap: wrap; }
  .search { max-width: none; }
  .view-library .toolbar-meta { order: 5; flex-basis: 100%; margin-left: 2px; }
  .sel-word { display: none; }
  .filters {
    flex-wrap: nowrap; gap: 16px; margin: 0 -16px 20px; padding: 0 16px 16px; overflow-x: auto; scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filter { flex: none; }
  .folder-head { grid-template-columns: 14px 46px minmax(0, 1fr) 54px; gap: 10px; height: 52px; padding: 0 12px 0 12px; }
  .badge-q { width: 46px; }
  .stat-scenes, .stat-clips { display: none; }
  .folder-ratio { display: none; }
  .scene { grid-template-columns: 16px minmax(0, 1fr) 54px; gap: 10px; min-height: 48px; padding: 6px 12px 6px 38px; }
  .scene-clips { display: none; }
  .scene-label { flex-direction: column; gap: 1px; }
  .scene-head { padding: 0 12px 0 38px; }
  .tray { left: 8px; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tray-inner { flex-wrap: wrap; gap: 10px; padding: 10px; }
  .tray-info { flex-basis: 100%; }
  .tray-stat-clips { display: none; }
  .tray-actions { flex: 1; }
  .tray-actions #build-btn { flex: 1; }
  .popover-anchor { position: static; }
  .popover { left: 0; right: 0; width: auto; bottom: calc(100% + 8px); padding: 16px; }
  .pop-grid { gap: 14px 12px; }
  .panel { top: 0; z-index: 50; width: 100%; border-left: 0; box-shadow: none; }
  .panel-back { display: inline-flex; }
  .panel-close { display: none; }
  .panel-head { padding: 10px 16px 16px; }
  .panel-body { padding: 16px 16px 32px; gap: 20px; }
  .toasts { top: calc(var(--topbar-h) + 8px); right: 12px; left: 12px; width: auto; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
  .modal-scrim { padding: 12px; }
  .player-video { max-height: calc(100vh - 210px); }
}
@media (max-width: 520px) {
  .topbar-disk { display: none; }
  .title-block h1 { font-size: 16px; }
  .meta-item { padding: 10px 12px; }
  .stepper { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
  .step { flex-direction: row; align-items: center; gap: 12px; min-height: 44px; text-align: left; }
  .step::before { top: auto; bottom: calc(50% + 16px); right: auto; left: 13px; width: 2px; height: 14px; }
  .step-text { flex: 1; flex-direction: row; justify-content: space-between; align-items: baseline; gap: 12px; }
  .step-label { font-size: 13px; }
  .step-count { font-size: 12px; }
  .output { grid-template-columns: 48px minmax(0, 1fr); }
  .output-thumb { width: 48px; height: 48px; }
  .player-foot { flex-wrap: wrap; justify-content: flex-end; }
  .player-path { flex-basis: 100%; }
  .confirm { padding: 20px 18px 16px; }
}

/* ---------------------------------------------------------------- motion */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes pulse { 0%, 100% { transform: scale(.8); opacity: .7; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes indeterminate { from { transform: translateX(-110%); } to { transform: translateX(340%); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
