:root { --bg:#f6f7f9; --panel:#fff; --fg:#17181c; --muted:#6b7280; --rule:#e6e8ec; --accent:#2563eb;
  --ok:#15803d; --ok-bg:#dcfce7; --todo:#b45309; --todo-bg:#fef3c7; --err:#b91c1c; --err-bg:#fee2e2;
  --none:#6b7280; --none-bg:#f1f2f4; }
@media (prefers-color-scheme: dark) { :root { --bg:#0f1115; --panel:#181b21; --fg:#eceef2; --muted:#9aa1ac;
  --rule:#2a2e36; --accent:#60a5fa; --ok:#4ade80; --ok-bg:#12301d; --todo:#fbbf24; --todo-bg:#3a2c0b;
  --err:#f87171; --err-bg:#3b1414; --none:#9aa1ac; --none-bg:#22262e; } }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:15px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif; }
header { background:var(--panel); border-bottom:1px solid var(--rule); position:sticky; top:0; z-index:5; }
.bar { max-width:1200px; margin:0 auto; padding:10px 16px; display:flex; gap:20px; align-items:center; flex-wrap:wrap; }
.brand { font-weight:700; font-size:17px; color:var(--fg); }
.bar nav { display:flex; gap:4px; flex-wrap:wrap; }
.bar nav a, .tabs a { padding:6px 12px; border-radius:8px; color:var(--muted); }
.bar nav a.active, .tabs a.active { background:var(--bg); color:var(--fg); font-weight:600; }
main { max-width:1200px; margin:0 auto; padding:20px 16px 48px; }
h1 { font-size:24px; margin:4px 0 4px; } h2 { font-size:17px; margin:28px 0 10px; }
a { color:var(--accent); text-decoration:none; } a:hover { text-decoration:underline; }
.muted { color:var(--muted); font-size:13px; display:block; } p.muted { margin:4px 0; }
.lead { color:var(--muted); margin:0 0 16px; } .updated { color:var(--muted); font-size:12px; margin-left:auto; }
.card { background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:14px; }
.cards { list-style:none; padding:0; margin:0; display:grid; gap:14px;
  grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); }
.task { border-left:4px solid var(--accent); } .task.error { border-left-color:var(--err); }
.task.vk { border-left-color:#0077ff; } .task.tiktok { border-left-color:#fe2c55; }
.task.dzen { border-left-color:#888; } .task.rutube { border-left-color:#00a1e7; }
.task.youtube { border-left-color:#ff0000; } .task.approve { border-left-color:var(--ok); }
.tiles { display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); }
.tile { background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:12px 14px; color:var(--fg); }
.tile b { display:block; font-size:24px; } .tile span { color:var(--muted); font-size:13px; }
.tile.error b { color:var(--err); } .tile.todo b { color:var(--todo); } .tile:hover { text-decoration:none;
  border-color:var(--accent); }
.scroll { overflow-x:auto; background:var(--panel); border:1px solid var(--rule); border-radius:14px; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; vertical-align:top; padding:10px 12px; border-bottom:1px solid var(--rule); }
tr:last-child td { border-bottom:0; } th { font-weight:600; color:var(--muted); font-size:13px; }
.badge { display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; font-weight:600;
  white-space:nowrap; }
.badge.ok, .dlv.ok { color:var(--ok); background:var(--ok-bg); }
.badge.todo, .dlv.todo { color:var(--todo); background:var(--todo-bg); }
.badge.error, .dlv.error, p.error { color:var(--err); background:var(--err-bg); }
.badge.none, .dlv.none { color:var(--none); background:var(--none-bg); }
p.error { padding:10px 12px; border-radius:10px; }
.dlv { display:inline-block; padding:1px 7px; border-radius:6px; font-size:12px; margin:1px 2px 1px 0; }
.dlv a { color:inherit; }
.tag { font-size:12px; color:var(--muted); }
video { width:100%; max-height:440px; margin:10px 0 8px; border-radius:10px; background:#000; display:block; }
button, .button { font:inherit; font-size:14px; cursor:pointer; border-radius:9px; padding:7px 14px;
  border:1px solid var(--rule); background:var(--panel); color:var(--fg); display:inline-block; }
button.primary { margin-top:10px; background:var(--accent); color:#fff; border-color:var(--accent); }
button.small { padding:2px 10px; font-size:13px; margin-left:8px; }
form { display:inline; } .tabs { display:flex; gap:4px; margin:0 0 14px; flex-wrap:wrap; }
.closed { margin-top:16px; } .closed li { margin:6px 0; } .closed .muted { display:inline; }
.empty { color:var(--muted); padding:24px; text-align:center; background:var(--panel); border-radius:14px;
  border:1px dashed var(--rule); }
.grid2 { display:grid; gap:20px; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
@media (max-width: 860px) { .grid2 { grid-template-columns:1fr; } }
.posttext { white-space:pre-wrap; font-size:14px; }
.caption { margin-top:10px; } .caption textarea { display:block; width:100%; margin:6px 0; font:13px/1.45 inherit;
  background:var(--bg); color:var(--fg); border:1px solid var(--rule); border-radius:8px; padding:8px; }
.flowbox { overflow-x:auto; } svg.flow { width:100%; min-width:760px; height:auto; display:block; }
svg .col { fill:var(--muted); font-size:13px; font-weight:600; }
svg .node { fill:var(--bg); stroke:var(--rule); stroke-width:1.5; } svg .node.bad { stroke:var(--err); }
svg g.muted { opacity:.38; } svg a:hover .node { stroke:var(--accent); }
svg .label { fill:var(--fg); font-size:14px; font-weight:600; } svg .note { fill:var(--muted); font-size:12px; }
svg .edge { fill:none; stroke:var(--accent); stroke-opacity:.35; stroke-width:1.6; }
/* drafts queue: the post as Telegram shows it */
.queue { list-style:none; padding:0; margin:0; display:grid; gap:16px; }
.draft { display:grid; gap:16px; grid-template-columns:minmax(0,1fr) 280px; }
@media (max-width: 860px) { .draft { grid-template-columns:1fr; } }
.tgpost { background:var(--bg); border:1px solid var(--rule); border-radius:12px; padding:10px 12px; white-space:pre-wrap;
  font-size:14px; overflow-wrap:anywhere; }
.tgpost blockquote { margin:4px 0; padding-left:10px; border-left:3px solid var(--accent); }
.tgpost pre { background:var(--panel); padding:8px; border-radius:8px; overflow-x:auto; }
.tgpost .tg-spoiler { background:var(--rule); color:transparent; border-radius:4px; }
.tgpost .tg-spoiler:hover { color:inherit; }
.linkimg { display:block; max-width:100%; max-height:260px; border-radius:10px; margin-bottom:8px; }
.actions { display:flex; flex-direction:column; gap:8px; }
.actions form { display:block; } .actions button, .actions .button { width:100%; text-align:center; margin:0; }
.actions input[type=datetime-local] { width:100%; font:inherit; padding:6px 8px; border-radius:8px;
  border:1px solid var(--rule); background:var(--bg); color:var(--fg); margin-bottom:6px; }
button.danger { color:var(--err); border-color:var(--err); }
button.primary.wide { margin-top:0; }
.editor { display:grid; gap:16px; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
@media (max-width: 860px) { .editor { grid-template-columns:1fr; } }
.editor textarea { width:100%; min-height:420px; font:13px/1.5 ui-monospace,Consolas,monospace; background:var(--panel);
  color:var(--fg); border:1px solid var(--rule); border-radius:10px; padding:10px; }
.login { max-width:340px; margin:60px auto; } .login input { width:100%; font:inherit; padding:8px 10px; margin:8px 0;
  border-radius:8px; border:1px solid var(--rule); background:var(--bg); color:var(--fg); }
.logout { margin-left:8px; } .logout button { padding:4px 10px; font-size:13px; }
.notice { padding:10px 12px; border-radius:10px; background:var(--todo-bg); color:var(--todo); margin:0 0 14px; }

/* AI stages: prompt editor, chain of models, «Проверить» */
#prompt label, .aiform label, label:has(#variables) { display:block; margin:0 0 12px; font-size:13px; color:var(--muted); }
#prompt textarea, #variables, #prompt input[name=note] { display:block; width:100%; box-sizing:border-box;
  margin-top:4px; padding:8px 10px; border:1px solid var(--rule); border-radius:8px; background:var(--panel);
  color:var(--fg); font:14px/1.5 system-ui,sans-serif; }
#prompt textarea.mono, #variables { font:13px/1.5 ui-monospace,Consolas,monospace; }
.chain input, .chain select { font:inherit; padding:5px 7px; border:1px solid var(--rule); border-radius:8px;
  background:var(--panel); color:var(--fg); }
.chain td.num { color:var(--muted); width:1em; } .nowrap { white-space:nowrap; } .nowrap form { display:inline; }
.tag.off { text-decoration:line-through; }
.vars { margin:0 0 12px; padding-left:18px; font-size:13px; } .vars code { font-weight:600; }
.result { margin:12px 0; } .result.ok { border-color:var(--ok); } .result.error { border-color:var(--err); }
.result div { white-space:pre-wrap; margin-top:8px; } .result pre { white-space:pre-wrap; color:var(--err); }
pre.diff { background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:12px; overflow-x:auto;
  font:13px/1.45 ui-monospace,Consolas,monospace; }
pre.diff .add { color:var(--ok); background:var(--ok-bg); } pre.diff .del { color:var(--err); background:var(--err-bg); }
pre.diff .hunk { color:var(--muted); }


/* Feedlyx Studio design system: layered over legacy selectors for backwards compatibility. */
:root {
  --bg:#f3f6fb; --panel:#ffffff; --fg:#182337; --muted:#64748b; --rule:#e3e9f2;
  --accent:#3859d6; --ok:#147d55; --ok-bg:#e6f7ef; --todo:#96620b; --todo-bg:#fff3d5;
  --err:#bc354d; --err-bg:#ffeaf0; --none:#637287; --none-bg:#eef2f7;
  --raised:#fff; --shadow:0 9px 32px rgba(18,37,63,.055); --radius:16px;
}
@media(prefers-color-scheme:dark) {
  :root {
    --bg:#0d1420; --panel:#141f2e; --fg:#edf3fb; --muted:#a2b2c7; --rule:#28364b;
    --accent:#93aeff; --ok:#63dbab; --ok-bg:#14392d; --todo:#f7c768; --todo-bg:#3f3218;
    --err:#ff91a1; --err-bg:#472733; --none:#b4bdce; --none-bg:#243245;
    --raised:#1c2a3c; --shadow:0 10px 38px rgba(0,0,0,.2);
  }
}
html { scroll-behavior:smooth; }
body { font:15px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif; }
:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.skip-link { position:absolute; left:10px; top:-90px; background:var(--panel); z-index:50; padding:9px 14px; }
.skip-link:focus { top:10px; }
.app-shell { display:grid; grid-template-columns:248px minmax(0,1fr); min-height:100vh; }
.app-sidebar { background:#111c2d; color:#d6e2f3; padding:26px 15px 20px; display:flex; flex-direction:column; gap:30px; position:sticky; top:0; height:100vh; }
.app-brand { display:flex; align-items:center; gap:12px; font-size:21px; font-weight:780; letter-spacing:-.045em; color:#f2f7ff; padding:3px 12px; }
.app-brand:hover { color:#fff; text-decoration:none; }
.brand-symbol { display:grid; place-items:center; width:37px; height:37px; border-radius:12px; font-size:23px; color:#fff;
  background:linear-gradient(140deg,#6686ff,#7b5bd6); }
.app-brand small { display:block; margin-top:-4px; font-size:9px; font-weight:730; letter-spacing:.19em; color:#95a6c0; }
.sidebar-label { font-size:10px; font-weight:750; letter-spacing:.13em; margin:3px 14px -18px; color:#7f94b0; }
.app-navigation { display:grid; gap:5px; overflow-y:auto; min-height:0; align-content:start; scrollbar-width:thin; }
.app-nav-group { min-width:0; border-radius:11px; }
.app-nav-group summary { cursor:pointer; list-style:none; padding:9px 13px; color:#93a9c7;
  font-size:11px; font-weight:750; letter-spacing:.065em; }
.app-nav-group summary::-webkit-details-marker { display:none; }
.app-nav-group summary::after { content:"⌄"; float:right; font-size:14px; line-height:1; }
.app-nav-group:not([open]) summary::after { transform:rotate(-90deg); }
.app-nav-group summary:hover { color:#fff; background:#202e46; border-radius:9px; }
.app-nav-links { display:grid; gap:3px; margin:0 0 7px; }
.app-navigation a { display:block; color:#bbcce1; padding:10px 13px; border-radius:11px; font-size:14px; font-weight:560; }
.app-navigation a:hover { color:#fff; background:#25334b; text-decoration:none; }
.app-navigation a.active,.app-navigation a[aria-current=page] { color:#fff; background:#304878; box-shadow:inset 3px 0 #99acff; }
.sidebar-bottom { flex-shrink:0; margin-top:auto; border-top:1px solid #293851; padding:17px 14px 0; color:#9fb1ca; font-size:12px; }
.connection-dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:#6bddae; margin-right:6px; }
.app-main { min-width:0; }
.app-topbar { top:0; background:color-mix(in srgb,var(--panel) 94%,transparent); backdrop-filter:blur(12px); }
.app-topbar .bar { max-width:none; padding:12px 34px; min-height:62px; gap:18px; }
.topbar-label { color:var(--muted); font-size:13px; font-weight:600; }
.topbar-label:hover { text-decoration:none; }
.updated { font-size:12px; }
.app-content { max-width:1480px; padding:28px 34px 80px; margin:0 auto; }
.page-heading { margin-bottom:23px; }
.app-breadcrumbs { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px;
  margin-bottom:12px; font-size:12px; color:var(--muted); }
.app-breadcrumbs a { color:var(--accent); }
.app-breadcrumbs [aria-current=page] { color:var(--fg); font-weight:650; }
h1 { font-size:clamp(23px,2vw,32px); letter-spacing:-.035em; margin:0; font-weight:750; }
h2 { font-size:19px; letter-spacing:-.018em; margin:28px 0 11px; }
.card,.scroll,.tile { border-radius:var(--radius); box-shadow:var(--shadow); }
.card { padding:20px; }
.tiles { grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); }
.tile { padding:19px; }
.tile b { font-size:29px; }
.table,table { font-size:14px; }
th { background:var(--bg); font-size:12px; text-transform:none; letter-spacing:.015em; }
th,td { padding:13px 15px; }
tbody tr:hover,table tr:hover td { background:color-mix(in srgb,var(--accent) 3%,transparent); }
a { text-underline-offset:3px; }
button,.button { font-weight:620; padding:9px 15px; transition:background .12s ease,border-color .12s ease,transform .12s ease; }
button:hover,.button:hover { border-color:var(--accent); text-decoration:none; }
button:active,.button:active { transform:translateY(1px); }
button.primary { margin-top:0; background:#4969db; border-color:#4969db; color:#fff; }
button.primary:hover { background:#3453ca; }
button:disabled { opacity:.45; cursor:not-allowed; }
input,textarea,select { accent-color:var(--accent); }
.login { max-width:410px; margin:10vh auto; padding:28px; }
.login label { font-weight:600; }
.login input { margin-top:7px; }
.notice { border:1px solid var(--rule); }
.mobile-navigation { display:none; }
@media(max-width:1050px) {
  .app-shell { grid-template-columns:210px minmax(0,1fr); }
  .app-content { padding:24px 22px 65px; }
  .app-topbar .bar { padding:11px 22px; }
}
@media(max-width:760px) {
  .app-shell { display:block; }
  .app-sidebar { display:none; }
  .app-content { padding:19px 15px 65px; }
  .app-topbar .bar { padding:9px 15px; gap:10px; }
  .topbar-label,.updated { display:none; }
  .mobile-navigation { display:block; flex:1; position:relative; }
  .mobile-navigation summary { cursor:pointer; font-weight:650; list-style:none; padding:7px 4px; }
  .mobile-navigation summary::-webkit-details-marker { display:none; }
  .mobile-navigation nav { position:absolute; top:44px; left:0; z-index:20; width:min(300px,calc(100vw - 30px));
    background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:8px;
    box-shadow:0 24px 48px rgba(0,0,0,.17); display:grid; }
  .mobile-navigation nav a { padding:10px 13px; border-radius:8px; color:var(--fg); }
  .mobile-navigation nav { max-height:calc(100dvh - 110px); overflow-y:auto; }
  .mobile-navigation .app-nav-group summary { color:var(--muted); }
  .mobile-navigation .app-nav-group summary:hover { background:var(--bg); color:var(--fg); }
  .mobile-navigation .app-nav-links { margin-left:6px; }
  .mobile-navigation nav a[aria-current=page] { background:var(--none-bg); font-weight:700; }
  .card { padding:15px; }
  .tiles { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .logout { margin-left:auto; }
}
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
  button,.button { transition:none; }
}

/* Studio workspace: focus on editorial decisions instead of raw CRUD forms. */
.studio-intro { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:20px; }
.studio-intro .lead { margin:0; }
.eyebrow { font-size:10px; font-weight:800; letter-spacing:.14em; color:var(--muted); margin:0 0 5px; }
.studio-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:0 0 25px; }
.studio-stat { display:grid; gap:1px; background:var(--panel); border:1px solid var(--rule); border-radius:15px;
  padding:17px 18px; color:var(--fg); box-shadow:var(--shadow); }
.studio-stat:hover { text-decoration:none; border-color:var(--accent); }
.studio-stat span { color:var(--muted); font-size:13px; font-weight:550; }
.studio-stat strong { font-size:30px; line-height:1.3; font-weight:770; }
.studio-stat small { color:var(--muted); font-size:11px; }
.studio-workspace { display:grid; grid-template-columns:minmax(0,1fr) minmax(275px,315px); gap:20px; align-items:start; }
.studio-section-header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.studio-section-header h2 { margin:0 0 12px; }
.studio-section-header .count { color:var(--muted); font-size:15px; font-weight:500; }
.studio-filter { display:grid; grid-template-columns:2fr 1fr 1.2fr auto; gap:10px; align-items:end;
  background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:13px; margin-bottom:13px; }
.studio-filter label,.studio-form label,.studio-section label { display:block; color:var(--muted); font-size:12px; font-weight:650; }
.studio-filter input,.studio-filter select,.studio-form input,.studio-form select,.studio-form textarea,
.studio-section input:not([type=hidden]),.studio-section select,.studio-section textarea {
  display:block; width:100%; min-width:0; padding:10px 11px; margin:5px 0 9px;
  border:1px solid var(--rule); border-radius:10px; background:var(--panel); color:var(--fg);
  font:14px/1.45 inherit; }
.studio-filter-actions { display:flex; gap:8px; align-items:center; padding-bottom:9px; white-space:nowrap; }
.studio-project-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.studio-project-card { background:var(--panel); border:1px solid var(--rule); border-radius:15px;
  padding:18px; color:var(--fg); display:grid; gap:14px; min-height:182px; box-shadow:var(--shadow); }
.studio-project-card:hover { border-color:var(--accent); text-decoration:none; transform:translateY(-1px); }
.studio-project-card h3 { font-size:17px; font-weight:710; line-height:1.4; margin:0;
  overflow-wrap:anywhere; letter-spacing:-.015em; }
.studio-project-head { display:flex; gap:8px; flex-wrap:wrap; justify-content:space-between; align-items:center; }
.channel-mark { font-size:10px; font-weight:800; padding:4px 7px; background:var(--none-bg); border-radius:7px; }
.channel-science { color:#208c77; }
.channel-movies { color:#9860be; }
.channel-games { color:#4f75da; }
.studio-status { font-size:11px; font-weight:730; line-height:1.35; padding:5px 9px;
  border-radius:999px; background:var(--none-bg); color:var(--muted); }
.studio-status-script_approved { color:var(--ok); background:var(--ok-bg); }
.studio-status-script_review { color:var(--todo); background:var(--todo-bg); }
.studio-status-rejected { color:var(--err); background:var(--err-bg); }
.studio-project-meta { display:flex; flex-wrap:wrap; gap:7px; color:var(--muted); font-size:11px; }
.studio-project-meta span:not(:last-child)::after { content:"·"; margin-left:7px; }
.studio-card-link { font-size:12px; color:var(--accent); font-weight:700; align-self:end; }
.studio-create { position:sticky; top:82px; }
.studio-create h2 { margin:0 0 5px; }
.studio-create .studio-form { display:grid; gap:11px; margin-top:19px; }
.studio-create .studio-form button { width:100%; }
.studio-help { color:var(--muted); font-size:12px; border-top:1px solid var(--rule); padding-top:12px; margin-bottom:0; }
.studio-empty { padding:40px 20px; border:1px dashed var(--rule); border-radius:15px; text-align:center; }
.studio-empty p { color:var(--muted); }
.studio-project-overview { background:var(--panel); border:1px solid var(--rule);
  padding:21px; border-radius:17px; box-shadow:var(--shadow); margin-bottom:13px; }
.studio-back { display:inline-block; font-size:13px; font-weight:650; margin-bottom:16px; }
.studio-project-title { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.studio-feature-title { font-size:24px; margin:3px 0 7px; }
.studio-progress { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:5px; margin:24px 0 0; padding:0; list-style:none; }
.studio-progress li { position:relative; padding:10px 7px; font-size:11px; text-align:center; border-radius:8px;
  background:var(--none-bg); color:var(--muted); }
.studio-progress li small { display:block; font-weight:500; margin-top:2px; }
.studio-progress li.current { background:var(--todo-bg); color:var(--todo); font-weight:760; }
.studio-progress li.done { background:var(--ok-bg); color:var(--ok); }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.studio-toc { display:flex; flex-wrap:wrap; gap:8px; padding:10px 0 18px; }
.studio-toc a { padding:7px 12px; background:var(--panel); border:1px solid var(--rule);
  border-radius:20px; font-size:12px; font-weight:650; }
.studio-section { padding:20px; background:var(--panel); border:1px solid var(--rule);
  border-radius:16px; margin-bottom:15px; scroll-margin-top:80px; box-shadow:var(--shadow); }
.studio-section .card { box-shadow:none; margin:9px 0; }
.studio-section form:not([method=get]) { display:block; margin:9px 0; }
.studio-section form button { margin-right:7px; margin-bottom:6px; }
.studio-section p { overflow-wrap:anywhere; }
.studio-section pre { padding:14px; background:var(--bg); border:1px solid var(--rule); border-radius:10px; overflow-x:auto; }
.studio-top-link { color:var(--muted); font-size:12px; }
.studio-section img { border-radius:10px; }
.studio-section audio { width:100%; margin:12px 0; }
@media(max-width:1250px) {
  .studio-workspace { grid-template-columns:1fr; }
  .studio-create { position:static; }
}
@media(max-width:900px) {
  .studio-filter { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .studio-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:620px) {
  .studio-project-grid,.studio-filter { grid-template-columns:1fr; }
  .studio-intro { align-items:flex-start; }
  .studio-progress { overflow-x:auto; display:flex; }
  .studio-progress li { min-width:125px; }
  .studio-project-title { flex-direction:column; }
  .studio-section { padding:15px; }
}

/* A form is inline in the legacy rules; a form that is itself a card (the login) is a block, centred */
form.card { display:block; }
/* Login has no authenticated sidebar: keep its form centered at full width. */
.app-shell.auth-shell { grid-template-columns:minmax(0,1fr); }
/* Studio: a subject on a scene with its remove button on the same line */
.subject-row { margin:6px 0; }
.subject-row form, .studio-section .subject-row form { display:inline; margin:0 0 0 8px; }

/* Explicit opt-in research mode; keep the native checkbox visible. */
.studio-auto-research { display:flex!important; gap:10px; align-items:flex-start; }
.studio-auto-research input[type=checkbox] { width:auto!important; margin:5px 0 0!important; flex:none; }

/* Studio: channel and content-series editor forms.
   Explicit opt-in classes override the legacy global "form { display:inline }".
   Other admin forms and actions stay unchanged. */
.studio-editor-panel {
  max-width: 880px;
  margin-top: 20px;
}
.studio-editor-heading { margin-bottom: 20px; }
.studio-editor-heading h2 { margin: 3px 0 6px; }
.studio-editor-panel .studio-editor-form { display: block; width: 100%; }
.studio-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
  align-items: start;
}
.studio-form-grid .studio-span-all { grid-column: 1 / -1; }
.studio-form-grid .studio-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 6px;
  color: var(--fg);
  font-size: 13px;
  font-weight: 650;
}
.studio-form-grid .studio-field input,
.studio-form-grid .studio-field select,
.studio-form-grid .studio-field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--fg);
  background: var(--panel);
}
.studio-form-grid .studio-field textarea {
  min-height: 110px;
  resize: vertical;
}
.studio-form-grid .studio-field input:focus-visible,
.studio-form-grid .studio-field select:focus-visible,
.studio-form-grid .studio-field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.studio-required { color: var(--err); }
.studio-field-hint { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; font-weight: 400; }
.studio-form-fieldset {
  padding: 0;
  margin: 0 0 24px;
  border: 0;
  min-width: 0;
}
.studio-form-fieldset + .studio-form-fieldset {
  border-top: 1px solid var(--rule);
  padding-top: 22px;
}
.studio-form-fieldset legend { font-size: 15px; font-weight: 730; padding: 0; margin-bottom: 14px; }
.studio-form-footer {
  border-top: 1px solid var(--rule);
  padding-top: 18px;
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.studio-form-footer .studio-field-hint { max-width: 470px; margin: 0; }
.studio-form-footer button.primary { margin: 0; }
.studio-table-scroll { max-width: 100%; overflow-x: auto; }
@media (max-width: 640px) {
  .studio-form-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .studio-form-grid .studio-span-all { grid-column: 1; }
  .studio-form-footer { align-items: stretch; }
  .studio-form-footer button.primary { width: 100%; }
}

/* A consistent responsive editorial UI for parser management and series planning. */
.studio-page-intro { max-width: 920px; margin: 0 0 28px; }
.studio-page-intro h2 { margin: 2px 0 8px; font-size: 22px; }
.studio-page-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 13px 0 0; }
.studio-editor-wide { max-width: 980px; }
.studio-source-details { border-top: 1px solid var(--rule); margin-top: 14px; padding-top: 14px; }
.studio-source-details summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.studio-source-details .studio-editor-form { display: block; margin: 16px 0; }
.studio-source-details form:not(.studio-editor-form) { display: block; margin-top: 15px; }
.studio-source-details .studio-field input[type=checkbox] { width: auto; min-height: auto; }
.studio-schedule-preview {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px; margin: 25px 0 15px;
}
.studio-schedule-preview > div {
  display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--rule);
  background: var(--bg); padding: 14px 12px; border-radius: 12px; min-width: 0;
}
.studio-schedule-preview span { color: var(--accent); font-size: 12px; font-weight: 800; }
.studio-schedule-preview strong { font-size: 12px; line-height: 1.3; }
.studio-schedule-preview small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.studio-series-form label[hidden], .studio-source-details label[hidden] { display: none; }
.studio-series-form .studio-form-fieldset { padding-bottom: 2px; }
@media (max-width: 850px) {
  .studio-schedule-preview { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 500px) {
  .studio-schedule-preview { grid-template-columns: minmax(0,1fr); }
  .studio-page-actions > a { flex: 1; text-align: center; }
}

/* Inline edit form for future Content Series windows. */
.studio-edit-series { margin: 12px 0 22px; padding: 12px 0; border-block: 1px solid var(--rule); }
.studio-edit-series summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.studio-existing-schedule { display: block; width: 100%; padding-top: 15px; }
.studio-existing-schedule label[hidden] { display:none; }


/* SPA Studio: readable card spacing, accessible stage tabs and creation dialogs. */
#main, .app-content, .studio-workspace, .studio-projects { min-width: 0; }
#main .page-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
#main .page-heading h1 { margin: 0 auto 0 0; }
#main .page-heading .studio-create-launch { flex: 0 0 auto; }
#existing-series { display: grid; gap: 18px; min-width: 0; }
#existing-series > h2 { margin: 0; }
#existing-series > .studio-series-card {
  display: flex; flex-direction: column; min-width: 0; gap: 14px;
  padding: clamp(16px, 2.5vw, 24px); border-radius: 15px;
}
#existing-series > .studio-series-card > * { margin-block: 0; }
#existing-series > .studio-series-card > h3 { line-height: 1.45; overflow-wrap: anywhere; }
#existing-series > .studio-series-card p { line-height: 1.65; overflow-wrap: anywhere; }
#existing-series > .studio-series-card form { min-width: 0; }
#existing-series > .studio-series-card form > button { margin: 3px 8px 3px 0; }
#existing-series > .studio-series-card > details {
  margin-block: 4px; border-radius: 10px;
  padding: 12px 14px; border: 1px solid var(--rule);
}
#existing-series > .studio-series-card > details[open] { padding-bottom: 18px; }
#existing-series > .studio-series-card > details > summary { margin-bottom: 0; }
#existing-series > .studio-series-card > details[open] > summary { margin-bottom: 14px; }
#existing-series > .studio-series-card .studio-form-grid { gap: 16px 20px; }
#existing-series > .studio-series-card button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.studio-section-header { flex-wrap: wrap; gap: 12px 16px; }
.studio-section-header h2 { margin-bottom: 0; }
.studio-section-header .studio-create-launch { margin-left: auto; }
.studio-project-grid > *, .studio-stat, .studio-form-grid > * { min-width: 0; }

/* Project stages are a tablist, not a multi-screen vertically stacked document. */
.studio-toc[role="tablist"] {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 18px;
  max-width: 100%; overflow: visible;
}
.studio-toc[role="tablist"] [role="tab"] {
  flex: 0 1 auto; font-weight: 600;
  border: 1px solid var(--rule); border-radius: 10px;
  padding: 10px 15px; margin: 0; background: var(--panel);
}
.studio-toc[role="tablist"] [role="tab"][aria-selected="true"] {
  color: var(--accent); border-color: var(--accent);
  background: var(--bg); box-shadow: inset 0 -2px var(--accent);
}
.studio-toc[role="tablist"] [role="tab"]:focus-visible,
.studio-create-launch:focus-visible, .studio-dialog-close:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
.studio-section[role="tabpanel"] { min-width: 0; }
.studio-section[hidden] { display: none !important; }

/* Native <dialog> provides focus containment, Escape and the modal backdrop. */
.studio-create-dialog {
  width: min(920px, calc(100vw - 24px)); max-width: 100%;
  max-height: min(90dvh, 960px); margin: auto; overflow-y: auto;
  padding: 0; color: var(--fg); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 16px;
  box-shadow: 0 22px 85px #0005;
}
.studio-create-dialog::backdrop { background: rgb(0 0 0 / 0.62); }
.studio-dialog-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--rule);
  background: var(--panel);
}
.studio-dialog-header h2 { margin: 0; font-size: 19px; }
.studio-dialog-close { flex: 0 0 auto; }
.studio-dialog-body { padding: clamp(14px, 3vw, 24px); min-width: 0; }
.studio-dialog-body .studio-form-footer { position:sticky; bottom:0; z-index:1;
  background:var(--panel); padding-block:12px; }
.studio-unsaved-warning { border-top:1px solid var(--rule); margin-top:20px; padding:12px;
  background:var(--bg); border-radius:10px; }
.studio-unsaved-warning p { margin:0 0 8px; }

.studio-dialog-body > .studio-editor-panel,
.studio-dialog-body > .studio-create {
  display: block; position: static; width: 100%; max-width: none;
  padding: 0; margin: 0; border: 0; box-shadow: none;
}
.studio-dialog-body .studio-editor-heading { margin-block: 0 18px; }
.studio-dialog-body .studio-editor-heading h2 { display: none; }
.studio-dialog-body form { min-width: 0; }
.studio-dialog-body textarea { max-width: 100%; }
body:has(.studio-create-dialog[open]) { overflow: hidden; }
@media (max-width: 680px) {
  .studio-toc[role="tablist"] [role="tab"] { padding: 9px 12px; }
  .studio-create-dialog { width: calc(100vw - 12px); max-height: 94dvh; }
  .studio-dialog-header { padding: 12px 14px; }
  #existing-series { gap: 14px; }
  #existing-series > .studio-series-card { gap: 12px; }
  #main .page-heading .studio-create-launch { width: 100%; }
  .studio-section-header .studio-create-launch { width: 100%; margin-left: 0; }
}

/* After moving the project creation form into a dialog, expand the project list. */
.studio-workspace:has(> .studio-projects:only-child) {
  display: block;
}
.studio-workspace:has(> .studio-projects:only-child) > .studio-projects { width: 100%; }
.studio-series-target {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  overflow-wrap: anywhere; padding: 8px 0;
}
.studio-series-target form { display: inline-flex; margin: 0; }
.studio-series-target button { margin: 0; }

/* Inline project form controls must retain usable sizing after the form moves out
   of .studio-section and into body > dialog (their old ancestor selector is gone). */
.studio-dialog-body form:not(.studio-editor-form) > label {
  display: block; margin: 0 0 14px; min-width: 0;
  color: var(--fg); font-size: 13px; font-weight: 650;
}
.studio-dialog-body form:not(.studio-editor-form) label > input:not([type=hidden], [type=checkbox]),
.studio-dialog-body form:not(.studio-editor-form) label > select,
.studio-dialog-body form:not(.studio-editor-form) label > textarea,
.studio-dialog-body form:not(.studio-editor-form) > textarea {
  display: block; width: 100%; max-width: 100%; min-width: 0;
  min-height: 44px; margin: 6px 0 0; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 10px;
  font: inherit; color: var(--fg); background: var(--panel);
}
.studio-dialog-body form:not(.studio-editor-form) textarea { min-height: 110px; resize: vertical; }
.studio-dialog-body form:not(.studio-editor-form) > button { margin-top: 12px; }
.studio-dialog-body form:focus-within { min-width: 0; }

/* Ambient music direction and background generation controls. */
.studio-instruments { display: flex; flex-wrap: wrap; gap: 12px 18px; padding: 10px 0; }
.studio-instruments label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
#backgrounds img { display: block; object-fit: contain; max-width: 100%; }
#backgrounds form { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 8px; }
.ambient-series-card details.studio-details { margin-block: 12px; }



.studio-react-registry { display: grid; gap: 18px; }
.studio-list-toolbar { display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px 20px; }
.studio-list-toolbar .lead { margin-bottom: 0; }
.studio-entity-table { min-width: 640px; }
.studio-entity-table tbody td { vertical-align: middle; }
.studio-entity-table td small { display: block; color: var(--muted); margin-top: 2px; }
.studio-entity-table td code { overflow-wrap: anywhere; }
.studio-row-actions { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.studio-icon-action { display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; min-width: 36px; padding: 4px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--fg); text-decoration: none; font-size: 18px; }
.studio-icon-action:hover { color: var(--accent); background: var(--bg);
  border-color: var(--rule); text-decoration: none; }
.studio-icon-action.danger { color: var(--err); }
.studio-channel-dialog form.studio-editor-form { display: block; width: 100%; }
.studio-channel-dialog .studio-form-fieldset { margin-bottom: 0; }
.studio-channel-dialog fieldset[disabled] { opacity: .6; }
.studio-deleted-section h2 { margin-bottom: 6px; }
@media (max-width: 640px) {
  .studio-list-toolbar > button { width: 100%; }
  .studio-react-registry .studio-table-scroll { overflow-x: auto; }
}



.studio-series-secondary-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.studio-series-secondary-actions button { font-size: 12px; padding: 5px 7px; }
.studio-registry-dialog .studio-series-target { justify-content: space-between; }
.studio-registry-dialog .studio-form-grid span { display: block; }

.studio-project-list-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 14px 0; }
.studio-project-list-filter label { min-width: 150px; flex: 1 1 180px; }
.studio-project-list-filter input, .studio-project-list-filter select { width: 100%; min-height: 42px; }


.studio-react-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 16px; }
.studio-react-tabs [role="tab"] {
  color: var(--fg); background: var(--panel); border: 1px solid var(--rule);
  border-radius: 8px; padding: 9px 12px; cursor: pointer;
}
.studio-react-tabs [role="tab"][aria-selected="true"] {
  border-color: var(--accent); background: var(--accent-soft);
}
.studio-react-stage { max-width: 100%; }
.studio-react-stage pre { max-height: 540px; overflow: auto; }


.studio-ambient-video { display: block; width: min(280px, 100%); max-height: 170px; margin-top: 8px; }
.studio-react-registry audio { display: block; max-width: 270px; width: 100%; }


.studio-react-registry audio { max-width: 280px; width: 100%; }

/* Ambient library and legal approvals now have native controls with explicit
   rights confirmations. The server-rendered content remains a no-JS fallback. */
.studio-react-registry .studio-ambient-background-preview {
  display: block; max-width: 240px; max-height: 160px; border-radius: 8px; margin-bottom: 8px;
}
.studio-react-registry .studio-instruments label { display: inline-flex; gap: 5px; align-items: center; }

/* Native operations lists; Python HTML remains visible after failed JSON reads. */
.studio-react-registry .studio-clipboard pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.studio-react-registry .studio-video-thumb { max-width: 230px; width: 100%; display: block; margin-bottom: 8px; }
.studio-react-registry .studio-stat { text-decoration: none; }

/* Approval queue and posts are native React once JSON is available. */
.studio-post-snippet { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 320px; max-height: 130px; overflow: hidden; }
.studio-post-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 75vh; overflow: auto; }
.studio-post-details { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; }
.studio-image-thumb { display: block; max-width: 200px; max-height: 160px; object-fit: contain; }
.studio-video-thumb { display: block; max-width: 360px; width: 100%; max-height: 50vh; }
.studio-entity-table audio { max-width: 240px; }

.app-navigation {
  align-content: start;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}
/* Navigation hierarchy: section labels outrank their child links, with visible grouping. */
.app-navigation > .app-nav-group + .app-nav-group { border-top: 1px solid #2c3e59; margin-top: 7px; padding-top: 7px; }
.app-nav-group { min-width: 0; border-radius: 11px; }
.app-nav-group > summary {
  cursor: pointer;
  list-style: none;
  padding: 9px 13px;
  color: #f0f5ff;
  font-size: 14px;
  font-weight: 760;
  letter-spacing: .005em;
}
.app-nav-group[open] > summary { color: #ffffff; }
.app-navigation .app-nav-links { border-left: 1px solid #344761; margin-left: 16px; padding-left: 9px; }
.app-navigation .app-nav-links a { font-size: 12px; font-weight: 530; padding: 8px 11px; border-radius: 8px; }
.app-nav-group > summary:focus-visible { outline: 2px solid #aec4ff; outline-offset: -2px; }
.app-nav-group > summary::-webkit-details-marker { display: none; }
.app-nav-group > summary::after { content: "⌄"; float: right; font-size: 14px; line-height: 1; }
.app-nav-group:not([open]) > summary::after { transform: rotate(-90deg); }
.app-nav-group > summary:hover { background: #202e46; color: #fff; border-radius: 9px; }
.app-nav-links { display: grid; gap: 3px; margin-bottom: 7px; }
.sidebar-bottom { flex-shrink: 0; }
@media (max-width: 950px) {
  .mobile-navigation nav {
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
  }
  .mobile-navigation .app-nav-group > summary { color: var(--fg); }
  .mobile-navigation .app-nav-group + .app-nav-group { border-top: 1px solid var(--rule); margin-top: 5px; padding-top: 5px; }
  .mobile-navigation .app-nav-links { border-left: 1px solid var(--rule); margin-left: 12px; padding-left: 6px; }
  .mobile-navigation .app-nav-links a { font-size: 12px; }
  .mobile-navigation .app-nav-group > summary:hover { color: var(--fg); background: var(--bg); }
  .mobile-navigation .app-nav-links { margin-left: 6px; }
}

/* Shared native checkbox geometry: override broad .studio-field input styles. */
form input[type="checkbox"] {
  appearance: auto;
  display: inline-block !important;
  inline-size: 18px !important;
  block-size: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 4px;
  flex: 0 0 18px;
  vertical-align: middle;
  accent-color: var(--accent);
  cursor: pointer;
}
form input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .6; }
form input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.studio-react-registry form label:has(> input[type="checkbox"]),
.studio-react-registry form .studio-field > span:has(> input[type="checkbox"]),
.studio-instruments label:has(> input[type="checkbox"]) {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  min-height: 36px;
  line-height: 1.4;
  cursor: pointer;
}

.studio-toc[role="tablist"] [role="tab"] { display: inline-flex; align-items: center; gap: 7px; }
.studio-visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; }
.studio-state-icon { flex: none; color: var(--muted); }
.studio-state-icon[data-state="done"] { color: var(--ok); }
.studio-state-icon[data-state="action"], .studio-state-icon[data-state="waiting"] { color: var(--todo); }
.studio-state-icon[data-state="error"] { color: var(--err); }
.studio-state-icon[data-state="stale"] { color: var(--todo); }
.studio-state-icon[data-state="running"] { color: var(--accent); animation: studio-state-spin 1.2s linear infinite; }
.studio-state-icon[data-state="running"] circle { opacity: .3; }
.studio-toc[role="tablist"] [role="tab"][data-state="done"] { border-color: var(--ok); }
@keyframes studio-state-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .studio-state-icon[data-state="running"] { animation: none; }
}

/* Materials stage: one compact row per entity; the materials unfold on demand. */
.studio-entity-materials { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 6px; }
.studio-entity-materials > li { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 12px; }
.studio-entity-materials summary { cursor: pointer; }
.studio-entity-materials details ul { margin: 8px 0 4px; padding-left: 18px; }
.studio-entity-materials small, .studio-entity-role { color: var(--muted); }

/* Entities stage: the theme, the hero, the central project and what the script names. */
.studio-entity-summary { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0 18px;
  padding: 12px 15px; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; }
.studio-entity-summary dt { color: var(--muted); }
.studio-entity-summary dd { margin: 0; }
.studio-entity-list { list-style: none; margin: 6px 0 14px; padding: 0; display: grid; gap: 6px; }
.studio-entity { padding: 8px 12px; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
.studio-entity small { color: var(--muted); }
.studio-entity-badge { margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--accent); border: 1px solid var(--accent); }
.studio-legacy { margin-top: 24px; }
.studio-legacy > summary { cursor: pointer; color: var(--muted); }

.studio-material-details { margin: 0 0 16px; }
.studio-material-details > summary { cursor: pointer; color: var(--muted); }
.studio-material-details h4 { margin: 12px 0 4px; }
.studio-material-details ul { margin: 0; padding-left: 18px; color: var(--muted); }

/* ===== Project Workspace (admin/frontend/src/project-workspace): the history of one content project ===== */
.pw-page { max-width: 1280px; margin: 0 auto; padding-bottom: 64px; font-size: 14px; }
.pw-muted { color: var(--muted); }
.pw-header { padding: 4px 0 12px; }
.pw-header h1 { margin: 4px 0 2px; font-size: 22px; line-height: 1.25; }
.pw-crumb { margin: 0; font-size: 13px; }
.pw-meta { margin: 0; color: var(--muted); font-size: 12px; }
.pw-state { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pw-state .pw-dot { width: 9px; height: 9px; }
.pw-state[data-state="running"] .pw-dot { background: var(--accent); }
.pw-state[data-state="stopped"] .pw-dot { background: var(--err, #dc2626); }
.pw-stale { margin: 6px 0 0; color: var(--todo, #b45309); font-size: 12px; }

.pw-attention { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; margin: 4px 0 16px;
  padding: 12px 14px; border-left: 3px solid var(--todo, #d97706); background: var(--panel); border-radius: 8px; }
.pw-attention strong { font-size: 14px; }
.pw-attention p { margin: 2px 0 0; color: var(--muted); }
.pw-attention ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.pw-attention-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.pw-attention-note, .pw-confirm { grid-column: 1 / -1; }
.pw-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pw-confirm p { margin: 0 8px 0 0; color: var(--fg); }
.pw-link { background: none; border: 0; padding: 4px 8px 4px 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; }
.pw-new { position: sticky; top: 8px; z-index: 3; margin: 0 0 8px; text-align: center; }
.pw-new button { border-radius: 999px; padding: 6px 14px; }

.pw-columns { display: grid; grid-template-columns: minmax(260px, 28%) 1fr; gap: 20px; padding: 0 0 6px;
  color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.pw-next { margin: 0 0 8px 28px; color: var(--muted); font-size: 12px; }
.pw-row { display: grid; grid-template-columns: minmax(260px, 28%) 1fr; gap: 20px; padding: 10px 0;
  border-top: 1px solid var(--rule); scroll-margin-top: 72px; }
.pw-node { position: relative; display: flex; gap: 12px; padding-left: 4px; }
.pw-node::before { content: ""; position: absolute; left: 8px; top: 14px; bottom: -22px; width: 1px; background: var(--rule); }
.pw-row:last-child .pw-node::before { display: none; }
.pw-child { margin-left: 18px; }
.pw-dot { flex: none; width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; background: var(--muted);
  box-shadow: 0 0 0 3px var(--bg); position: relative; z-index: 1; }
.pw-row[data-status="completed"] .pw-dot { background: var(--fg); opacity: .55; }
.pw-row[data-status="running"] .pw-dot, .pw-row[data-status="queued"] .pw-dot { background: var(--accent); }
.pw-row[data-status="running"] .pw-dot { animation: pw-pulse 2s ease-in-out infinite; }
.pw-row[data-status="failed"] .pw-dot, .pw-row[data-status="needs_action"] .pw-dot { background: var(--err, #dc2626); }
.pw-row[data-status="skipped"] .pw-dot { background: transparent; border: 1px dashed var(--muted); }
.pw-row[data-status="superseded"] .pw-dot, .pw-row[data-status="cancelled"] .pw-dot { background: transparent; border: 1px solid var(--muted); }
.pw-dim { opacity: .62; }
.pw-node-text h3 { margin: 0; font-size: 14px; line-height: 1.3; }
.pw-node-text p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.pw-summary { color: var(--fg) !important; opacity: .8; }
.pw-status[data-status="running"], .pw-status[data-status="needs_action"], .pw-status[data-status="failed"] { color: var(--fg); font-weight: 600; }
.pw-current .pw-node-text h3 { font-size: 15px; }
@keyframes pw-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pw-row[data-status="running"] .pw-dot { animation: none; } }

.pw-artifacts { min-width: 0; }
.pw-empty { margin: 2px 0; font-size: 12px; }
.pw-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; max-height: 190px; overflow: hidden; }
.pw-cell { min-width: 0; display: flex; }
.pw-tile { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 6px 8px; width: 132px; max-width: 100%;
  background: transparent; border: 1px solid var(--rule); border-radius: 8px; color: var(--fg); font: inherit; font-size: 12px; cursor: pointer; }
.pw-tile:hover, .pw-tile:focus-visible { border-color: var(--accent); }
.pw-tile.pw-wide { width: 220px; }
.pw-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; line-height: 1.3; }
.pw-line.pw-muted { color: var(--muted); font-size: 11px; }
.pw-thumb { width: 100%; height: 72px; object-fit: cover; border-radius: 5px; background: var(--rule); display: block; }
.pw-thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pw-more-tile { width: 56px; align-items: center; justify-content: center; color: var(--muted); }

.pw-older { margin: 12px 0 0 28px; }
.pw-skeleton { height: 160px; margin-top: 12px; border-radius: 8px; background: var(--rule); opacity: .35; }

.pw-drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); display: flex; justify-content: flex-end; }
.pw-drawer { width: min(560px, 100%); height: 100%; display: flex; flex-direction: column; background: var(--panel); color: var(--fg);
  border-left: 1px solid var(--rule); outline: none; }
.pw-drawer header { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.pw-drawer header h2 { margin: 0; font-size: 16px; }
.pw-drawer header p { margin: 2px 0 0; font-size: 12px; }
.pw-drawer header button { min-width: 44px; min-height: 44px; }
.pw-drawer-body { flex: 1; overflow: auto; padding: 12px 16px; overflow-wrap: anywhere; }
.pw-drawer-body h3 { margin: 0 0 8px; font-size: 14px; }
.pw-drawer footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--rule); }
.pw-drawer footer button { min-height: 44px; }
.pw-player { width: 100%; max-height: 52vh; background: #000; border-radius: 6px; }
.pw-full { max-width: 100%; border-radius: 6px; }
.pw-segments { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 2px; }
.pw-segments button { display: grid; grid-template-columns: 44px 92px 1fr; gap: 8px; width: 100%; text-align: left; padding: 8px 6px;
  background: transparent; border: 0; border-bottom: 1px solid var(--rule); color: var(--fg); font: inherit; font-size: 12px; cursor: pointer; min-height: 44px; }
.pw-segments button[aria-current="true"] { background: var(--bg); }
.pw-segments em { font-style: normal; color: var(--muted); }
.pw-scene { margin: 0 0 8px; }
.pw-diff { margin: 0 0 6px; padding: 2px 6px; border-radius: 4px; }
.pw-diff-add { background: var(--ok-bg, rgba(34, 197, 94, .12)); }
.pw-diff-del { background: var(--err-bg, rgba(220, 38, 38, .1)); text-decoration: line-through; opacity: .8; }
.pw-plan, .pw-refs { padding-left: 20px; margin: 4px 0; font-size: 12px; }

@media (max-width: 767px) {
  .pw-columns { display: none; }
  .pw-row { grid-template-columns: 1fr; gap: 6px; }
  .pw-artifacts { padding-left: 28px; }
  .pw-strip { flex-wrap: nowrap; overflow-x: auto; max-height: none; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .pw-cell { flex: none; }
  .pw-attention { grid-template-columns: 1fr; }
  .pw-attention-actions { justify-content: stretch; }
  .pw-attention-actions button { flex: 1; min-height: 44px; }
  .pw-node { min-height: 44px; }
  .pw-drawer { width: 100%; }
}

/* Music series: series list -> series page -> episode page; compact, nothing overflows its column. */
.ms-page { max-width: 1180px; }
.ms-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.ms-head-main { min-width:0; flex:1 1 320px; }
.ms-head-main h1, .ms-head-main h2 { margin:0 0 2px; }
.ms-crumbs { margin:0 0 8px; }
.ms-crumbs button { background:none; border:0; padding:0; color:var(--accent); cursor:pointer; font:inherit; }
.ms-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.ms-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-block:6px; }
.ms-row > input, .ms-row > select { flex:1 1 220px; min-width:0; }
.ms-between { justify-content:space-between; }
.ms-section { background:var(--panel); border:1px solid var(--rule); border-radius:12px; padding:12px 14px; margin-block:10px; min-width:0; }
.ms-section h3 { margin:0 0 6px; font-size:16px; }
.ms-section h4 { margin:12px 0 6px; font-size:14px; }
.ms-section > p.muted { margin:0 0 8px; font-size:13px; }
.ms-ellipsis { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; max-width:100%; }
.ms-clamp { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.ms-table-wrap { overflow-x:auto; border:1px solid var(--rule); border-radius:12px; background:var(--panel); }
.ms-table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:14px; }
.ms-table th, .ms-table td { padding:8px 10px; border-bottom:1px solid var(--rule); text-align:left; vertical-align:middle; overflow:hidden; }
.ms-table th { font-size:12px; color:var(--muted); font-weight:600; }
.ms-table th:first-child, .ms-table td:first-child { width:38%; }
.ms-table th:last-child, .ms-table td:last-child { width:96px; text-align:right; }
.ms-table tr:last-child td { border-bottom:0; }
.ms-table small { display:block; }
.ms-click { cursor:pointer; }
.ms-click:hover td { background:var(--none-bg); }
.ms-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:10px; }
.ms-grid-small { grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); }
.ms-card { margin:0; min-width:0; border:1px solid var(--rule); border-radius:10px; padding:6px; display:flex; flex-direction:column; gap:6px; background:var(--panel); }
.ms-card video, .ms-card img, .ms-placeholder { width:100%; aspect-ratio:16/9; object-fit:cover; border-radius:6px; display:block; background:var(--none-bg); }
.ms-placeholder { display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:12px; text-align:center; }
.ms-card figcaption { min-width:0; font-size:13px; }
.ms-card figcaption small { color:var(--muted); font-size:12px; }
.ms-card figcaption small.error { color:var(--err); background:none; }
.ms-card .ms-actions button { font-size:12px; padding:4px 8px; }
.ms-options { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:8px; }
.ms-option { display:flex; gap:8px; align-items:flex-start; border:1px solid var(--rule); border-radius:10px; padding:8px 10px; cursor:pointer; min-width:0; }
.ms-option span { min-width:0; }
.ms-option small { display:block; color:var(--muted); font-size:12px; }
.ms-upload { display:inline-flex; align-items:center; gap:6px; border:1px dashed var(--rule); border-radius:8px; padding:6px 12px; cursor:pointer; color:var(--accent); }
.ms-upload input { display:none; }
.ms-facts { display:grid; grid-template-columns:max-content minmax(0, 1fr); gap:4px 14px; margin:0; font-size:14px; }
.ms-facts dt { color:var(--muted); }
.ms-facts dd { margin:0; min-width:0; overflow-wrap:anywhere; }
@media (max-width: 640px) {
  .ms-table th:nth-child(4), .ms-table td:nth-child(4) { display:none; }
  .ms-table th:first-child, .ms-table td:first-child { width:auto; }
}
.ms-video { display:block; width:100%; max-width:960px; aspect-ratio:16/9; background:#000; border-radius:6px; }
.ms-choice { display:flex; gap:16px; flex-wrap:wrap; margin-block:6px; }
.ms-choice label { display:flex; align-items:center; gap:6px; }

/* UX-01: channel management stays usable at 390/768px without page-wide overflow. */
.studio-react-registry, .studio-table-scroll, .studio-channels-list { min-width: 0; }
.studio-channel-cards { display: none; }
@media (max-width: 700px) {
  .studio-channels-list > .studio-table-scroll { display: none; }
  .studio-channel-cards { display: grid; gap: 12px; min-width: 0; }
  .studio-channel-card { min-width: 0; padding: 15px; border: 1px solid var(--rule); border-radius: 12px; background: var(--panel); }
  .studio-channel-card-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .studio-channel-card-heading strong, .studio-channel-card-heading small { display: block; overflow-wrap: anywhere; }
  .studio-channel-card-heading small { color: var(--muted); }
  .studio-channel-card details { margin-block: 10px; }
  .studio-channel-card summary { cursor: pointer; }
  .studio-channel-card p, .studio-channel-card code { overflow-wrap: anywhere; word-break: break-word; }
  .studio-channel-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .studio-channel-card-actions > * { flex: 1 1 125px; text-align: center; }
}

/* UX-28: tables with semantics supplied by EntityTable become accessible stacked cards on phones. */
@media (max-width: 600px) {
  .studio-table-scroll:has(> .studio-entity-table--responsive) { overflow-x: visible; min-width: 0; }
  .studio-entity-table.studio-entity-table--responsive { display:block; min-width:0; width:100%; }
  .studio-entity-table--responsive thead { position:absolute; width:1px; height:1px; overflow:hidden;
    clip-path:inset(50%); white-space:nowrap; }
  .studio-entity-table--responsive tbody { display:grid; gap:12px; }
  .studio-entity-table--responsive tbody tr { display:block; min-width:0; padding:10px 14px;
    border:1px solid var(--rule); border-radius:12px; background:var(--panel); }
  .studio-entity-table--responsive tbody td { display:grid; min-width:0;
    grid-template-columns:minmax(76px,0.32fr) minmax(0,1fr); align-items:start; gap:8px;
    border:0; padding:6px 0; overflow-wrap:anywhere; }
  .studio-entity-table--responsive tbody td::before { content:attr(data-label); min-width:0;
    color:var(--muted); font-size:12px; line-height:1.5; font-weight:600; }
  .studio-entity-table--responsive tbody td[colspan] { display:block; }
  .studio-entity-table--responsive tbody td[colspan]::before { display:none; }
  .studio-entity-table--responsive .studio-row-actions { display:flex; flex-wrap:wrap;
    white-space:normal; min-width:0; }
  .studio-entity-table--responsive tbody td code, .studio-entity-table--responsive tbody td a {
    overflow-wrap:anywhere; }
}

/* Independent owner-review wizard for silent 2D animation Shorts. */
.animation-shorts { display: grid; gap: 1.2rem; min-width: 0; }
.animation-toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.animation-toolbar h2 { margin: 0; }
.animation-project-list { display: grid; gap: .65rem; }
.animation-project { display: grid; gap: .3rem; padding: 1rem; border: 1px solid var(--line, #444);
  border-radius: 12px; text-decoration: none; color: inherit; }
.animation-project:hover { background: var(--surface-raised, rgba(128,128,128,.08)); }
.animation-form, .animation-feedback { display: grid; gap: 1rem; }
.animation-form label, .animation-feedback label, .animation-decision label { display: grid; gap: .4rem; }
.animation-form-two { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.animation-workspace { display: grid; grid-template-columns: minmax(0,2fr) minmax(260px,1fr); gap: 1.2rem; align-items: start; }
.animation-workspace > main, .animation-workspace > aside { display: grid; gap: 1.2rem; min-width: 0; }
.animation-workspace section { border: 1px solid var(--line, #444); padding: 1rem; border-radius: 12px; min-width: 0; }
.animation-workspace video { display: block; width: min(100%, 380px); max-height: 580px; background: #111; }
.animation-shots ol { padding-left: 1.4rem; display: grid; gap: 1rem; }
.animation-shots li { padding-left: .3rem; }
.animation-shots li p { margin: .4rem 0; }
.animation-shot-header { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: space-between; }
.animation-asset-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(145px,1fr)); gap: .75rem; }
.animation-asset { margin: 0; max-width: 230px; }
.animation-asset img, .animation-asset-empty { width: 100%; aspect-ratio: 9/16; object-fit: contain;
  background: #17212b; border-radius: 9px; }
.animation-asset-empty { display: grid; place-items: center; text-align: center; padding: .6rem; box-sizing: border-box; }
.animation-asset figcaption { display: grid; gap: .2rem; padding: .4rem 0; overflow-wrap: anywhere; }
.animation-asset figcaption small { opacity: .75; }
.animation-asset figcaption span { font-size: .84rem; }
.animation-decision { display: grid; gap: .7rem; }
.animation-script { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .animation-workspace { grid-template-columns: 1fr; }
  .animation-form-two { grid-template-columns: 1fr; }
}


/* Post-render revisions in the existing Project Workspace. */
.pw-video-edit { background:var(--panel); border:1px solid var(--rule); border-radius:14px;
  margin:20px 0; padding:18px; display:grid; gap:15px; }
.pw-video-edit h2, .pw-video-edit h3 { margin:0 0 8px; }
.pw-video-edit-heading p { margin:0; }
.pw-video-edit form { display:grid; gap:12px; }
.pw-video-edit label { display:grid; gap:6px; color:var(--fg); font-weight:500; min-width:0; }
.pw-video-edit select, .pw-video-edit input, .pw-video-edit textarea {
  width:100%; min-width:0; padding:8px 10px; border:1px solid var(--rule);
  border-radius:9px; background:var(--bg); color:var(--fg); font:inherit; }
.pw-video-edit textarea { resize:vertical; }
.pw-video-edit-preview { max-width:720px; }
.pw-video-edit-preview video { max-height:370px; object-fit:contain; }
.pw-video-edit-range { display:grid; gap:12px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.pw-video-edit-manual { border:1px solid var(--rule); border-radius:10px; padding:12px; }
.pw-video-edit-manual summary { cursor:pointer; font-weight:600; }
.pw-video-edit-manual form { margin-top:14px; max-width:720px; }
.pw-video-edit-history { display:grid; gap:10px; }
.pw-video-edit-request { padding:12px; border:1px solid var(--rule); border-radius:10px; }
.pw-video-edit-request p { margin:0 0 8px; }
.pw-video-edit-ops { margin:8px 0 12px 20px; padding:0; }
.pw-video-edit-ops li { margin-bottom:6px; }
@media (max-width:600px) { .pw-video-edit { padding:12px; } .pw-video-edit-range { grid-template-columns:1fr; } }
