:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f0f0f2;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: rgba(0, 0, 0, 0.10);
  --line-2: rgba(0, 0, 0, 0.06);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --danger: #d70015;
  --ok: #2a9d3a;
  --warn: #b8860b;
  --radius: 16px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-3: #3a3a3c;
    --text: #f5f5f7;
    --text-2: #98989d;
    --line: rgba(255, 255, 255, 0.12);
    --line-2: rgba(255, 255, 255, 0.07);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.16);
    --danger: #ff453a;
    --ok: #32d74b;
    --warn: #ffd60a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
figure, figcaption { margin: 0; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; font-weight: 600; }
h1 { font-size: 17px; }
h2 { font-size: 19px; }
h3 { font-size: 14px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); text-decoration: none; }
.brand:hover { opacity: .7; }

/* ─── шапка страницы: назад · заголовок · действия ─── */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 6px 0 18px; min-height: 34px; }
.pagehead-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pagehead-left h2 { font-size: 22px; letter-spacing: -0.02em; }
.pagehead-left .hint { display: block; margin-top: 1px; }
.back-link { text-decoration: none; }
.pagehead-actions { display: flex; gap: 8px; flex: none; }
.view { display: block; }
.status {
  font: inherit; font-size: 12px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
}
.status:hover { color: var(--text); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.status.bad { color: var(--danger); }
.status.bad::before { background: var(--danger); }

main { padding-top: 24px; padding-bottom: 140px; display: flex; flex-direction: column; gap: 18px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card-head { margin-bottom: 16px; }
.sub { margin: 6px 0 0; color: var(--text-2); font-size: 13px; max-width: 74ch; }
.hint { color: var(--text-2); font-size: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }

/* ─── общая панель (уровень «всё») ─── */
.globalbar {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 16px; margin-bottom: 14px;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent-soft);
}
.global-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.global-head { font-size: 12px; font-weight: 600; }
.global-head .hint { font-weight: 400; }
.global-refs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.global-drop {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px dashed var(--accent); border-radius: 8px; background: transparent;
  color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer;
}
.global-drop:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.global-tpl { max-width: 100%; }
@media (max-width: 720px) { .globalbar { grid-template-columns: 1fr; } }

/* ─── зона добавления ─── */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 42px 24px; }
.dropzone-inner strong { font-size: 15px; font-weight: 600; }
.dropzone-inner span { font-size: 13px; color: var(--text-2); max-width: 46ch; }
.dropzone-inner .btn { margin-top: 8px; }
.dropzone.compact .dropzone-inner { padding: 20px; }

/* ─── панель массовых действий ─── */
.bulkbar {
  position: sticky; top: 48px; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid var(--line); border-radius: 999px;
}
.checkall { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; padding-left: 6px; }
.checkall input { width: 16px; height: 16px; accent-color: var(--accent); }
.bulkbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── строки заданий ─── */
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: grid;
  grid-template-columns: 26px 30px 64px 20px 1fr 200px 150px 30px;
  align-items: center; gap: 12px;
  padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.task.sel { border-color: var(--accent); background: var(--accent-soft); }
.task-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.task-n { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; text-align: center; }

.cell-label { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }

.pic {
  position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden;
  background: var(--surface-3); cursor: pointer; flex: none;
}
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic.empty { display: grid; place-items: center; border: 1px dashed var(--line); color: var(--text-2); font-size: 20px; }
.pic .pic-x {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; opacity: 0; display: grid; place-items: center;
}
.pic:hover .pic-x { opacity: 1; }
.arrow { color: var(--text-2); font-size: 15px; text-align: center; }

.refs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ref-thumb { width: 40px; height: 40px; border-radius: 6px; overflow: hidden; position: relative; background: var(--surface-3); flex: none; }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb .pic-x { width: 14px; height: 14px; font-size: 10px; }
.ref-add {
  width: 40px; height: 40px; border-radius: 6px; border: 1px dashed var(--line);
  background: transparent; color: var(--text-2); font-size: 18px; cursor: pointer; flex: none;
}
.ref-add:hover { border-color: var(--accent); color: var(--accent); }
/* унаследованный от общей панели референс — подсвечен, чтобы не путаться */
.ref-thumb.shared { box-shadow: 0 0 0 2px var(--accent); }
.ref-thumb.shared::after {
  content: "общий"; position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 8px; text-align: center; color: #fff; background: var(--accent); padding: 1px 0; line-height: 1.3;
}
.refs .detached { font-size: 11px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.refs .detached button { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 11px; padding: 0; }

.tpl-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tpl-pick {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px 8px;
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; text-align: left;
}
.tpl-pick:hover { border-color: var(--accent); }
.tpl-pick .tpl-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-pick .tpl-edit { color: var(--text-2); font-size: 12px; }
.tpl-pick.edited .tpl-name::after { content: " · изменён"; color: var(--warn); font-size: 11px; }
/* строка наследует общий промпт — приглушаем; свой промпт — акцент */
.tpl-pick.inherited { background: transparent; border-style: dashed; color: var(--text-2); }
.tpl-pick.own { border-color: var(--warn); }
.tpl-revert { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 11px; padding: 2px 0 0; text-align: left; }

.task-status { display: flex; flex-direction: column; gap: 4px; font-size: 12px; min-width: 0; }
.task-state { display: flex; align-items: center; gap: 6px; }
.task-state.ok { color: var(--ok); }
.task-state.err { color: var(--danger); }
.task-state.warn { color: var(--warn); }
.result-mini { display: flex; align-items: center; gap: 6px; }
.result-mini .pic { width: 48px; height: 48px; }
.result-mini a { font-size: 11px; color: var(--accent); text-decoration: none; }
.result-mini a:hover { text-decoration: underline; }
.task-err { color: var(--danger); font-size: 11px; line-height: 1.3; max-height: 3.6em; overflow: hidden; }
.task-remove { background: none; border: 0; color: var(--text-2); font-size: 18px; cursor: pointer; line-height: 1; }
.task-remove:hover { color: var(--danger); }

.spinner { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.tasks-foot { display: flex; align-items: center; gap: 14px; margin-top: 12px; }

/* режим выполнения: строки принадлежат серверу, локальное редактирование прячем */
.tasks.run .task-check, .tasks.run .task-remove, .tasks.run .ref-add, .tasks.run .pic-x { display: none; }
.tasks.run .pic, .tasks.run .tpl-pick { cursor: default; pointer-events: none; }
.tasks.run .task { grid-template-columns: 26px 30px 64px 20px 1fr 200px 160px 30px; }

/* ─── настройки ─── */
details summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "⌄"; margin-left: auto; color: var(--text-2); transition: transform .2s; }
details[open] summary::after { transform: rotate(180deg); }
.summary-value { font-size: 13px; color: var(--text-2); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-top: 18px; }
.settings-grid label { display: flex; flex-direction: column; gap: 6px; }
.settings-grid span { font-size: 13px; font-weight: 500; }
.settings-grid em { font-size: 11.5px; color: var(--text-2); font-style: normal; line-height: 1.4; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; font: 13px/1.6 ui-monospace, "SF Mono", Menlo, monospace; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ─── кнопки ─── */
.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: opacity .15s, background .15s, transform .05s; white-space: nowrap;
}
.btn:hover { opacity: .82; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .38; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 11px; font-size: 12px; }
.btn.big { padding: 12px 26px; font-size: 15px; }
.btn.danger { color: var(--danger); }
.btn.arming { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .7; } }

/* ─── пустое состояние ─── */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 64px 24px; }
.empty-state strong { font-size: 17px; }
.empty-state span { font-size: 13px; color: var(--text-2); max-width: 42ch; }
.empty-state .btn { margin-top: 10px; }
.empty-emoji { font-size: 40px; margin-bottom: 6px; }
.save-hint { display: inline-block; margin-top: 4px; color: var(--ok); }

/* ─── ранбар ─── */
.runbar {
  position: fixed; left: 0; right: 0; bottom: 18px; z-index: 18;
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
}
.runbar > * { pointer-events: auto; }
.run-progress {
  display: flex; align-items: center; gap: 12px; width: min(680px, calc(100vw - 48px));
  padding: 8px 16px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(20px); border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.run-progress .progress { flex: 1; }
.run-progress .hint { white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
.progress-bar.err { background: var(--danger); }
.run-actions {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(180%) blur(20px); border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(0,0,0,.14); flex-wrap: wrap; justify-content: center;
}
@media (prefers-color-scheme: dark) {
  .run-progress, .run-actions { box-shadow: 0 8px 28px rgba(0,0,0,.5); }
}

/* ─── модалки ─── */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.4); padding: 24px; }
.modal-card { background: var(--surface); border-radius: var(--radius); padding: 22px; width: min(560px, 100%); max-height: 82vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-card.narrow { width: min(460px, 100%); }
.modal-card.wide { width: min(900px, 100%); }
.modal-card code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.modal-card a { color: var(--accent); }
#keyInput { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }
.applyall { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.template-pick { display: flex; flex-direction: column; gap: 8px; }
.tpl-option { text-align: left; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); cursor: pointer; }
.tpl-option:hover { border-color: var(--accent); }
.tpl-option strong { font-size: 14px; }
.tpl-option span { display: block; font-size: 12px; color: var(--text-2); margin-top: 3px; }

.template-editor { display: grid; grid-template-columns: 220px 1fr; gap: 16px; min-height: 340px; }
.template-side { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow: auto; border-right: 1px solid var(--line); padding-right: 12px; }
.template-side button { text-align: left; border: 0; background: none; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.template-side button:hover { background: var(--surface-2); }
.template-side button.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.template-side .badge { font-size: 10px; color: var(--text-2); margin-left: 4px; }
.template-form { display: flex; flex-direction: column; gap: 12px; }
.template-form label { display: flex; flex-direction: column; gap: 5px; }
.template-form span { font-size: 12px; font-weight: 500; color: var(--text-2); }

/* ─── история (лента на странице) ─── */
.viewbanner {
  position: sticky; top: 48px; z-index: 16;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 16px; margin-bottom: 16px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 14px; font-size: 13px;
}
.history-feed { margin-top: 4px; }
.history-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; padding: 0 2px; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  width: 100%; text-align: left; font: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  cursor: pointer; background: var(--surface);
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.history-item, .history-item strong, .history-item span { text-decoration: none; color: var(--text); }
.history-item .history-when span { color: var(--text-2); }
.history-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.history-item:active { transform: scale(.995); }
.history-item.active { border-color: var(--accent); background: var(--accent-soft); }
@media (prefers-color-scheme: dark) { .history-item:hover { box-shadow: 0 4px 16px rgba(0,0,0,.35); } }

.history-thumbs { display: flex; gap: 5px; }
.history-thumbs img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-3); }
.history-thumbs .more { font-size: 11px; color: var(--text-2); align-self: center; padding-left: 2px; font-variant-numeric: tabular-nums; }
.history-when { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.history-when strong { font-size: 13.5px; font-weight: 600; }
.history-when span { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { display: flex; align-items: center; gap: 10px; }
.history-badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.history-badge.done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.history-badge.running { background: var(--accent-soft); color: var(--accent); }
.history-badge.err { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.history-badge.mask { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* ─── сравнение «было/стало» ─── */
.compare-card { width: min(940px, 100%); }
.compare {
  position: relative; width: 100%; min-height: 240px; max-height: 74vh; overflow: hidden;
  border-radius: var(--radius-sm); background: var(--surface-3);
  user-select: none; cursor: ew-resize; touch-action: none;
  /* aspect-ratio ставится из JS по размеру результата */
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.cmp-before { clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.cmp-divider { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); transform: translateX(-1px); pointer-events: none; }
.cmp-handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 32px; height: 32px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; box-shadow: 0 1px 5px rgba(0,0,0,.45); font-size: 14px; }
.cmp-label { position: absolute; top: 10px; padding: 2px 9px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; pointer-events: none; }
.cmp-label.left { left: 10px; }
.cmp-label.right { right: 10px; }

/* курсор-указатель на результате — намёк, что кликабельно для сравнения */
.result-mini .pic { cursor: zoom-in; }

/* ─── цепочка генераций (режим выполнения/истории) ─── */
.runinfo {
  max-width: 1120px; margin: 0 auto 14px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 12.5px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
}
.runinfo b { color: var(--text); font-weight: 600; }

.tasks.run .task { grid-template-columns: 30px 56px 18px 96px 150px 1fr; align-items: start; }
.tasks.run .task-check, .tasks.run .task-remove { display: none; }
.result-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.result-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.gens { display: flex; gap: 6px; flex-wrap: wrap; }
.gen {
  position: relative; width: 60px; height: 60px; border-radius: 8px; overflow: hidden;
  background: var(--surface-3); cursor: zoom-in; border: 2px solid transparent;
}
.gen img { width: 100%; height: 100%; object-fit: cover; }
.gen.final { border-color: var(--ok); }
.gen-star {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; opacity: 0; transition: opacity .12s;
}
.gen:hover .gen-star, .gen.final .gen-star { opacity: 1; }
.gen.final .gen-star { background: var(--ok); color: #fff; }
.gen-tag { position: absolute; left: 0; bottom: 0; right: 0; font-size: 8px; text-align: center; color: #fff; background: rgba(0,0,0,.6); line-height: 1.4; padding: 1px 0; }
.gen.final .gen-tag { background: var(--ok); }
.gen-actions { display: flex; gap: 10px; align-items: center; font-size: 11.5px; }
.gen-actions a, .gen-actions button { color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 11.5px; }
.rerun-btn { color: var(--accent) !important; }

/* ─── тумблер настроек ─── */
.toggle-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.toggle-row.static { cursor: default; border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.toggle-on { width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 2px; flex: none; }
.toggle-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.toggle-row span { display: flex; flex-direction: column; gap: 3px; }
.toggle-row strong { font-size: 13px; }
.toggle-row em { font-size: 11.5px; color: var(--text-2); font-style: normal; line-height: 1.4; }
.compare-meta { padding: 2px 0; }

/* ─── статус хранилища (переживут ли данные деплой) ─── */
.storage-banner {
  padding: 12px 16px; margin-bottom: 14px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.5; border: 1px solid var(--line);
}
.storage-banner.ok { background: color-mix(in srgb, var(--ok) 10%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.storage-banner.warn { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); font-weight: 500; }

/* ─── тост «Сохранено» ─── */
.toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 60;
  transform: translateX(-50%) translateY(10px);
  display: flex; align-items: center; gap: 7px;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.28); pointer-events: none;
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast::before { content: "✓"; font-weight: 700; }
.toast.err { background: var(--danger); color: #fff; }
.toast.err::before { content: "⚠"; }

@media (max-width: 720px) {
  .tasks.run .task { grid-template-columns: 24px 1fr; }
}

@media (max-width: 720px) {
  .task { grid-template-columns: 24px 1fr; grid-auto-rows: auto; row-gap: 8px; }
  .task-check { grid-row: 1 / 3; }
  .template-editor { grid-template-columns: 1fr; }
  .template-side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
}
