/* Герои региона — живые фото. Оформление: тёмная тема с оранжевым акцентом (см. example_design). */

:root {
  /* поверхности */
  --bg:#0E0E11; --bg-2:#0B0B0E; --surface:#15151A; --surface-2:#101014;
  --card-a:#16161B; --card-b:#101014; --header-bg:rgba(14,14,17,.72);
  /* текст */
  --text:#F4F3F1; --muted:#A6A6AF; --muted-2:#9A9AA3; --faint:#74747D; --faint-2:#5F5F68;
  /* линии */
  --line:rgba(255,255,255,.08); --line-2:rgba(255,255,255,.14); --hair:rgba(255,255,255,.06);
  --chip:rgba(255,255,255,.04); --chip-hover:rgba(255,255,255,.08);
  /* акцент */
  --accent:#FF6A1A; --accent-2:#FF8A3D; --accent-deep:#C2470A;
  --accent-soft:rgba(255,106,26,.12); --accent-glow:rgba(255,106,26,.28); --on-accent:#0B0B0D;
  /* состояния */
  --ok:#27D07F; --ok-soft:rgba(39,208,127,.12);
  --warn:#F5C542; --warn-soft:rgba(245,197,66,.12);
  --err:#FF5C5C; --err-soft:rgba(255,92,92,.12);
  /* форма */
  --r-xs:8px; --r-sm:10px; --r-md:14px; --r-lg:20px; --r-pill:100px;
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:22px; --s6:32px;
  --header-h:64px; --maxw:1640px;
  --shadow-1:0 8px 24px rgba(0,0,0,.35); --shadow-2:0 24px 60px rgba(0,0,0,.45);
  --glow:0 10px 28px var(--accent-glow);
  --font-display:'Unbounded',system-ui,sans-serif; --font:'Manrope',system-ui,-apple-system,sans-serif;
  --font-mono:'JetBrains Mono',Consolas,ui-monospace,monospace;
  --dur:.18s; --ease:cubic-bezier(.2,.7,.3,1);
}
:root[data-theme="light"] {
  --bg:#F3F3F1; --bg-2:#EAEAE6; --surface:#FFFFFF; --surface-2:#F7F7F4;
  --card-a:#FFFFFF; --card-b:#F6F6F3; --header-bg:rgba(243,243,241,.82);
  --text:#19191C; --muted:#55555E; --muted-2:#5E5E68; --faint:#86868F; --faint-2:#9A9AA2;
  --line:rgba(0,0,0,.10); --line-2:rgba(0,0,0,.16); --hair:rgba(0,0,0,.07);
  --chip:rgba(0,0,0,.035); --chip-hover:rgba(0,0,0,.06);
  --accent-soft:rgba(255,106,26,.14); --on-accent:#FFFFFF;
  --shadow-1:0 8px 24px rgba(20,20,25,.08); --shadow-2:0 24px 60px rgba(20,20,25,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* иначе display у .navpill, .chip, .btn и т. п. перебивает hidden */
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55;
       -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
::selection { background: rgba(255,106,26,.32); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- типографика */
.t-display { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px,2.4vw,28px); line-height: 1.1; letter-spacing: -.02em; }
.t-h1 { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.2; letter-spacing: -.015em; }
.t-h2 { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.t-label { font-family: var(--font-mono); font-weight: 600; font-size: 10.5px; letter-spacing: .2em;
           text-transform: uppercase; color: var(--faint); }
.t-num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.t-sm { font-size: 13px; color: var(--muted-2); }

/* ---------------------------------------------------------------- кнопки */
.btn { --h:40px; height: var(--h); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
       padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--chip);
       color: var(--text); font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap;
       transition: background var(--dur) var(--ease), border-color var(--dur), transform var(--dur); }
.btn:hover { background: var(--chip-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: var(--glow); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); transform: translateY(-1px); }
.btn.ghost { background: transparent; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--chip); color: var(--text); }
.btn.danger { background: transparent; border-color: rgba(255,92,92,.34); color: #FF9B9B; }
.btn.danger:hover { background: var(--err-soft); border-color: var(--err); }
.btn.big { --h:50px; padding: 0 26px; font-size: 15.5px; border-radius: var(--r-md); }
.btn.small { --h:32px; padding: 0 11px; font-size: 13px; border-radius: var(--r-xs); }
.btn.icon { --h:38px; width: 38px; padding: 0; }
.btn.block { width: 100%; }
.spin { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: currentColor;
        border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -2px; }

/* ---------------------------------------------------------------- поля */
.field { display: block; margin-bottom: var(--s4); }
.field > span, .field__label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--faint); line-height: 1.45; }
input, select, textarea { width: 100%; height: 42px; padding: 0 13px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  font: 500 14.5px/1.4 var(--font); transition: border-color var(--dur), box-shadow var(--dur); }
textarea { height: auto; min-height: 84px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--font-mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint-2); }
input[type=checkbox] { width: auto; height: auto; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23A6A6AF' stroke-width='2'><path d='M2 4.5 6 8.5 10 4.5'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type=range] { width: 100%; height: 4px; padding: 0; appearance: none; background: var(--line-2);
  border: none; border-radius: var(--r-pill); margin: 14px 0 6px; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); cursor: pointer; }
.switch { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; padding: 7px 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { flex: none; width: 40px; height: 23px; border-radius: var(--r-pill); background: var(--chip);
  border: 1px solid var(--line-2); position: relative; transition: all var(--dur) var(--ease); margin-top: 1px; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--muted); transition: all var(--dur) var(--ease); }
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { left: 19px; background: #fff; }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch b { display: block; font-size: 14px; font-weight: 600; }
.switch small { display: block; font-size: 12.5px; color: var(--faint); line-height: 1.4; margin-top: 2px; }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.seg button { height: auto; padding: 7px 13px; border-radius: 7px; border: none; background: transparent; color: var(--muted);
  font: 600 13px/1 var(--font); cursor: pointer; transition: all var(--dur) var(--ease); }
.seg button:hover { color: var(--text); background: var(--chip); }
.seg button.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------------------------------------------------------------- шапка */
.appbar { position: sticky; top: 0; z-index: 60; height: var(--header-h); background: var(--header-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--hair); }
.appbar > div { height: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 120%, var(--accent-deep), #161318); border: 1px solid rgba(255,255,255,.12); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text b { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.brand-text i { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .3em;
  color: var(--accent); margin-top: 4px; font-style: normal; text-transform: uppercase; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.navpill { height: 34px; padding: 0 15px; border-radius: var(--r-pill); border: 1px solid transparent; background: transparent;
  color: var(--muted); font: 600 13.5px/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.navpill:hover { background: var(--chip); color: var(--text); }
.navpill.on { background: var(--accent-soft); border-color: rgba(255,106,26,.3); color: var(--accent); }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--chip); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chip.btn-like { cursor: pointer; } .chip.btn-like:hover { background: var(--chip-hover); color: var(--text); }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(39,208,127,.28); }
.chip.err { color: #FF9B9B; background: var(--err-soft); border-color: rgba(255,92,92,.3); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 9px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 9px var(--warn); }
.dot.err { background: var(--err); box-shadow: 0 0 9px var(--err); }
.dot.live { background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: blink 2.2s ease-in-out infinite; }
.usermenu { position: relative; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font: 700 12px/1 var(--font-mono); border: 1px solid rgba(255,106,26,.3); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 6px; display: none; z-index: 70; }
.menu.open { display: block; }
.menu b { display: block; padding: 9px 12px 3px; font-size: 14px; }
.menu .role { padding: 0 12px 9px; font-size: 12px; color: var(--faint); border-bottom: 1px solid var(--hair); margin-bottom: 6px; }
.menu button { width: 100%; height: 36px; justify-content: flex-start; border: none; background: transparent; color: var(--text);
  font: 500 13.5px/1 var(--font); padding: 0 12px; border-radius: var(--r-xs); cursor: pointer; display: flex; align-items: center; gap: 9px; }
.menu button:hover { background: var(--chip); }

/* ---------------------------------------------------------------- экраны */
.screen { display: none; }
body[data-screen="catalog"] .screen.catalog,
body[data-screen="studio"] .screen.studio,
body[data-screen="jobs"] .screen.jobs,
body[data-screen="users"] .screen.users,
body[data-screen="api"] .screen.api,
body[data-screen="materials"] .screen.materials,
body[data-screen="landing"] .screen.landing { display: block; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 22px; }
.pagehead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: var(--s5); }
.pagehead .t-display { flex: none; }
.empty { color: var(--muted); padding: 48px 20px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty b { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* каталог */
.catalog-grid { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.tree-panel { position: sticky; top: calc(var(--header-h) + 22px); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; max-height: calc(100vh - var(--header-h) - 44px); display: flex; flex-direction: column; }
.tree-panel .search { padding: 12px; border-bottom: 1px solid var(--hair); }
.tree { overflow: auto; padding: 6px; }
.region > .title { padding: 9px 12px; font-weight: 700; font-size: 13.5px; cursor: pointer; display: flex;
  justify-content: space-between; gap: 8px; border-radius: var(--r-xs); user-select: none; }
.region > .title:hover { background: var(--chip); }
.region > .title .n { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.region.collapsed .persons { display: none; }
.person { padding: 7px 12px 7px 20px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px;
  border-radius: var(--r-xs); font-size: 13.5px; }
.person:hover { background: var(--chip); }
.person.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.person .n { font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.person .n b { color: var(--accent); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.photo { position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); cursor: pointer; transition: border-color var(--dur), transform var(--dur), box-shadow var(--dur); }
.photo:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.photo img, .photo video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.rail .photo video { aspect-ratio: 4/3; background: #000; }
.photo .cap { padding: 8px 10px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo .badge { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-pill); background: rgba(11,11,14,.72); backdrop-filter: blur(6px);
  border: 1px solid var(--accent); color: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 220px); gap: 12px; overflow-x: auto;
  padding-bottom: 6px; scrollbar-width: thin; }

/* студия */
.studio-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(420px, 1fr) minmax(320px, 420px); gap: 20px; align-items: start; }
.sticky { position: sticky; top: calc(var(--header-h) + 22px); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); }
.card + .card { margin-top: 16px; }
.card > h3 { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.step-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font: 700 11px/1 var(--font-mono); }
.preview img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); display: block; }
.preview .meta { margin-top: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--faint); word-break: break-all; line-height: 1.6; }
.filmstrip { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.filmstrip img { width: 62px; height: 62px; object-fit: cover; border-radius: var(--r-xs); border: 1px solid var(--line);
  cursor: pointer; flex: none; opacity: .65; transition: opacity var(--dur), border-color var(--dur); }
.filmstrip img:hover { opacity: 1; }
.filmstrip img.on { opacity: 1; border-color: var(--accent); }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.option { position: relative; text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 16px;
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
  transition: all var(--dur) var(--ease); color: inherit; font: inherit; height: auto; }
.option:hover { border-color: var(--line-2); transform: translateY(-2px); background: var(--surface-2); }
.option.on { border-color: var(--accent); background: linear-gradient(150deg, var(--accent-soft), transparent 58%);
  box-shadow: 0 14px 34px rgba(255,106,26,.12); }
.option .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.option .name { font-size: 15px; font-weight: 700; }
.option .desc { font-size: 12.8px; line-height: 1.5; color: var(--muted-2); }
.option .meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); letter-spacing: .04em; }
.option .pick { position: absolute; top: -9px; left: 14px; padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; }
.quick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 14px;
  padding: 12px 14px; border-radius: var(--r-md); background: linear-gradient(140deg, var(--accent-soft), transparent 70%);
  border: 1px solid rgba(255,106,26,.28); }
.quick .btn { flex: none; }
.quick span { flex: 1; min-width: 180px; }

.advice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--accent-soft); border: 1px solid rgba(255,106,26,.25); font-size: 13.5px; margin-bottom: 14px; }
.advice.warn { background: var(--warn-soft); border-color: rgba(245,197,66,.3); }
details.adv { margin-top: 14px; border-top: 1px solid var(--hair); padding-top: 12px; }
details.adv > summary, details > summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 7px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--faint); transition: transform var(--dur); }
details[open] > summary::before { transform: rotate(90deg); }
details.adv > div, details.adv > .row, details > .inner { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.row > label { flex: 1; min-width: 150px; margin: 0; }
.row.tight { gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 200px; }
.director-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.director-grid textarea { min-height: 76px; font-size: 13.5px; }
.actionbar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-top: 14px; margin-top: 4px; }
.note { background: var(--ok-soft); border: 1px solid rgba(39,208,127,.28); border-radius: var(--r-md);
  padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.error { background: var(--err-soft); border: 1px solid rgba(255,92,92,.3); color: #FFB3B3; border-radius: var(--r-md);
  padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; white-space: pre-wrap; }

/* дубли (задачи) */
.takes { display: flex; flex-direction: column; gap: 14px; }
/* колонка дублей не растягивает страницу: свой скролл */
.takes-col > .card { display: flex; flex-direction: column; max-height: calc(100vh - var(--header-h) - 54px); }
.takes-col .takes { overflow: auto; padding-right: 4px; margin-right: -4px; }
@media (max-width: 1240px) { .takes-col > .card { max-height: none; } .takes-col .takes { overflow: visible; } }
.take { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; animation: rise .22s var(--ease); }
.take.running { border-color: rgba(255,106,26,.34); }
.take.failed { border-color: rgba(255,92,92,.34); }
.take video { display: block; width: 100%; background: #000; }
.take .ph { aspect-ratio: 4/3; display: grid; place-items: center; gap: 10px; background: var(--surface-2);
  color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }
.take .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 9px; }
.take .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.take .no { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.take .note-ru { font-size: 13px; color: var(--muted-2); line-height: 1.45; }
.take .tech { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint-2); line-height: 1.6; overflow-wrap: anywhere; }
.take .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  background: var(--chip); border: 1px solid var(--line); color: var(--muted); }
.pill.running { color: var(--accent); background: var(--accent-soft); border-color: rgba(255,106,26,.3); }
.pill.done { color: var(--ok); background: var(--ok-soft); border-color: rgba(39,208,127,.28); }
.pill.failed, .pill.cancelled { color: #FF9B9B; background: var(--err-soft); border-color: rgba(255,92,92,.3); }
.bar { height: 6px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); width: 0; transition: width .6s var(--ease); }
.stage { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }

/* плитки готовых роликов */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.vgrid.big { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.takes-col .vgrid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.takes-col .vtile .cap b { font-size: 12.5px; }
.vtile { position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); cursor: pointer; transition: border-color var(--dur), transform var(--dur), box-shadow var(--dur); }
.vtile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.vtile video { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #000; }
.vtile .play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 44px; height: 44px;
  border-radius: 50%; display: grid; place-items: center; background: rgba(11,11,14,.6); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: 15px; pointer-events: none; transition: opacity var(--dur); }
.vtile:hover .play { opacity: 0; }
.vtile .cap { padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; }
.vtile .cap b { font-size: 13.5px; font-weight: 700; }
.vtile .cap span { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* строки задач в работе / с ошибкой */
.jrows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.jrows.wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.jrow { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; }
.jrow.running, .jrow.queued { border-color: rgba(255,106,26,.34); }
.jrow.failed, .jrow.cancelled { border-color: rgba(255,92,92,.34); }
.jrow-head { display: flex; align-items: center; gap: 8px; }
.jrow-head b { font-size: 14px; }

/* окно просмотра ролика */
.modal.viewer { width: min(1100px, 96vw); padding: 18px; }
.viewer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.viewer-media { background: #000; border-radius: var(--r-md); overflow: hidden; display: grid; place-items: center; }
.viewer-media video { display: block; width: 100%; max-height: 62vh; background: #000; }
.modal.viewer .note-ru { margin-top: 12px; font-size: 14px; color: var(--muted-2); }
.modal.viewer .tech { margin-top: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--faint-2); overflow-wrap: anywhere; }

/* таблица пользователей */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 600 11px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); padding: 0 12px 10px; }
.table td { padding: 12px; border-top: 1px solid var(--hair); vertical-align: middle; }
.table tr.off td { opacity: .5; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* модалки и тосты */
.modal-bg { position: fixed; inset: 0; background: rgba(6,6,8,.72); backdrop-filter: blur(4px); display: none;
  align-items: center; justify-content: center; z-index: 80; padding: 20px; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); width: min(900px, 96vw);
  max-height: 88vh; overflow: auto; padding: 22px; box-shadow: var(--shadow-2); }
.modal.narrow { width: min(460px, 96vw); }
.modal h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.modal .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
.modal-foot { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--surface); border: 1px solid var(--line-2);
  padding: 12px 16px; border-radius: var(--r-md); z-index: 90; display: none; max-width: 420px; box-shadow: var(--shadow-2); font-size: 14px; }
.toast.err { border-color: var(--err); color: #FFB3B3; }
.toast.open { display: block; animation: rise .2s var(--ease); }
pre.log { font-family: var(--font-mono); font-size: 11.5px; white-space: pre-wrap; max-height: 60vh; overflow: auto;
  background: var(--bg-2); padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- вход */
.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--bg); position: relative; overflow: hidden; padding: 20px; }
.login-glow { position: absolute; width: 780px; height: 780px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,106,26,.18), transparent 62%); filter: blur(30px); }
.login-card { position: relative; width: min(400px, 94vw); background: linear-gradient(150deg, var(--card-a), var(--card-b));
  border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 30px 28px; box-shadow: var(--shadow-2); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-card h1 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-card .muted { font-size: 13.5px; margin-bottom: 20px; }
.login-card .field { margin-bottom: 14px; }
.login-err { background: var(--err-soft); border: 1px solid rgba(255,92,92,.34); color: #FFB3B3; border-radius: var(--r-sm);
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.login-note { font-size: 12px; margin-top: 16px; text-align: center; }

/* ---------------------------------------------------------------- адаптив */
@media (max-width: 1500px) { .studio-grid { grid-template-columns: minmax(260px, 330px) 1fr minmax(300px, 380px); } }
@media (max-width: 1240px) {
  .studio-grid { grid-template-columns: minmax(260px, 320px) 1fr; }
  .studio-grid .takes-col { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .catalog-grid { grid-template-columns: 1fr; }
  .tree-panel { position: static; max-height: 340px; }
  .studio-grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .appbar > div { padding: 0 14px; gap: 10px; }
  .wrap { padding: 16px; }
  .options { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .appbar > div { gap: 8px; }
  .brand-text { display: none; }
  .navpill { padding: 0 11px; font-size: 13px; }
  #chip-system span, #chip-queue span { display: none; }
  #chip-system, #chip-queue { padding: 0 9px; }
  #user-name { display: none; }
  .photos { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .rail { grid-auto-columns: minmax(160px, 70vw); }
  .pagehead { gap: 10px; }
  .modal { padding: 16px; }
  .row > label { min-width: 100%; }
}

/* лучшее фото человека (кнопка «Выбрать лучшее фото») */
.photo.best { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--glow); }
.photo .best-flag { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent); font: 700 11.5px/1.2 var(--font); box-shadow: var(--glow); }
.photo .verdict { padding: 0 10px 8px; margin-top: -4px; font: 600 10.5px/1.3 var(--font-mono); color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo.best .verdict { color: var(--accent); }
.photo.dim img { opacity: .45; filter: grayscale(.5); }
.photo.dim:hover img { opacity: 1; filter: none; }
.best-card { display: grid; grid-template-columns: 240px 1fr; gap: 22px; margin-bottom: 18px;
  border-color: rgba(255,106,26,.35); background: linear-gradient(135deg, var(--accent-soft), transparent 55%), var(--surface);
  animation: rise .3s var(--ease); }
.best-card.loading { display: block; }
.best-card.loading .spin { display: inline-block; vertical-align: -2px; margin-right: 8px; }
.best-card > img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-md); cursor: pointer; }
.best-kicker { font: 700 12px/1 var(--font); color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.best-reason { margin: 10px 0 12px; font-size: 14.5px; line-height: 1.55; max-width: 78ch; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fact { padding: 4px 10px; border-radius: var(--r-pill); background: var(--chip); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); }
.best-how { margin-bottom: 12px; }
.best-others { margin-bottom: 14px; font-size: 13px; }
.best-others summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.best-others .other { display: flex; gap: 10px; margin-top: 8px; align-items: flex-start; }
.best-others .other img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-xs); flex: none; }
.best-others .other b { display: block; font-size: 12.5px; }
.best-others .other span { color: var(--muted-2); }
.best-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.btn.pulse { animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { box-shadow: var(--glow), 0 0 0 0 rgba(255,106,26,.55); }
                   60% { box-shadow: var(--glow), 0 0 0 14px rgba(255,106,26,0); } }
@media (prefers-reduced-motion: reduce) { .btn.pulse { animation: none; } .best-card { animation: none; } }
@media (max-width: 760px) { .best-card { grid-template-columns: 1fr; } .best-card > img { max-width: 320px; } }

/* поля поиска: type="search" (чтобы браузер не принимал их за логин) выглядят как обычные поля */
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }

/* разговор с героем (панель справа) */
.chat { position: fixed; top: var(--header-h); right: 0; bottom: 0; z-index: 40; width: min(460px, 100vw);
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-2); transform: translateX(105%); transition: transform .25s var(--ease); }
.chat.open { transform: none; }
body.chat-open .wrap { padding-right: min(480px, 34vw); }
@media (max-width: 1100px) { body.chat-open .wrap { padding-right: 0; } }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-ava { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none;
  box-shadow: 0 0 0 2px var(--accent); }
.chat-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-who b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-who span { font-size: 12px; color: var(--muted-2); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
.chat-empty { margin: auto 0; text-align: center; color: var(--muted); }
.chat-empty img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-empty p { font-size: 14px; margin-bottom: 14px; }
.chat-tips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chat-tips .chip { height: auto; min-height: 32px; padding: 6px 12px; text-align: left; line-height: 1.35; white-space: normal; color: var(--text); }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.msg.me { align-self: flex-end; }
.msg.hero img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.msg .bubble { padding: 10px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 5px; }
.msg.hero .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.hero.err .bubble { border-color: rgba(255,92,92,.35); color: #FFB3B3; }
.msg .src { font-size: 12px; color: var(--faint); cursor: help; align-self: flex-end; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px 6px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; min-height: 42px; max-height: 160px; resize: none; padding: 10px 12px; line-height: 1.4; }
.chat-form .btn { flex: none; }
.chat-note { padding: 0 16px 12px; font-size: 11.5px; color: var(--faint); }
@media (max-width: 760px) { .chat { top: 0; width: 100vw; z-index: 65; } }
@media (prefers-reduced-motion: reduce) { .chat { transition: none; } .typing i { animation: none; } }

/* редактор текста интервью (CONTEXT.txt) */
.modal.ctx-modal { width: min(1280px, 97vw); height: 92vh; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.ctx-head { display: flex; align-items: flex-start; gap: 12px; }
.ctx-head .sub { margin-bottom: 10px; }
.ctx-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.ctx-tools input[type=search] { width: 200px; height: 34px; }
.switch.mini { padding: 0; gap: 7px; align-items: center; font-size: 12.5px; color: var(--muted); }
.switch.mini i { width: 32px; height: 19px; }
.switch.mini i::after { width: 13px; height: 13px; }
.switch.mini input:checked + i::after { left: 15px; }
.ctx-body { flex: 1; min-height: 0; display: flex; gap: 12px; }
.ctx-body textarea { flex: 1; height: 100%; resize: none; font: 13.5px/1.6 var(--font); padding: 12px 14px; }
.ctx-proof { width: min(480px, 42%); overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.ctx-proof[hidden] { display: none; }
.proof-run .bar { height: 6px; border-radius: 3px; background: var(--chip); margin: 10px 0 6px; overflow: hidden; }
.proof-run .bar i { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); }
.proof-head { display: flex; flex-direction: column; gap: 2px; }
.proof-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; scrollbar-width: thin; }
.proof-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: var(--r-sm); background: var(--surface);
  border: 1px solid var(--line); cursor: pointer; font-size: 13px; line-height: 1.5; }
.proof-item input { margin-top: 4px; accent-color: var(--accent); }
.proof-item .p-before { color: var(--faint); margin-top: 2px; }
.proof-item .p-after { color: var(--text); }
.proof-item mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 1px; }
.proof-item del { color: #FF9B9B; text-decoration: line-through; }
.proof-foot { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .ctx-body { flex-direction: column; } .ctx-body textarea { min-height: 110px; }
  .ctx-proof { width: auto; flex: 1.6; min-height: 0; } }

/* саммари героя (SUMMARY.txt) */
.sum-text { white-space: pre-wrap; font-size: 14px; line-height: 1.65; max-height: 340px; overflow-y: auto; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); margin-bottom: 14px; scrollbar-width: thin; }
.modal.sum-modal { width: min(920px, 96vw); height: 88vh; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.sum-modal textarea { flex: 1; min-height: 0; resize: none; font: 14.5px/1.65 var(--font); padding: 12px 14px; }

/* главный ролик героя (звезда) */
.vtile .star { position: absolute; top: 8px; left: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(11,11,14,.66); backdrop-filter: blur(6px); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--dur), transform var(--dur), background var(--dur); }
.vtile:hover .star, .vtile .star:focus-visible, .vtile .star.on { opacity: 1; }
.vtile .star:hover { transform: scale(1.1); background: rgba(11,11,14,.85); }
.vtile .star.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.vtile .star.on.auto { background: rgba(11,11,14,.72); border-color: var(--accent); color: var(--accent); box-shadow: none; }
.vtile.main { border-color: var(--accent); }
@media (hover: none) { .vtile .star { opacity: 1; } }
.view-star.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------------------------------------------------------------- API: ключи и документация */
.api-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.api-toc { position: sticky; top: calc(var(--header-h) + 18px); max-height: calc(100vh - var(--header-h) - 36px); overflow: auto;
  font-size: 13px; padding-right: 4px; }
.api-toc a { display: block; text-decoration: none; color: var(--muted); padding: 4px 8px; border-radius: var(--r-xs); }
.api-toc a:hover { color: var(--text); background: var(--chip); }
.toc-group { margin-bottom: 12px; }
.toc-group > a:first-child { color: var(--text); font-weight: 700; }
.toc-ep { display: flex !important; gap: 8px; align-items: baseline; }
.toc-ep .method { flex: none; width: 46px; }
.api-main { min-width: 0; }
.api-main > .card + .card, .api-main > .card + #api-docs { margin-top: 16px; }
#api-keys-card > h3 .spacer { flex: 1; }
.api-all { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; cursor: pointer; }
.api-newkey { display: flex; gap: 10px; margin-bottom: 14px; }
.api-newkey input { max-width: 440px; }
.api-keys-wrap { overflow-x: auto; }
.api-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.api-base { flex: 1 1 320px; max-width: 460px; }
.api-langs { margin-bottom: 0; }
.api-notes { margin: 4px 0 16px 18px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--muted-2); }
.api-notes code, .ep-desc code, .params code { font-family: var(--font-mono); font-size: .9em; color: var(--text);
  background: var(--chip); border: 1px solid var(--hair); border-radius: 5px; padding: 0 4px; }
.api-notes a { color: var(--accent); }

.codebox { position: relative; }
.codebox pre { margin: 0; font: 500 12.5px/1.55 var(--font-mono); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px; overflow-x: auto; white-space: pre; tab-size: 4; }
.codebox pre .c { color: var(--faint); }
.codebox .copy { position: absolute; top: 8px; right: 8px; background: var(--surface); }

.ep-group { margin-top: 30px; }
.ep-group > h2 { margin-bottom: 12px; scroll-margin-top: calc(var(--header-h) + 16px); }
.ep { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5);
  scroll-margin-top: calc(var(--header-h) + 16px); }
.ep + .ep { margin-top: 12px; }
.ep-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.ep-path { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.ep-title { color: var(--muted); font-size: 14px; }
.ep-desc { font-size: 14px; line-height: 1.55; color: var(--muted-2); margin-bottom: 12px; }
.method { display: inline-block; font: 700 10.5px/1 var(--font-mono); letter-spacing: .06em; padding: 4px 6px; border-radius: 6px;
  text-align: center; border: 1px solid transparent; }
.method.get { color: var(--ok); background: var(--ok-soft); border-color: rgba(39,208,127,.28); }
.method.post { color: var(--accent); background: var(--accent-soft); border-color: rgba(255,106,26,.3); }
.method.put { color: var(--warn); background: var(--warn-soft); border-color: rgba(245,197,66,.3); }
.method.delete { color: #FF9B9B; background: var(--err-soft); border-color: rgba(255,92,92,.3); }
:root[data-theme="light"] .method.delete { color: #C73A3A; }
:root[data-theme="light"] .method.get { color: #13894F; }
:root[data-theme="light"] .method.put { color: #9A7300; }
.params { margin-bottom: 12px; font-size: 13.5px; }
.params td { padding: 8px 12px; vertical-align: top; }
.params td:first-child { white-space: nowrap; }
.params .req { color: var(--accent); margin-left: 2px; }
details.resp { margin-top: 10px; }
details.resp summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; }
details.resp pre { margin-top: 6px; font: 500 12px/1.5 var(--font-mono); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px; max-height: 360px; overflow: auto; white-space: pre; }
.api-keyshow { display: flex; gap: 10px; }
.api-keyshow input { font-size: 13.5px; }

@media (max-width: 1100px) {
  .api-layout { grid-template-columns: minmax(0, 1fr); }
  .api-toc { display: none; }
}
@media (max-width: 760px) {
  .api-newkey, .api-keyshow { flex-direction: column; }
  .api-newkey input { max-width: none; }
  .ep { padding: 16px; }
  .params td:first-child { white-space: normal; }
}
.ep-group { scroll-margin-top: calc(var(--header-h) + 16px); }
.ep-note { font-size: 13px; line-height: 1.45; margin: -4px 0 12px; padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(255,106,26,.25); }
.ep-note.danger { color: #FF9B9B; background: var(--err-soft); border-color: rgba(255,92,92,.3); }
:root[data-theme="light"] .ep-note.danger { color: #B42F2F; }
/* шапка на телефоне: пункты меню прокручиваются, кнопки справа не сжимаются и не уезжают за край */
@media (max-width: 760px) {
  .appbar > div { gap: 6px; padding: 0 12px; }
  .nav { min-width: 0; overflow-x: auto; scrollbar-width: none; margin-left: 0; }
  .nav::-webkit-scrollbar { display: none; }
  .navpill { flex: none; padding: 0 8px; }
  #nav-users, #nav-materials, #nav-landing { display: none; }   /* у администратора они есть в меню профиля */
  #chip-system, #chip-queue, #btn-theme, .usermenu, .brand { flex-shrink: 0; }
}
.api-keys-wrap td.mono, .api-keys-wrap .nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- материалы (администратор) */
.mat-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.mat-folder { margin-top: 4px; overflow-wrap: anywhere; }
.mat-links { display: flex; gap: 8px; flex-wrap: wrap; }
#mat-main > .card + .card { margin-top: 16px; }
.drop { display: grid; gap: 6px; place-items: center; text-align: center; padding: 26px 18px; cursor: pointer;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface-2);
  transition: border-color var(--dur), background var(--dur); }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop b { font-size: 15px; }
.drop span { font-size: 13px; color: var(--muted); max-width: 560px; }
.mat-check { display: inline-flex; gap: 8px; align-items: center; margin-top: 12px; cursor: pointer; }
.mat-up, .mat-job-file { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; margin-top: 10px; }
.mat-up .bar, .mat-job-file .bar { grid-column: 1 / -1; }
.mat-up .name, .mat-job-file .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.mat-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.mat-sum > div { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.mat-job { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 6px; }
.mat-job.st-error { border-color: rgba(255,92,92,.35); }
.mat-job-head { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.mat-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mat-actions .mat-check { margin-top: 0; }
.mat-files td { padding: 9px 12px; }
.mat-files .mat-name { overflow-wrap: anywhere; font-size: 13.5px; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.err-text { color: #FF9B9B; }
:root[data-theme="light"] .ok-text { color: #13894F; }
:root[data-theme="light"] .warn-text { color: #9A7300; }
:root[data-theme="light"] .err-text { color: #C73A3A; }
.person .n .spin { width: 10px; height: 10px; vertical-align: -1px; }
@media (max-width: 760px) { .mat-files td:first-child { display: none; } }
:root[data-theme="light"] .error { color: #B42F2F; }
#mat-main { min-width: 0; }
.mat-actions .btn { white-space: normal; height: auto; min-height: var(--h); padding-top: 6px; padding-bottom: 6px; text-align: left; }
@media (max-width: 760px) {
  .mat-files td:nth-child(3) { display: none; }
  .mat-files .mat-name { min-width: 130px; }
  .mat-files td { padding: 8px 6px; }
}

/* регионы на экране «Материалы»: действия у названия */
#mat-tree .region > .title { align-items: center; }
#mat-tree .rname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ractions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity var(--dur); }
#mat-tree .region > .title:hover .ractions, #mat-tree .region > .title:focus-within .ractions { opacity: 1; }
@media (hover: none) { .ractions { opacity: 1; } }
.btn.icon.tiny { --h: 24px; width: 24px; font-size: 13px; border-radius: 7px; padding: 0; background: transparent; }
.mat-empty-region { padding: 6px 12px 8px 20px; }
.tree-panel .search { display: flex; gap: 8px; align-items: center; }
.tree-panel .search .btn.icon { flex: none; --h: 38px; width: 38px; }
.api-scope { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; cursor: pointer; }
#api-landing-card { margin-top: 16px; }

/* ---------------------------------------------------------------- Лендинг (администратор) */
#land-main > * + *, #land-a > .card + .card, #land-b > .card + .card { margin-top: 16px; }
.screen.landing .card > h3 .spacer { flex: 1; }
.land-p { font-size: 14px; line-height: 1.55; color: var(--muted-2); margin-bottom: 12px; }
.land-p code, .land-fields code, .land-checklist code, .land-details code, #land-settings code, .screen.landing .ep-note code {
  font-family: var(--font-mono); font-size: .9em; color: var(--text); }
.land-p b { color: var(--text); }
.land-h4 { font-size: 13px; font-weight: 700; color: var(--muted); margin: 20px 0 8px; }
.land-dl { margin-left: auto; }
#land-kit-note { margin-top: 4px; }
.land-flow { display: flex; align-items: stretch; margin: 2px 0 10px; }
.land-flow-back { margin-bottom: 16px; }
.land-node { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-2); }
.land-node b { font-size: 14px; }
.land-node span { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.land-node code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text); overflow-wrap: anywhere; }
.land-arrow { flex: 0 0 150px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px;
  padding: 0 8px; text-align: center; font-size: 12px; line-height: 1.3; color: var(--accent); }
.land-arrow::after { content: '⟶'; font-size: 20px; line-height: 1; }
.land-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.land-stat { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.land-stat b { display: block; font: 700 22px/1.25 var(--font-display); }
.land-stat span { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.land-warn { margin-bottom: 8px; padding: 8px 12px; font-size: 13.5px; line-height: 1.5; border-radius: var(--r-sm);
  background: var(--warn-soft); border: 1px solid rgba(245,197,66,.3); }
.land-warn.soft { background: var(--chip); border-color: var(--line); }
.land-warn a { color: var(--accent); }
#land-preview p code { font-family: var(--font-mono); font-size: .9em; color: var(--text); }
#land-preview-box { margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); }
#land-preview-box iframe { display: block; width: 100%; height: 760px; border: 0; background: #f5f4f1; }
.land-tree { margin-bottom: 8px; padding: 12px 14px; overflow-x: auto; font: 500 12.5px/1.6 var(--font-mono); color: var(--muted-2);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.land-tree b { color: var(--text); font-weight: 600; }
.land-fields td { padding: 8px 10px; font-size: 13.5px; line-height: 1.45; color: var(--muted-2); }
.land-fields td.mono { width: 1%; white-space: nowrap; font: 500 12.5px var(--font-mono); color: var(--text); }
.land-ol { list-style: decimal; }
.land-checklist { list-style: none; display: grid; gap: 8px; font-size: 14px; }
.land-checklist li { position: relative; padding-left: 26px; line-height: 1.5; color: var(--muted-2); }
.land-checklist li::before { content: '✓'; position: absolute; left: 4px; top: 0; color: var(--ok); font-weight: 700; }
.land-details { padding: 10px 0; border-top: 1px solid var(--hair); }
.land-details:first-of-type { border-top: 0; }
.land-details summary { cursor: pointer; font-size: 14.5px; font-weight: 600; }
.land-details p { margin-top: 8px; font-size: 14px; line-height: 1.55; color: var(--muted-2); }
#land-check-key { margin-top: 14px; border-top: 1px solid var(--hair); }
#land-check-key .api-newkey { margin: 10px 0 8px; }
#land-check-out { display: grid; gap: 4px; }
.land-ok { color: var(--ok); }
.land-bad { color: var(--err); }
@media (max-width: 900px) {
  .land-flow { flex-direction: column; }
  .land-arrow { flex: none; padding: 6px 0; }
  .land-arrow::after { content: '↓'; }
  .land-dl { margin-left: 0; }
  .land-dl > span { display: none; }
  .land-fields td.mono { white-space: normal; overflow-wrap: anywhere; width: auto; }
  #land-preview-box iframe { height: 620px; }
}
.land-flow-label { margin: 10px 0 6px; font: 600 11px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.land-code { margin: 12px 0 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.land-code > summary { cursor: pointer; padding: 10px 14px; font-size: 14px; display: flex; gap: 10px; align-items: baseline; }
.land-code > summary b { font-family: var(--font-mono); font-size: 13px; }
.land-code > summary .muted { font-size: 12.5px; }
.land-code[open] > summary { border-bottom: 1px solid var(--line); }
.land-code .codebox pre { border: 0; border-radius: 0 0 var(--r-md) var(--r-md); }
/* меню слева: текущий раздел (вкладки «Лендинг» и «API») */
.api-toc a.on { color: var(--accent); background: var(--accent-soft); }
.api-toc .toc-group > a.on-parent { color: var(--accent); }
#land-preview > h3 .btn { font-weight: 600; }

/* саммари в списке героев «Материалов»: значок и текст при наведении */
.mat-pname { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.mat-sum-ic { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0;
  border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; }
.mat-sum-ic:hover, .mat-sum-ic:focus-visible { color: var(--accent); background: var(--accent-soft); }
.mat-sum-ic:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sum-pop { position: fixed; z-index: 75; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 16px; background: var(--surface); color: var(--text); border: 1px solid var(--line-2);
  border-radius: var(--r-md); box-shadow: 0 18px 44px rgba(0,0,0,.35); font-size: 13.5px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; }
.sum-pop[hidden] { display: none; }

/* ролики по ссылке на картинку: удалённые по сроку хранения (purged_at), источник в строке задачи */
.vtile.purged { cursor: default; }
.vtile.purged:hover { border-color: var(--line); transform: none; box-shadow: none; }
.vstub { aspect-ratio: 4/3; display: grid; place-items: center; padding: 16px; text-align: center;
  background: var(--surface-2); color: var(--faint); font-size: 13px; }
.viewer-media .vstub { width: 100%; aspect-ratio: auto; min-height: 260px; font-size: 14.5px; color: var(--muted); }
.jrow-head .origin { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--faint); }

/* окно «Настройки» (администратор): очистка медиафайлов */
.modal.settings-modal { width: min(640px, 96vw); }
.set-h { margin: 2px 0 4px; }
.set-lead { margin-bottom: 8px; line-height: 1.5; }
.set-num { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; font-weight: 600; }
.set-num input { width: 120px; }
.set-private { margin-top: 10px; }
.set-status { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin-top: 16px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13.5px; line-height: 1.5; }
.set-status > .muted { white-space: nowrap; }
.set-status .error { grid-column: 1 / -1; margin: 0; }
@media (max-width: 560px) { .set-status { grid-template-columns: 1fr; gap: 2px; } .set-status > .muted { margin-top: 6px; } }
