/* ══ Pipeline Studio Web — стиль, повторяющий десктоп-студию (PySide6) ══
   Палитра взята 1:1 из pipeline_studio.py (COL{}): тот же тёмный вид. */
:root {
  --bg:      #0f1117;
  --panel:   #171a23;
  --panel2:  #1d212d;
  --border:  #2a2f3d;
  --text:    #e6e9ef;
  --muted:   #8b93a7;
  --accent:  #6c8cff;
  --accent-d:#5878f0;
  --green:   #46d18b;
  --red:     #ff6b6b;
  --grey:    #5b6472;
  --radius:  14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, Roboto, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Каркас: сайдбар + контент ── */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "side top" "side main";
  min-height: 100vh;
}

/* Сайдбар */
.side {
  grid-area: side;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  padding: 6px 10px 18px;
  color: var(--text);
}
.logo span { color: var(--accent); }
.nav-btn {
  display: block;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-btn:hover { background: var(--panel2); color: var(--text); }
.nav-btn.active {
  background: var(--panel2);
  color: var(--text);
  border-left: 3px solid var(--accent);
}
.side-foot { margin-top: auto; }
.side-foot a { color: var(--grey); font-size: 12px; text-decoration: none; padding: 8px 14px; display: block; }
.side-foot a:hover { color: var(--muted); }

/* Топбар */
.top {
  grid-area: top;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 14px;
}
.top .ws {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.top .ws b { color: var(--text); }
.dot { color: var(--grey); font-size: 13px; }
.dot.ok { color: var(--green); }

/* Контент */
.main {
  grid-area: main;
  padding: 26px 28px;
  overflow-y: auto;
}
h1.page-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
p.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* Карточки */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card .name { font-weight: 700; font-size: 15px; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card .row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Кнопки — как QPushButton студии */
.btn {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  font-family: inherit;
}
.btn:hover { background: #242938; border-color: var(--accent); }
.btn:active { background: #2c3346; }
.btn.primary { background: var(--accent); border: none; color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn.danger:hover { background: rgba(255,107,107,.12); }

/* Очередь */
.queue { margin-top: 26px; }
.queue h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.qitem {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 8px;
}
.qitem .qname { font-weight: 600; flex: 1; }
.qitem .qstage { color: var(--muted); font-size: 12px; }
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .3px;
}
.badge.waiting { background: rgba(139,147,167,.15); color: var(--muted); }
.badge.running { background: rgba(70,209,139,.15); color: var(--green); }
.badge.done    { background: rgba(108,140,255,.15); color: var(--accent); }
.badge.error   { background: rgba(255,107,107,.15); color: var(--red); }
.badge.paused  { background: rgba(139,147,167,.15); color: var(--muted); }

.empty { color: var(--muted); padding: 30px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ── Логин ── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; background: var(--bg);
}
.login-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 32px; width: 340px;
}
.login-card .logo { padding: 0 0 22px; text-align: center; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.login-card input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px; color: var(--text);
  font-size: 14px; font-family: inherit; margin-bottom: 16px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card .btn { width: 100%; }
.login-err { color: var(--red); font-size: 13px; margin-bottom: 14px; text-align: center; }

/* ── Адаптив: на телефоне сайдбар сверху ── */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr;
         grid-template-areas: "side" "top" "main"; }
  .side { flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .logo { width: 100%; padding: 4px 8px 10px; }
  .nav-btn { flex: 1; text-align: center; padding: 9px; }
  .side-foot { margin: 0; }
}

/* ── Формы (страница Сценарий) ── */
.flabel { display:block; font-size:12px; color:var(--muted); margin:12px 0 6px; font-weight:600; }
.finput {
  width:100%; background:var(--bg); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 12px; color:var(--text);
  font-size:14px; font-family:inherit; resize:vertical;
}
.finput:focus { outline:none; border-color:var(--accent); }
.notice {
  padding:12px 16px; border-radius:var(--radius-sm); margin-bottom:18px;
  font-size:13px; font-weight:600;
}
.notice.ok  { background:rgba(70,209,139,.12); color:var(--green); border:1px solid rgba(70,209,139,.3); }
.notice.err { background:rgba(255,107,107,.12); color:var(--red); border:1px solid rgba(255,107,107,.3); }

/* ── Сегментные переключатели (страница Видео) ── */
.seg { display:flex; gap:6px; margin-top:6px; }
.segbtn {
  flex:1; background:var(--panel2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:9px 10px; color:var(--muted);
  font-weight:600; font-size:13px; cursor:pointer; font-family:inherit;
  transition:background .12s, color .12s, border-color .12s;
}
.segbtn:hover { background:#242938; color:var(--text); }
.segbtn.active { background:var(--accent); border-color:var(--accent); color:#fff; }
/* тумблеры бэкендов */
.btn.toggle { color:var(--muted); }
.btn.toggle.on { background:var(--accent); border:none; color:#fff; }

/* ── Логи ── */
.log-tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.log-tab {
  background:var(--panel2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:8px 14px; color:var(--muted);
  font-weight:600; font-size:13px; cursor:pointer; font-family:inherit;
  transition:background .12s,color .12s,border-color .12s;
}
.log-tab:hover { background:#242938; color:var(--text); }
.log-tab.active { background:var(--accent); border-color:var(--accent); color:#fff; }

.log-toolbar { display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.log-follow { margin-left:auto; color:var(--muted); font-size:13px; display:flex; align-items:center; gap:6px; cursor:pointer; }
.log-follow input { accent-color:var(--accent); }

.log-view {
  background:#0b0d12; border:1px solid var(--border); border-radius:var(--radius);
  padding:16px 18px; color:#cdd3e0; font-family:"Cascadia Code","Consolas","Courier New",monospace;
  font-size:12.5px; line-height:1.55; white-space:pre-wrap; word-break:break-word;
  height:calc(100vh - 280px); min-height:300px; overflow-y:auto; margin:0;
}


/* ── модалка (диалоги настроек и т.п.) — общая для всех страниц ── */
.modal-bg{ position:fixed; inset:0; background:rgba(0,0,0,.55); display:none;
           align-items:center; justify-content:center; z-index:60; }
.modal{ background:#15171f; border:1px solid #2a2d3a; border-radius:14px; padding:22px;
        width:min(470px,93vw); max-height:88vh; overflow:auto; }
.modal h3{ margin:0 0 16px; font-size:16px; }
.frow{ display:flex; flex-direction:column; gap:5px; margin-bottom:13px; }
.frow label{ color:#8b8f9c; font-size:12px; }
.fselect{ background:#0f1118; color:#e7e9ef; border:1px solid #2a2d3a; border-radius:8px;
          padding:8px 10px; font-size:13px; }
.fselect:focus{ outline:none; border-color:#4754ff; }
.chk{ display:flex; align-items:center; gap:8px; color:#c9ccd6; font-size:13px; cursor:pointer; }
.modal-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:8px; }
