/* Tiktok Pro — локальная студия. Тёмная тема, акцент #E4402B. */

:root {
  --bg: #0b0d10;
  --bg-soft: #0f1216;
  --panel: #13171d;
  --panel-2: #171c23;
  --panel-3: #1c222b;
  --line: #242b35;
  --line-2: #1b212a;
  --text: #e8ebf0;
  --text-2: #b6bec9;
  --muted: #828c9b;
  --dim: #5c6472;
  --accent: #E4402B;
  --accent-hi: #ff5a41;
  --accent-soft: rgba(228, 64, 43, .16);
  --ok: #3ec98a;
  --warn: #e6b03e;
  --err: #f0564b;
  --info: #5aa2ff;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 236px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .42);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html { background-color: var(--bg); }

body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 88% -8%, rgba(228, 64, 43, .10), transparent 62%),
    radial-gradient(900px 520px at -6% 108%, rgba(90, 162, 255, .05), transparent 60%);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(228, 64, 43, .32); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262e39; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #34404e; background-clip: content-box; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .1px; }
p { margin: 0; }
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
button { font: inherit; }

.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ok-text { color: var(--ok); }
.err-text { color: var(--err); }
.hint { color: var(--dim); font-size: 12px; }
.spacer { flex: 1; }

/* ---------- каркас ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(19, 23, 29, .96), rgba(11, 13, 16, .96));
  backdrop-filter: blur(8px);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px; }

.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent-hi), #b82a19);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 6px 18px rgba(228, 64, 43, .34), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: .2px; }
.brand-text b span { color: var(--accent-hi); }
.brand-text small { color: var(--dim); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .035); color: var(--text); }
.nav-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(228, 64, 43, .34);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item.is-active svg { color: var(--accent-hi); opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px 2px;
  border-top: 1px solid var(--line-2);
}

.status-line { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--dim); min-width: 0; }
.status-line span { flex: none; }
.status-line b { margin-left: auto; color: var(--text-2); font-weight: 500; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 118px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(62, 201, 138, .55); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px rgba(230, 176, 62, .35); }
.dot.off { background: #3a424e; }
.foot-ver { color: #444c58; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; padding-top: 4px; }

.main { min-width: 0; padding: 22px 28px 70px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.topbar-title { min-width: 0; }
.topbar h1 { font-size: 21px; line-height: 1.25; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; }
.topbar p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(62, 201, 138, .5); }
.sync.idle { background: #384150; box-shadow: none; }
.sync.live { animation: pulse 2.2s infinite; }
.sync.down { background: var(--err); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(62, 201, 138, .45); } 70% { box-shadow: 0 0 0 7px rgba(62, 201, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 201, 138, 0); } }

.screen-wrap { max-width: 1360px; }
.screen { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }

/* ---------- карточки ---------- */

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
  min-width: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 10px 26px rgba(0, 0, 0, .16);
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head.mt { margin-top: 18px; }
.card-head h2 { font-size: 15px; letter-spacing: .2px; }
.card-head h3 { font-size: 13px; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; }
.card-head .hint { margin-left: auto; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 7px; margin-left: 6px;
  border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line);
  color: var(--text-2); font-size: 11.5px; font-weight: 600; vertical-align: 1px;
}

/* ---------- формы ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.fields + .fields, .field + .fields, .fields + .field { margin-top: 12px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.label { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.label b { color: var(--text); font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 12.5px; }

.input {
  width: 100%;
  padding: 9px 11px;
  background: #0d1116;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: #4d5765; }
.input:hover { border-color: #2e3742; }
.input:focus { outline: none; border-color: rgba(228, 64, 43, .75); box-shadow: 0 0 0 3px rgba(228, 64, 43, .14); background: #0f141a; }
.textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.input.xs { width: 68px; padding: 4px 7px; font-size: 12.5px; }

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.6 6 6.4 11 1.6' fill='none' stroke='%23828c9b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
select.input option { background: var(--panel-2); color: var(--text); }

.input-group { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.input-group .input { flex: 1 1 auto; min-width: 0; }
.input-group .btn { flex: none; }

input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; flex: none; }

.check { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text-2); padding: 3px 0; }
.check:hover { color: var(--text); }
.check.sm { font-size: 12px; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; margin: 2px 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, #7c4dff, #a855f7 55%, rgba(255,255,255,.10) 55%, rgba(255,255,255,.10)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px; background: #2b323d; }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 99px; background: #a855f7; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid #14181e; }

input[type="color"] {
  width: 42px; height: 36px; flex: none; padding: 3px;
  background: #0d1116; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }

.range-marks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); padding: 0 1px; margin-top: -2px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row .input[type="range"] { flex: 1; }
.range-out { font-family: var(--mono); font-size: 12px; color: var(--text-2); min-width: 44px; text-align: right; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #20262f, #1a1f27);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .06s, color .15s;
}
.btn:hover { background: #232a34; border-color: #303945; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid rgba(228, 64, 43, .6); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(180deg, #ef4a33, #d93724);
  border-color: #f05a44;
  color: #fff;
  box-shadow: 0 6px 18px rgba(228, 64, 43, .22), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn.primary:hover { background: linear-gradient(180deg, #ff5a41, #e4402b); border-color: #ff7a64; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .045); color: var(--text); border-color: var(--line); }
.btn.danger { background: linear-gradient(180deg, #f0564b, #d43d32); border-color: #f4685e; color: #fff; }
.btn.danger-ghost { background: transparent; border-color: rgba(240, 86, 75, .3); color: #f0837a; }
.btn.danger-ghost:hover { background: rgba(240, 86, 75, .1); border-color: rgba(240, 86, 75, .5); color: #ff9b92; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { padding: 3px 8px; font-size: 11.5px; border-radius: 7px; }

.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 14px; }
.actions.end { justify-content: flex-end; }

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.iconbtn:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.iconbtn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: block; }
.iconbtn.danger:hover { background: rgba(240, 86, 75, .12); border-color: rgba(240, 86, 75, .4); color: #ff9b92; }

/* ---------- чипы и статусы ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.chip.ghost { background: transparent; color: var(--muted); border-color: var(--line-2); }
.chip.ok, .chip[data-status="ready"], .chip[data-status="published"], .chip[data-status="approved"] {
  color: #7ee2b0; border-color: rgba(62, 201, 138, .35); background: rgba(62, 201, 138, .1);
}
.chip.warn, .chip[data-status="rendering"] {
  color: #f0c86a; border-color: rgba(230, 176, 62, .34); background: rgba(230, 176, 62, .1);
}
.chip[data-status="error"] { color: #ff9b92; border-color: rgba(240, 86, 75, .38); background: rgba(240, 86, 75, .1); }
.chip[data-status="pending"], .chip[data-status="draft"] { color: var(--muted); }

/* ---------- студия ---------- */

.ideas { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.ideas-list { display: flex; flex-direction: column; gap: 8px; }
.idea {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #10151b;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
}
.idea:hover { border-color: rgba(228, 64, 43, .5); background: rgba(228, 64, 43, .07); transform: translateX(2px); }
.idea b { color: var(--text); font-size: 13.5px; }
.idea .idea-log { font-size: 12.5px; color: var(--muted); }
.idea .idea-hook { font-size: 12px; color: var(--accent-hi); opacity: .9; }

.jobs { display: flex; flex-direction: column; gap: 9px; max-height: 330px; overflow: auto; padding-right: 2px; }
.job {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-sm);
  background: #10151b;
  padding: 9px 11px;
}
.job[data-status="running"] { border-left-color: var(--accent); }
.job[data-status="done"] { border-left-color: var(--ok); }
.job[data-status="error"] { border-left-color: var(--err); }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-kind { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.job-status { font-size: 11.5px; color: var(--muted); }
.job[data-status="running"] .job-status { color: var(--warn); }
.job[data-status="done"] .job-status { color: var(--ok); }
.job[data-status="error"] .job-status { color: var(--err); }
.job-msg { font-size: 13px; color: var(--text); margin-top: 3px; word-break: break-word; }
.job-meta { font-size: 11px; color: var(--dim); margin-top: 4px; }
.job .bar { margin-top: 7px; }

.bar { height: 5px; border-radius: 99px; background: #0a0d11; overflow: hidden; border: 1px solid rgba(255, 255, 255, .03); }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #c93521, var(--accent-hi)); transition: width .4s ease; }
.job[data-status="done"] .bar > i { background: linear-gradient(90deg, #2ba873, #58e3a6); }
.job[data-status="error"] .bar > i { background: linear-gradient(90deg, #c43a30, #f0564b); }

.log {
  height: 214px;
  overflow: auto;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #0a0d11;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
}
.log-line { display: flex; gap: 9px; color: #9aa4b2; }
.log-line .log-t { color: #4f5967; flex: none; }
.log-line.err .log-x { color: #ff9b92; }
.log-line.ok .log-x { color: #7ee2b0; }
.log-line .log-x { word-break: break-word; min-width: 0; }

.empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .012); }
.empty.sm { padding: 12px; font-size: 12.5px; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 4px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(228, 64, 43, .25);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- проекты ---------- */

.projects { display: flex; flex-direction: column; gap: 8px; }
.proj-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #10151b;
  transition: border-color .15s, background .15s;
}
.proj-row:hover { border-color: #303945; background: #12181f; }
.proj-main { min-width: 0; flex: 1; }
.proj-title { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-meta { font-size: 11px; color: var(--dim); margin-top: 4px; }
.proj-side { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- экран проекта ---------- */

.proj-head { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.proj-head-main { min-width: 0; flex: 1 1 420px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.proj-h { font-size: 22px; line-height: 1.25; letter-spacing: .2px; }
.proj-l { color: var(--text-2); font-size: 13.5px; margin-top: 7px; max-width: 72ch; }
.proj-head-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
.review-note { margin-top: 10px; font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 10px; }

.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.part-card { display: flex; flex-direction: column; gap: 10px; }
.part-top { display: flex; align-items: flex-start; gap: 10px; }
.part-num {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid rgba(228, 64, 43, .35);
  color: var(--accent-hi);
  font-weight: 700;
  font-size: 13px;
}
.part-name { min-width: 0; flex: 1; }
.part-name b { display: block; font-size: 13.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-name small { color: var(--muted); font-size: 11.5px; }
.part-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.part-media { border-radius: var(--radius-sm); overflow: hidden; background: #000; border: 1px solid var(--line); }
.part-video { display: block; width: 100%; height: 286px; background: #000; object-fit: contain; }
.part-placeholder {
  height: 128px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--dim); font-size: 12px; background: rgba(255, 255, 255, .012);
}
.part-placeholder svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .7; }
.part-error { font-size: 12px; color: #ff9b92; background: rgba(240, 86, 75, .08); border: 1px solid rgba(240, 86, 75, .25); border-radius: 8px; padding: 7px 9px; word-break: break-word; }
.part-actions { display: flex; gap: 8px; margin-top: auto; }
.part-actions .btn { flex: 1; }
.part-link { font-size: 12px; color: var(--ok); }

.running-strip { display: flex; flex-direction: column; gap: 8px; }
.running-line { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #10151b; font-size: 12.5px; }
.running-line .bar { flex: 1; min-width: 60px; }
.running-line .running-kind { color: var(--accent-hi); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .08em; flex: none; }
.running-line .running-msg { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.running-line .running-pct { font-family: var(--mono); color: var(--muted); font-size: 11.5px; flex: none; }

/* ---------- редактор ---------- */

.editor-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dirty { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dirty::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3a424e; }
.dirty.on { color: var(--warn); }
.dirty.on::before { background: var(--warn); box-shadow: 0 0 7px rgba(230, 176, 62, .55); }

.editor-parts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.epart { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #10151b; overflow: hidden; }
.epart[open] { border-color: #2c3541; }
.epart-head {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.epart-head::-webkit-details-marker { display: none; }
.epart-head::after { content: "▾"; color: var(--dim); margin-left: 2px; transition: transform .18s; font-size: 11px; }
.epart:not([open]) .epart-head::after { transform: rotate(-90deg); }
.epart-head:hover { background: rgba(255, 255, 255, .025); }
.epart-num { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 7px; background: var(--panel-3); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--text-2); }
.epart-title { font-weight: 600; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epart-meta { margin-left: auto; color: var(--dim); font-size: 11.5px; flex: none; }
.epart-body { padding: 4px 13px 14px; border-top: 1px solid var(--line-2); }

.scenes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 11px; margin-top: 13px; }
.scene { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #0d1116; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.scene-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scene-n { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
.scene-tools { display: flex; align-items: center; gap: 6px; }
.mini { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--dim); }
.scene .label { font-size: 10.5px; }
.scene .input { font-size: 13px; }
.subblock { border-top: 1px dashed var(--line); padding-top: 10px; }
.sub-title { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-hi); opacity: .85; font-weight: 600; margin-bottom: 8px; }
.scene-extra { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- настройки ---------- */

.savebar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 28, 35, .92);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .3);
}
.savebar-text b { font-size: 14px; }
.savebar-text .muted { font-size: 12px; }
.savebar .actions { margin: 0; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.settings-grid .card { height: 100%; }

.inline-result { font-size: 12.5px; color: var(--muted); min-height: 18px; }
.inline-result b { color: var(--text); }

.tiktok-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12.5px; }

.kv { display: flex; align-items: baseline; gap: 10px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed var(--line-2); min-width: 0; }
.kv:last-of-type { border-bottom: none; }
.kv > span { color: var(--dim); flex: none; min-width: 72px; text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em; }
.kv > b { color: var(--text-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- реклама ---------- */

.adblock { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #10151b; padding: 13px 14px; }
.adblock + .adblock { margin-top: 10px; }
.adblock-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.adblock-n { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; }
.ad-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #0b0e12;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  overflow: hidden;
  position: relative;
}
.ad-preview::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--ad-accent, #E4402B) 0%, transparent 62%); opacity: .22; pointer-events: none; }
.ad-preview-brand { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #fff; opacity: .9; font-weight: 700; flex: none; z-index: 1; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.ad-preview-main { z-index: 1; min-width: 0; }
.ad-preview-main b { display: block; font-size: 14px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-preview-main span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-preview-tags { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; z-index: 1; }

/* ---------- тосты и модалка ---------- */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 9px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  background: #151b22;
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in .22s ease-out;
  word-break: break-word;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.info { border-left-color: var(--info); }
.toast .toast-x { margin-left: auto; background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 6px; }
.toast .toast-x:hover { color: var(--text); }
.toast.hide { animation: toast-out .22s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

.modal { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 7, 10, .72); backdrop-filter: blur(3px); animation: toast-in .16s ease-out; }
.modal-box { width: min(440px, 100%); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.modal-box h3 { font-size: 16px; }
.modal-box p { margin-top: 8px; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

/* ---------- роли моделей ---------- */

.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }

.role-list { display: flex; flex-direction: column; }
.role-row { display: flex; flex-direction: column; gap: 6px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.role-row:first-child { padding-top: 0; }
.role-row:last-child { border-bottom: none; padding-bottom: 0; }
.role-input { display: flex; gap: 8px; align-items: stretch; }
.role-input .input { flex: 1 1 auto; min-width: 0; font-size: 12.5px; }
.role-input .btn { flex: none; }

/* ---------- модалка выбора модели ---------- */

.model-box { width: min(600px, 100%); display: flex; flex-direction: column; max-height: min(84vh, 720px); }
.model-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.model-head h3 { font-size: 15.5px; line-height: 1.35; padding-right: 6px; }
.model-list {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 120px;
  flex: 1 1 auto;
}
.model-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: background .13s, border-color .13s, color .13s;
}
.model-row:hover { background: rgba(255, 255, 255, .04); border-color: var(--line); color: var(--text); }
.model-row.is-current { border-color: rgba(228, 64, 43, .45); background: var(--accent-soft); color: #fff; }
.model-id { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-row.is-current .model-id { color: #fff; }
.model-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-ctx { margin-left: auto; flex: none; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.model-manual { margin-top: 12px; }
.model-foot { margin-top: 8px; display: flex; justify-content: flex-end; }

/* ---------- адаптив ---------- */

@media (max-width: 1180px) {
  :root { --sidebar: 208px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 20px 20px 60px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line-2);
    background: rgba(12, 15, 19, .94);
  }
  .brand { padding: 0; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
  .brand-text small { display: none; }
  .nav { flex-direction: row; gap: 4px; overflow-x: auto; min-width: 0; flex: 1; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; padding: 8px 11px; font-size: 12.5px; white-space: nowrap; }
  .nav-item.is-active { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-foot { display: none; }
  .main { padding: 16px 14px 56px; }
  .topbar { margin-bottom: 15px; gap: 10px; }
  .topbar h1 { font-size: 18px; }
  .topbar p { font-size: 12px; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .fields.two { grid-template-columns: minmax(0, 1fr); }
  .screen { gap: 12px; }
  .card { padding: 14px; border-radius: 12px; }
  .grid-2 { gap: 12px; }
  .parts { grid-template-columns: minmax(0, 1fr); }
  .part-video { height: 320px; }
  .scenes { grid-template-columns: minmax(0, 1fr); }
  .savebar { padding: 10px 12px; }
  .savebar .actions { width: 100%; }
  .savebar .actions .btn { flex: 1; }
  .topbar { flex-wrap: wrap; }
  .actions .btn { flex: 1 1 auto; }
  .proj-row { flex-wrap: wrap; gap: 9px; }
  .proj-side { width: 100%; justify-content: flex-end; }
  .proj-head-actions { width: 100%; }
  .proj-head-actions .btn { flex: 1 1 auto; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ============================================================================
   Redesign v2 — глубокая синева + фиолетовый градиент, «стеклянные» карточки
   ========================================================================== */

:root {
  --bg: #070714;
  --bg-soft: #0a0a1c;
  --panel: rgba(19, 19, 40, .72);
  --panel-2: rgba(26, 26, 54, .78);
  --panel-3: rgba(34, 34, 68, .9);
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .045);
  --text: #eeeef8;
  --text-2: #c3c3dd;
  --muted: #8b8ba9;
  --dim: #63637f;
  --accent: #7c4dff;
  --accent-hi: #a78bfa;
  --accent-soft: rgba(124, 77, 255, .18);
  --ok: #38d39f;
  --warn: #f0b64a;
  --err: #ff5d73;
  --info: #6cb8ff;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(4, 4, 18, .55);
  --grad: linear-gradient(135deg, #7c4dff 0%, #a855f7 55%, #d946ef 100%);
  --grad-soft: linear-gradient(135deg, rgba(124,77,255,.28), rgba(217,70,239,.16));
}

html { background-color: #070714; }

body {
  background-color: #070714;
  background-image:
    radial-gradient(900px 620px at 88% -6%, rgba(124, 77, 255, .28), transparent 60%),
    radial-gradient(760px 560px at 4% 4%, rgba(56, 78, 255, .16), transparent 62%),
    radial-gradient(900px 700px at 50% 118%, rgba(168, 85, 247, .18), transparent 62%);
  background-attachment: fixed;
}

/* боковая панель */
.sidebar {
  background: linear-gradient(180deg, rgba(12, 12, 30, .92), rgba(9, 9, 22, .82));
  border-right: 1px solid rgba(255, 255, 255, .06);
  backdrop-filter: blur(14px);
}

.brand-mark {
  border-radius: 16px;
  background: var(--grad);
  box-shadow: 0 10px 26px rgba(124, 77, 255, .45);
}

.brand-text b { font-size: 17px; letter-spacing: .2px; }
.brand-text small { color: var(--muted); }

.nav { gap: 6px; }

.nav-item {
  border-radius: 16px;
  padding: 11px 14px;
  color: var(--text-2);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, .045); color: #fff; }

.nav-item.is-active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 14px 30px rgba(124, 77, 255, .38), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.nav-item.is-active svg { color: #fff; opacity: 1; }

/* карточки */
.card, .panel, .proj-card, .job, .idea, .part-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card-head h2, .card-head h3 { font-size: 18px; letter-spacing: .1px; }

/* кнопки */
.btn {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  padding: 10px 16px;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { background: rgba(255, 255, 255, .09); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--grad);
  border: 0;
  color: #fff;
  box-shadow: 0 14px 30px rgba(124, 77, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn.primary:hover { box-shadow: 0 18px 38px rgba(124, 77, 255, .55); }

.btn.danger { background: rgba(255, 93, 115, .12); border-color: rgba(255, 93, 115, .35); color: #ff8b9c; }
.btn.danger-ghost { border-color: rgba(255, 93, 115, .35); color: #ff8b9c; background: transparent; }

.iconbtn { border-radius: 14px; }

/* поля */
.input, .textarea, select.input {
  background: rgba(10, 10, 26, .82);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px;
  color: var(--text);
  padding: 11px 14px;
}
.input:focus, .textarea:focus, select.input:focus {
  border-color: rgba(167, 139, 250, .7);
  box-shadow: 0 0 0 4px rgba(124, 77, 255, .18);
  outline: none;
}

/* прогресс и бейджи */
.bar { background: rgba(255, 255, 255, .06); border-radius: 99px; height: 8px; }
.bar > i { background: var(--grad); box-shadow: 0 0 14px rgba(168, 85, 247, .7); }

.badge { border-radius: 999px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); }
.chip { border-radius: 999px; background: rgba(124, 77, 255, .14); border: 1px solid rgba(167, 139, 250, .28); color: #d8ccff; }

/* верхняя панель */
.topbar { border-bottom: 1px solid rgba(255, 255, 255, .06); }
.topbar h1 { font-size: 26px; letter-spacing: -.2px; }
.topbar p { color: var(--muted); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 24px rgba(124, 77, 255, .45);
  cursor: pointer; user-select: none;
}
.iconbtn-bell {
  width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08);
  color: var(--text-2);
}

/* модалка и тосты */
.modal-box { border-radius: 24px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(16, 16, 36, .96); backdrop-filter: blur(18px); }
.toast { border-radius: 16px; background: rgba(20, 20, 44, .96); border: 1px solid rgba(255, 255, 255, .1); }

/* тема light */
[data-theme="light"] {
  --bg: #f4f4fb;
  --panel: rgba(255, 255, 255, .86);
  --panel-2: #ffffff;
  --panel-3: #f0f0fa;
  --line: rgba(18, 18, 40, .1);
  --line-2: rgba(18, 18, 40, .06);
  --text: #14142c;
  --text-2: #3d3d5c;
  --muted: #6b6b8a;
  --dim: #8f8fa8;
  --shadow: 0 18px 40px rgba(30, 20, 80, .12);
}
[data-theme="light"] body {
  background-color: #f4f4fb;
  background-image:
    radial-gradient(900px 620px at 88% -6%, rgba(124, 77, 255, .16), transparent 60%),
    radial-gradient(760px 560px at 4% 4%, rgba(56, 78, 255, .10), transparent 62%);
}
[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(244,244,251,.86)); }
[data-theme="light"] .input, [data-theme="light"] .textarea, [data-theme="light"] select.input { background: #fff; }

/* мелкие правки под редизайн */
.sidebar { padding-top: 18px; }
.brand { padding: 6px 8px 18px; }
.nav-item svg { width: 19px; height: 19px; }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 99px !important; background: rgba(255,255,255,.09) !important; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: var(--grad); border: 2px solid #14142c; box-shadow: 0 0 0 4px rgba(124,77,255,.22);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #a855f7; border: 2px solid #14142c;
}
.card-head { padding-bottom: 10px; }
.proj-card, .part-card { transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.proj-card:hover, .part-card:hover { border-color: rgba(167,139,250,.35); transform: translateY(-1px); }
.badge.ok, .badge[data-status="ready"] { background: rgba(56,211,159,.14); border-color: rgba(56,211,159,.35); color: #7ff0c8; }
.badge.err { background: rgba(255,93,115,.14); border-color: rgba(255,93,115,.35); color: #ff9fae; }

/* sticky-панель сохранения должна перекрывать контент */
.savebar {
  position: sticky; top: 12px; z-index: 6;
  background: rgba(14, 14, 32, .92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 20px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.savebar .btn.primary { box-shadow: 0 8px 18px rgba(124, 77, 255, .35); }

/* убираем неоновые свечения: только мягкие тени */
.brand-mark, .avatar, .nav-item.is-active, .btn.primary, .bar > i, .savebar .btn.primary {
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35) !important;
}
.nav-item.is-active { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 4px rgba(0, 0, 0, .35) !important; }
.btn.primary:hover { box-shadow: 0 3px 10px rgba(0, 0, 0, .4) !important; }
.card, .panel, .proj-card, .job, .idea, .part-card { box-shadow: 0 10px 28px rgba(2, 2, 12, .35) !important; }

/* нативные контролы выключаем: Safari/macOS рисует кнопки системными */
button, .btn, select.input, input[type="checkbox"], input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
}
button { background: none; border: 0; color: inherit; }
.btn { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
select.input {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238b8ba9' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
input[type="checkbox"] {
  width: 18px; height: 18px; border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(10, 10, 26, .8);
  display: inline-grid; place-items: center; cursor: pointer;
}
input[type="checkbox"]:checked {
  background: var(--grad); border-color: transparent;
}
input[type="checkbox"]:checked::after {
  content: ""; width: 10px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
