:root {
  /* Manolka — Bold studio: near-black + электрический лайм */
  --bg: #0a0a0a;
  --bg2: #0e0e0e;
  --panel: #141414;
  --panel2: #1b1b1b;
  --border: #242424;
  --text: #f5f5f4;
  --muted: #8a8a86;
  --accent: #c6f24e;
  --accent-dim: #9bc23a;
  --green: #c6f24e;
  --red: #ff5c5c;
  --radius: 9px;
  font-size: 15px;
}

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

body {
  background:
    radial-gradient(1100px 520px at 88% -12%, rgba(198, 242, 78, .07), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, sans-serif;
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3, .stage-name, button.primary {
  font-family: "Oswald", "Inter", sans-serif;
  letter-spacing: .04em;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, .82);
  backdrop-filter: blur(8px);
}
.brand {
  font-family: "Inter", sans-serif;
  font-size: 23px; font-weight: 800; letter-spacing: -.02em; line-height: 1;
}
.brand em { color: var(--accent); font-style: normal; }
.brand .tag {
  font-size: 9.5px; color: var(--muted); display: block;
  letter-spacing: .32em; margin-top: 3px; font-weight: 500;
}
.topbar .spacer { flex: 1; }
.keydots { display: flex; gap: 10px; align-items: center; }
.keydot { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.keydot i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); display: inline-block;
}
.keydot.ok i { background: var(--green); }

/* ---------- layout ---------- */
.body { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 270px; min-width: 270px;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  display: flex; flex-direction: column;
  padding: 16px;
  gap: 12px;
}
.newvideo { display: flex; gap: 8px; }
.newvideo input {
  flex: 1; min-width: 0;
}
.newparams { display: flex; gap: 8px; margin-top: -4px; }
.newparams label {
  flex: 1; font-size: 10px; color: var(--muted);
  display: flex; flex-direction: column; gap: 3px;
  text-transform: uppercase; letter-spacing: .06em;
}
.newparams input { width: 100%; padding: 5px 8px; }
.partsep {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 6px; color: var(--accent);
  font-family: "Oswald", sans-serif; font-size: 13px;
  text-transform: uppercase; letter-spacing: .1em;
}
.partsep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.projlist { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.projcard {
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel);
  cursor: pointer; transition: border-color .15s;
}
.projcard:hover { border-color: var(--accent-dim); }
.projcard.active { border-color: var(--accent); background: var(--panel2); }
.projcard .t { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.projcard .s { font-size: 11px; color: var(--muted); display: flex; gap: 4px; flex-wrap: wrap; }
.minidot { width: 7px; height: 7px; border-radius: 2px; background: #333330; display: inline-block; }
.minidot.done { background: var(--green); }
.minidot.running { background: var(--accent); animation: pulse 1.2s infinite; }
.minidot.error { background: var(--red); }

.main { flex: 1; overflow-y: auto; padding: 22px 28px; }
.placeholder { color: var(--muted); text-align: center; margin-top: 18vh; }
.placeholder h2 { font-size: 26px; margin-bottom: 10px; color: var(--text); }

/* ---------- проект ---------- */
.projhead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.projhead h1 { font-size: 26px; text-transform: uppercase; }
.projhead .sub { color: var(--muted); font-size: 13px; }
.projhead .spacer { flex: 1; }

/* pipeline */
.pipeline { display: flex; gap: 10px; margin-bottom: 22px; }
.stage {
  flex: 1; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  position: relative; overflow: hidden;
}
.stage .stage-name {
  font-size: 13px; text-transform: uppercase; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}
.stage .num { color: var(--muted); font-size: 11px; }
.stage .detail {
  font-size: 11px; color: var(--muted); margin-top: 6px; min-height: 28px;
  line-height: 1.35;
}
.stage .err { color: var(--red); }
.stage .bar {
  height: 3px; background: #242424; border-radius: 2px; margin-top: 8px;
}
.stage .bar i {
  display: block; height: 100%; background: var(--accent);
  border-radius: 2px; transition: width .5s; width: 0;
}
.stage.done .bar i { background: var(--green); }
.stage button {
  margin-top: 9px; width: 100%;
}
.stage.running { border-color: var(--accent-dim); }
.stage.running::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(198,242,78,.06) 50%, transparent 70%);
  animation: sweep 1.6s infinite;
}
@keyframes sweep { from { transform: translateX(-100%);} to { transform: translateX(100%);} }
@keyframes pulse { 50% { opacity: .35; } }

/* tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs button {
  background: none; border: none; color: var(--muted);
  padding: 9px 16px; font-size: 14px; cursor: pointer;
  border-bottom: 2px solid transparent; font-family: "Oswald", sans-serif;
  letter-spacing: .05em; text-transform: uppercase;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* script */
.scriptmeta {
  display: flex; gap: 14px; align-items: center; margin-bottom: 14px; flex-wrap: wrap;
}
.scriptmeta .pill {
  background: var(--panel); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 30px; font-size: 12px; color: var(--muted);
}
.scriptmeta .pill b { color: var(--text); }
.scenerow {
  display: grid; grid-template-columns: 44px 90px 1.4fr 1fr .8fr;
  gap: 8px; padding: 8px 0; border-bottom: 1px solid #1c1c1a;
  align-items: start;
}
.scenerow .sid { color: var(--muted); font-size: 12px; padding-top: 8px; text-align: center; }
.scenerow textarea, .scenerow input, .scenerow select { width: 100%; }
.scenehead {
  display: grid; grid-template-columns: 44px 90px 1.4fr 1fr .8fr; gap: 8px;
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; padding-bottom: 6px;
}
.titlebox { margin-bottom: 12px; }
.titlebox input { width: 100%; font-size: 16px; font-weight: 600; }
.titlebox textarea { width: 100%; margin-top: 8px; }

/* images grid */
.imggrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.imgcard {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.imgcard img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.imgwrap { position: relative; }
.badge {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  font-size: 9px; font-weight: 600; letter-spacing: .08em;
  padding: 2px 7px; border-radius: 4px;
}
.badge.real { background: rgba(198,242,78,.92); color: #101401; }
.badge.ai { background: rgba(227,164,79,.9); color: #14100a; }
.badge.stock { background: rgba(79,195,227,.92); color: #05121a; }
.imgcard video { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }

.newref { margin-top: -4px; }
.newref summary {
  font-size: 11px; color: var(--muted); cursor: pointer;
  text-transform: uppercase; letter-spacing: .06em; padding: 2px 0;
}
.newref input { width: 100%; margin-top: 6px; }
.newparams select { width: 100%; padding: 5px 8px; }
.imgcard .cap {
  padding: 7px 10px; font-size: 11px; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.imgcard .cap .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imgcard.isclip { border-color: var(--accent-dim); }
video { width: 100%; border-radius: 10px; background: #000; }

/* result */
.result { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.costcard {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.costcard h3 { font-size: 14px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.costrow { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid #1c1c1a; }
.costrow b { color: var(--accent); }
.dl { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

/* controls */
input, textarea, select {
  background: #12151b; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-dim); }
textarea { resize: vertical; min-height: 54px; line-height: 1.4; }

button {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  transition: filter .12s, border-color .12s; font-family: inherit;
}
button:hover { border-color: var(--accent-dim); }
button:disabled { opacity: .45; cursor: default; }
button.primary {
  background: var(--accent);
  color: #101401; border: none; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
button.primary:hover { filter: brightness(1.08); }
button.small { padding: 4px 9px; font-size: 11px; }
button.ghost { background: none; }

/* modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(5, 7, 10, .7);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  width: 660px; max-width: 94vw; max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
}
.modal h2 { text-transform: uppercase; margin-bottom: 16px; font-size: 18px; }
.modal h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.formrow { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.formrow label { width: 170px; font-size: 13px; color: var(--muted); }
.formrow input, .formrow select { flex: 1; }
.voicelist { max-height: 220px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; }
.voicerow {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-bottom: 1px solid #1c1c1a; font-size: 13px; cursor: pointer;
}
.voicerow:hover { background: var(--panel2); }
.voicerow.sel { background: rgba(198,242,78,.1); }
.voicerow .meta { color: var(--muted); font-size: 11px; }
.voicerow audio { height: 26px; margin-left: auto; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.whoami {
  font-size: 11px; color: var(--muted); letter-spacing: .06em;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 20px;
}
#btn-logout { padding: 8px 11px; }

/* страница входа */
.loginbody { display: flex; align-items: center; justify-content: center; }
.loginwrap { width: 100%; max-width: 380px; padding: 20px; }
.loginbox {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 30px 28px 26px;
}
.loginbox .brand { font-size: 26px; }
.loginbox .brand .tag { letter-spacing: .28em; margin-top: 4px; }
.loginbox form { margin-top: 22px; display: flex; flex-direction: column; }
.lgl {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .1em; margin: 12px 0 5px;
}
.loginbox input { width: 100%; padding: 10px 12px; font-size: 14px; }
.loginbox button.primary { margin-top: 22px; padding: 11px; font-size: 13px; }
.lgerr { color: var(--red); font-size: 12px; margin-top: 12px; min-height: 16px; text-align: center; }

/* Test Videos */
.testform {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; max-width: 620px;
}
.testform .formrow label { width: 150px; }
.testform .hint {
  font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 10px;
}
.testform .hint b { color: var(--text); }
#tv-list { display: flex; flex-direction: column; gap: 8px; max-width: 620px; }
#tv-list .projcard .s { align-items: center; font-size: 11px; }

/* low-effort чекбокс в «Новый проект» */
.lowfx {
  display: flex; gap: 11px; align-items: flex-start;
  margin: 12px 0 4px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.lowfx:hover { border-color: var(--accent-dim); }
.lowfx:has(input:checked) { border-color: var(--accent); background: rgba(198,242,78,.06); }
.lowfx input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--accent); flex: none; cursor: pointer; }
.lowfx b { color: var(--text); font-size: 13px; }
.lowfx small { color: var(--muted); font-size: 11px; line-height: 1.4; }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 99;
  background: var(--panel2); border: 1px solid var(--accent-dim);
  padding: 12px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.toast.err { border-color: var(--red); }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: #242424; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
