/* ============================================================================
   Cloud.ru Design — единая визуальная система платформы (пилот: /images).
   База: тёмный графит для экранов, единственный акцент — бренд-зелёный #26D07C,
   тонкие 1px-хайрлайны как главный структурный приём, геометрические штрихи-
   стрелки (↗), крупные заголовки SB Sans Display + капс-микролейблы.
   Канон для раскатки на /slides, /creatives и сайт целиком.
   ВАЖНО: имена селекторов и id неизменны — JS/шаблоны на них завязаны.
   ============================================================================ */
@font-face { font-family: "SB Sans Text"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/fonts/sb-sans-text-400.woff2") format("woff2"); }
@font-face { font-family: "SB Sans Text"; font-weight: 500 700; font-style: normal; font-display: swap;
  src: url("/static/fonts/sb-sans-text-600.woff2") format("woff2"); }
@font-face { font-family: "SB Sans Display"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/fonts/sb-sans-display-400.woff2") format("woff2"); }
@font-face { font-family: "SB Sans Display"; font-weight: 500 700; font-style: normal; font-display: swap;
  src: url("/static/fonts/sb-sans-display-600.woff2") format("woff2"); }

:root {
  /* Поверхности — глубокий графит (на больших экранах тёмное читается мягче) */
  --bg: #1b1b1b;
  --bg-soft: #212121;
  --panel: #242424;
  --panel-2: #2e2e2e;
  /* Хайрлайны — основной структурный приём бренда */
  --line: #343434;
  --line-soft: #2a2a2a;
  /* Текст */
  --text: #f4f4f4;
  --muted: #989898;
  --muted-2: #707070;
  /* Единственный акцент */
  --accent: #26D07C;
  --accent-2: #1fb06a;
  --accent-ink: #04130d;
  --accent-dim: rgba(38, 208, 124, .10);
  --accent-line: rgba(38, 208, 124, .35);
  --danger: #ff6b6b;
  --warn-bg: #2a2613;
  --warn-line: #46401f;
  --warn-ink: #ecd581;
  /* Геометрия — строгие прямые углы (бренд-язык слайдов: хайрлайны + прямоугольники) */
  --r-sm: 0px;
  --r: 0px;
  --r-lg: 0px;
  --font-display: "SB Sans Display", Verdana, sans-serif;
  --font-text: "SB Sans Text", Verdana, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-text);
  line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand { font-family: var(--font-display); letter-spacing: -0.01em; }
[hidden] { display: none !important; }

/* Капс-микролейбл — повторяющийся бренд-приём (как подписи на слайдах) */
.eyebrow, .act-group__label, .result-promptbox__label, .sub-variant::before {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2);
}

/* ===== Канонная шапка платформы (едина во всех Apps) ===== */
.topbar { display: flex; align-items: center; gap: 28px; padding: 0 28px; height: 60px;
  background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.topbar .brand { display: inline-flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 700;
  letter-spacing: 0; text-decoration: none; color: var(--text); }
/* Угловой зелёный знак-стрелка перед лого — фирменный геометрический штрих */
.topbar .brand::before { content: ""; width: 16px; height: 16px; flex: 0 0 auto;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 62% 100%, 62% 38%, 0 38%); }
.topbar .brand span { color: var(--accent); }
.topnav { display: flex; gap: 2px; }
.topnav__link { text-decoration: none; color: var(--muted); font-size: 14px; padding: 8px 14px;
  border-radius: var(--r-sm); transition: color .12s, background .12s; }
.topnav__link:hover { color: var(--text); background: var(--panel-2); }
.topnav__link.is-active { color: var(--text); background: transparent;
  box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.topbar__auth { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar__user { color: var(--muted); font-size: 13px; }
.topbar .login { text-decoration: none; color: var(--accent-ink); background: var(--accent);
  padding: 8px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; }
.logout-form { margin: 0; }
.logout-form button { cursor: pointer; border: 1px solid var(--line); background: transparent;
  color: var(--muted); padding: 7px 14px; border-radius: var(--r-sm); font: inherit; font-size: 13px;
  transition: border-color .12s, color .12s; }
.logout-form button:hover { border-color: var(--muted); color: var(--text); }

main { padding: 40px 28px 64px; max-width: 880px; margin: 0 auto; }

/* Заголовок раздела с фирменным диагональным штрихом-стрелкой слева */
h1 { font-size: 30px; line-height: 1.12; margin: 0 0 28px; position: relative; padding-left: 22px; }
h1::before { content: ""; position: absolute; left: 0; top: 4px; width: 10px; height: 26px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 30%, 42% 30%, 42% 100%, 0 100%); }

/* ===== Лендинг: вступление + уведомление ===== */
.intro { margin: 0 0 32px; }
.intro__lead { margin: 0 0 16px; max-width: 640px; color: var(--muted);
  font-size: 16px; line-height: 1.6; }
.notice { margin: 0; padding: 11px 14px 11px 16px; border-left: 2px solid var(--accent);
  background: var(--bg-soft); color: var(--text); font-size: 14px; line-height: 1.5; }
.notice--warn { border-left-color: var(--accent); color: var(--muted); }

/* ===== Лендинг: карточки разделов ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.card { display: block; padding: 26px 24px; border: 1px solid var(--line); border-radius: var(--r-lg);
  text-decoration: none; color: inherit; background: transparent; position: relative; overflow: hidden;
  transition: border-color .15s, background .15s; }
.card::after { content: "↗"; position: absolute; top: 18px; right: 20px; color: var(--muted-2);
  font-size: 17px; transition: color .15s, transform .15s; }
.card:hover { border-color: var(--accent); background: var(--bg-soft); }
.card:hover::after { color: var(--accent); transform: translate(2px, -2px); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ===== Форма генерации ===== */
.gen-form { display: flex; flex-direction: column; gap: 18px; max-width: 580px; }
.gen-form label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }
.gen-form select, .gen-form textarea, .gen-form input[type="file"] { font: inherit; font-size: 15px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-soft);
  color: var(--text); transition: border-color .12s, background .12s; }
.gen-form select:hover, .gen-form textarea:hover { border-color: #454545; }
.gen-form select:focus, .gen-form textarea:focus { outline: none; border-color: var(--accent);
  background: var(--panel); }
.gen-form input[type="file"] { color: var(--muted); }
.gen-form button { align-self: flex-start; cursor: pointer; border: none; background: var(--accent);
  color: var(--accent-ink); padding: 12px 26px; border-radius: var(--r); font: inherit; font-size: 15px;
  font-weight: 600; transition: background .15s, transform .05s; }
.gen-form button:hover { background: var(--accent-2); }
.gen-form button:active { transform: translateY(1px); }
.gen-form button:disabled { opacity: .4; cursor: default; }
.gen-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.muted { color: var(--muted); font-size: 13px; }

.retention-hint { margin-top: 14px; font-size: 13px; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-left: 2px solid var(--accent-line); padding: 9px 14px;
  border-radius: var(--r-sm); max-width: 580px; }

/* ===== Статус задачи + тонкая полоса прогресса ===== */
.status { margin-top: 20px; padding: 11px 15px; border-radius: var(--r); background: transparent;
  border: 1px solid var(--line); border-left: 2px solid var(--accent); font-size: 14px; max-width: 580px; }
.status--running { border-color: var(--line); color: var(--text); }
.status--done { border-color: var(--accent-line); color: var(--accent); }
.status--error { border-color: #4a2222; color: var(--danger); }
.status--cancelled { border-color: var(--warn-line); color: var(--warn-ink); }

.progress { margin-top: 8px; max-width: 580px; height: 3px;
  background: var(--line-soft); overflow: hidden; }
.progress__bar { height: 100%; width: 0%; background: var(--accent);
  transition: width .35s ease; }
/* Неопределённый прогресс (этап без процента) — бегущая полоса */
.progress--indeterminate .progress__bar { width: 35% !important; animation: progress-slide 1.1s ease-in-out infinite; }
@keyframes progress-slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* Кнопка «Остановить» — показывается только во время прогона */
.stop-btn { margin-top: 12px; cursor: pointer; border: 1px solid #4a2222; background: transparent;
  color: var(--danger); padding: 9px 16px; border-radius: var(--r-sm); font: inherit; font-size: 14px;
  font-weight: 600; transition: background .12s, border-color .12s; }
.stop-btn:hover { background: #2a1818; border-color: var(--danger); }
.stop-btn:disabled { opacity: .5; cursor: default; }

/* ===== Панель «В работе»: по карточке на каждую активную задачу ===== */
.queue { margin-top: 24px; max-width: 740px; }
.queue h2 { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2);
  margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.queue h2 .muted { font-weight: 400; text-transform: none; letter-spacing: 0; }
.queue-grid { display: flex; flex-direction: column; gap: 12px; }
.job { border: 1px solid var(--line); border-left: 2px solid var(--accent); background: var(--panel);
  padding: 13px 15px; display: flex; flex-direction: column; gap: 9px; }
.job--done { border-left-color: var(--accent-line); }
.job--error { border-left-color: var(--danger); }
.job--cancelled { border-left-color: var(--warn-line); }
.job__title { font-size: 14px; color: var(--text); font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.job__status { font-size: 13px; color: var(--muted); }
.job--error .job__status { color: var(--danger); }
.job--cancelled .job__status { color: var(--warn-ink); }
.job .progress { margin-top: 0; max-width: none; }
.job__stop { margin-top: 3px; padding: 7px 13px; font-size: 13px; align-self: flex-start; }

/* ===== Результат + превью ===== */
.result { margin-top: 20px; }
.result img { max-width: 100%; border-radius: var(--r-lg); border: 1px solid var(--line); }
.result-card { display: flex; flex-direction: column; gap: 16px; max-width: 740px; }

.previews { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.thumb { display: flex; flex-direction: column; gap: 5px; width: 96px; font-size: 11px; color: var(--muted); }
.thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.thumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { margin-top: 20px; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--r-lg);
  color: var(--muted); max-width: 740px; background: transparent; }
.empty h2 { margin: 0 0 10px; font-size: 15px; color: var(--text); }
.empty ul { margin: 0; padding-left: 18px; line-height: 1.7; font-size: 14px; }
.empty ul b { color: var(--text); font-weight: 600; }

.history { margin-top: 40px; max-width: 740px; }
.history h2 { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2);
  margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.history h2 .muted { font-weight: 400; text-transform: none; letter-spacing: 0; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px; }
.history-item { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--panel); overflow: hidden; transition: border-color .12s; }
.history-item:hover { border-color: var(--accent-line); }
.history-thumb { padding: 0; border: none; background: none; cursor: pointer; display: block; }
.history-thumb img { display: block; width: 100%; height: 124px; object-fit: cover; }
.history-cap { padding: 8px 9px; font-size: 12px; color: var(--muted); line-height: 1.4; max-height: 3.4em;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.history-del { position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; padding: 0; border: none;
  border-radius: var(--r-sm); background: rgba(15,15,15,.78); color: #fff; cursor: pointer; font-size: 14px;
  line-height: 28px; opacity: 0; transition: opacity .12s, background .12s; }
.history-item:hover .history-del { opacity: 1; }
.history-del:hover { background: var(--danger); }

/* Копируемое поле с фактическим промптом Nano Banana */
.result-promptbox { display: flex; flex-direction: column; gap: 8px; }
.result-promptbox__label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.result-prompt-ta { width: 100%; box-sizing: border-box; padding: 11px 13px; font: inherit; font-size: 14px;
  line-height: 1.5; color: var(--text); background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r); resize: vertical; }
.copy-btn { cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--text);
  padding: 6px 12px; border-radius: var(--r-sm); font: inherit; font-size: 12px; white-space: nowrap;
  transition: border-color .12s, color .12s; }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Действия после генерации — семантические группы ===== */
.actions { display: flex; flex-direction: column; gap: 18px; }
.act-group { display: flex; flex-direction: column; gap: 9px; }
.act-group__row { display: flex; flex-wrap: wrap; gap: 9px; }

.actions .btn { cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--text);
  padding: 10px 16px; border-radius: var(--r-sm); font: inherit; font-size: 14px; text-decoration: none;
  transition: border-color .12s, color .12s, background .12s; }
.actions .btn:hover { border-color: var(--accent); color: var(--accent); }
.actions .btn--primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink);
  font-weight: 600; }
.actions .btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.actions .btn--active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

/* Образцы фона спикера — квадрат-сватч + подпись (как плитки палитры в рефе) */
.actions .btn--swatch { display: inline-flex; align-items: center; gap: 8px; }
.actions .btn--swatch:hover { color: var(--text); }
.actions .btn--swatch::before { content: ""; width: 13px; height: 13px;
  background: var(--sw, #ccc); }

/* Инлайн-правка запроса (заменяет window.prompt) */
.act-edit { display: flex; flex-direction: column; gap: 9px; margin-top: 2px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.act-edit textarea { font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--r-sm); resize: vertical; background: var(--bg-soft); color: var(--text); }
.act-edit textarea:focus { outline: none; border-color: var(--accent); }
.act-edit .btn--primary { align-self: flex-start; }

/* ===== Баннер истёкшей сессии ===== */
.session-banner { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 12px 16px;
  border: 1px solid var(--warn-line); border-left: 2px solid var(--warn-ink); background: var(--warn-bg);
  border-radius: var(--r); color: var(--warn-ink); font-size: 14px; max-width: 740px; }
.session-banner .btn { cursor: pointer; border: none; background: var(--accent); color: var(--accent-ink);
  padding: 7px 14px; border-radius: var(--r-sm); font: inherit; font-size: 14px; text-decoration: none;
  font-weight: 600; }
.session-banner .btn:hover { background: var(--accent-2); }

/* ===== Сценарное меню (Экран 1) ===== */
.scenario-menu { display: grid; gap: 12px; margin: 4px 0 24px; max-width: 580px; }
.scenario-menu__title { margin: 0 0 4px; font-size: 15px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted-2); }

.scenario-card { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: transparent; transition: border-color .15s; }
.scenario-card:hover { border-color: #454545; }
.scenario-card:has(.scenario-card__sub:not([hidden])) { border-color: var(--accent); }

.scenario-card__head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font-size: 17px; font-weight: 600; background: transparent; color: var(--text); border: 0; cursor: pointer;
  padding: 19px 20px; line-height: 1.2; font-family: var(--font-display); transition: background .15s; }
.scenario-card__head:hover { background: var(--panel-2); }
.scenario-card__head::after { margin-left: auto; color: var(--muted-2); font-size: 15px;
  transition: transform .15s, color .15s; }
.scenario-card__head[data-open]::after { content: "▾"; }
.scenario-card__head[data-workflow]::after { content: "↗"; }
.scenario-card:has(.scenario-card__sub:not([hidden])) .scenario-card__head::after { transform: rotate(180deg); color: var(--accent); }

.scenario-card__sub { display: flex; flex-direction: column; gap: 9px; padding: 0 20px 20px; }
.sub-choice { display: flex; align-items: center; width: 100%; text-align: left; background: var(--bg-soft);
  color: var(--text); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 16px; cursor: pointer;
  font: inherit; font-size: 15px; transition: border-color .12s, background .12s, color .12s; }
.sub-choice:hover { border-color: var(--accent-line); background: var(--panel-2); }
.sub-choice::after { margin-left: auto; color: var(--muted-2); font-size: 14px; content: "↗"; transition: color .12s; }
.sub-choice:hover::after { color: var(--accent); }
.sub-choice[data-brand]::after { content: "▾"; }

.sub-variant { display: flex; flex-wrap: wrap; gap: 9px; width: 100%; margin-top: 2px; padding-left: 2px; }
.sub-variant::before { content: "Стиль"; width: 100%; margin-bottom: 2px; }
.sub-variant .sub-choice { width: auto; flex: 0 0 auto; padding: 9px 16px; font-size: 14px; }
.sub-variant .sub-choice::after { content: none; }

/* Кнопка возврата + метка сценария на форме (Экран 2) */
.gen-form .back-link { background: transparent; color: var(--muted); border: 0; cursor: pointer; font: inherit;
  font-size: 14px; padding: 0 0 8px; align-self: flex-start; transition: color .12s; }
.gen-form .back-link:hover { color: var(--accent); }
.scenario-label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2);
  margin-bottom: 8px; }
