/* Панель VideoCore: светлая тема по умолчанию, тёмная — по настройке системы. */
:root{
  --bg:#f4f5f7;--surface:#fff;--surface-2:#eef0f3;--surface-3:#e4e7ec;--line:#e2e5ea;
  --text:#0e1216;--text-2:#3d4751;--muted:#6b7682;--accent:#1d6bf3;--accent-soft:#e3edff;
  --primary:#0e1216;--primary-text:#fff;--danger:#c42b3c;--danger-soft:#fde8ea;
  --ok:#14804a;--ok-soft:#dcf5e7;--warn:#8a5a00;--warn-soft:#fff2d6;--info-soft:#bfe3f7;
  --shadow:0 1px 2px rgba(14,18,22,.06),0 4px 16px rgba(14,18,22,.05);
  color-scheme:light;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--text);background:var(--bg)
}
@media (prefers-color-scheme:dark){:root{
  --bg:#0b0e13;--surface:#151a21;--surface-2:#1d232c;--surface-3:#28303b;--line:#262d37;
  --text:#eef1f5;--text-2:#c3cad3;--muted:#8a95a3;--accent:#6ea0ff;--accent-soft:#1c2b48;
  --primary:#f2f4f7;--primary-text:#0e1216;--danger:#ff8796;--danger-soft:#3d1a20;
  --ok:#6ad7a0;--ok-soft:#153526;--warn:#ffcf7a;--warn-soft:#3a2a0b;--info-soft:#16384d;
  --shadow:none;color-scheme:dark}}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text)}
[hidden]{display:none!important}
svg{width:24px;height:24px;flex:none}
a{color:var(--accent);text-decoration:none}
code{font-size:.92em;background:var(--surface-2);padding:1px 5px;border-radius:5px}
h1,h2,h3{margin:0;letter-spacing:-.01em}
h2{font-size:24px;font-weight:650}h3{font-size:18px;font-weight:650;margin-bottom:8px}
p{color:var(--text-2);line-height:1.55;font-size:14px}
.sub{color:var(--muted);font-size:13px;font-weight:400}
.err{color:var(--danger);font-size:13px;margin:6px 0 0}
.note{color:var(--muted);font-size:14px}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.grow{flex:1}

/* Кнопки и поля */
button,.btn,.primary,.secondary{font:inherit;font-size:14px;font-weight:600;border:0;border-radius:10px;padding:10px 16px;cursor:pointer;
  display:inline-flex;align-items:center;gap:8px;justify-content:center;line-height:1.2}
.primary{background:var(--primary);color:var(--primary-text)}
.secondary{background:var(--surface-2);color:var(--text)}
.danger{background:var(--danger-soft);color:var(--danger)}
button:hover,.btn:hover,.primary:hover{filter:brightness(.96)}
button:disabled{opacity:.55;cursor:wait}
.wide{width:100%}
input,select{font:inherit;font-size:14px;color:var(--text);background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:10px 12px;width:100%}
input:focus,select:focus{outline:2px solid var(--accent);outline-offset:-1px}
label{display:block;font-size:13px;color:var(--text-2);margin:14px 0 6px}
.icon-btn{background:transparent;color:var(--text);padding:8px;border-radius:50%;position:relative}
.icon-btn.soft{background:var(--surface-2);border-radius:10px}
.icon-btn:hover{background:var(--surface-2)}
.dot{position:absolute;top:6px;right:6px;width:9px;height:9px;border-radius:50%;background:#03c1eb;border:2px solid var(--bg)}
.tag{font-size:12px;font-weight:600;background:var(--accent-soft);color:var(--accent);padding:5px 10px;border-radius:8px;white-space:nowrap}
.pill{display:inline-block;font-size:13px;background:#e3f6fb;color:#0a6e88;padding:4px 10px;border-radius:8px}
@media (prefers-color-scheme:dark){.pill{background:#103a47;color:#7fdcf3}}

/* Вход */
.login{min-height:100vh;display:grid;place-items:center;padding:16px}
.login-card{background:var(--surface);border-radius:20px;box-shadow:var(--shadow);padding:32px;width:min(440px,100%)}
.login-card h1{font-size:26px;margin:22px 0 4px}
.login-card input{margin:10px 0 12px}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:20px}
.logo{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--accent);color:#fff}
.logo svg{width:18px;height:18px}

/* Каркас: узкое меню из иконок + рабочая область */
.app{display:grid;grid-template-columns:72px 1fr;min-height:100vh}
.rail{position:sticky;top:0;z-index:25;height:100vh;display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 0;
  background:var(--surface);border-right:1px solid var(--line)}
.rail-logo{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:var(--accent);color:#fff;margin-bottom:14px}
.rail-logo svg{width:20px;height:20px}
.rail-btn{position:relative;display:grid;place-items:center;width:46px;height:46px;border-radius:12px;color:var(--text-2)}
.rail-btn:hover{background:var(--surface-2);color:var(--text)}
.rail-btn.active{background:var(--surface-3);color:var(--text)}
.rail-btn.active::before{content:"";position:absolute;left:-13px;top:11px;bottom:11px;width:3px;border-radius:3px;background:var(--accent)}
.rail-btn::after{content:attr(data-tip);position:absolute;left:56px;top:50%;transform:translateY(-50%);background:var(--primary);color:var(--primary-text);
  font-size:13px;font-weight:600;padding:6px 10px;border-radius:8px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .12s;z-index:20}
.rail-btn:hover::after,.rail-btn:focus-visible::after{opacity:1}
.rail-sep{width:28px;height:1px;background:var(--line);margin:8px 0}
.rail-grow{flex:1}
.main{min-width:0;padding:16px 32px 48px}

/* Верхняя панель */
.topbar{display:flex;align-items:center;gap:12px;margin-bottom:18px}
.search{display:flex;align-items:center;gap:8px;background:var(--surface);border-radius:12px;padding:0 14px;flex:0 1 460px;min-width:0;color:var(--muted)}
.search input{border:0;background:transparent;padding:12px 0;outline:none}
.search svg{width:20px;height:20px}
.project-switch{flex:none;display:flex;align-items:center;gap:6px;margin:0;background:var(--surface);border-radius:12px;padding:0 4px 0 12px;color:var(--muted)}
.project-switch svg{width:18px;height:18px}
.project-switch select{border:0;background:transparent;font-weight:600;max-width:240px;padding:11px 8px}
.btn-create{padding:11px 18px;border-radius:12px}
.btn-create svg{width:20px;height:20px}
.avatar{width:40px;height:40px;border-radius:50%;background:#f26b1d;color:#fff;padding:0;font-size:16px}
.pop{position:relative}
.menu{position:absolute;top:calc(100% + 8px);background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);
  padding:6px;min-width:200px;z-index:30}
.menu-right{right:0}
.wide-menu{width:340px}
.menu button,.menu a{display:flex;width:100%;justify-content:flex-start;background:transparent;color:var(--text);font-weight:500;padding:9px 10px;border-radius:8px}
.menu button:hover,.menu a:hover{background:var(--surface-2)}
.menu .danger-item{color:var(--danger)}
.menu-head{padding:8px 10px 10px;font-weight:600;border-bottom:1px solid var(--line);margin-bottom:4px}
.menu-empty{padding:12px 10px;color:var(--muted);font-size:14px}
.notif{display:block;padding:8px 10px;border-radius:8px;font-size:14px;color:var(--text)}
.notif:hover{background:var(--surface-2)}

.banner{display:flex;gap:12px;align-items:flex-start;background:var(--info-soft);border-radius:14px;padding:14px 18px;margin-bottom:22px;font-size:14px;line-height:1.5}
.banner svg{color:#1d6bf3;width:22px;height:22px;margin-top:1px}
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:var(--primary);color:var(--primary-text);padding:10px 16px;border-radius:10px;margin:0;z-index:50;font-size:14px}

/* Разделы */
.view{display:none}.view.active{display:block}
.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:6px 0 16px}
.arrows{display:flex;gap:8px}
.panel{background:var(--surface);border-radius:16px;padding:24px;box-shadow:var(--shadow);margin-bottom:18px}
.panel-title{display:inline-flex;align-items:center;gap:4px;font-size:22px;font-weight:650;color:var(--text)}
.panel-title svg{width:20px;height:20px}
.muted-panel{background:var(--surface-2);box-shadow:none}
.two{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:start}

/* Главная */
.quick{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px;margin-bottom:28px}
.quick-card{min-width:0;display:flex;align-items:center;gap:14px;background:var(--surface);border-radius:14px;padding:18px;color:var(--text);box-shadow:var(--shadow)}
.quick-card:hover{background:var(--surface-2)}
.quick-card b{display:block;font-size:17px;font-weight:600}
.quick-card b,.quick-card small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.quick-card>span:last-child{min-width:0}
.quick-card small{color:var(--muted);font-size:14px}
.qi{display:grid;place-items:center;width:44px;height:44px;border-radius:10px;background:var(--surface-2);flex:none}
.strip{display:grid;grid-auto-flow:column;grid-auto-columns:calc((100% - 60px) / 4);gap:20px;overflow-x:auto;scroll-snap-type:x mandatory;padding-bottom:8px;margin-bottom:24px;scrollbar-width:none}
.strip>*{scroll-snap-align:start}
.home-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:18px}
.next h3{font-size:30px;margin:18px 0 10px}
.next p{font-size:17px;max-width:460px}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;margin:14px 0}
.stat b{display:block;font-size:28px;font-weight:600}
.stat span{color:var(--muted);font-size:14px}
.stats.big .stat{background:var(--surface);border-radius:14px;padding:18px;box-shadow:var(--shadow)}
.bars{display:grid;gap:10px;margin-top:8px}
.bar{display:grid;grid-template-columns:110px 1fr 40px;gap:10px;align-items:center;font-size:14px}
.bar-track{height:10px;border-radius:6px;background:var(--surface-2);overflow:hidden}
.bar-fill{height:100%;border-radius:6px;background:var(--accent)}
.bar-fill.ready{background:#21b26a}.bar-fill.failed{background:#e5484d}.bar-fill.queued,.bar-fill.processing,.bar-fill.reprocessing{background:#03c1eb}
.bar b{text-align:right;font-weight:600}

/* Карточки видео */
.grid-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:24px 20px}
.vcard{min-width:0}
.thumb{position:relative;display:block;aspect-ratio:16/9;border-radius:12px;overflow:hidden;background:linear-gradient(135deg,#2a3340,#151a21);color:#fff}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb .ph{position:absolute;inset:0;display:grid;place-items:center;color:rgba(255,255,255,.7)}
.thumb .ph svg{width:36px;height:36px}
.badge{position:absolute;bottom:10px;background:rgba(14,18,22,.72);color:#fff;font-size:13px;font-weight:600;padding:3px 8px;border-radius:7px;display:flex;align-items:center;gap:4px}
.badge.right{right:10px}.badge.left{left:10px}
.badge svg{width:15px;height:15px}
.vmeta{display:flex;gap:10px;margin-top:10px;align-items:flex-start}
.vmeta .vtext{flex:1;min-width:0}
.vtitle{font-weight:600;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.vsub{color:var(--muted);font-size:14px;margin-top:2px}
.status{display:inline-block;font-size:12px;font-weight:600;padding:2px 8px;border-radius:6px;background:var(--surface-2);color:var(--text-2)}
.status.ready{background:var(--ok-soft);color:var(--ok)}
.status.failed{background:var(--danger-soft);color:var(--danger)}
.status.queued,.status.processing,.status.reprocessing{background:var(--accent-soft);color:var(--accent)}
.vmeta .pop .menu{top:34px}
.more-btn{background:transparent;padding:6px;border-radius:8px;color:var(--text-2)}
.more-btn svg{width:6px;height:20px}
.more-btn:hover{background:var(--surface-2)}
.empty{grid-column:1/-1;background:var(--surface);border-radius:16px;padding:40px;text-align:center;color:var(--muted)}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{background:var(--surface);color:var(--text-2);font-weight:500;padding:8px 14px;border-radius:10px}
.chip.active{background:var(--primary);color:var(--primary-text)}
#more{margin-top:20px}

/* Проекты */
.list{display:grid;gap:12px}
.proj{display:flex;align-items:center;gap:14px;background:var(--surface);border-radius:14px;padding:16px 18px;box-shadow:var(--shadow)}
.proj.current{outline:2px solid var(--accent)}
.proj .qi{background:var(--accent-soft);color:var(--accent)}
.proj .grow b{display:block}
pre,.code{white-space:pre-wrap;word-break:break-all;font-size:13px;background:var(--surface-2);border-radius:10px;padding:12px;margin:12px 0}

/* Загрузка */
.upload-panel{max-width:820px}
.drop{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;border:2px dashed var(--line);border-radius:14px;padding:40px 20px;margin:0;cursor:pointer;color:var(--text)}
.drop.over,.drop:hover{border-color:var(--accent);background:var(--accent-soft)}
.drop input{position:absolute;width:1px;height:1px;opacity:0}
.drop-icon{display:grid;place-items:center;width:56px;height:56px;border-radius:14px;background:var(--surface-2)}
.drop b{font-size:17px}.drop small{color:var(--muted);font-size:14px}
.upload-fields{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px}
progress{width:100%;margin:0 0 14px;accent-color:var(--accent)}

@media (max-width:1200px){.strip{grid-auto-columns:calc((100% - 40px) / 3)}}
/* Узко: быстрые действия — прокручиваемая строка вместо сетки с «сиротами». */
@media (max-width:1000px){.quick{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:200px;overflow-x:auto;scrollbar-width:none}}
@media (max-width:900px){
  .two,.home-grid,.upload-fields{grid-template-columns:1fr}
  .strip{grid-auto-columns:calc((100% - 20px) / 2)}
  .tag{display:none}
}
/* Телефон: меню из иконок уезжает вниз экрана */
@media (max-width:700px){
  .app{grid-template-columns:1fr}
  .rail{position:fixed;top:auto;bottom:0;left:0;right:0;height:62px;flex-direction:row;justify-content:space-around;padding:0 6px;border-right:0;border-top:1px solid var(--line);z-index:40}
  .rail-logo,.rail-sep,.rail-grow,.rail-btn[href="/docs"],.rail-btn[data-nav="system"]{display:none}
  .rail-btn{width:44px;height:44px}
  .rail-btn::after{display:none}
  .rail-btn.active::before{left:12px;right:12px;top:auto;bottom:-8px;width:auto;height:3px}
  .main{padding:12px 16px 84px}
  .topbar{flex-wrap:wrap}
  .search{flex:1 1 100%;order:5}
  .project-switch{flex:1}.project-switch select{max-width:none;width:100%}
  .btn-create span{display:none}.btn-create{padding:10px}
  .wide-menu{width:min(340px,calc(100vw - 32px))}
  .quick{gap:10px;grid-auto-columns:150px}
  .strip{grid-auto-columns:80%}
  .quick-card{padding:12px;gap:10px}.quick-card small{display:none}.quick-card b{font-size:15px}
  .qi{width:36px;height:36px}
  .topbar .grow{display:none}
  .project-switch{min-width:0}
  .next h3{font-size:24px}
}
form.panel>button{margin-top:16px}
.modal-back{position:fixed;inset:0;background:rgba(14,18,22,.45);display:grid;place-items:center;padding:16px;z-index:60}
.modal{background:var(--surface);border-radius:16px;padding:24px;width:min(440px,100%);box-shadow:var(--shadow)}
.modal input{margin-top:8px}
.modal-actions{justify-content:flex-end;margin-top:18px}
.vtext .err{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* Пункты выпадающих списков: явные цвета темы, иначе в тёмной теме браузер рисует светлый текст на белом. */
select option,select optgroup{background-color:var(--surface);color:var(--text)}
select{color-scheme:inherit}
