/* Пока человек спит — студия в стиле «Гипнограмма».
   Night-blue ground, lamp-yellow for "your move", compact rows for the
   owner's decisions. Fonts are vendored (vendor/fonts.css).
   Sections: tokens · base · shell · components · legacy screens. */

:root {
  --night: #0E1030; --night-2: #151843; --night-3: #1C2052;
  --panel: #11143A; --panel-2: #181C4A;
  --line: #2B3070; --line-2: #3A4090;
  --ink: #ECEBFF; --mut: #A9ABD8; --mut-2: #7E81B8;
  --lamp: #FFC94A; --lamp-2: #FFB21F; --ant: #6FB8FF; --lav: #C59BFF; --mint: #7FE0B0;
  --err: #FF7A7A; --err-bg: #3A1830;
  --paper: #FFF3C4; --paper-2: #FBE7A2; --paper-ink: #2A2340; --paper-mut: #6E6590;
  --r-s: 10px; --r: 16px; --r-l: 24px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --f: 'Onest', system-ui, sans-serif; --hand: 'Caveat', cursive; --mono: 'JetBrains Mono', ui-monospace, monospace;
  /* legacy names used by older screens */
  --bg: var(--night); --panel2: var(--panel-2); --text: var(--ink); --muted: var(--mut);
  --accent: var(--lamp); --accent-text: var(--night); --ok: var(--mint); --bad: var(--err);
  --warn: var(--lamp-2); --info: var(--ant);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #151638; }
[hidden] { display: none !important; }
body {
  margin: 0; color: var(--ink); font: 16px/1.5 var(--f); min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(1100px 520px at 88% -12%, #2A2B6B 0, transparent 62%),
              linear-gradient(180deg, var(--night) 0, #12143A 900px, #151638 100%);
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 33% 8%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 14%, #fff7 50%, transparent 51%), radial-gradient(1px 1px at 77% 22%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 6%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 4% 40%, #fff4 50%, transparent 51%);
}
a { color: inherit; }
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic.s { width: 16px; height: 16px; } .ic.l { width: 24px; height: 24px; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1 { font-size: 40px; line-height: 1.1; margin: 8px 0 6px; font-weight: 700; letter-spacing: -.01em; }
h1 em { font-style: normal; color: var(--lamp); }
h2 { font-size: 22px; line-height: 1.2; margin: 0 0 14px; }
h3 { font-size: 17px; margin: 0 0 6px; }
.mono { font-family: var(--mono); }
.mut, .meta { color: var(--mut); } .meta { font-size: 13.5px; }
.small { font-size: 13.5px; }
.hand { font-family: var(--hand); font-weight: 500; font-size: 22px; line-height: 1.12; }
.eyebrow { font-size: 12.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--mut); font-weight: 600; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.sub, .help { color: var(--mut); margin: 0 0 22px; }
.err { color: var(--err); word-break: break-word; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; padding: 16px 40px; background: linear-gradient(180deg, #0E1030 60%, #0E103000); }
.logo { display: flex; gap: 12px; align-items: center; font-weight: 700; font-size: 17px; text-decoration: none; white-space: nowrap; }
.logo img { width: 32px; height: 32px; }
.nav { display: flex; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--mut); text-decoration: none; padding: 9px 14px; border-radius: 999px; font-weight: 500; transition: background .15s var(--ease), color .15s; }
.nav a:hover { color: var(--ink); background: #ffffff0d; }
.nav a.on { color: var(--night); background: var(--lamp); font-weight: 600; }
.nav .badge, .tabbar .badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--night); color: var(--lamp); font-size: 12px; font-weight: 700; border: 0; }
.nav a:not(.on) .badge { background: var(--lamp); color: var(--night); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.top-r .logout { display: contents; }
.clock { color: var(--mut); font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.pulse { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mut); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px #7FE0B022; flex: none; }
.dot.w { background: var(--lamp); box-shadow: 0 0 0 4px #FFC94A22; } .dot.e { background: var(--err); box-shadow: 0 0 0 4px #FF7A7A22; } .dot.o { background: var(--mut-2); box-shadow: none; }
.iconbtn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; position: relative; text-decoration: none; }
.iconbtn:hover { background: #ffffff0d; }
.iconbtn.on { background: var(--lamp); color: var(--paper-ink); border-color: var(--lamp); }
.iconbtn .pip { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--lamp); }
.iconbtn .pip.e { background: var(--err); }
.testbar { margin: 0 40px 8px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ant); background: #6FB8FF12; border: 1px dashed #6FB8FF55; border-radius: 12px; padding: 8px 14px; }
.testbar a { color: var(--ant); font-weight: 600; }
.tabbar { display: none; }
main.page { padding: 4px 40px 48px; position: relative; max-width: 1440px; margin: 0 auto; }
main, section, aside, .panel { min-width: 0; }
.wrap { max-width: 1360px; margin: 0 auto; }

/* focus mode: the four decisions run without the menu */
.focusbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 14px 40px; background: #0E1030F2; border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.focusbar .back { display: flex; align-items: center; gap: 8px; color: var(--mut); text-decoration: none; font-weight: 500; }
.focusbar .t { font-weight: 700; font-size: 16px; }
.focusbar .fb-r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pips { display: flex; gap: 6px; } .pips i { width: 28px; height: 6px; border-radius: 3px; background: #ffffff22; } .pips i.d { background: var(--mint); } .pips i.c { background: var(--lamp); }

/* ---------- components ---------- */
.panel, .card { background: #0B0D28AA; border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px 22px; }
.panel.tight { padding: 14px 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.divide > * + * { border-top: 1px dashed var(--line); }

/* buttons — .b is the system; .btn* map onto it for older screens */
.b, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 11px 18px; min-height: 44px; font: 600 14.5px var(--f); cursor: pointer; text-decoration: none; white-space: nowrap; color: var(--ink); background: transparent; box-shadow: inset 0 0 0 1.5px #ffffff2e; transition: transform .1s var(--ease), background .15s, box-shadow .15s; }
.b:active, .btn:active { transform: translateY(1px); }
.b.ghost:hover, .btn:hover { box-shadow: inset 0 0 0 1.5px #ffffff55; background: #ffffff08; }
.b.lamp, .btn-primary { background: var(--lamp); color: var(--night); box-shadow: none; }
.b.lamp:hover, .btn-primary:hover { background: #FFD56B; }
.b.ink { background: var(--paper-ink); color: var(--paper); box-shadow: none; }
.b.pghost { color: var(--paper-ink); box-shadow: inset 0 0 0 1.5px #2A234055; }
.b.danger, .btn-danger { color: var(--err); box-shadow: inset 0 0 0 1.5px #FF7A7A66; background: transparent; }
.b.big { min-height: 52px; padding: 14px 24px; font-size: 16px; }
.b.sm { min-height: 36px; padding: 7px 12px; font-size: 13.5px; }
.b[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.b.wide { width: 100%; }
.kbd { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid currentColor; opacity: .6; }
button.link { background: none; border: 0; color: var(--lamp); cursor: pointer; padding: 0; font: inherit; font-size: 13.5px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.actions form { display: contents; }

/* chips & tags */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 13.5px var(--f); padding: 8px 13px; min-height: 38px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; transition: all .15s var(--ease); }
.chip:hover { border-color: var(--mut-2); }
.chip[aria-pressed=true], .chip.active { background: var(--lamp); border-color: var(--lamp); color: var(--night); font-weight: 600; }
.chip .n { font-size: 11.5px; opacity: .7; }
.chip-check { display: inline-flex; cursor: pointer; margin: 0; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-flex; align-items: center; font: 500 13.5px var(--f); padding: 8px 13px; min-height: 38px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); }
.chip-check input:checked + span { background: var(--lamp); border-color: var(--lamp); color: var(--night); font-weight: 600; }
.chip-check input:focus-visible + span { outline: 2px solid var(--lamp); outline-offset: 2px; }
.tag, .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #ffffff12; color: var(--ink); white-space: nowrap; }
.tag.lamp { background: var(--lamp); color: var(--night); } .tag.ant { background: #6FB8FF22; color: var(--ant); } .tag.lav { background: #C59BFF22; color: var(--lav); }
.tag.mint, .badge-ok { background: #7FE0B01f; color: var(--mint); } .tag.err, .badge-bad { background: var(--err-bg); color: var(--err); }
.badge.status-needs_review, .badge.status-script_review, .badge.status-storyboard_review, .badge.status-video_review, .badge.status-publish_review { background: var(--lamp); color: var(--night); }
.badge.status-failed { background: var(--err-bg); color: var(--err); }
.badge.status-published, .badge.status-scheduled { background: #7FE0B01f; color: var(--mint); }
/* EN / RU label in front of a line shown in both languages */
.lang-k { font: 600 10.5px var(--mono); letter-spacing: .06em; color: var(--mut-2); padding-top: 3px; }
.warnpill { display: inline-flex; gap: 6px; align-items: center; background: #FFD9D0; color: #8A2D1E; border-radius: 8px; padding: 3px 9px; font-size: 12.5px; font-weight: 600; }

/* still 9:16 */
.still { aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; position: relative; background: #0B0D28; flex: none; }
.still img, .still video { width: 100%; height: 100%; object-fit: cover; display: block; }
.still .cap { position: absolute; left: 8px; right: 8px; bottom: 10px; text-align: center; font-weight: 800; font-size: 13px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 6px #000; }
.still .cap b { color: var(--lamp); }
.still.blank { display: grid; place-items: center; color: var(--mut-2); background: linear-gradient(160deg, #1C2052, #0B0D28); }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--mut); font-weight: 500; margin: 0; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.f { display: grid; gap: 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="time"], input[type="date"], input[type="datetime-local"], input:not([type]), textarea, select, .input {
  width: 100%; font: 15px/1.45 var(--f); color: var(--ink); background: #0A0C26; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 13px; min-height: 44px;
}
label.inline input, label.inline select { width: auto; min-height: 38px; padding: 6px 10px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, .input:focus { outline: 2px solid var(--lamp); outline-offset: 1px; border-color: transparent; }
input[readonly], textarea[readonly] { opacity: .75; }
input[type="range"] { accent-color: var(--lamp); padding: 0; min-height: 0; background: none; border: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--lamp); width: 18px; height: 18px; }
.hint { font-size: 12.5px; color: var(--mut-2); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 0; }
legend { padding: 0 6px; color: var(--mut); font-size: 13.5px; }
button.switch { position: relative; width: 46px; height: 28px; border-radius: 14px; background: #ffffff1f; border: 0; cursor: pointer; flex: none; padding: 0; }
button.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: transform .2s var(--ease); }
button.switch[aria-checked=true] { background: var(--lamp); }
button.switch[aria-checked=true]::after { transform: translateX(18px); background: var(--night); }
label.switch { flex-direction: row; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); }
.form-narrow { max-width: 680px; display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .two { grid-template-columns: 1fr 1fr; } }

/* progress */
.bar { height: 8px; border-radius: 4px; background: #ffffff14; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ant), var(--lamp)); border-radius: 4px; }
.steps { display: flex; gap: 4px; } .steps span { flex: 1; height: 6px; border-radius: 3px; background: #ffffff1a; } .steps span.f { background: var(--mint); } .steps span.x { background: var(--err); }

/* feedback */
.flashes { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.flash { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.flash-error { border-color: #FF7A7A66; background: var(--err-bg); color: #FFD0D0; }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; margin-bottom: 14px; border: 1px solid #6FB8FF33; color: #CFE6FF; background: #6FB8FF14; }
.banner.warn { border-color: #FFC94A55; color: var(--lamp); background: #FFC94A12; }
.banner.bad { border-color: #FF7A7A66; color: #FFD0D0; background: var(--err-bg); }
.sk { background: linear-gradient(90deg, #ffffff0a 0, #ffffff16 40%, #ffffff0a 80%); background-size: 300% 100%; animation: sk 1.6s linear infinite; border-radius: 10px; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -200% 0; } }
.breath { animation: breath 3.2s ease-in-out infinite; }
@keyframes breath { 50% { opacity: .45; } }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 20px; }
.empty .hand { font-size: 30px; color: var(--paper); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { margin-bottom: 0; }

/* decision panel (gates) */
.gate-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; max-width: 1360px; margin: 0 auto; }
.ghead { display: flex; gap: 18px; align-items: flex-start; margin: 6px 0 20px; }
.ghead .still { width: 72px; border-radius: 10px; }
.ghead h1 { font-size: 32px; margin: 0 0 6px; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--mut); font-size: 14px; }
/* The decision panel never grows past the screen: its content scrolls and
   the decision buttons stay pinned to its bottom edge, always in reach. */
.decide { position: sticky; top: 86px; max-height: calc(100vh - 106px); overflow-y: auto; overscroll-behavior: contain; }
.decide .dbtns { position: sticky; bottom: -20px; z-index: 1; margin-bottom: -20px; padding: 14px 0 20px; background: linear-gradient(180deg, #0D0F2Fe6 0, #0D0F2F 18px); }
.decide h3 { margin: 0 0 4px; font-size: 18px; }
.reason-h { font-size: 13px; color: var(--mut); margin: 16px 0 8px; display: flex; align-items: center; gap: 6px; }
.ai-guess { display: flex; gap: 10px; align-items: flex-start; background: #6FB8FF14; border: 1px solid #6FB8FF33; border-radius: 14px; padding: 10px 12px; font-size: 13.5px; color: #CFE6FF; margin-top: 12px; }
.dbtns { display: grid; gap: 8px; margin-top: 16px; }
.kbdhints { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--mut-2); margin-top: 12px; }
.mbar { display: none; }

/* login */
.login-body { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: #0B0D28CC; border: 1px solid var(--line); border-radius: var(--r-l); padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { font-size: 26px; margin: 6px 0 0; }
.login-card .subtitle { color: var(--mut); margin: 0 0 8px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card .b { width: 100%; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .top { padding: 12px 16px; gap: 10px; } .top .nav, .clock, .pulse { display: none; } .logo { font-size: 16px; }
  .top-r a[href="/settings"] { display: none; }
  .testbar { margin: 0 16px 8px; }
  main.page { padding: 4px 16px 110px; }
  h1 { font-size: 28px; }
  .grid2, .gate-grid { grid-template-columns: 1fr; gap: 22px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #0E1030F5; border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); backdrop-filter: blur(10px); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--mut); text-decoration: none; padding: 6px 0; position: relative; min-height: 48px; }
  .tabbar a.on { color: var(--lamp); }
  .tabbar a .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; background: var(--lamp); color: var(--night); }
  .focusbar { padding: 10px 16px; gap: 10px; } .focusbar .back span { display: none; } .pips i { width: 16px; }
  .decide { position: static; max-height: none; overflow: visible; }
  .decide .dbtns { position: static; margin-bottom: 0; padding: 0; background: none; }
  .kbdhints { display: none; }
  .between { flex-wrap: wrap; }
  .ghead h1 { font-size: 24px; }
  .mbar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #0E1030F5; border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
  .mbar .b { flex: 1; }
}
@media (max-width: 480px) {
  .queue { font-size: 0.82rem; }
  .queue th:nth-child(5), .queue td:nth-child(5) { display: none; }
}

/* ================= legacy screens (being moved onto the system) ================= */
/* ---------- dashboard ---------- */

.status-label { font-size: 1.5rem; font-weight: 700; margin: 0.2rem 0; }
.status-idle .status-label { color: var(--muted); }
.status-running .status-label { color: var(--ok); }
.status-paused .status-label { color: var(--warn); }
.status-error .status-label { color: var(--bad); }
.status .detail { color: var(--muted); font-size: 0.9rem; word-break: break-word; }

.counts { list-style: none; padding: 0; margin: 0; }
.counts li { padding: 0.25rem 0; }
.counts b { color: var(--accent); font-size: 1.1em; }

.spend-row {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 0.6rem;
  align-items: center;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--ant), var(--mint)); border-radius: 4px; max-width: 100%; }
.bar .fill.warn { background: var(--warn); }
.bar .fill.over { background: var(--bad); }
.spend-row .num { color: var(--muted); white-space: nowrap; }

.alerts { list-style: none; padding: 0; margin: 0; }
.alerts .alert {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: baseline;
}
.alerts .when { color: var(--muted); }
.alerts .sev-critical .what { color: var(--bad); }
.alerts .sev-warning .what { color: var(--warn); }
.alerts .sev-info .what { color: var(--info); }
.alerts .dropped { opacity: 0.65; }

/* ---------- queue table ---------- */


.queue {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.queue th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
.queue td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.queue .title { max-width: 22ch; }
.queue .err { color: var(--bad); max-width: 24ch; word-break: break-word; }
.queue .num { white-space: nowrap; }
tr.sev-critical { border-left: 3px solid var(--bad); }
tr.sev-warning { border-left: 3px solid var(--warn); }
tr.sev-info { border-left: 3px solid var(--info); }

/* ---------- episode page ---------- */

.videos { display: grid; gap: 0.8rem; grid-template-columns: 1fr 1fr; }
.videos figure { margin: 0; }
.videos video { width: 100%; max-width: 100%; border-radius: 10px; background: #000; }
.novideo {
  aspect-ratio: 9/16;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel2); border-radius: 10px; color: var(--muted); font-size: 0.9rem;
}

.slots { display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.slot {
  display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap;
  padding: 0.45rem 0.6rem;
  background: var(--panel2); border-radius: 8px; font-size: 0.85rem;
}
.slot.paused { opacity: 0.6; }

.events { list-style: none; padding: 0; margin: 0; }
.events li { padding: 0.3rem 0; font-size: 0.92rem; }
.events b { color: var(--accent); font-weight: 600; }

.mask { color: var(--muted); }


/* ---------- review screens ---------- */

.crumbs { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.3rem; }
.crumbs a { color: var(--muted); }
.two { display: grid; gap: 0.6rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .two { grid-template-columns: 1fr 1fr; } }

label.inline { flex-direction: row; align-items: center; gap: 0.35rem; }

textarea { resize: vertical; min-height: 2.6rem; }
input[readonly], textarea[readonly] { opacity: 0.75; }
.form-narrow { max-width: 640px; display: flex; flex-direction: column; gap: 0.8rem; }
/* legacy stacked review form; the gates lay themselves out with .gate-grid */
.review:not(.gate-grid) { display: flex; flex-direction: column; gap: 0.8rem; }
.scene-head { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem; }
.scene-n {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-weight: 700;
}
.card.scene.has-issues { border-color: var(--warn); }
.counter { font-size: 0.8rem; color: var(--muted); }
.counter.over { color: var(--bad); font-weight: 700; }
.issues { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.9rem; }
.issues li { padding: 0.15rem 0; }
.issues .sev-error { color: #ffb3b9; }
.issues .sev-error::before { content: "✖ "; color: var(--bad); }
.issues .sev-warning { color: var(--warn); }
.issues .sev-warning::before { content: "▲ "; }
.lint-summary { padding: 0.6rem 0.9rem; border-radius: 10px; margin-bottom: 0.8rem; border: 1px solid var(--line); }
.lint-summary.ok { border-color: var(--ok); color: var(--ok); }
.lint-summary.warn { border-color: var(--warn); color: var(--warn); }
.lint-summary.bad { border-color: var(--bad); color: #ffb3b9; }
.chip-check { flex-direction: row; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.8rem;
  color: var(--text); background: var(--panel2); font-size: 0.9rem;
}
.chip-check input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip-check input:focus-visible + span { outline: 2px solid var(--info); }
.btn-danger { border-color: var(--bad); color: #ffb3b9; background: transparent; }
.sticky-actions { position: sticky; bottom: 0; background: var(--panel); padding: 0.6rem 0; }
.frames { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.frame-img { position: relative; }
.frame-img img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; background: #000; }
.frame-img .scene-n { position: absolute; top: 0.5rem; left: 0.5rem; }
.frame { display: flex; flex-direction: column; gap: 0.5rem; }
.banner {
  padding: 0.6rem 1rem; border-radius: 10px; margin-bottom: 0.8rem;
  border: 1px solid var(--info); color: var(--info); background: rgba(110, 168, 254, 0.08);
}
.banner.warn { border-color: var(--warn); color: var(--warn); background: rgba(232, 160, 61, 0.08); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.episode-nav { margin: 0.4rem 0 1rem; }
.autonomy { display: flex; flex-direction: column; gap: 0.8rem; }
.autonomy-row { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 0.6rem; }
.level-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.lesson { border-top: 1px solid var(--line); padding: 0.6rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.lessons { list-style: none; padding: 0; margin: 0; }
.lessons li { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.timeline { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.scene-media video, .scene-media img { width: 100%; aspect-ratio: 9 / 16; max-height: 360px; object-fit: contain; background: #000; border-radius: 10px; }
.card.scene.removed { opacity: 0.5; }
.qa summary { cursor: pointer; color: var(--muted); }
input[type="range"] { accent-color: var(--accent); padding: 0; }
.week { display: grid; gap: 0.6rem; grid-template-columns: 1fr; margin: 0.8rem 0; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(7, 1fr); } }
.day h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.day.today { border-color: var(--accent); }
.entry { border-top: 1px solid var(--line); padding: 0.4rem 0; font-size: 0.88rem; }
.entry.state-PUBLISHED b, .entry.state-SEND_TO_USER_INBOX b { color: var(--ok); }
.entry.state-FAILED b { color: var(--bad); }
.entry form { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.3rem; }
.ready-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 0.5rem 0; }
.theme-row { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 0.6rem 0; }
.cast { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.character { display: flex; flex-direction: column; gap: 0.6rem; }
.refs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.refs figure { margin: 0; width: 96px; }
.refs img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: #000; }

/* ---------- studio board ---------- */
.strip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0 0.8rem; }
.strip-item { border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.8rem; background: var(--panel); color: var(--text); text-decoration: none; font-size: 0.9rem; }
.strip-item b { color: var(--accent); }
.strip-item.hot { border-color: var(--accent); }
.strip-item.bad { border-color: var(--bad); }
.strip-item.worker-alive { border-color: var(--ok); color: var(--ok); }
.strip-item.worker-stale, .strip-item.worker-never { border-color: var(--bad); color: #ffb3b9; }
.strip-item.worker-paused { border-color: var(--warn); color: var(--warn); }
.board { display: grid; gap: 0.7rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 1000px) { .board { grid-template-columns: repeat(5, 1fr); } }
.column { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem; min-height: 6rem; }
.column h2 { font-size: 1rem; margin: 0 0 0.5rem; display: flex; justify-content: space-between; }
.ticket { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.55rem 0.6rem; margin-bottom: 0.5rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); text-decoration: none; }
.ticket:hover { filter: brightness(1.1); }
.ticket-title { font-weight: 600; font-size: 0.92rem; line-height: 1.3; }
.ticket-note { font-size: 0.82rem; color: var(--muted); }
.ticket.state-your_turn { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ticket.state-your_turn .ticket-note { color: var(--accent); }
.ticket.state-failed { border-color: var(--bad); }
.ticket.state-failed .ticket-note { color: #ffb3b9; }
.ticket.state-working .ticket-note::before, .ticket.state-queued .ticket-note::before { content: "⟳ "; }
.ticket.state-done { opacity: 0.7; }
.empty-col { text-align: center; }
.how summary { cursor: pointer; font-weight: 600; }
.how ol { margin: 0.6rem 0; padding-left: 1.2rem; }
/* ---------- episode stepper ---------- */
.stepper { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0 0 1rem; }
.stepper .step-home { color: var(--muted); margin-right: 0.3rem; }
.step { border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.88rem; color: var(--text); text-decoration: none; background: var(--panel); }
.step.done { color: var(--ok); border-color: var(--ok); }
.step.your_turn { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.step.current { border-color: var(--info); color: var(--info); }
.step.failed { border-color: var(--bad); color: #ffb3b9; }
.step.locked { opacity: 0.45; cursor: not-allowed; }
.step.active { outline: 2px solid var(--text); outline-offset: 1px; }
.card.next { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.8rem; }
.next-what { font-size: 1.1rem; font-weight: 600; margin: 0; }
.card.next-your_turn { border-color: var(--accent); }
.card.next-failed { border-color: var(--bad); }
.card.next-working .next-what::before, .card.next-queued .next-what::before { content: "⟳ "; color: var(--info); }
/* ---------- montage desk ---------- */
.editor-main { display: grid; gap: 0.8rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .editor-main { grid-template-columns: minmax(280px, 380px) 1fr; } }
.player { width: 100%; aspect-ratio: 9 / 16; max-height: 70vh; background: #000; border-radius: 12px; display: grid; place-items: center; text-align: center; padding: 0; }
.player-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.chip.lang-tab { cursor: pointer; }
.chip.lang-tab:disabled { opacity: 0.4; cursor: not-allowed; }
.scene-panel .clip { width: 100%; max-height: 260px; background: #000; border-radius: 10px; }
.scene-form { display: flex; flex-direction: column; gap: 0.6rem; }
.timeline-head { display: flex; justify-content: space-between; align-items: baseline; }
.timeline-strip { display: flex; gap: 3px; overflow-x: auto; padding: 0.3rem 0; min-height: 96px; }
.tl-block {
  position: relative; flex-basis: 64px; min-width: 64px; height: 96px; border-radius: 8px; cursor: pointer;
  background: var(--panel2) center / cover no-repeat; border: 2px solid var(--line); display: flex;
  flex-direction: column; justify-content: space-between; padding: 0.2rem; user-select: none;
}
.tl-block.selected { border-color: var(--accent); }
.tl-block.playing { box-shadow: 0 0 0 2px var(--info); }
.tl-block.cut { opacity: 0.35; background-blend-mode: luminosity; }
.tl-block.cut .tl-label { text-decoration: line-through; }
.tl-label { background: rgba(0, 0, 0, 0.65); border-radius: 6px; padding: 0 0.3rem; font-size: 0.78rem; align-self: flex-start; }
.tl-move { display: flex; justify-content: space-between; }
.tl-move button { background: rgba(0, 0, 0, 0.65); color: var(--text); border: 0; border-radius: 6px; width: 1.8rem; height: 1.6rem; cursor: pointer; }
/* ---------- montage editor (Shotstack Studio) ----------
   One screen: toolbar, then canvas + scene inspector, then the timeline.
   editor.js sets --nle-h to the room left under the page header. */
.nle { display: flex; flex-direction: column; gap: 10px; height: var(--nle-h, auto); min-height: 480px; }
.nle-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; flex: none; }
.nle-toolbar .iconbtn { width: 36px; height: 36px; font-size: 17px; }
.nle-play { width: 44px; padding: 0; }
.nle-lang { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.nle-lang button { border: 0; background: transparent; color: var(--mut); font: 600 12px var(--mono); padding: 6px 11px; border-radius: 999px; cursor: pointer; }
.nle-lang button.active { background: #ffffff16; color: var(--ink); }
.nle-title { display: grid; min-width: 0; margin-left: 6px; flex: 1; }
.nle-title b, .nle-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nle-title b { font-size: 15px; }
.nle-title span { font-size: 12.5px; color: var(--mut); }
.nle-status { font-size: 13px; color: var(--mut); max-width: 320px; }
.nle-status:empty { display: none; }
.nle-status.ok { color: var(--mint); }
.nle-status.warn { color: var(--lamp); }
.nle-status.bad { color: var(--err); }
.nle-actions { display: flex; gap: 8px; flex: none; }
.nle-body { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) 380px; flex: 1; min-height: 0; }
.nle-canvas { border-radius: 18px; overflow: hidden; min-height: 0; background: #0B0D28; }
.nle-canvas [data-shotstack-studio] { width: 100%; height: 100%; }
.nle-inspector { display: flex; flex-direction: column; gap: 10px; overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 16px; }
.nle-inspector h2 { margin: 0; font-size: 17px; }
.nle-inspector label { display: grid; gap: 4px; font-size: 13px; color: var(--mut); }
.nle-inspector textarea { font-size: 14px; }
.nle-thumb { width: 100%; height: 88px; flex: none; object-fit: contain; background: #000; border-radius: 10px; }
.nle-assist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nle-suggest { border: 1px dashed var(--lamp); border-radius: 12px; padding: 10px; }
.nle-timeline { flex: none; height: 304px; padding: 0; overflow: hidden; }
.nle-timeline [data-shotstack-timeline] { height: 100%; overflow: hidden; }
.nle-dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); border-radius: 20px; max-width: 560px; width: 92vw; padding: 22px; }
.nle-dialog h2 { margin-top: 0; }
.nle-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.nle-dialog label { margin-bottom: 0.6rem; }
.nle-dialog .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.nle-final { width: 100%; max-height: 70vh; background: #000; border-radius: 12px; }
/* The montage editor uses the whole width of the window. */
.page:has(#nle) { max-width: none; }
.page:has(#nle) .stepper { margin-bottom: 10px; }
@media (max-width: 1200px) { .nle-actions .b .ic { display: none; } .nle-title { display: none; } }
/* Short laptop screens: the tracks scroll inside a lower timeline, the canvas keeps its room. */
@media (max-height: 820px) { .nle-timeline { height: 236px; } }
@media (max-width: 900px) {
  .nle { height: auto; }
  .nle-toolbar { flex-wrap: wrap; }
  .nle-actions { flex-wrap: wrap; }
  .nle-body { grid-template-columns: 1fr; }
  .nle-canvas { height: 60vh; }
}
/* ---------- script editor ---------- */
.sed { display: grid; gap: 0.8rem; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .sed { grid-template-columns: 1fr 340px; } .page:has(#script-editor) { max-width: 1400px; } }
.sed-head { display: flex; justify-content: space-between; align-items: baseline; }
.sed-side { display: flex; flex-direction: column; gap: 0.8rem; position: sticky; top: 3.6rem; align-self: start; }
.sed-scene { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.7rem; }
.sed-scene.has-issues { border-color: var(--warn); }
.sed-scene-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.sed-tools { margin-left: auto; display: flex; gap: 0.2rem; }
.sed-tools .btn { padding: 0.2rem 0.5rem; }
.sed-line { display: flex; flex-direction: column; gap: 0.3rem; }
.sed-line textarea { font-size: 1.02rem; line-height: 1.45; }
.sed-line-head { display: flex; justify-content: space-between; }
.sed-ai { display: flex; flex-wrap: wrap; gap: 0.6rem; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: 0.85rem; }
.sed-suggest { border: 1px dashed var(--accent); border-radius: 10px; padding: 0.5rem; }
.sed-add { width: 100%; }
.ok-text { color: var(--ok); }
.workroom { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
/* grids used by settings, keys and older lists */
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(2, 1fr); } .grid .wide { grid-column: 1 / -1; } }
@media (min-width: 1050px) { .grid.dash { grid-template-columns: repeat(4, 1fr); } .grid.keys { grid-template-columns: repeat(3, 1fr); } }
.card.empty { text-align: center; }
details.debug summary { cursor: pointer; color: var(--mut); }
.models { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .models { grid-template-columns: repeat(2, 1fr); } }
.pauses { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .pauses { grid-template-columns: repeat(3, 1fr); } }
.card h2 { font-size: 18px; }
/* EN / RU switch */
.lang-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.lang-switch a { padding: 5px 10px; border-radius: 999px; font: 600 12px var(--mono); color: var(--mut); text-decoration: none; }
.lang-switch a.on { background: #ffffff14; color: var(--ink); }
.login-card .lang-switch { align-self: flex-end; }
@media (max-width: 760px) { .top .lang-switch { order: -1; } }
