/* ClaroSpark: a dark-first editing suite with a purple accent. Light theme via [data-theme=light]. */
:root {
  --bg: #0E0E12; --bg-2: #131318; --panel: #18181F; --panel-2: #1F1F28; --raise: #262631;
  --ink: #EEEEF3; --ink-2: #B9B9C6; --muted: #8B8B99; --line: #2A2A35; --line-2: #22222B;
  --top: #0A0A0D; --top-ink: #E4E4EC;
  --accent: #7C6CFF; --accent-2: #6457F0; --accent-ink: #FFFFFF; --accent-soft: rgba(124,108,255,.16); --ring: rgba(124,108,255,.55);
  --ok: #4ADE80; --ok-bg: rgba(74,222,128,.13); --warn: #FBBF24; --warn-bg: rgba(251,191,36,.13);
  --todo: #A1A1AE; --todo-bg: rgba(161,161,174,.14); --bad: #F87171; --bad-bg: rgba(248,113,113,.14);
  --tt: #000000; --ig: #E1306C;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.5);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}
:root[data-theme=light] {
  --bg: #F4F4F7; --bg-2: #ECECF1; --panel: #FFFFFF; --panel-2: #F7F7FA; --raise: #EFEFF4;
  --ink: #15151B; --ink-2: #474756; --muted: #6E6E7C; --line: #E1E1E8; --line-2: #ECECF1;
  --top: #111116; --top-ink: #E4E4EC;
  --accent: #5B4BF5; --accent-2: #4B3CE0; --accent-soft: #ECEAFF; --ring: rgba(91,75,245,.45);
  --ok: #157A44; --ok-bg: #E3F5EA; --warn: #8A5300; --warn-bg: #FFF1D6; --todo: #555561; --todo-bg: #EDEDF1; --bad: #B42318; --bad-bg: #FDE8E7;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.06); --shadow-lg: 0 24px 60px rgba(0,0,0,.18);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--raise); padding: 1px 5px; border-radius: 5px; }
.sub { color: var(--ink-2); margin-top: 4px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; }

/* ---------- top bar ---------- */
.top { height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--top); color: var(--top-ink); position: sticky; top: 0; z-index: 30; border-bottom: 1px solid #1d1d25; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 750; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; }
.apps { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.app-tab { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; border: 0; background: transparent; color: #C9C9D4; cursor: pointer; white-space: nowrap; text-decoration: none; font-weight: 550; transition: background .15s var(--ease); min-height: 40px; }
.app-tab:hover { background: #1A1A21; color: #fff; }
.app-tab[aria-current=page] { background: #24242E; color: #fff; }
.app-tab img, .app-tab .ph { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; background: #fff; }
.app-tab .ph { display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }
.app-tab .n { color: #8C8C99; font-size: 12px; font-variant-numeric: tabular-nums; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.on-dark { color: #D6D6E0 !important; border-color: #30303B !important; }
.on-dark:hover { background: #1A1A21 !important; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4a4a55; display: inline-block; }
.dot.run { background: #4ADE80; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.55); } 70% { box-shadow: 0 0 0 7px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
.count { color: #9a9aa8; font-size: 12.5px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.side { background: var(--bg-2); border-right: 1px solid var(--line); position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 14px 10px 20px; display: flex; flex-direction: column; gap: 18px; }
.side-link { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; border: 0; background: none; color: var(--ink-2); text-decoration: none; cursor: pointer; text-align: left; min-height: 38px; transition: background .12s var(--ease), color .12s; }
.side-link:hover { background: var(--panel-2); color: var(--ink); }
.side-link[aria-current=page] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.side-link .c { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-link .c.zero { color: var(--warn); }
.side-link .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 26px 30px 90px; min-width: 0; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); padding: 8px 14px; min-height: 38px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--ink); transition: background .15s var(--ease), border-color .15s, transform .08s; }
.btn:hover { border-color: var(--muted); background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.tt { background: #000; border-color: #000; color: #fff; }
.btn.ig { background: linear-gradient(135deg, #F58529, #DD2A7B 50%, #8134AF); border: 0; color: #fff; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; transform: none; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid transparent; background: none; border-radius: 10px; cursor: pointer; color: var(--ink-2); transition: background .12s; }
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: var(--bg-2); border-radius: 9px; padding: 9px 11px; outline: none; min-height: 40px; transition: border-color .12s, box-shadow .12s; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range] { padding: 0; min-height: 28px; accent-color: var(--accent); background: none; border: 0; box-shadow: none; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.field { display: block; margin: 0 0 16px; }
.field > span:first-child { display: flex; gap: 8px; align-items: baseline; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 13.5px; min-height: 32px; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed=true] { background: var(--raise); color: var(--ink); font-weight: 600; }
.select-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.select-inline select { width: auto; min-height: 36px; padding: 6px 30px 6px 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--r); padding: 12px 14px; margin-bottom: 18px; }
.banner svg { color: var(--warn); margin-top: 2px; }
.banner pre { white-space: pre-wrap; font: 12px/1.55 var(--mono); margin: 8px 0 0; color: var(--ink-2); }
.banner.info { background: var(--accent-soft); border-color: transparent; }
.banner.info svg { color: var(--accent); }

/* ---------- video grid ---------- */
.group { margin-bottom: 34px; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.group-head .page { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.group-head .n { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-w, 300px), 1fr)); gap: 20px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; box-shadow: var(--shadow); transition: border-color .15s, transform .15s var(--ease); }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.thumb { position: relative; background: #050507; aspect-ratio: 9 / 16; cursor: pointer; border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden; border: 0; padding: 0; width: 100%; display: block; }
.thumb.wide { aspect-ratio: 16 / 9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s var(--ease); }
.card:hover .thumb img { transform: scale(1.02); }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(to top, rgba(0,0,0,.45), transparent 45%); opacity: .0; transition: opacity .18s; }
.thumb:hover .play, .thumb:focus-visible .play { opacity: 1; }
.thumb .play span { width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.95); display: grid; place-items: center; color: #111; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.thumb .play svg { fill: #111; stroke: none; margin-left: 4px; width: 22px; height: 22px; }
.thumb .empty { position: absolute; inset: 0; display: grid; place-items: center; color: #9a9aa6; font-size: 14px; text-align: center; padding: 24px; background: repeating-linear-gradient(-45deg, #0b0b0f, #0b0b0f 12px, #101016 12px, #101016 24px); }
.thumb .badges { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.thumb .dur { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; padding: 2px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.card-body { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 7px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.vid { font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hook { font-weight: 650; font-size: 15.5px; line-height: 1.3; }
.card-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.card-meta svg { width: 14px; height: 14px; }
.card-actions { display: flex; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--line-2); align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 3px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.2; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.stale { background: var(--warn-bg); color: var(--warn); }
.chip.todo { background: var(--todo-bg); color: var(--todo); }
.chip.fmt { background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(4px); }
.chip.tt { background: rgba(0,0,0,.75); color: #fff; }
.chip.ig { background: rgba(225,48,108,.85); color: #fff; }
.add-card { border: 1.5px dashed var(--line); border-radius: var(--r-lg); display: grid; place-items: center; min-height: 220px; color: var(--muted); cursor: pointer; background: none; text-align: center; padding: 20px; transition: border-color .15s, color .15s; }
.add-card:hover { border-color: var(--accent); color: var(--ink); }
.empty-state { border: 1.5px dashed var(--line); border-radius: var(--r-lg); padding: 48px 24px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-lg); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- menus (portal: never clipped by cards) ---------- */
.menu { position: fixed; z-index: 80; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 250px; max-width: 320px; max-height: min(70vh, 520px); overflow-y: auto; animation: pop .12s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu .mi { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); text-decoration: none; font-size: 14px; }
.menu .mi:hover, .menu .mi:focus-visible { background: var(--panel-2); outline: none; }
.menu .mi svg { margin-top: 1px; color: var(--muted); }
.menu .mi small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.menu .mi.danger { color: var(--bad); }
.menu .mi.danger svg { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(5,5,8,.62); backdrop-filter: blur(3px); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .16s var(--ease); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 6px; }
.modal-body { padding: 10px 22px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; }
.modes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.mode { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.mode:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode input { margin-top: 3px; }
.mode b { display: block; }
.mode .opts { display: flex; gap: 6px; margin-top: 8px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: flex; flex-direction: column; animation: fade .15s; }
.lb-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: #eee; }
.lb-head .t { flex: 1; min-width: 0; }
.lb-head .t div:first-child { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-head .t div:last-child { font: 12px var(--mono); color: #9a9aa6; }
.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 16px 16px; min-height: 0; }
.lb-stage video { height: 100%; width: auto; max-width: calc(100% - 120px); object-fit: contain; border-radius: 12px; background: #000; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.lb-nav { color: #ddd !important; border: 1px solid #333 !important; }

/* full-screen editor */
.editor { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; grid-template-rows: auto minmax(0, 1fr); animation: fade .15s; }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); min-height: 60px; }
.ed-top .t { flex: 1; min-width: 0; }
.ed-top .t h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-top .t .vid { margin-top: 2px; }
.ed-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 560px); min-height: 0; }
.ed-stage { display: flex; flex-direction: column; min-height: 0; padding: 18px; gap: 12px; background: #07070A; }
.ed-video { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.ed-video video { height: 100%; width: auto; max-width: 100%; object-fit: contain; border-radius: 12px; background: #000; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.ed-video .none { color: #8a8a96; text-align: center; max-width: 360px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.timeline { position: relative; height: 46px; background: #111117; border: 1px solid #23232c; border-radius: 10px; cursor: pointer; overflow: hidden; flex: none; }
.timeline .seg-intro, .timeline .seg-outro { position: absolute; top: 0; bottom: 0; background: rgba(124,108,255,.12); }
.timeline .cue { position: absolute; top: 9px; height: 28px; border-radius: 6px; background: rgba(124,108,255,.35); border: 1px solid rgba(124,108,255,.8); color: #fff; font-size: 11px; padding: 0 6px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; }
.timeline .cue.on { background: var(--accent); }
.timeline .head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; }
.tl-legend { display: flex; justify-content: space-between; color: #8a8a96; font: 12px var(--mono); }
.ed-panel { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
.tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .badge { background: var(--warn); color: #000; border-radius: 99px; font-size: 10px; padding: 0 5px; }
.ed-scroll { flex: 1; overflow-y: auto; padding: 18px 20px; }
.ed-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.ed-foot .state { color: var(--muted); font-size: 13px; }
.lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.line { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 8px; align-items: start; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; transition: border-color .15s; }
.line.on { border-color: var(--accent); }
.line .atcol { display: flex; flex-direction: column; gap: 4px; }
.line input.at { text-align: center; font-variant-numeric: tabular-nums; padding: 7px 4px; }
.line .words { font-size: 11px; color: var(--muted); text-align: center; }
.line .texts { display: flex; flex-direction: column; gap: 6px; }
.line .say { font-size: 13px; }
.line .ops { display: flex; flex-direction: column; gap: 2px; }
.help { color: var(--ink-2); font-size: 13.5px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.help summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.help p, .help ul { margin: 8px 0 0; }
.help ul { padding-left: 18px; }
.cap-count { font-variant-numeric: tabular-nums; }
.cap-count.over { color: var(--bad); font-weight: 700; }
.posts { display: flex; flex-direction: column; gap: 6px; }
.post { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.stills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stills a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.stills img { width: 100%; display: block; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* voice & music pages */
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.voice { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: var(--bg-2); text-align: left; display: flex; flex-direction: column; gap: 2px; transition: border-color .12s; min-height: 58px; }
.voice:hover { border-color: var(--muted); }
.voice[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.voice b { font-size: 14px; }
.voice small { color: var(--muted); font-size: 12px; }
.slider-row { display: grid; grid-template-columns: 1fr 64px; gap: 12px; align-items: center; }
.slider-row output { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.track { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.track + .track { margin-top: 8px; }
.track .meta { flex: 1; min-width: 0; }
.track .meta div:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track audio { height: 34px; width: 240px; }
.track.default { border-color: var(--accent); }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px); }
.table.pron tr.off input:not([type=checkbox]) { opacity: .5; text-decoration: line-through; }
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.conn { display: flex; gap: 14px; align-items: flex-start; }
.conn .logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; font-weight: 800; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--todo); }
.status-dot.ok::before { background: var(--ok); }

/* jobs drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(1000px, 100vw); background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 65; display: flex; flex-direction: column; animation: slide .18s var(--ease); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.jobs-split { flex: 1; display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 0; }
.job-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; border-right: 1px solid var(--line); }
.job-list button { width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 10px; cursor: pointer; color: var(--ink); }
.job-list button:hover { background: var(--panel-2); }
.job-list button[aria-current=true] { background: var(--accent-soft); }
.job-list .jt { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.job-list .jm { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.st { font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; }
.st.running { background: var(--accent-soft); color: var(--accent); }
.st.queued, .st.cancelled { background: var(--todo-bg); color: var(--todo); }
.st.done { background: var(--ok-bg); color: var(--ok); }
.st.failed { background: var(--bad-bg); color: var(--bad); }
.job-view { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.job-view-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.log { flex: 1; margin: 0; padding: 14px 16px; overflow: auto; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; background: var(--bg); color: var(--ink-2); }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 90; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 550; animation: pop .15s var(--ease); pointer-events: auto; max-width: min(560px, calc(100vw - 32px)); }
.toast.err { background: var(--bad); color: #fff; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 1100px) {
  .ed-body { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 45vh) minmax(0, 1fr); }
  .ed-panel { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 8px; }
  .side-group { display: flex; gap: 4px; align-items: center; }
  .side-link { width: auto; white-space: nowrap; }
  .main { padding: 18px 16px 32px; }
  .hide-sm { display: none; }
  .brand span { display: none; }
  .jobs-split { grid-template-columns: 1fr; grid-template-rows: 220px minmax(0, 1fr); }
  .job-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .row2, .row3 { grid-template-columns: 1fr; }
  .track { flex-wrap: wrap; }
  .track audio { width: 100%; }
  .grid { --card-w: 240px !important; }
}

/* ===================== v3: nav, sidebar, folders, templates, schedule ===================== */
.show-sm { display: none !important; }
.side-scrim { display: none; }

.layout { transition: grid-template-columns .2s var(--ease); }
.layout.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.side { gap: 14px; }
.alogo { width: 30px; height: 30px; border-radius: 8px; object-fit: contain; background: #fff; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
.side-tools { display: flex; gap: 6px; align-items: center; padding: 0 2px; }
.side-tools input { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.tree { display: flex; flex-direction: column; gap: 1px; }
.folder { display: flex; align-items: center; gap: 2px; border-radius: 9px; }
.folder:hover { background: var(--panel-2); }
.folder[aria-current=page] { background: var(--accent-soft); }
.folder .tw { width: 26px; height: 32px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; flex: none; }
.folder .tw svg { width: 14px; height: 14px; transition: transform .15s; }
.folder .tw[aria-expanded=true] svg { transform: rotate(90deg); }
.folder .tw:disabled { visibility: hidden; }
.folder a { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 8px 7px 2px; color: var(--ink-2); text-decoration: none; min-height: 36px; }
.folder[aria-current=page] a { color: var(--ink); font-weight: 600; }
.folder a svg { color: color-mix(in srgb, var(--accent) 75%, var(--muted)); width: 17px; height: 17px; }
.folder .c { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-right: 8px; }
.folder .c.zero { color: var(--warn); }
.leaf { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 46px; color: var(--ink-2); text-decoration: none; font-size: 13px; border-radius: 8px; min-height: 32px; }
.leaf:hover { background: var(--panel-2); color: var(--ink); }
.leaf .sd { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--todo); }
.leaf .sd.ok { background: var(--ok); } .leaf .sd.stale { background: var(--warn); }
.leaf span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot { margin-top: auto; display: flex; padding-top: 8px; border-top: 1px solid var(--line); }
.side-toggle { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left; }
.side-toggle:hover { background: var(--panel-2); color: var(--ink); }
.side-toggle svg { width: 18px; height: 18px; flex: none; }
.rail .side-toggle { width: 44px; height: 44px; justify-content: center; padding: 0; margin-top: auto; }
.layout.collapsed .side { padding: 12px 8px; align-items: center; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; flex: 1; }
.rail a, .rail button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); border: 0; background: none; cursor: pointer; }
.rail a:hover, .rail button:hover { background: var(--panel-2); color: var(--ink); }
.rail a[aria-current=page] { background: var(--accent-soft); color: var(--ink); }
.rail hr { width: 28px; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* streamlined toolbar */
.tb { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tb .search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.tb .search input { padding-left: 36px; }
.tb .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.tb .btn .badge { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; }
.active-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; min-height: 4px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--ink); border: 0; border-radius: 99px; padding: 4px 6px 4px 12px; font-size: 13px; cursor: pointer; }
.fchip svg { width: 14px; height: 14px; }
.pop { position: fixed; z-index: 80; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px; width: 300px; animation: pop .12s var(--ease); }
.pop h5 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pop .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.opt { border: 1px solid var(--line); background: var(--bg-2); border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.opt[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: #fff; }
.menu .mi .lead { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; background: #fff; flex: none; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; }
.menu .mi.on { background: var(--accent-soft); }

/* templates */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.tcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tcard.default { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.tprev { position: relative; aspect-ratio: 9 / 16; overflow: hidden; background: #111; cursor: pointer; border: 0; padding: 0; display: block; width: 100%; }
.tprev iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.tcard .tb2 { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tcard .tb2 .row { display: flex; align-items: center; gap: 6px; }
.tcard .acts { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
.swatch { width: 100%; aspect-ratio: 9 / 12; border-radius: 10px; display: grid; place-items: center; font-size: 26px; border: 2px solid transparent; }
.tpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tpick button { border: 0; background: none; padding: 0; cursor: pointer; text-align: center; color: var(--ink-2); font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.tpick button[aria-pressed=true] .swatch { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpick button[aria-pressed=true] { color: var(--ink); font-weight: 650; }
.stage-prev { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.stage-prev .pf { position: relative; overflow: hidden; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #000; flex: none; }
.stage-prev iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }
.stage-switch { display: flex; justify-content: center; gap: 8px; flex: none; }
.sect { border-bottom: 1px solid var(--line); padding: 14px 0; }
.sect:first-child { padding-top: 0; }
.sect > summary { cursor: pointer; font-weight: 650; display: flex; align-items: center; gap: 8px; list-style: none; padding: 4px 0; }
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary svg { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.sect[open] > summary svg.chev { transform: rotate(90deg); }
.sect .body { padding-top: 12px; }
.color { display: flex; gap: 6px; align-items: center; }
.color input[type=color] { width: 40px; height: 40px; padding: 2px; border-radius: 9px; flex: none; cursor: pointer; }
.tokens { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tokens button { border: 1px solid var(--line); background: var(--bg-2); border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.radio-row { display: flex; gap: 4px; flex-wrap: wrap; }
.radio-row button { border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); min-height: 34px; }
.radio-row button[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }

/* schedule */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.srow { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.srow + .srow { margin-top: 8px; }
.srow .poster { width: 56px; aspect-ratio: 9 / 16; border-radius: 8px; object-fit: cover; background: #111; }
.srow .poster.wide { aspect-ratio: 16 / 9; }
.srow .t { min-width: 0; }
.srow .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .meta2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.srow .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.stats { display: flex; gap: 14px; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); }
.stats span { display: inline-flex; gap: 4px; align-items: baseline; }
.stats b { color: var(--ink); font-size: 14px; }
.spark { width: 90px; height: 26px; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 2; }
.calstrip { display: flex; align-items: center; gap: 6px; margin: 4px 0 16px; }
.cs-days { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(14, minmax(44px, 1fr)); gap: 4px; overflow-x: auto; }
.cs-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; min-height: 64px; }
.cs-day:hover:not(:disabled) { border-color: var(--muted); }
.cs-day:disabled { cursor: default; }
.cs-day.past { opacity: .55; }
.cs-day.today { border-color: var(--accent); background: var(--accent-soft); }
.cs-day .dw { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cs-day b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cs-day .dots { display: flex; gap: 3px; align-items: center; min-height: 8px; }
.cs-day .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.cs-day .dots i.tiktok { background: var(--ink); } .cs-day .dots i.instagram { background: #C13584; }
.cs-day .dots i.failed { background: var(--bad); }
.cs-day .dots small { font-size: 10px; color: var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 6px; }
.cal .day { min-height: 110px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal .day.out { opacity: .45; }
.cal .day.today { border-color: var(--accent); }
.cal .day .n { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal .ev { font-size: 11.5px; border-radius: 6px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; text-align: left; color: #fff; }
.cal .ev.tiktok { background: #111; } .cal .ev.instagram { background: #C13584; } .cal .ev.other { background: var(--raise); color: var(--ink); }
.cal .ev.failed { outline: 2px solid var(--bad); } .cal .ev.posted { opacity: .7; }
.acct { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; }
.apps-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.apps-pick label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px 5px 8px; cursor: pointer; font-size: 13px; background: var(--bg-2); }
.apps-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.target { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: var(--bg-2); }
.target + .target { margin-top: 6px; }
.target:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

@media (max-width: 860px) {
  .show-sm { display: inline-grid !important; }
    .layout, .layout.collapsed { grid-template-columns: 1fr; }
  .side .side-group { display: block; }
  .side .side-link { width: 100%; white-space: normal; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); height: 100vh; z-index: 70; transform: translateX(-105%); transition: transform .2s var(--ease); flex-direction: column; overflow-y: auto; padding: 16px 12px; border-right: 1px solid var(--line); }
  body.side-open .side { transform: none; }
  .side-scrim { display: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 69; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .srow { grid-template-columns: 48px minmax(0, 1fr); }
  .srow .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .cal .day { min-height: 70px; }
  .side-foot { display: none; }
  .top { gap: 6px; padding: 0 8px; }
  .top-actions { gap: 0; }
  #jobsBtn { padding-inline: 10px; }
  .acct-btn { margin-left: 2px; }
  .top-app { flex: 1; }
}

/* settings: logins, page links, discovered pages */
.row4 { display: grid; grid-template-columns: 1fr 1.2fr 1.4fr 1.4fr; gap: 12px; }
@media (max-width: 860px) { .row4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .row4 { grid-template-columns: 1fr; } }
.url-cell { display: flex; gap: 4px; align-items: center; }
.url-cell input { color: var(--accent); }
.disc-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.disc-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.disc-row.have { opacity: .6; }
.disc-row input:not([type=checkbox]) { min-height: 34px; padding: 6px 10px; margin-bottom: 4px; }
.disc-row .hint a { color: var(--accent); word-break: break-all; }

/* jobs dropdown */
.jobs-pop { position: fixed; top: 58px; right: 12px; width: min(520px, calc(100vw - 24px)); max-height: min(78vh, 760px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 65; animation: fade .12s; }
.jobs-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px 18px; border-bottom: 1px solid var(--line); }
.jobs-head h2 { font-size: 16px; }
.jobs-body { overflow-y: auto; padding: 6px 12px 14px; }
.jgroup h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 6px 4px; }
.jpage h4 { font-size: 13.5px; margin: 8px 6px 6px; color: var(--ink); }
.jpage ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.jcard { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg-2); }
.jcard.failed { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.jc-top { display: flex; gap: 8px; align-items: baseline; }
.jc-t { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; }
.jc-t span { color: var(--ink-2); }
.jc-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.jcard .st { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; background: var(--raise); color: var(--ink-2); }
.jcard .st.run { background: var(--accent-soft); color: var(--accent); } .jcard .st.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.jcard .st.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.jbar { height: 6px; border-radius: 999px; background: var(--raise); overflow: hidden; margin: 10px 0 6px; }
.jbar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s var(--ease); }
.jcard.done .jbar i { background: var(--ok); } .jcard.failed .jbar i { background: var(--bad); } .jcard.cancelled .jbar i { background: var(--muted); }
.jcard.running .jbar i { background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); background-size: 200% 100%; animation: jshine 1.4s linear infinite; }
@keyframes jshine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.jc-step { font-size: 12.5px; color: var(--ink-2); }
.jc-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.linkish { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; padding: 4px; }
.jcard .log { max-height: 260px; margin-top: 8px; }
@media (max-width: 860px) { .jobs-pop { right: 8px; left: 8px; width: auto; } }

.sel-add { display: flex; gap: 8px; align-items: center; }
.sel-add select { flex: 1; min-width: 0; }
.sel-add .icon-btn { border: 1px solid var(--line); flex: none; }

/* background layer editor */
.bge { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bge-layer { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; overflow: hidden; }
.bge-layer.off .bge-toggle { opacity: .55; }
.bge.overridden .bge-list { opacity: .45; }
.bge-head { display: flex; align-items: center; gap: 2px; padding-right: 4px; }
.bge-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--ink); padding: 8px 8px 8px 10px; min-height: 48px; cursor: pointer; text-align: left; font-size: 14px; font-weight: 600; }
.bge-toggle svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.bge-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bge-badge { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; font-weight: 600; flex: none; }
.bge-thumb { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); flex: none; background-color: #15151c; background-size: cover; }
.bge-acts { display: flex; flex: none; }
.bge-acts .icon-btn:disabled { opacity: .3; cursor: default; }
.bge-acts .icon-btn[aria-pressed=true] { color: var(--muted); }
.bge-body { border-top: 1px solid var(--line); padding: 14px 12px 2px; }
.bge-hint { color: var(--muted); font-size: 13px; margin: 0; }
.bge-add { display: flex; }
.bge-color .color { gap: 10px; }
.bge-colorname { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bge-color .tokens button { min-height: 30px; padding: 2px 10px; }
.bge-color .tokens button[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.bge-bar { position: relative; height: 30px; border-radius: 8px; border: 1px solid var(--line); margin: 6px 10px 12px 10px; cursor: copy; touch-action: none; }
.bge-stop { position: absolute; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.4); padding: 0; cursor: grab; touch-action: none; }
.bge-stop.on { box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0,0,0,.4); z-index: 1; }
.bge-stopedit { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.bge-pad { position: relative; width: 100%; max-width: 260px; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2) linear-gradient(var(--line-2) 1px, transparent 1px) 0 0 / 100% 25%; cursor: crosshair; touch-action: none; }
.bge-dot { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.5); pointer-events: none; }
.bge-imggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-bottom: 10px; max-height: 260px; overflow: auto; }
.bge-imgcell { aspect-ratio: 1; padding: 0; border: 2px solid var(--line); border-radius: 9px; overflow: hidden; cursor: pointer; background: var(--bg-2); }
.bge-imgcell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bge-imgcell[aria-pressed=true], .bge-imgcell:hover { border-color: var(--accent); }
.bge-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.bge-btns input[type=search] { flex: 1; min-width: 160px; }
.bge-pix { display: flex; flex-direction: column; gap: 8px; }
.bge-notice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; font-weight: 600; }
.bge-notice[hidden] { display: none; }
.bge-notice svg { width: 16px; height: 16px; flex: none; }
.bge-notice span { flex: 1; min-width: 140px; }
.bge-adv > summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; font-weight: 600; padding: 6px 0; min-height: 34px; }
.bge-advbody textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.bge-sw { position: relative; width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); flex: none; overflow: hidden; cursor: pointer; }
.bge-sw input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ===================== Library + three-column editor ===================== */
.lib-tabs { padding: 0; margin-bottom: 20px; }
.lib-tabs .tab { text-decoration: none; min-height: 44px; }
.lib-tabs .tab svg { width: 16px; height: 16px; }
.lib-intro { margin-bottom: 16px; }
.lib-h { font-size: 15px; color: var(--ink-2); margin: 4px 0 12px; }
.lib-h + .lgrid, .lib-h + .empty-state { margin-bottom: 28px; }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.lgrid.voices { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.lcard .lprev { border: 0; padding: 0; background: var(--bg-2); cursor: pointer; display: block; width: 100%; }
.lcard .lprev:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.lcard .tb2 b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lgrid.voices .psw-icon { aspect-ratio: 3 / 1; }
.lib-empty { padding: 28px 20px; }

/* piece swatch: drawn at video scale, shrunk to fit */
.psw { position: relative; overflow: hidden; width: 100%; background: #15151c; }
.psw-in { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.psw-subs { display: grid; place-items: center; padding: 40px; text-align: center; line-height: 1.2; }
.psw-cap { display: inline-block; letter-spacing: -0.01em; }
.psw-icon { display: grid; place-items: center; aspect-ratio: 1; background: var(--raise); color: var(--ink-2); }
.psw-icon svg { width: 22px; height: 22px; }
.lcard .psw-icon svg { width: 34px; height: 34px; color: var(--accent); }

/* piece picker */
.ppick.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ppick.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ppick.rows { display: flex; flex-direction: column; gap: 6px; }
.pp-item { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: var(--ink-2); cursor: pointer; text-align: left; font-size: 13px; min-width: 0; }
.ppick.tiles .pp-item .psw { border-radius: 10px; border: 2px solid var(--line); }
.ppick.tiles .pp-item:hover .psw { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.ppick.tiles .pp-item[aria-pressed=true] .psw { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ppick.tiles .pp-item .psw-icon.lead { aspect-ratio: 4 / 5; border-style: dashed; }
.pp-item[aria-pressed=true] { color: var(--ink); font-weight: 650; }
.pp-label { display: flex; flex-direction: column; min-width: 0; }
.pp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-label small { color: var(--muted); font-size: 11.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pp-check svg { width: 13px; height: 13px; stroke-width: 3; }
.ppick.rows .pp-item { flex-direction: row; align-items: center; gap: 12px; padding: 8px 10px; min-height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.ppick.rows .pp-item:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.ppick.rows .pp-item[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.ppick.rows .psw-icon { width: 36px; height: 36px; flex: none; border-radius: 9px; aspect-ratio: auto; }
.ppick.rows .psw-icon svg { width: 18px; height: 18px; }
.ppick.rows .pp-label { flex: 1; }
.ppick.rows .pp-check { position: static; flex: none; }
.ppick.rows .pp-new { border-style: dashed; }
.pp-skel { height: 120px; }
.ppick.rows .pp-skel { height: 52px; }

/* three-column shell: pieces | preview | settings */
.editor.ed3 { grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.ed3 .ed-top { min-width: 0; }
.ed3-body { display: grid; grid-template-columns: 300px minmax(0, 1fr) 400px; grid-template-areas: "left mid right"; min-height: 0; }
.ed3-left { grid-area: left; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.ed3-mid { grid-area: mid; background: #07070A; display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 16px; }
.ed3-right { grid-area: right; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.ed3-switch { display: none; }
.ed3-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 24px; }
.ed3-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.ed3-tab { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); border-radius: 999px; padding: 6px 12px; min-height: 36px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.ed3-tab svg { width: 15px; height: 15px; }
.ed3-tab:hover { color: var(--ink); }
.ed3-tab[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ed3-lhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.ed3-lhead a { text-decoration: none; }
.ed3-head { margin-bottom: 14px; }
.ed3-head h3 { font-size: 18px; overflow-wrap: anywhere; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.ed3-note { margin-bottom: 12px; }
.ed3-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ed3-right .banner { margin-bottom: 16px; font-size: 13.5px; }
.banner-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ed3-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.ed3-fs.locked { opacity: .55; pointer-events: none; }
.locked-field { opacity: .55; }
.ed3-prev { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.ed3-prev .stage-switch { flex-wrap: wrap; }
.ed3-sample { width: auto; max-width: 220px; }
.ed3-audio { width: 100%; margin-bottom: 14px; }
.ed3-foot { grid-column: 1 / -1; background: var(--bg-2); }
.vctl-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.toggle-row { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; cursor: pointer; min-height: 32px; }
@media (max-width: 1240px) {
  .ed3-body { grid-template-columns: 260px minmax(0, 1fr) 360px; }
}
@media (max-width: 860px) {
  .ed3-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(240px, 42vh) auto minmax(0, 1fr); grid-template-areas: "mid" "sw" "pane"; }
  .ed3-mid { padding: 10px; }
  .ed3-switch { grid-area: sw; display: flex; justify-content: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
  .ed3-switch .seg { width: 100%; max-width: 360px; }
  .ed3-switch .seg button { flex: 1; justify-content: center; }
  .ed3-left, .ed3-right { grid-area: pane; border: 0; }
  .ed3-body[data-pane=pieces] .ed3-right, .ed3-body[data-pane=settings] .ed3-left { display: none; }
  .ed3-scroll { padding: 14px 16px 20px; }
  .ed3-tabs { padding: 10px 16px; flex-wrap: nowrap; overflow-x: auto; }
  .ed3-tab { flex: none; }
  .ppick.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ed3-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .ed3-prev .stage-switch .seg button { padding: 6px 9px; }
  .ed3-prev .stage-switch { gap: 6px; }
  .ed3-sample { max-width: 100%; flex: 1 1 100%; }
  .lgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .lgrid.voices { grid-template-columns: 1fr; }
}

/* video editor on the three-column shell */
.ed3-mid > .ed-stage { flex: 1; padding: 0; min-height: 0; background: none; }
.ed3-right > .tabs { flex: none; }
.ed3-right > .ed-scroll { flex: 1; min-height: 0; }
.ppick.tiles .pp-item .psw .swatch { border-radius: 8px; }
.ed3-right > .tabs { overflow-x: auto; scrollbar-width: none; }
.ed3-right > .tabs { padding-inline: 6px; gap: 0; }
.ed3-right > .tabs .tab { flex: none; padding-inline: 6px; gap: 4px; }
/* Six tabs (Timeline added) fit the 400px panel as text only. */
.ed3-right > .tabs .tab svg { display: none; }
.ed3-right > .tabs .tab { padding-inline: 8px; }

/* jobs: clear finished + remove one */
.jobs-head { gap: 6px; }
.jobs-head .grow { flex: 1; }
.jc-x { align-self: center; margin: -6px -6px -6px 0; }

/* long piece names never spill into the next tile: the label is as wide as its tile and ellipsises */
.ppick.tiles .pp-label { width: 100%; }
.ppick.tiles .pp-name { max-width: 100%; }
/* timeline legend: the hint drops to its own line when the stage is narrow */
.tl-legend { flex-wrap: wrap; gap: 2px 12px; }
@media (max-width: 860px) {
  .tl-legend > span:nth-child(2) { order: 3; flex-basis: 100%; text-align: center; }
}
/* Library tabs on phones: drop the icons so all four fit without a hidden sideways scroll */
@media (max-width: 520px) {
  .lib-tabs .tab { padding-inline: 10px; }
  .lib-tabs .tab svg { display: none; }
}
/* piece editor footer on phones: one row (state ellipsises, Duplicate/Delete shrink to icons) */
@media (max-width: 520px) {
  .ed3-foot:has(.foot-ic) { flex-wrap: nowrap; }
  .ed3-foot:has(.foot-ic) .state { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed3-foot:has(.foot-ic) .grow { display: none; }
  .ed3-foot .btn.foot-ic { font-size: 0; gap: 0; padding-inline: 10px; flex: none; }
}

/* ===================== team (G2) ===================== */
.role-badge { font-size: 12px; font-weight: 650; color: #D6D6E0; border: 1px solid #30303B; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.role-badge.view-only { color: #fff; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
body.view-only button:disabled, body.view-only input:disabled, body.view-only select:disabled, body.view-only textarea:disabled { cursor: not-allowed; }
body.view-only input:disabled, body.view-only select:disabled, body.view-only textarea:disabled { opacity: .62; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.team-invite { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: end; }
.team-invite .field { margin: 0; }
.team-invite .seg { min-height: 42px; align-items: center; }
.team-invite .seg button { min-height: 34px; padding: 6px 16px; }
.team-list { margin-top: 16px; }
.team-list .panel-head { align-items: baseline; margin-bottom: 6px; }
.team-rows { list-style: none; margin: 0; padding: 0; }
.team-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line-2); }
.team-row:first-child { border-top: 0; }
.team-av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; color: var(--accent-ink); background: var(--accent); }
.team-row.pending .team-av { background: var(--panel-2); color: var(--ink-2); border: 1.5px dashed var(--line); }
.team-email { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; min-width: 0; }
.team-email > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.team-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.team-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 860px) {
  .team-invite { grid-template-columns: 1fr; }
  .team-invite .team-go span { display: none; }
  .team-invite .btn.primary { width: 100%; justify-content: center; min-height: 44px; }
  .team-row { grid-template-columns: 38px minmax(0, 1fr); }
  .team-actions { grid-column: 2; justify-content: flex-start; }
  .role-badge { display: none; }
  .role-badge.view-only { display: inline-block; }
}

/* ===================== app shell (G3): slim top bar, sectioned sidebar, account menu ===================== */
.top-app { display: inline-flex; align-items: center; gap: 9px; min-width: 0; max-width: 260px; min-height: 40px; padding: 5px 10px 5px 6px; border: 1px solid #30303B; border-radius: 11px; background: #17171d; color: #E8E8F0; font: inherit; font-weight: 600; cursor: pointer; margin-left: 4px; }
.top-app[hidden] { display: none; }
.top-app:hover { background: #1f1f28; border-color: #45455a; }
.top-app .alogo { width: 26px; height: 26px; border-radius: 7px; font-size: 12px; }
.top-app .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-app svg { color: #9a9aa8; width: 16px; height: 16px; }
.top .top-actions { margin-left: auto; }
.acct-btn { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; background: var(--accent); color: var(--accent-ink, #fff); font: inherit; font-size: 13px; font-weight: 750; letter-spacing: .02em; cursor: pointer; display: grid; place-items: center; margin-left: 4px; flex: none; }
.acct-btn[hidden] { display: none; }
.acct-btn:hover { border-color: #ffffff55; }
.menu-head { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: 280px; }
.menu-head b { font-size: 13.5px; word-break: break-all; font-weight: 650; }
.role-chip { font-size: 11.5px; font-weight: 650; border-radius: 999px; padding: 2px 9px; background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.side { gap: 10px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-sep { border: 0; border-top: 1px solid var(--line); margin: 2px 6px; width: calc(100% - 12px); }
.side-row { display: flex; align-items: center; gap: 4px; }
.side-row .side-link { flex: 1; min-width: 0; font-weight: 650; }
.side-link svg { color: var(--muted); }
.side-link[aria-current=page] svg { color: var(--accent); }
.side-group > .side-tools { margin: 4px 0 6px; }
.side-group > .tree { padding-left: 6px; }
.side-foot { border-top: 0; padding-top: 4px; }
.rail hr { width: 28px; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.rail .rail-end { margin-top: auto; }
.rail .rail-end .side-toggle { margin-top: 0; }
.layout.collapsed .side { overflow-x: hidden; }

@media (min-width: 861px) {
  .side { overflow: hidden; }
  .side-videos { flex: 1 1 0; min-height: 150px; }
  .side-videos > .tree { overflow-y: auto; min-height: 0; flex: 1; scrollbar-width: thin; }
  .side-foot { margin-top: 0; }
}

/* Sound & voice: ElevenLabs connection, voice tuning, phoneme warning */
.el-conn .panel-head .btn { flex-shrink: 0; }
.conn-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.conn-status .chip { font-size: 12.5px; padding: 5px 10px; }
.conn-status .chip svg { width: 14px; height: 14px; }
.credits { margin-bottom: 16px; }
.credits-bar { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.credits-bar span { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.credits-bar.low span { background: var(--warn); }
.credits-text { display: flex; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-top: 8px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; min-width: 0; font-family: var(--mono); }
.key-note { display: flex; align-items: center; gap: 8px; margin: 0; }
.key-note svg { color: var(--ok); flex-shrink: 0; }
.tune-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.pron-warn { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--warn); }
.table.pron tr.has-warn td { border-bottom: 0; padding-bottom: 2px; }
.table.pron tr.pron-warn-row td { padding-top: 0; }
.table.pron tr.pron-warn-row[hidden] { display: none; }
.pron-warn svg { width: 14px; height: 14px; flex-shrink: 0; }
@media (max-width: 640px) {
  .tune-grid { grid-template-columns: 1fr; }
  .key-row { flex-direction: column; }
  .el-conn .panel-head { flex-direction: column; }
  .table.pron { table-layout: fixed; width: 100%; }
  .table.pron th:first-child { width: 40px; }
  .table.pron th:last-child { width: 76px; }
  .table.pron td input:not([type=checkbox]) { width: 100%; min-width: 0; }
}
/* Keep focused or scrolled-to controls clear of the sticky save bar */
html:has(.save-bar) { scroll-padding-bottom: 88px; }
.chip.fix { background: var(--warn-bg); color: var(--warn); font-weight: 600; }

/* ---- Video editor: Timeline (steps), Pages, Screenshots, and the line → step chip on the Script tab */
.line-step { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-step svg { width: 13px; height: 13px; flex: none; }
.line-step.none { color: var(--muted); border-style: dashed; }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 0 10px; flex-wrap: wrap; }
.tl-head h3 { font-size: 15px; }
.tl-pages { display: flex; flex-direction: column; gap: 8px; }
.tl-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-pages-add { display: flex; flex-direction: column; gap: 8px; }
.tl-uncap { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.tl-warn { display: flex; gap: 8px; align-items: flex-start; color: var(--warn); font-size: 13px; margin: 0 0 10px; }
.tl-warn svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.step { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; transition: border-color .15s, opacity .15s; }
.step.fix { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--bg-2)); }
.step.dragging { opacity: .45; }
.step.over { border-color: var(--accent); }
.step-top { display: flex; align-items: center; gap: 4px; min-width: 0; }
.step .handle { cursor: grab; }
.step-n { font: 600 12px var(--mono); color: var(--muted); min-width: 18px; text-align: center; }
.step-act { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: 14px; }
.step-act svg { width: 16px; height: 16px; color: var(--accent); }
.tl-target { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; text-align: left; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 9px; padding: 7px 10px; cursor: pointer; font-size: 13.5px; overflow: hidden; }
.tl-target span, .tl-target { text-overflow: ellipsis; white-space: nowrap; }
.tl-target svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.tl-target.empty { color: var(--muted); border-style: dashed; }
.tl-target:disabled { cursor: default; opacity: .8; }
.tl-num { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.tl-pause { grid-template-columns: 44px 1fr 52px; gap: 8px; }
.tl-line { font-size: 13px; min-height: 36px; padding: 6px 9px; }
.step-errs { margin: 0; padding-left: 18px; color: var(--bad); font-size: 12.5px; }
.tl-add { margin-top: 10px; }
.tl-stills { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.still-row { display: flex; gap: 10px; align-items: center; width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.still-row img, .still-film { width: 64px; height: 44px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.still-film { display: grid; place-items: center; color: var(--muted); background: var(--panel); }
.still-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pick-stage { position: relative; margin: 10px auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; line-height: 0; background: var(--bg-2); }
.pick-stage img { width: 100%; display: block; user-select: none; }
.pick-box { position: absolute; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; padding: 0; cursor: pointer; min-width: 6px; min-height: 6px; }
.pick-box:hover, .pick-box:focus-visible { background: color-mix(in srgb, var(--accent) 30%, transparent); outline: 2px solid var(--ring); }
.pick-box.on { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 25%, transparent); }
.pick-box.no { border: 1px dashed var(--muted); background: repeating-linear-gradient(45deg, rgba(0,0,0,.18) 0 4px, transparent 4px 8px); cursor: not-allowed; }
.pick-box:disabled { pointer-events: auto; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.pick-list h4 { margin: 4px 0; font-size: 13px; color: var(--ink-2); }
.pick-row { display: flex; gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); border-radius: 8px; padding: 6px 9px; cursor: pointer; font-size: 13px; }
.pick-row.on { border-color: var(--ok); }
.pick-row:disabled { opacity: .5; cursor: not-allowed; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shot-pick { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); border-radius: 10px; padding: 6px; cursor: pointer; font-size: 12px; text-align: left; }
.shot-pick img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; border-radius: 6px; }
.shot-pick:hover { border-color: var(--accent); }
