* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: #0b0e14; color: #e8ecf1; }
.topbar { border-bottom: 1px solid #1f2937; background: linear-gradient(180deg, #111827 0%, #0f172a 100%); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.brand { font-weight: 800; letter-spacing: .3px; font-size: 17px; }
.nav { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; }
.nav a, .linkbtn { color: #93c5fd; text-decoration: none; background: none; border: none; cursor: pointer; font: inherit; font-size: 14px; padding: 6px 4px; border-radius: 6px; }
.nav a:hover { color: #bfdbfe; background: rgba(59, 130, 246, 0.08); }
.nav-logout-form { margin: 0; display: inline; }
.nav-menu-btn {
  display: none;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.container { max-width: 1200px; margin: 22px auto; padding: 0 16px 48px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: #111827; border: 1px solid #1f2937; border-radius: 12px; padding: 16px; }
.narrow { max-width: 440px; margin: 40px auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
input, textarea, button { border-radius: 8px; border: 1px solid #374151; background: #0f172a; color: #e8ecf1; padding: 10px; }
button { background: #2563eb; border: none; font-weight: 600; cursor: pointer; }
button:hover { background: #1d4ed8; }
.hint { color: #9ca3af; font-size: 13px; }
.ok { color: #86efac; }
.error { color: #fca5a5; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid #1f2937; padding: 8px 6px; font-size: 14px; }
.status { padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid #374151; }
.status.preparing, .status.downloading, .status.transcribing, .status.generating_avatar, .status.compositing { background: #1e3a8a; }
.status.awaiting_generate_confirm, .status.awaiting_composite_confirm { background: #78350f; }
.status.awaiting_mix_confirm { background: #0e7490; }
.status.awaiting_montage_review { background: #0f766e; }
.status.awaiting_offer { background: #5b21b6; }
.status.attaching_offer { background: #4c1d95; }
.status.completed { background: #14532d; }
.status.failed { background: #7f1d1d; }
.status.awaiting_group_share { background: #44403c; color: #fde68a; }
.pre { white-space: pre-wrap; background: #0b1220; padding: 12px; border-radius: 8px; border: 1px solid #233045; }
.textarea-transcript {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}
.transcript-edit { margin-bottom: 8px; }
.roadmap-card { margin: 18px 0 20px; padding: 16px; border-radius: 12px; border: 1px solid #243041; background: linear-gradient(180deg, #0e1628 0%, #0b1220 100%); }
.roadmap-header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 14px; }
.roadmap-header h3 { margin: 0; font-size: 18px; }
.roadmap { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.roadmap-step { position: relative; min-height: 132px; padding: 14px; border-radius: 14px; border: 1px solid #233045; background: rgba(15, 23, 42, 0.95); overflow: hidden; }
.roadmap-step::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.roadmap-step-pending { opacity: 0.68; }
.roadmap-step-current { border-color: #60a5fa; box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35), 0 18px 34px rgba(37, 99, 235, 0.18); }
.roadmap-step-completed { border-color: #1f7a46; background: rgba(9, 34, 22, 0.95); }
.roadmap-step-failed { border-color: #b91c1c; background: rgba(55, 18, 25, 0.96); }
.roadmap-step-cancelled { border-color: #92400e; background: rgba(53, 39, 16, 0.96); opacity: 0.92; }
.roadmap-step-cancelled .roadmap-dot { background: #b45309; border-color: #fbbf24; color: #fffbeb; }
.roadmap-step-cancelled .roadmap-code { color: #fcd34d; }
.roadmap-step-skipped { border-color: #334155; background: rgba(30, 41, 59, 0.55); opacity: 0.7; }
.roadmap-step-skipped .roadmap-dot { background: #1e293b; border-color: #475569; color: #94a3b8; }
.roadmap-step-skipped .roadmap-code { color: #94a3b8; }
.roadmap-step-skipped .roadmap-title { color: #cbd5e1; }

.group-variant-link.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
  text-decoration: none;
  color: inherit;
  display: block;
}
.group-variant-card.is-nav-closed .group-variant-link.is-disabled { pointer-events: none; }

.group-montage-skip-panel {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(71, 85, 105, 0.65);
  background: rgba(15, 23, 42, 0.55);
}
.group-montage-skip-title { margin: 0 0 8px; font-size: 1rem; }
.group-montage-skip-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.group-montage-skip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(51, 65, 85, 0.5);
}
.group-montage-skip-info { flex: 1; min-width: 200px; }
.group-sibling-skip-form { margin: 0; }
.roadmap-dot { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 13px; font-weight: 700; margin-bottom: 12px; border: 1px solid #334155; background: #111827; color: #cbd5e1; }
.roadmap-step-current .roadmap-dot { background: #2563eb; border-color: #60a5fa; color: #eff6ff; }
.roadmap-step-completed .roadmap-dot { background: #166534; border-color: #22c55e; color: #ecfdf5; }
.roadmap-step-failed .roadmap-dot { background: #991b1b; border-color: #ef4444; color: #fff1f2; }
.roadmap-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.roadmap-code { font-size: 12px; color: #93c5fd; text-transform: lowercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.roadmap-step-completed .roadmap-code { color: #86efac; }
.roadmap-step-failed .roadmap-code { color: #fca5a5; }
.roadmap-desc { font-size: 13px; color: #cbd5e1; line-height: 1.45; }
.tab-btn { background: #1f2937; color: #9ca3af; font-size: 13px; padding: 7px 14px; }
.tab-btn.active-tab { background: #2563eb; color: #fff; }
.tab-btn:hover { background: #374151; }
.tab-btn.active-tab:hover { background: #1d4ed8; }
.checkbox-label { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; }
.result-block { display: flex; flex-direction: column; gap: 14px; margin: 18px 0; }
.result-player { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.btn-download { display: block; text-align: center; background: #16a34a; color: #fff; font-weight: 700; font-size: 18px; padding: 14px 24px; border-radius: 12px; text-decoration: none; letter-spacing: 0.02em; }
.btn-download:hover { background: #15803d; }
.btn-primary { background: #2563eb; color: #fff; font-weight: 600; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #374151; }
.btn-secondary:hover { background: #4b5563; }
.offer-processing-banner {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #6d28d9;
  background: #2e1065;
  color: #ede9fe;
  font-size: 14px;
  line-height: 1.45;
}
.offer-processing-banner p { margin: 0; }
.offer-step-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; }
.offer-step-block h3 { margin: 0 0 8px; font-size: 17px; }

/* Job page: pick a specific offer instead of random */
.offer-pick-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #243041;
  background: rgba(15, 23, 42, 0.5);
}
.offer-pick-label { font-size: 13px; color: #cbd5e1; margin: 0; }
.offer-pick-select {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 14px;
  min-width: 240px;
  cursor: pointer;
}
.offer-pick-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* Settings: custom user offer card (block "Ваши офферы") */
.custom-offers-section .offers-grid { gap: 14px; }
.custom-offer-card {
  border: 1px solid #243041;
  background: rgba(15, 23, 42, 0.55);
}
.custom-offer-card.is-configured {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.10) inset;
}
.custom-offer-card.kind-no-montage.is-configured {
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.10) inset;
}
.custom-offer-card.kind-ready-composite.is-configured {
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.12) inset;
}

.custom-offer-source-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.custom-offer-kind {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 900px) { .custom-offer-kind { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .custom-offer-kind { grid-template-columns: 1fr; } }

.custom-offer-ready-block {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.72);
  gap: 10px;
}
.custom-offer-ready-block label { font-size: 13px; color: #cbd5e1; }
.custom-offer-kind-opt { position: relative; cursor: pointer; }
.custom-offer-kind-opt input { position: absolute; opacity: 0; pointer-events: none; }
.custom-offer-kind-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  font-size: 13px;
  transition: border-color .15s ease, background-color .15s ease;
}
.custom-offer-kind-card strong { font-size: 13px; color: #e2e8f0; }
.custom-offer-kind-card small { font-size: 11.5px; color: #94a3b8; }
.custom-offer-kind-opt input:checked + .custom-offer-kind-card {
  border-color: #6366f1;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.18), rgba(124, 58, 237, 0.14));
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35) inset;
}
.custom-offer-kind-opt:hover .custom-offer-kind-card { border-color: #475569; }

.custom-offer-field { display: flex; flex-direction: column; gap: 6px; }
.custom-offer-field-label { font-size: 12.5px; color: #cbd5e1; font-weight: 600; }
.custom-offer-field-label small { font-weight: 400; color: #94a3b8; margin-left: 4px; }
.custom-offer-source-form textarea {
  resize: vertical;
  min-height: 86px;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.45;
}
.custom-offer-source-form textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.custom-offer-file-zone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed #475569;
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.custom-offer-file-zone:hover,
.custom-offer-file-zone.is-drag {
  border-color: #6366f1;
  background: rgba(79, 70, 229, 0.08);
}
.custom-offer-file-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.custom-offer-file-ico {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
  font-size: 14px;
  flex-shrink: 0;
}
.custom-offer-file-text { font-size: 13px; color: #cbd5e1; line-height: 1.4; }
.custom-offer-file--disabled { opacity: 0.45; pointer-events: none; }
.custom-offer-file--disabled .custom-offer-file-zone { border-style: solid; }

.offer-lib-card--custom { border-color: rgba(99, 102, 241, 0.35); }
.offer-lib-card--custom .offer-lib-slot { color: #c7d2fe; }
.mix-step-block h3 { margin: 0 0 8px; font-size: 17px; }
.mix-preview-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 720px) { .mix-preview-row { grid-template-columns: 1fr; } }
.mix-preview-col .mix-label { margin: 0 0 6px; font-size: 14px; }
.mix-mixed-player-wrap { margin: 12px 0 8px; }
.mix-mixed-player-wrap .mix-label { margin: 0 0 8px; font-size: 14px; }
.mix-audio-el { width: 100%; max-width: 420px; }
.mix-video-el { width: 100%; max-width: 280px; border-radius: 8px; background: #111; }
/* Off-screen but non-zero box: clip(0,0,0,0) / 1×1px often stops <video> audio decode in Web Audio. */
.mix-hidden-sources {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 320px;
  height: 180px;
  overflow: hidden;
  opacity: 0.02;
  pointer-events: none;
  z-index: -1;
}
.mix-hidden-sources audio,
.mix-hidden-sources video {
  display: block;
  width: 100%;
  height: 100%;
}
.mix-sliders label { display: block; font-size: 14px; margin-top: 10px; }
.mix-sliders input[type="range"] { width: 100%; max-width: 420px; }

.mix-sliders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 6px;
}
@media (min-width: 760px) {
  .mix-sliders-grid { grid-template-columns: 1fr 1fr; }
  .mix-sliders-grid .mix-speed-row { grid-column: 1 / -1; }
}
.mix-slider-row {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.55);
}
.mix-slider-row__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.mix-slider-row__head label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}
.mix-slider-row__value {
  font-size: 14px;
  font-weight: 700;
  color: #67e8f9;
  font-variant-numeric: tabular-nums;
  background: rgba(34, 211, 238, 0.10);
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.25);
}
.mix-slider-row input[type="range"] {
  width: 100%;
  max-width: 100%;
  accent-color: #38bdf8;
}
.mix-slider-row__sub {
  display: block;
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #94a3b8;
}
.mix-speed-row .mix-slider-row__value {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.30);
}
.mix-speed-row input[type="range"] { accent-color: #fbbf24; }
.mix-speed-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.mix-speed-chips button {
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.mix-speed-chips button:hover {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.5);
  color: #fcd34d;
}
.mix-speed-chips button.is-current {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.7);
  color: #fcd34d;
}

/* Шаг баланса: выбор фонового трека */
.mix-music-picker {
  margin: 20px 0 8px;
  padding: 16px 18px 18px;
  border-radius: 14px;
  border: 1px solid #243041;
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.95), rgba(11, 18, 32, 0.98));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.mix-music-picker__head { margin-bottom: 14px; }
.mix-music-picker__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #e2e8f0;
}
.mix-music-picker__sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #94a3b8;
  max-width: 52rem;
}
.mix-music-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.mix-music-grid[aria-busy="true"] { opacity: 0.55; pointer-events: none; }
.mix-music-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 12px 12px 12px 10px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: rgba(30, 41, 59, 0.55);
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  font: inherit;
}
.mix-music-card:hover {
  border-color: #64748b;
  background: rgba(51, 65, 85, 0.65);
  transform: translateY(-1px);
}
.mix-music-card:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}
.mix-music-card.is-current {
  border-color: #22c55e;
  background: rgba(22, 101, 52, 0.22);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.25);
}
.mix-music-card__badge {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: #475569;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.25);
}
.mix-music-card.is-current .mix-music-card__badge {
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
}
.mix-music-card__body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mix-music-card__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.mix-music-card__hint {
  font-size: 11px;
  color: #94a3b8;
}
.mix-music-picker__status { margin: 10px 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.offers-settings .offers-note { max-width: 900px; line-height: 1.5; margin-bottom: 16px; }
.offers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 16px 0; }
.offer-slot-card { border: 1px solid #243041; border-radius: 12px; padding: 12px; background: #0b1220; display: flex; flex-direction: column; gap: 10px; transition: border-color .18s ease; }
.offer-slot-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.offer-slot-title { font-weight: 700; }
.offer-slot-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid #374151; }
.badge-ok { border-color: #166534; color: #86efac; }
.badge-warn { border-color: #b45309; color: #fdba74; }
.badge-muted { opacity: 0.75; color: #9ca3af; }
.offer-slot-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { display: inline; margin: 0; }
.inline-form button { font-size: 13px; padding: 8px 12px; }
.btn-save-offers { margin-top: 4px; }
.offer-action-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid #243041; }
.offer-form-buttons { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.offer-montage-only { opacity: 0.95; }
.offer-variant-list { margin: 6px 0 10px; padding-left: 18px; font-size: 13px; color: #cbd5e1; }
.offer-variant-list li { margin: 4px 0; }
.offer-avatar-id { font-size: 11px; word-break: break-all; }
.admin-flags-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-flags-form select { min-width: 140px; }
table.admin-user-flags td { vertical-align: middle; }
/* ══════════════════════════════════════════════════════════════
   Медиатека
══════════════════════════════════════════════════════════════ */

/* Header */
.ml-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.ml-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ml-title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.ml-stat { font-size: 13px; color: #4b5563; }
.ml-stat-sep { color: #1f2937; }
.ml-stat-used { color: #6366f1; font-weight: 600; }

/* Toggle switch */
.ml-controls { display: flex; align-items: center; gap: 12px; }
.ml-toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: #9ca3af;
  cursor: pointer;
  user-select: none;
}
.ml-toggle-label input { display: none; }
.ml-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 999px;
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
.ml-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4b5563;
  transition: transform .2s, background .2s;
}
.ml-toggle-label input:checked ~ .ml-toggle-track { background: #4f46e5; border-color: #6366f1; }
.ml-toggle-label input:checked ~ .ml-toggle-track .ml-toggle-thumb { transform: translateX(16px); background: #fff; }

/* Toolbar */
.ml-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
  min-height: 38px;
  flex-wrap: wrap;
}
.ml-toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ml-sel-info { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #a5b4fc; }
.ml-sel-count { font-size: 20px; font-weight: 800; color: #818cf8; line-height: 1; }
.ml-sel-limit { font-size: 12px; color: #4b5563; }

.ml-btn-ghost {
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.ml-btn-ghost:hover { color: #e5e7eb; border-color: #374151; }

.ml-btn-batch {
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  padding: 9px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
  transition: opacity .15s, box-shadow .15s;
  white-space: nowrap;
}
.ml-btn-batch:hover:not(:disabled) { box-shadow: 0 4px 20px rgba(99,102,241,.55); }
.ml-btn-batch:disabled { opacity: .38; cursor: default; box-shadow: none; }

/* Messages */
.ml-msg {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}
.ml-msg-info { background: #0f1d3a; border-color: #1d4ed8; color: #93c5fd; }
.ml-msg-ok   { background: #052e16; border-color: #15803d; color: #86efac; }
.ml-msg-warn { background: #2d1600; border-color: #b45309; color: #fcd34d; }
.ml-msg-err  { background: #2d0a0a; border-color: #b91c1c; color: #fca5a5; }

/* List */
.ml-list { display: flex; flex-direction: column; gap: 5px; }

/* Row */
.ml-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #111827;
  border: 1px solid #1a2236;
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.ml-row:hover { border-color: #2d3f5e; background: #0f1929; }
.ml-row-used { background: #0d1520; border-color: #1a2236; opacity: .8; }
.ml-row-used:hover { opacity: 1; }
.ml-row-sel {
  border-color: #6366f1 !important;
  background: #12103a !important;
  box-shadow: 0 0 0 1px rgba(99,102,241,.25);
  opacity: 1 !important;
}

/* Checkbox */
.ml-cb-wrap {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ml-cb { display: none; }
.ml-cb-ui {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid #2d3748;
  border-radius: 6px;
  background: #0d1520;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.ml-cb:checked ~ .ml-cb-ui { background: #6366f1; border-color: #818cf8; }
.ml-cb-check { opacity: 0; transition: opacity .1s; }
.ml-cb:checked ~ .ml-cb-ui .ml-cb-check { opacity: 1; }

/* Thumbnail icon */
.ml-thumb {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
}
.ml-row-used .ml-thumb { color: #4b5563; }

/* Body */
.ml-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ml-url {
  color: #60a5fa;
  text-decoration: none;
  font-size: 13.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  transition: color .12s;
}
.ml-url:hover { color: #a5b4fc; }
.ml-row-used .ml-url { color: #475569; }
.ml-row-used .ml-url:hover { color: #60a5fa; }

.ml-used-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ml-used-label { font-size: 11px; color: #374151; }

.ml-job-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  text-decoration: none;
  letter-spacing: .02em;
  transition: opacity .15s;
}
.ml-job-badge:hover { opacity: .8; }
.ml-badge-completed   { background: #052e16; color: #4ade80; border: 1px solid #166534; }
.ml-badge-failed      { background: #2d0a0a; color: #f87171; border: 1px solid #991b1b; }
.ml-badge-compositing,
.ml-badge-generating_avatar,
.ml-badge-transcribing,
.ml-badge-downloading,
.ml-badge-preparing   { background: #0f1d3a; color: #93c5fd; border: 1px solid #1e3a6e; }
.ml-badge-awaiting_generate_confirm { background: #1c1200; color: #fbbf24; border: 1px solid #78350f; }

/* Buttons in row */
.ml-btn-view {
  flex-shrink: 0;
  display: inline-block;
  font-size: 12px;
  color: #4b5563;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.ml-btn-view:hover { color: #93c5fd; border-color: #374151; }

.ml-btn-shorts {
  flex-shrink: 0;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, box-shadow .15s;
  letter-spacing: .01em;
}
.ml-btn-shorts:hover:not(:disabled) { background: #1d4ed8; box-shadow: 0 3px 10px rgba(37,99,235,.4); }
.ml-btn-shorts:disabled { opacity: .5; cursor: default; }
.ml-btn-shorts-dup { background: #1e293b; color: #64748b; }
.ml-btn-shorts-dup:hover:not(:disabled) { background: #273549; box-shadow: none; }
.ml-btn-shorts-done { background: #15803d !important; }

/* Empty */
.ml-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 80px 20px;
  color: #374151;
  text-align: center;
}
.ml-empty-icon { margin-bottom: 8px; }
.ml-empty p { margin: 0; }
.ml-empty code { background: #111827; padding: 2px 7px; border-radius: 5px; font-size: 12px; color: #6b7280; }

/* Responsive */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .roadmap-header { flex-direction: column; align-items: flex-start; }
  .ml-header { flex-direction: column; align-items: flex-start; }
  .ml-toolbar { flex-direction: column; align-items: flex-start; }
  .ml-toolbar-right { width: 100%; }
  .ml-btn-batch { width: 100%; justify-content: center; }
  .ml-row { flex-wrap: wrap; }
  .ml-body { width: calc(100% - 120px); }
  .ml-btn-shorts { flex: 1; text-align: center; }
}

@media (max-width: 768px) {
  .nav-menu-btn { display: inline-block; }
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0 4px;
    border-top: 1px solid #1f2937;
    margin-top: 4px;
  }
  .nav.nav-open { display: flex; }
  .nav a { padding: 10px 8px; }
  .nav-logout-form .linkbtn { padding: 10px 8px; width: 100%; text-align: left; }
  .topbar-inner { flex-direction: row; flex-wrap: wrap; }
  .brand { flex: 1; }
}

/* ═══ Settings / Dashboard (как медиатека) ═══ */
.st-page { margin-bottom: 32px; }
.st-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.st-title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.4px; }
.st-sub { display: block; font-size: 13px; color: #64748b; margin-top: 4px; }
.st-card {
  background: #111827;
  border: 1px solid #1a2236;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.st-card-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.st-form label { color: #cbd5e1; }
.st-form input,
.st-form textarea,
.st-form select {
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
  color-scheme: dark;
}
.st-form select {
  cursor: pointer;
  appearance: auto;
}
.st-form select option,
.st-form select optgroup {
  background: #0f172a;
  color: #e2e8f0;
}
.st-btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.st-btn-primary:hover { filter: brightness(1.06); }
.st-btn-secondary {
  background: #334155;
  color: #f1f5f9;
  border: none;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.st-btn-secondary:hover { background: #475569; }
.st-btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}
.st-btn-ghost:hover { color: #e2e8f0; border-color: #475569; }
.st-btn-danger {
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
  border: 1px solid #991b1b;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}
.st-btn-danger:hover { background: rgba(153, 27, 27, 0.5); }
.st-btn-sm { padding: 6px 12px; font-size: 12px; }
.st-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.st-tab {
  background: #1e293b;
  color: #94a3b8;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid #334155;
  cursor: pointer;
  font-weight: 600;
}
.st-tab.active-tab {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border-color: transparent;
}
.st-pane { margin-top: 4px; }
.st-form-status { font-size: 13px; color: #94a3b8; margin-top: 8px; }
.st-inline-hint { margin-top: 12px; }
.st-mini-hint { margin: 0 0 8px; font-size: 12px; }
.st-select { width: 100%; }
.st-toast {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid #334155;
  background: #0f1d3a;
  color: #93c5fd;
}
.st-toast-err { background: #2d0a0a; border-color: #991b1b; color: #fecaca; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 960px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.dash-job-list { display: flex; flex-direction: column; gap: 8px; }
.dash-job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: #0f172a;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.dash-job-row:hover { border-color: #4f46e5; background: #12103a; }
.dash-job-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dash-job-title {
  font-weight: 600;
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-job-id { font-family: ui-monospace, monospace; font-size: 11px; color: #64748b; word-break: break-all; }
.dash-job-date { font-size: 12px; color: #64748b; }
.dash-job-arrow { color: #6366f1; font-weight: 700; }
@media (max-width: 520px) {
  .dash-job-row { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .dash-job-title { white-space: normal; }
}

.offer-roadmaps-wrap { margin: 16px 0; }
.offer-roadmaps-heading { margin: 0 0 8px; font-size: 15px; color: #cbd5e1; }
#offer-roadmaps .offer-roadmap.offer-roadmap-item {
  margin: 0 0 14px;
}
#offer-roadmaps .offer-roadmap.offer-roadmap-item:last-child {
  margin-bottom: 0;
}

.offer-roadmap {
  margin: 16px 0 20px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #312e81;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12) 0%, rgba(15, 23, 42, 0.95) 100%);
}
.offer-roadmap-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.offer-roadmap-title { font-weight: 800; font-size: 14px; color: #a5b4fc; }
.offer-roadmap-slot { font-size: 12px; color: #818cf8; }
.offer-roadmap-track { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 10px; }
.offer-roadmap-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
  opacity: 0.45;
  transition: opacity 0.2s;
}
.offer-roadmap-step span {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  background: #1e293b;
  border: 2px solid #334155;
}
.offer-roadmap-step small { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.offer-roadmap-step-active { opacity: 1; }
.offer-roadmap-step-active span { border-color: #818cf8; background: #312e81; color: #e0e7ff; }
.offer-roadmap-step-done { opacity: 1; }
.offer-roadmap-step-done span { border-color: #166534; background: #14532d; color: #bbf7d0; }
.offer-roadmap-step-error span { border-color: #dc2626; background: #7f1d1d; color: #fecaca; }
.offer-roadmap-line { flex: 1; max-width: 48px; height: 2px; background: #334155; margin: 0 4px; margin-bottom: 18px; }
.offer-roadmap-label { margin: 0; font-size: 13px; color: #cbd5e1; text-align: center; }

.offer-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.offer-lib-card {
  border: 1px solid #1e293b;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  flex-direction: column;
}
.offer-lib-video-wrap { background: #000; aspect-ratio: 9 / 16; max-height: 420px; }
.offer-lib-video { width: 100%; height: 100%; object-fit: contain; vertical-align: middle; }
.offer-lib-meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.offer-lib-slot { font-size: 12px; font-weight: 700; color: #818cf8; text-transform: uppercase; letter-spacing: 0.06em; }
.offer-lib-aid { font-size: 11px; word-break: break-all; color: #94a3b8; }
.offer-lib-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.ml-title { color: #f1f5f9; }
.ml-stat { color: #64748b; }
.ml-stat-used { color: #a5b4fc; }

/* ── Montage review (step 7) — full layout ─────────────────── */
.montage-step {
  margin: 20px 0 28px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.98) 0%, rgba(8, 12, 22, 0.99) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.montage-hero {
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.65);
  background: linear-gradient(180deg, rgba(30, 58, 95, 0.35) 0%, transparent 100%);
}
.montage-step-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(14, 116, 144, 0.35);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.montage-hero-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f1f5f9;
}
.montage-hero-sub {
  margin: 0;
  max-width: 52rem;
  font-size: 14px;
  line-height: 1.55;
  color: #94a3b8;
}

.montage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 0;
  align-items: stretch;
}
@media (max-width: 900px) {
  .montage-layout { grid-template-columns: 1fr; }
}

/* Step 7: четыре колонки; при узкой карточке — горизонтальный скролл, без схлопывания в один столбец */
.montage-unified-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.montage-unified-layout {
  display: grid;
  box-sizing: border-box;
  min-width: 1100px;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(272px, 1fr) minmax(272px, 1fr);
  grid-template-areas: "result source avatar sub";
  gap: 1px;
  align-items: start;
  background: rgba(51, 65, 85, 0.45);
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}
.montage-u-col {
  min-width: 0;
  background: rgba(15, 23, 42, 0.55);
  padding: 14px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
}
.montage-u-col-result {
  grid-area: result;
}
.montage-u-col-source {
  grid-area: source;
}
.montage-u-col-avatar {
  grid-area: avatar;
}
.montage-u-col-sub {
  grid-area: sub;
}
.montage-u-panel-stack {
  gap: 14px;
}
.montage-u-editor-caption {
  margin: 0 0 4px;
  flex-shrink: 0;
}
.montage-u-col .montage-panel {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.montage-u-col .montage-quick-row {
  flex-direction: column;
  align-items: stretch;
}
.montage-u-col .montage-quick-row .montage-chip {
  width: 100%;
  min-width: 0;
  flex: none;
  box-sizing: border-box;
}
/* Колонка «Результат»: одно видео + кастомная полоса управления (не второй <video>) */
.montage-u-col-result .montage-result-inline-vid {
  display: block;
  width: 100%;
  max-height: min(48vh, 480px);
  border-radius: 12px;
  background: #000;
}
.montage-external-transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 4px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 12px;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.35;
}
.montage-transport-readout {
  font-size: 12px;
  min-width: 8.5em;
  color: #e2e8f0;
}
.montage-main-seek {
  flex: 1 1 200px;
  min-width: 0;
  width: 100%;
  height: 12px;
  cursor: pointer;
  accent-color: #38bdf8;
}
.montage-source-preview-vid {
  max-height: min(48vh, 480px);
  width: 100%;
  pointer-events: none;
}

.montage-col-player {
  padding: 18px 20px 22px;
  border-right: 1px solid rgba(51, 65, 85, 0.5);
}
@media (max-width: 900px) {
  .montage-col-player { border-right: none; border-bottom: 1px solid rgba(51, 65, 85, 0.5); }
}

.montage-player-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.montage-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.montage-video-pane {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.montage-video-caption {
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.01em;
}
@media (max-width: 980px) {
  .montage-compare-grid {
    grid-template-columns: 1fr;
  }
}

.montage-video-stack {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.montage-review-video {
  position: relative;
  z-index: 0;
  width: 100%;
  display: block;
  margin: 0;
  max-height: min(52vh, 520px);
}
.montage-video-stack.montage-draw-on {
  cursor: crosshair;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55), 0 16px 48px rgba(14, 116, 144, 0.35);
}
.montage-video-stack.montage-draw-on .montage-review-video {
  pointer-events: none;
  max-height: min(72vh, 640px);
}
.montage-draw-canvas {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  pointer-events: none;
  box-sizing: border-box;
}
.montage-video-stack.montage-draw-on .montage-draw-canvas { pointer-events: auto; }

.montage-idle-hint {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  z-index: 1;
  pointer-events: none;
  justify-content: center;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.75) 0%, transparent 100%);
}
.montage-idle-hint-inner {
  font-size: 12px;
  color: #cbd5e1;
  text-align: center;
  line-height: 1.4;
  max-width: 26rem;
}

.montage-draw-hint {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.montage-timeline-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.montage-time-readout {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  letter-spacing: 0.02em;
}
.montage-time-readout #montage-cur-time { color: #e2e8f0; }
.montage-time-sep { margin: 0 4px; opacity: 0.5; }
.montage-timeline {
  outline: none;
}
.montage-timeline-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  cursor: pointer;
  overflow: visible;
}
.montage-timeline-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0e7490, #38bdf8);
  pointer-events: none;
  opacity: 0.85;
}
.montage-timeline-markers {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
}
.montage-timeline-marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  background: rgba(99, 102, 241, 0.55);
  border: 1px solid rgba(165, 180, 252, 0.85);
  border-radius: 4px;
  pointer-events: auto;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.montage-timeline-marker:hover {
  background: rgba(129, 140, 248, 0.75);
  transform: scaleY(1.15);
}
.montage-timeline-playhead {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  margin-left: -1.5px;
  background: #f8fafc;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
  pointer-events: none;
  left: 0%;
}
.montage-timeline-caption {
  margin: 0;
  font-size: 11px;
  color: #64748b;
  line-height: 1.35;
}

/* === Player controls bar ============================================ */
.montage-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.55);
  border-radius: 10px;
}
.montage-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(14, 116, 144, 0.22);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.montage-ctrl-btn:hover { background: rgba(14, 116, 144, 0.45); }
.montage-ctrl-btn:active { transform: scale(0.96); }
.montage-ctrl-play { display: inline-block; }
.montage-ctrl-pause { display: none; }
.montage-ctrl-btn.is-playing .montage-ctrl-play { display: none; }
.montage-ctrl-btn.is-playing .montage-ctrl-pause { display: inline-block; }
.montage-ctrl-inpoint, .montage-ctrl-outpoint {
  border-color: rgba(45, 212, 191, 0.38);
  background: rgba(15, 118, 110, 0.2);
  color: #5eead4;
}
.montage-ctrl-inpoint:hover, .montage-ctrl-outpoint:hover {
  background: rgba(15, 118, 110, 0.4);
}
.montage-controls .montage-time-readout { margin-left: auto; margin-right: auto; }

/* === Timeline enhancements ========================================= */
.montage-timeline-track { height: 14px; }

/* Range band (current In..Out selection) */
.montage-timeline-range {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 0%;
  width: 0%;
  background: rgba(56, 189, 248, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.75);
  border-radius: 6px;
  pointer-events: none;
}

/* Saved interval markers on track */
.montage-timeline-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  background: rgba(99, 102, 241, 0.5);
  border: 1px solid rgba(165, 180, 252, 0.85);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.montage-timeline-marker.is-selected {
  background: rgba(236, 72, 153, 0.55);
  border-color: rgba(244, 114, 182, 0.95);
  box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.25);
}

/* Handles */
.montage-timeline-handle {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 28px;
  margin-left: -9px;
  margin-top: -14px;
  border-radius: 5px;
  background: #0ea5e9;
  border: 2px solid #f0f9ff;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.55), 0 0 0 1px rgba(2, 6, 23, 0.8);
  cursor: ew-resize;
  touch-action: none;
  z-index: 3;
}
.montage-timeline-handle:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.montage-timeline-handle::before {
  content: '';
  position: absolute;
  top: 5px; bottom: 5px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(240, 249, 255, 0.75);
  border-radius: 1px;
}
.montage-timeline-handle-in {
  background: #22d3ee;
  border-radius: 5px 1px 1px 5px;
}
.montage-timeline-handle-out {
  background: #38bdf8;
  border-radius: 1px 5px 5px 1px;
}
.montage-handle-bubble {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
  background: rgba(2, 6, 23, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
.montage-timeline-handle:hover .montage-handle-bubble,
.montage-timeline-handle:focus-visible .montage-handle-bubble,
.montage-timeline-handle:active .montage-handle-bubble { opacity: 1; }

.montage-hero-shortcut {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.6;
}
.montage-hero-shortcut kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  line-height: 1.1;
}

/* Pause badge hint over video */
.montage-pause-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 11.5px;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 999px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
  max-width: 90%;
  text-overflow: ellipsis;
  overflow: hidden;
}
.montage-video-stack.montage-paused .montage-pause-badge { opacity: 1; }
.montage-video-stack.montage-paused { cursor: crosshair; box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35), 0 16px 48px rgba(14, 116, 144, 0.3); }
.montage-video-stack.montage-paused .montage-draw-canvas { pointer-events: auto; }

/* Stat grid in sidebar */
.montage-stat-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 4px 0 10px;
  font-size: 13px;
  color: #94a3b8;
}
.montage-stat-grid dt { color: #64748b; font-weight: 500; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.08em; align-self: center; }
.montage-stat-grid dd { margin: 0; color: #e2e8f0; font-variant-numeric: tabular-nums; font-size: 13px; }
.montage-stat-grid dd strong { color: #67e8f9; font-size: 14px; font-weight: 700; }

/* Add button disabled styling */
.montage-btn-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.montage-add-note {
  margin: 4px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #64748b;
}

/* Annotation edit button */
.montage-ann-edit {
  flex: 1;
  min-width: 0;
  display: block;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}
.montage-ann-item.is-selected {
  border-color: rgba(236, 72, 153, 0.55);
  background: rgba(236, 72, 153, 0.08);
}

.montage-col-panel {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(2, 6, 23, 0.35);
}

.montage-panel {
  padding: 16px 16px 14px;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.85);
  background: rgba(15, 23, 42, 0.65);
}
.montage-panel-accent {
  border-color: rgba(45, 212, 191, 0.28);
  background: linear-gradient(165deg, rgba(19, 78, 74, 0.25) 0%, rgba(15, 23, 42, 0.5) 100%);
}
.montage-panel-head { margin-bottom: 10px; }
.montage-panel-kicker {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}
.montage-panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
}
.montage-panel-desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #94a3b8;
}

.montage-time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.montage-field { gap: 6px; }
.montage-field-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}
.montage-field input[type="number"] {
  width: 100%;
  max-width: none;
  padding: 10px 12px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
}
.montage-field-radius { display: flex; flex-direction: column; gap: 6px; }
.montage-field-radius input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #4cc9f0;
}
.montage-field-radius .montage-field-label {
  display: flex; justify-content: space-between; align-items: baseline;
}
.montage-field-radius .montage-field-label span#montage-corner-value,
.montage-field-radius .montage-field-label span#montage-tpl-corner-value {
  color: #bfdbfe; font-variant-numeric: tabular-nums; font-weight: 700;
}

.montage-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.montage-chip {
  flex: 1;
  min-width: 120px;
  background: #0f1d3a;
  color: #93c5fd;
  border: 1px solid #1e3a6e;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.montage-chip:hover {
  background: #172a50;
  border-color: #3b82f6;
  color: #bfdbfe;
}

.montage-draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.montage-btn-draw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #cbd5e1;
  border: 1px solid #475569;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
}
.montage-btn-draw:hover {
  border-color: #64748b;
  color: #f1f5f9;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.montage-btn-draw.active {
  background: linear-gradient(180deg, #164e63 0%, #0c4a6e 100%);
  color: #e0f2fe;
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4), 0 8px 24px rgba(14, 116, 144, 0.35);
}

.montage-btn-clear {
  background: transparent;
  color: #64748b;
  border: 1px dashed #334155;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.montage-btn-clear:hover {
  color: #f87171;
  border-color: #991b1b;
  border-style: solid;
}

.montage-btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(180deg, #115e59 0%, #0d4f4a 100%);
  color: #ccfbf1;
  border: 1px solid #14b8a6;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: box-shadow 0.15s, transform 0.1s;
}
.montage-btn-add:hover {
  box-shadow: 0 6px 22px rgba(20, 184, 166, 0.35);
  transform: translateY(-1px);
}
.montage-btn-add-skip {
  margin-top: 8px;
  background: linear-gradient(180deg, #3f3f46 0%, #27272a 100%);
  color: #f4f4f5;
  border-color: #52525b;
}
.montage-btn-add-skip:hover {
  box-shadow: 0 6px 18px rgba(82, 82, 91, 0.45);
}
.montage-btn-add-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 18px;
  line-height: 1;
}

.montage-mini-steps {
  margin: 0;
  padding: 12px 14px 12px 28px;
  font-size: 12px;
  line-height: 1.55;
  color: #64748b;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px dashed #334155;
}
.montage-mini-steps strong { color: #94a3b8; }

.montage-ann-section {
  margin: 0;
  padding: 16px 22px 20px;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  background: rgba(2, 6, 23, 0.25);
}
.montage-ann-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.montage-ann-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}
.montage-btn-clear-all {
  background: transparent;
  color: #64748b;
  border: 1px solid #334155;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.montage-btn-clear-all:hover {
  color: #fca5a5;
  border-color: #7f1d1d;
}

.montage-ann-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.montage-ann-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(17, 24, 39, 0.95);
  border-radius: 10px;
  border: 1px solid #334155;
  transition: border-color 0.15s;
}
.montage-ann-item:hover {
  border-color: #475569;
}
.montage-ann-item-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.montage-ann-time { font-size: 14px; font-weight: 700; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.montage-ann-box { font-size: 11px; color: #64748b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.montage-rm-btn {
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.8);
  color: #94a3b8;
  border: 1px solid #334155;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.montage-rm-btn:hover {
  color: #fecaca;
  border-color: #b91c1c;
}

.montage-foot {
  padding: 18px 22px 22px;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  background: rgba(2, 6, 23, 0.4);
}
.montage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.montage-form-approve { display: inline; margin: 0; }
.montage-btn-approve {
  padding: 12px 22px !important;
  border-radius: 12px !important;
  font-size: 15px !important;
}
.montage-foot-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}
.montage-redo-status {
  margin-top: 10px !important;
}

.montage-btn-redo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #312e81 0%, #1e1b4b 100%);
  color: #c7d2fe;
  border: 1px solid #4f46e5;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.15s, opacity 0.15s;
}
.montage-btn-redo:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.45);
}
.montage-btn-redo:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.montage-sub-frame-stack {
  border-color: rgba(251, 191, 36, 0.45);
}

.montage-frame-panel {
  margin-bottom: 12px;
}
.montage-frame-stack {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(51, 65, 85, 0.8);
  background: #020617;
}
.montage-frame-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}
.montage-frame-hint {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #bae6fd;
  font-size: 11px;
  line-height: 1.35;
}
.montage-frame-controls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.montage-frame-controls .montage-field {
  width: 100%;
  min-width: 0;
}
.montage-frame-controls .montage-chip {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: none;
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
}
.montage-range-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.montage-range-wrap input[type=\"range\"] {
  width: 100%;
}
.montage-ann-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.montage-ann-kind {
  color: #fde68a;
  font-weight: 700;
}
.btn-small {
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.7);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  cursor: pointer;
}
.btn-small:hover {
  border-color: #0ea5e9;
  color: #bae6fd;
}

.tpl-editor-wrap {
  border: 1px solid #334155;
  border-radius: 12px;
  background: #020617;
  padding: 8px;
}
.tpl-canvas {
  width: 100%;
  max-width: 720px;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  cursor: crosshair;
}

/* === Redesigned templates page ============================================= */
.tpl-page { padding-bottom: 40px; }
.tpl-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.tpl-title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, #f0f9ff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tpl-sub { color: #94a3b8; max-width: 760px; line-height: 1.5; margin: 0; }
.tpl-stats-badge {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.35);
  color: #bfe7f5;
}
.tpl-stats-badge strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.tpl-flash {
  padding: 10px 14px; border-radius: 10px;
  background: rgba(34, 197, 94, 0.10); color: #d1fae5;
  border: 1px solid rgba(34, 197, 94, 0.35);
  font-size: 14px; margin: 0 0 18px;
}
.tpl-layout {
  display: grid;
  grid-template-columns: minmax(380px, 1.05fr) minmax(380px, 1fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 1100px) { .tpl-layout { grid-template-columns: 1fr; } }

.tpl-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(8, 13, 28, 0.96) 100%);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.tpl-card-head { margin-bottom: 14px; }
.tpl-card-title { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.tpl-card-sub { margin: 0; color: #94a3b8; font-size: 13px; line-height: 1.5; }

.tpl-form { display: flex; flex-direction: column; gap: 14px; }
.tpl-field { display: flex; flex-direction: column; gap: 6px; }
.tpl-field-label { font-size: 12px; font-weight: 700; color: #cbd5e1; text-transform: none; letter-spacing: 0.01em; }
.tpl-field-label small { color: #64748b; font-weight: 500; margin-left: 4px; }
.tpl-field input, .tpl-field textarea, .tpl-field select {
  width: 100%;
  background: #0b1220;
  border: 1px solid #1f2c4a;
  color: #e8ecf1;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.tpl-field input:focus, .tpl-field textarea:focus, .tpl-field select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}
.tpl-field input[type="range"] {
  padding: 0; background: transparent; border: none; accent-color: #22d3ee;
}
.tpl-field-meta { color: #64748b; font-size: 12px; }

.tpl-field-file .tpl-file-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 18px;
  border: 1px dashed #334155; border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.tpl-field-file .tpl-file-zone:hover,
.tpl-field-file .tpl-file-zone.is-drag { border-color: #3b82f6; background: rgba(15, 23, 42, 0.9); }
.tpl-field-file .tpl-file-ico { font-size: 22px; color: #38bdf8; }
.tpl-field-file .tpl-file-text { color: #cbd5e1; font-size: 13px; text-align: center; }
.tpl-field-file input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.tpl-editor {
  border: 1px solid #1f2c4a; border-radius: 14px;
  background: rgba(2, 6, 23, 0.6);
  overflow: hidden;
}
.tpl-editor-tabs {
  display: flex; gap: 4px;
  padding: 8px;
  border-bottom: 1px solid #1f2c4a;
  background: rgba(2, 6, 23, 0.6);
}
.tpl-tab {
  flex: 1;
  background: transparent; color: #94a3b8;
  border: 1px solid transparent; padding: 8px 12px;
  border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.tpl-tab:hover { background: rgba(15, 23, 42, 0.85); color: #cbd5e1; }
.tpl-tab.is-active {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.4);
  color: #67e8f9;
}
.tpl-tab small { color: inherit; opacity: 0.7; font-weight: 500; margin-left: 4px; }

.tpl-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr);
  gap: 14px;
  padding: 14px;
}
@media (max-width: 820px) { .tpl-editor-body { grid-template-columns: 1fr; } }
.tpl-canvas-wrap {
  position: relative;
  background: #020617;
  border: 1px solid #1f2c4a;
  border-radius: 12px;
  padding: 6px;
}
.tpl-canvas-hint { color: #64748b; font-size: 12px; margin: 8px 4px 0; line-height: 1.5; }
.tpl-editor-side { display: flex; flex-direction: column; gap: 12px; }
.tpl-editor-side > [data-tab-panel] { display: flex; flex-direction: column; gap: 10px; }

.tpl-chip {
  background: rgba(15, 29, 58, 0.85); color: #93c5fd;
  border: 1px solid #1e3a6e; padding: 9px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.tpl-chip:hover { background: rgba(23, 42, 80, 0.95); border-color: #3b82f6; color: #bfdbfe; }
.tpl-form-actions { display: flex; justify-content: flex-end; }
.tpl-btn-primary {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  border: 1px solid #1e3a8a;
  padding: 11px 22px; border-radius: 11px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: opacity .15s, transform .12s;
}
.tpl-btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.tpl-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.tpl-btn-ghost {
  background: transparent; color: #93c5fd;
  border: 1px solid #1e3a6e; padding: 8px 14px; border-radius: 10px;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.tpl-btn-ghost:hover { background: rgba(15, 29, 58, 0.85); }
.tpl-btn-danger {
  background: rgba(220, 38, 38, 0.12); color: #fecaca;
  border: 1px solid rgba(220, 38, 38, 0.4);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer;
}
.tpl-btn-danger:hover { background: rgba(220, 38, 38, 0.22); }

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.tpl-tile {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .15s, transform .12s;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0;
  grid-template-columns: none !important;
}
.tpl-tile * { box-sizing: border-box; }
.tpl-tile .tpl-rename-form input[type="text"],
.tpl-tile .tpl-script-form textarea,
.tpl-tile .tpl-script-form input,
.tpl-tile .tpl-rename-form textarea {
  width: 100%;
  max-width: 100%;
  resize: vertical;
}
.tpl-tile .tpl-script-form textarea { min-height: 70px; }
.tpl-tile .tpl-tile-details form { width: 100%; }
.tpl-tile .tpl-tile-meta code { word-break: break-all; max-width: 100%; }
.tpl-tile:hover { border-color: rgba(56, 189, 248, 0.6); transform: translateY(-1px); }
.tpl-tile-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0; border: none;
  background: #020617;
  cursor: zoom-in;
  overflow: hidden;
}
.tpl-tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-tile-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.6) 100%);
  pointer-events: none;
}
.tpl-tile-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.tpl-tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tpl-tile-title { font-size: 14px; font-weight: 700; color: #e2e8f0; }
.tpl-tile-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.tpl-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(34, 211, 238, 0.12); color: #67e8f9; border: 1px solid rgba(34, 211, 238, 0.32);
  font-weight: 600;
}
.tpl-badge-sub { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border-color: rgba(251, 191, 36, 0.32); }
.tpl-badge-corner { background: rgba(139, 92, 246, 0.12); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.32); }
.tpl-badge-script { background: rgba(34, 197, 94, 0.12); color: #86efac; border-color: rgba(34, 197, 94, 0.32); }
.tpl-tile-meta { color: #94a3b8; font-size: 11px; display: flex; flex-direction: column; gap: 2px; }
.tpl-tile-meta code { background: rgba(15, 23, 42, 0.6); padding: 2px 6px; border-radius: 6px; color: #cbd5e1; font-size: 11px; }
.tpl-tile-details { margin-top: 4px; }
.tpl-tile-details summary {
  cursor: pointer; color: #93c5fd; font-size: 13px; font-weight: 600;
  padding: 6px 8px; border-radius: 8px;
  background: rgba(15, 29, 58, 0.6);
  user-select: none;
}
.tpl-tile-details[open] summary { background: rgba(15, 29, 58, 0.95); }
.tpl-tile-details form { margin-top: 8px; }
.tpl-tile-details .tpl-field { margin-bottom: 8px; }
.tpl-rename-form, .tpl-script-form, .tpl-delete-form { display: flex; flex-direction: column; gap: 8px; }
.tpl-rename-form button, .tpl-script-form button { align-self: flex-start; }
.tpl-empty {
  color: #94a3b8; font-size: 14px; padding: 20px; text-align: center;
  border: 1px dashed #334155; border-radius: 12px;
}
.tpl-preview {
  margin-top: 16px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.7);
  padding: 14px;
}
.tpl-preview-head { margin-bottom: 10px; color: #67e8f9; font-size: 14px; font-weight: 700; }

/* Кнопка «Редактировать рамки» внутри карточки шаблона */
.tpl-edit-open-btn {
  align-self: stretch;
  border-color: rgba(34, 211, 238, 0.45);
  color: #67e8f9;
}
.tpl-edit-open-btn:hover {
  background: rgba(34, 211, 238, 0.10);
  border-color: rgba(34, 211, 238, 0.75);
}

/* === Модальный редактор рамок шаблона ====================================== */
.tpl-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tpl-modal[hidden] { display: none; }
.tpl-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.tpl-modal-card {
  position: relative;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(8, 13, 28, 0.99) 100%);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
}
.tpl-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.tpl-modal-close {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 14px; line-height: 1;
  transition: background .15s, border-color .15s;
}
.tpl-modal-close:hover {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.45);
  color: #fecaca;
}
.tpl-modal-foot {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.tpl-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
}
.tpl-list-row {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(15, 23, 42, 0.45);
}
.tpl-thumb-btn {
  display: block;
  width: 64px;
  height: 64px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  background: #020617;
  cursor: zoom-in;
  line-height: 0;
  box-shadow: none;
}
.tpl-thumb-btn:focus {
  outline: none;
}
.tpl-thumb-btn:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}
.tpl-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
  border: none;
}
.tpl-rename-form {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.tpl-rename-form input {
  min-width: 220px;
}
.tpl-inline-preview {
  margin-top: 12px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.5);
  padding: 10px;
}
.tpl-inline-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
}
.tpl-preview-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.tpl-preview-wrap img {
  width: 100%;
  display: block;
}
#tpl-preview-rect,
#tpl-inline-rect {
  position: absolute;
  border: 2px solid #22d3ee;
  background: rgba(34, 211, 238, 0.14);
  z-index: 3;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.42);
  pointer-events: none;
}

.admin-heygen-consent-help {
  margin: 14px 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.65);
}
.admin-heygen-consent-help summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: #e2e8f0;
  list-style-position: outside;
}
.admin-heygen-consent-body {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
}
.admin-heygen-consent-body ol { margin: 8px 0 8px 1.1rem; padding: 0; }
.admin-heygen-consent-body li { margin-bottom: 6px; }
.admin-heygen-consent-body a { color: #93c5fd; }

.admin-heygen-create { margin-bottom: 8px; }
.admin-heygen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.admin-heygen-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.admin-step-card {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #243041;
  background: #0b1220;
}
.admin-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.admin-step-head h3 {
  margin: 0;
  font-size: 15px;
}
.admin-step-num {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #334155;
  background: #172554;
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 700;
}
.admin-heygen-form label { margin-bottom: 8px; }
.admin-verif-create-form { margin-top: 6px; }
.admin-verif-auto {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #334155;
}
.admin-compact-details {
  margin-top: 8px;
  border: 1px dashed #334155;
  border-radius: 10px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.4);
}
.admin-compact-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #cbd5e1;
}
.admin-verif-table { margin-top: 8px; }
.admin-verif-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.admin-verif-inline input[type="url"] { min-width: 220px; }
.admin-verify-step {
  margin: 8px 0 2px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.7);
}
.admin-verify-step-title { margin: 0 0 8px; font-size: 14px; color: #e2e8f0; }
.admin-heygen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) {
  .admin-heygen-grid { grid-template-columns: 1fr; }
}
.admin-heygen-sub { margin: 18px 0 8px; font-size: 15px; }
.admin-heygen-table { width: 100%; margin-top: 8px; font-size: 13px; }
.admin-heygen-table th, .admin-heygen-table td { vertical-align: top; }

.admin-consent-recorder {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.55);
}
.admin-consent-recorder-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.admin-consent-recorder-title { font-weight: 800; font-size: 13px; color: #e2e8f0; }
.admin-consent-recorder-sub { font-size: 12px; color: #94a3b8; line-height: 1.4; }
.admin-consent-recorder-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0; }
.admin-consent-preview {
  width: 100%;
  max-height: 260px;
  border-radius: 10px;
  background: #000;
  border: 1px solid #1f2937;
}

/* ═══ Admin: HeyGen avatar creator ═══ */
.hg-create-card {
  margin-bottom: 12px;
  border: 1px solid #1e293b;
  background: linear-gradient(165deg, rgba(79, 70, 229, 0.1) 0%, #0b1220 38%, #0a0f1a 100%);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
}
.hg-create-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.hg-create-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #818cf8;
}
.hg-create-title { margin: 0 0 6px; }
.hg-create-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #94a3b8;
  max-width: 640px;
}
.hg-create-hint { margin: 0 0 14px; }
.hg-create-hint-warn { color: #fcd34d; }
.hg-create-form { margin-top: 4px; }
.hg-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 720px) {
  .hg-create-grid { grid-template-columns: 1fr; }
}
.hg-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.hg-field-label { font-size: 12px; font-weight: 700; color: #cbd5e1; }
.hg-field input,
.hg-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
}
.hg-create-empty-users { margin: 0 0 12px; color: #fbbf24; }
.hg-upload-zone {
  border: 2px dashed #334155;
  border-radius: 14px;
  padding: 28px 18px;
  text-align: center;
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
}
.hg-upload-zone:hover,
.hg-upload-zone.dragover {
  border-color: #6366f1;
  background: rgba(79, 70, 229, 0.08);
}
.hg-upload-zone.has-file {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.06);
}
.hg-upload-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 8px;
  opacity: .85;
}
.hg-upload-title { margin: 0 0 4px; font-weight: 700; color: #e2e8f0; }
.hg-upload-sub { margin: 0 0 8px; font-size: 12px; color: #94a3b8; }
.hg-upload-file { margin: 0; font-size: 13px; color: #93c5fd; word-break: break-all; }
.hg-create-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}
.hg-create-submit {
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}
.hg-create-submit:hover:not(:disabled) { filter: brightness(1.06); }
.hg-create-submit:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.hg-progress-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid #243041;
  background: #0b1220;
}
.hg-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.hg-progress-title { font-weight: 700; color: #e2e8f0; }
.hg-progress-pct { font-weight: 800; color: #a5b4fc; font-size: 14px; }
.hg-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #15213c;
  overflow: hidden;
}
.hg-progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  transition: width .35s ease;
}
.hg-progress-bar.is-failed .hg-progress-bar-fill {
  background: linear-gradient(90deg, #f87171, #ef4444);
}
.hg-progress-message {
  margin: 10px 0 12px;
  font-size: 13px;
  color: #cbd5e1;
}
.hg-progress-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.hg-progress-steps li {
  position: relative;
  padding: 8px 10px 8px 34px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: rgba(15, 23, 42, 0.5);
  font-size: 12px;
  color: #64748b;
}
.hg-progress-steps li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  border: 2px solid #475569;
  background: transparent;
}
.hg-progress-steps li.active {
  color: #e2e8f0;
  border-color: #4338ca;
  background: rgba(67, 56, 202, 0.12);
}
.hg-progress-steps li.active::before {
  border-color: #818cf8;
  background: #818cf8;
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2);
}
.hg-progress-steps li.done {
  color: #86efac;
  border-color: #166534;
  background: rgba(22, 101, 52, 0.12);
}
.hg-progress-steps li.done::before {
  border-color: #22c55e;
  background: #22c55e;
}
.hg-progress-steps li.failed {
  color: #fecaca;
  border-color: #991b1b;
  background: rgba(153, 27, 27, 0.15);
}
.hg-progress-steps li.failed::before {
  border-color: #ef4444;
  background: #ef4444;
}
.hg-progress-extra { margin-top: 12px; }
.hg-progress-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.25);
  border: 1px solid #991b1b;
  color: #fecaca;
  font-size: 13px;
}
.hg-jobs-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid #243041; }
.hg-jobs-title { margin: 0 0 10px; font-size: 15px; color: #e2e8f0; }
.hg-jobs-list { display: grid; gap: 10px; }
.hg-job-row {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #243041;
  background: rgba(15, 23, 42, 0.45);
}
.hg-job-row.is-done { border-color: #166534; }
.hg-job-row.is-failed { border-color: #991b1b; }
.hg-job-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.hg-job-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hg-job-pill {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #1e293b;
  color: #cbd5e1;
}
.hg-job-id { font-size: 11px; word-break: break-all; }
.hg-job-error { margin: 0; font-size: 12px; color: #fca5a5; }
.hg-job-consent { font-size: 12px; }

@media (max-width: 520px) {
  .st-title { font-size: 22px; }
  .offers-grid { grid-template-columns: 1fr; }
  .offer-library-grid { grid-template-columns: 1fr; }
  .montage-hero { padding: 18px 16px 14px; }
  .montage-col-player,
  .montage-col-panel,
  .montage-u-col,
  .montage-ann-section,
  .montage-foot { padding-left: 16px; padding-right: 16px; }
  .montage-time-grid { grid-template-columns: 1fr; }
}

/* ═══ Admin: Выкладка YouTube (как дашборд / медиатека) ═══ */
.pub-page { max-width: 1120px; margin-left: auto; margin-right: auto; }
.pub-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 22px 22px 20px;
  border-radius: 16px;
  border: 1px solid #1e293b;
  background: linear-gradient(145deg, rgba(79, 70, 229, 0.14) 0%, #0f172a 42%, #0b1020 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.pub-hero-slim { padding: 18px 20px; margin-bottom: 16px; }
.pub-hero-main { min-width: 0; flex: 1; }
.pub-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #818cf8;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pub-kicker-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.65);
}
.pub-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #f8fafc;
  line-height: 1.15;
}
.pub-hero .pub-sub {
  margin: 8px 0 0;
  max-width: 52ch;
  font-size: 14px;
  line-height: 1.5;
  color: #94a3b8;
}
.pub-callout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.pub-callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #273449;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s, transform 0.15s;
}
.pub-callout:hover {
  border-color: #4338ca;
  transform: translateY(-1px);
}
.pub-callout-ico {
  font-size: 22px;
  line-height: 1.2;
  flex-shrink: 0;
}
.pub-callout strong { color: #e2e8f0; font-size: 13px; }
.pub-callout-p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #94a3b8;
}
.pub-callout-p a { color: #a5b4fc; }
.pub-callout-p a:hover { text-decoration: underline; }

.pub-form-studio .pub-studio-intro { margin-bottom: 4px; }
.pub-studio-lead { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: #94a3b8; }
.pub-fieldset {
  border: none;
  margin: 0 0 8px;
  padding: 16px 0 4px;
  border-top: 1px solid #1e293b;
}
.pub-fieldset:first-of-type {
  border-top: none;
  padding-top: 0;
}
.pub-legend {
  padding: 0;
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #818cf8;
}
.pub-form-grid .pub-field-span2 { grid-column: 1 / -1; }
.pub-field-note {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.45;
}
.pub-field-note a { color: #818cf8; }
.pub-field-note a:hover { text-decoration: underline; }
.pub-hint-inline { font-weight: 500; color: #64748b; font-size: 12px; }
.pub-select-lg { font-size: 14px; }
.pub-check-card {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #273449;
  background: rgba(30, 41, 59, 0.4);
  margin-top: 10px;
}
.pub-actions-sticky {
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid #1e293b;
}
.pub-btn-lg { padding: 11px 20px; font-size: 15px; font-weight: 700; }
.pub-btn-ico { margin-right: 6px; }
.pub-actions-hint { display: inline-block; font-size: 12px; color: #64748b; max-width: 42ch; vertical-align: middle; margin-left: 10px; line-height: 1.4; }
@media (max-width: 560px) {
  .pub-actions-hint { display: block; margin-left: 0; margin-top: 8px; }
}
.pub-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.pub-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pub-ico { flex-shrink: 0; opacity: 0.95; }
.pub-flash { margin-bottom: 16px; }

.pub-stat-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.65);
}
.pub-stat { display: flex; flex-direction: column; gap: 2px; }
.pub-stat-val { font-size: 22px; font-weight: 800; color: #e0e7ff; font-variant-numeric: tabular-nums; }
.pub-stat-lbl { font-size: 12px; color: #64748b; }
.pub-stat-div { width: 1px; height: 28px; background: #334155; align-self: center; }

.pub-card-sweep {
  margin-bottom: 18px;
  overflow-x: auto;
  background: linear-gradient(155deg, rgba(30, 27, 75, 0.5), rgba(15, 23, 42, 0.94));
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.28);
}
.pub-sweep-head { align-items: flex-start !important; }
.pub-sweep-lead { margin-top: 6px !important; max-width: 70ch; line-height: 1.5; }
.pub-sweep-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  margin-top: 10px !important;
  font-size: 12px;
  color: #94a3b8;
}
.pub-sweep-legend-i {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: -2px;
}
.pub-sweep-legend--multi {
  background: rgba(59, 130, 246, 0.35);
  border: 1px solid rgba(96, 165, 250, 0.45);
}
.pub-sweep-legend--low {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(248, 113, 113, 0.5);
}
.pub-sweep-legend--triple {
  background: rgba(34, 197, 94, 0.32);
  border: 1px solid rgba(52, 211, 153, 0.45);
}
.pub-sweep-legend-mixed-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0 8px 0 12px;
  background: #fbbf24;
  color: #0f172a;
  font-size: 10px;
  font-weight: 900;
  border-radius: 3px;
  vertical-align: middle;
}
.pub-sweep-start { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pub-sweep-progress { margin-top: 16px; }
.pub-sweep-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.pub-sweep-progress-pct { font-size: 18px; font-weight: 800; color: #c7d2fe; font-variant-numeric: tabular-nums; }
.pub-sweep-progress-label { font-size: 13px; color: #94a3b8; min-width: 0; }
.pub-sweep-progress-bar-wrap {
  height: 10px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.85);
  overflow: hidden;
  border: 1px solid rgba(51, 65, 85, 0.65);
}
.pub-sweep-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  transition: width 0.35s ease;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
}
.pub-sweep-err {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  font-size: 14px;
}
.pub-sweep-chart-wrap {
  margin-top: 20px;
  padding: 18px 18px 14px;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: linear-gradient(165deg, rgba(30, 27, 75, 0.45), rgba(15, 23, 42, 0.88));
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
}
.pub-sweep-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 14px;
}
.pub-sweep-chart-title { margin: 0 0 4px !important; }
.pub-sweep-chart-hint { margin: 0 !important; max-width: 58ch; line-height: 1.45; }
.pub-sweep-chart-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(15, 23, 42, 0.72);
  min-width: 120px;
}
.pub-sweep-chart-stat-val {
  font-size: 22px;
  font-weight: 800;
  color: #e0e7ff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.pub-sweep-chart-stat-lbl {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
  line-height: 1.3;
}
.pub-sweep-chart-inner { height: 300px; }
.pub-sweep-resize-hint { margin-top: 4px !important; max-width: 62ch; }
.pub-sweep-fetch-warnings {
  margin-top: 16px;
  margin-bottom: 4px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.42);
  background: linear-gradient(145deg, rgba(120, 53, 15, 0.38), rgba(15, 23, 42, 0.94));
  padding: 14px 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}
.pub-sweep-fetch-warnings-title {
  font-weight: 700;
  font-size: 14px;
  color: #fcd34d;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.pub-sweep-fetch-warnings-list {
  margin: 0;
  padding-left: 1.15em;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.55;
}
.pub-sweep-fetch-warnings-list li { margin-bottom: 6px; }
.pub-sweep-fetch-warnings-list li:last-child { margin-bottom: 0; }
.pub-sweep-fetch-warnings-name { color: #fef9c3; font-weight: 700; }
.pub-sweep-fetch-warnings-err { color: #94a3b8; font-weight: 500; }
.pub-sweep-chart-loading {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed rgba(129, 140, 248, 0.35);
  background: rgba(30, 27, 75, 0.35);
  color: #cbd5e1;
  max-width: 72ch;
}
.pub-sweep-chart-warnings { margin-top: 12px; margin-bottom: 0; }
.pub-sweep-fetch-warnings-foot {
  margin-top: 12px !important;
  margin-bottom: 0 !important;
  color: #a8b8cf !important;
}
.pub-sweep-table-mount { margin-top: 18px; }
.pub-sweep-table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
/* Двойной селектор (.pub-table-scroll.pub-sweep-matrix-wrap) намеренно —
   нужен, чтобы перебить max-height: 240px из .pub-table-scroll, который
   определён ПОЗЖЕ в стилях. Без этой специфики тебя не пускало растягивать
   ниже ~6 строк, даже при resize: both. Дефолтная высота большая (по высоте
   окна), плюс resize: vertical позволяет вручную ужать или растянуть.
   JS дополнительно auto-fit'ит высоту сразу после рендера таблицы. */
.pub-table-scroll.pub-sweep-matrix-wrap,
.pub-sweep-matrix-wrap {
  display: block;
  overflow: auto;
  resize: vertical;
  min-height: 220px;
  height: min(78vh, 900px);
  width: 100%;
  max-height: none !important;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.65);
  background: rgba(8, 12, 24, 0.55);
}
.pub-sweep-matrix {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.pub-sweep-matrix th,
.pub-sweep-matrix td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid rgba(30, 41, 59, 0.85);
  border-right: 1px solid rgba(30, 41, 59, 0.5);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pub-sweep-matrix th:last-child,
.pub-sweep-matrix td:last-child {
  border-right: none;
}
.pub-sweep-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 23, 42, 0.97);
  color: #cbd5e1;
  font-weight: 700;
  backdrop-filter: blur(6px);
}
.pub-sweep-matrix thead .pub-sweep-sticky-acc {
  z-index: 4;
  vertical-align: bottom;
}
.pub-sweep-matrix .pub-sweep-sticky-acc {
  position: sticky;
  left: 0;
  z-index: 3;
  text-align: left !important;
  font-weight: 600;
  color: #f1f5f9;
  background: rgba(15, 23, 42, 0.98);
  min-width: 140px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 4px 0 14px rgba(0, 0, 0, 0.2);
}
.pub-sweep-matrix tbody tr:hover .pub-sweep-sticky-acc {
  background: rgba(30, 27, 75, 0.98);
}
.pub-sweep-matrix tbody tr:hover td.pub-sweep-td-empty:not(.pub-sweep-sticky-acc),
.pub-sweep-matrix tbody tr:hover td.pub-sweep-td-data:not(.pub-sweep-td-multi):not(.pub-sweep-td-triple):not(.pub-sweep-sticky-acc) {
  background: rgba(49, 46, 129, 0.08);
}
.pub-sweep-matrix tbody tr:hover td.pub-sweep-td-multi:not(.pub-sweep-td-triple):not(.pub-sweep-sticky-acc) {
  background: rgba(59, 130, 246, 0.28) !important;
}
.pub-sweep-matrix tbody tr:hover td.pub-sweep-td-triple:not(.pub-sweep-sticky-acc) {
  background: rgba(34, 197, 94, 0.3) !important;
}
.pub-sweep-td-empty { color: #475569; text-align: right; }
.pub-sweep-td-data {
  position: relative;
  vertical-align: middle;
  padding-right: 16px !important;
}
.pub-sweep-td-multi { background: rgba(59, 130, 246, 0.22) !important; }
.pub-sweep-td-triple { background: rgba(34, 197, 94, 0.22) !important; }
.pub-sweep-td-low { box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.52); color: #fecaca; }
.pub-sweep-td-multi.pub-sweep-td-low {
  background: rgba(59, 130, 246, 0.16) !important;
  box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.6);
}
.pub-sweep-td-triple.pub-sweep-td-low {
  background: rgba(34, 197, 94, 0.14) !important;
  box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.55);
}
.pub-sweep-mixed-flag {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 17px;
  height: 17px;
  line-height: 15px;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  color: #0f172a;
  background: #fbbf24;
  clip-path: polygon(100% 0, 100% 100%, 0 0);
  pointer-events: none;
  padding-left: 5px;
  box-sizing: border-box;
}
.pub-sweep-cell-popover {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 220px;
  max-width: min(360px, 92vw);
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 10px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
  z-index: 60;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: #e2e8f0;
  white-space: normal;
  line-height: 1.45;
}
.pub-sweep-cell-popover-line + .pub-sweep-cell-popover-line {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(51, 65, 85, 0.65);
}
.pub-sweep-td-mixed:hover .pub-sweep-cell-popover {
  display: block;
}
.pub-sweep-td-mixed:hover {
  z-index: 25;
}
.pub-sweep-matrix tfoot .pub-sweep-matrix-foot td {
  position: sticky;
  bottom: 0;
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 2px solid rgba(99, 102, 241, 0.45);
  background: rgba(30, 41, 59, 0.97);
  color: #e2e8f0;
  font-weight: 800;
  backdrop-filter: blur(4px);
}
.pub-sweep-matrix tfoot .pub-sweep-matrix-foot .pub-sweep-sticky-acc {
  z-index: 5;
  color: #c7d2fe;
  background: rgba(30, 41, 59, 0.98);
}
.pub-sweep-matrix tfoot .pub-sweep-matrix-foot .pub-sweep-matrix-foot-cell {
  background: rgba(30, 41, 59, 0.97);
}
.pub-sweep-sticky-total {
  position: sticky;
  right: 0;
  z-index: 3;
  text-align: right !important;
  font-weight: 800;
  color: #e0e7ff !important;
  border-left: 1px solid rgba(99, 102, 241, 0.45) !important;
  box-shadow: -8px 0 16px rgba(8, 12, 24, 0.55);
}
.pub-sweep-sticky-total-head {
  background: linear-gradient(180deg, rgba(49, 46, 129, 0.95), rgba(15, 23, 42, 0.97)) !important;
  z-index: 5;
  min-width: 88px;
}
.pub-sweep-sticky-total-cell {
  background: rgba(15, 23, 42, 0.96) !important;
  min-width: 88px;
}
.pub-sweep-matrix tbody tr:hover .pub-sweep-sticky-total-cell {
  background: rgba(30, 27, 75, 0.92) !important;
}
.pub-sweep-sticky-total-foot {
  background: linear-gradient(180deg, rgba(49, 46, 129, 0.88), rgba(15, 23, 42, 0.98)) !important;
  z-index: 4;
  font-size: 13px;
  color: #c7d2fe !important;
}
.pub-sweep-matrix thead .pub-sweep-sticky-total-head {
  z-index: 6;
}
.pub-sweep-matrix tfoot .pub-sweep-sticky-total-foot {
  z-index: 6;
}

.pub-main-grid {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 300px);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.pub-card-title-tight { margin-bottom: 6px; }
.pub-card-head { margin-bottom: 12px; }
.pub-card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.pub-req { font-size: 11px; font-weight: 700; color: #fb923c; margin-left: 4px; }
.pub-form-actions { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pub-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) {
  .pub-form-grid { grid-template-columns: 1fr; }
  .pub-main-grid { grid-template-columns: 1fr; }
}

.pub-card-hint {
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
}
.pub-aside-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #cbd5e1;
}
.pub-step-list {
  margin: 0 0 16px;
  padding-left: 18px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.55;
}
.pub-step-list li { margin-bottom: 8px; }
.pub-step-list strong { color: #e2e8f0; }
.pub-hint-box {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #312e81;
  background: rgba(49, 46, 129, 0.2);
}
.pub-hint-ico { font-size: 18px; line-height: 1.2; }
.pub-hint-p { margin: 4px 0 0; font-size: 12px; color: #94a3b8; line-height: 1.45; }
.pub-hint-box strong { color: #c7d2fe; font-size: 13px; }

.pub-card-accounts { margin-bottom: 16px; }
.pub-acc-list { display: flex; flex-direction: column; gap: 10px; }
.pub-acc {
  border-radius: 14px;
  border: 1px solid #1e293b;
  background: #0f172a;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.pub-acc[open] {
  border-color: #4338ca;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25), 0 12px 40px rgba(0, 0, 0, 0.35);
}
.pub-acc-summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 12px 14px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.pub-acc-summary::-webkit-details-marker { display: none; }
.pub-acc-chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(-45deg);
  transition: transform 0.2s;
  margin-top: -2px;
}
.pub-acc[open] .pub-acc-chevron { transform: rotate(45deg); margin-top: 2px; }
.pub-acc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
  color: #a5b4fc;
  border: 1px solid #3730a3;
}
.pub-acc-titles { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pub-acc-name { font-weight: 700; font-size: 15px; color: #f1f5f9; }
.pub-acc-channel { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-acc-channel-muted { color: #64748b; font-style: italic; }
.pub-acc-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pub-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
}
.pub-pill-muted { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pub-acc-body {
  padding: 0 16px 18px;
  border-top: 1px solid #1e293b;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.4) 0%, #0b1120 100%);
}
.pub-acc-body .pub-sub {
  padding: 16px 0 18px;
  border-left: 3px solid #4f46e5;
  padding-left: 16px;
  margin-left: 4px;
}
.pub-acc-body .pub-sub + .pub-sub { border-top: 1px solid #1e293b; margin-top: 0; padding-top: 18px; }
.pub-sub-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pub-sub-icon { font-size: 16px; line-height: 1; }
.pub-sub-title { margin: 0; font-size: 14px; font-weight: 700; color: #e2e8f0; }
.pub-sub-desc { margin: 0 0 12px !important; }
.pub-code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #1e293b;
  color: #c4b5fd;
}

.pub-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  margin-top: 4px;
}
.pub-check input { margin-top: 3px; accent-color: #6366f1; width: 16px; height: 16px; flex-shrink: 0; }

.pub-sub-chart .pub-chart-wrap {
  position: relative;
  height: 220px;
  margin: 12px 0 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: radial-gradient(ellipse 80% 80% at 50% 0%, rgba(99, 102, 241, 0.08), transparent 55%), #080c18;
}
.pub-chart-canvas { width: 100% !important; height: 100% !important; }

.pub-analytics-mount { margin-top: 16px; }
.pub-analytics-block { margin-top: 18px; }
.pub-analytics-block:first-child { margin-top: 4px; }
.pub-analytics-table-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}
.pub-table-scroll {
  overflow: auto;
  max-height: 240px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: rgba(8, 12, 24, 0.55);
}
.pub-table-scroll--tall { max-height: 380px; }
.pub-analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #cbd5e1;
}
.pub-analytics-table th,
.pub-analytics-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid #1e293b;
  vertical-align: top;
}
.pub-analytics-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0f172a;
  font-weight: 700;
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pub-analytics-table tbody tr:hover { background: rgba(49, 46, 129, 0.15); }
.pub-analytics-table a { color: #a5b4fc; text-decoration: none; word-break: break-all; }
.pub-analytics-table a:hover { text-decoration: underline; }
.pub-analytics-cell-title {
  max-width: 280px;
  word-break: break-word;
  line-height: 1.35;
}
@media (max-width: 720px) {
  .pub-analytics-cell-title { max-width: 160px; }
}

.pub-acc-danger-zone {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed #334155;
}
.pub-del-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pub-del-hint { margin: 0 !important; }

.pub-empty {
  text-align: center;
  padding: 36px 20px 28px;
  border-radius: 14px;
  border: 1px dashed #334155;
  background: rgba(15, 23, 42, 0.5);
}
.pub-empty-tight { padding: 28px 18px; }
.pub-empty-icon { display: flex; justify-content: center; margin-bottom: 10px; color: #475569; }
.pub-empty-title { margin: 0 0 6px; font-weight: 700; font-size: 16px; color: #e2e8f0; }

.pub-card-queue .pub-queue-list { display: flex; flex-direction: column; gap: 12px; }
.pub-queue-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #1e293b;
  background: linear-gradient(165deg, rgba(30, 27, 75, 0.12) 0%, #0f172a 48%, #0c1220 100%);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.pub-queue-row:hover {
  border-color: #334155;
  background: linear-gradient(165deg, rgba(49, 46, 129, 0.18) 0%, #121c31 50%, #0f172a 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.pub-queue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-bottom: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid #1e293b;
}
.pub-queue-head-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  flex: 1;
  min-width: 0;
}
.pub-queue-head-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  font-size: 12px;
  flex-shrink: 0;
}
.pub-queue-head-links > * + * {
  margin-left: 8px;
  padding-left: 10px;
  border-left: 1px solid #334155;
}
.pub-queue-watch {
  font-weight: 700;
  color: #38bdf8 !important;
  text-decoration: none !important;
}
.pub-queue-watch:hover { text-decoration: underline !important; color: #7dd3fc !important; }
.pub-queue-channel {
  display: flex;
  align-items: flex-start;
  gap: 10px 12px;
  padding: 11px 14px;
  margin: 0;
  border-radius: 11px;
  border: 1px solid #243045;
  background: rgba(15, 23, 42, 0.75);
}
.pub-queue-channel-ico { font-size: 18px; line-height: 1.25; opacity: 0.88; flex-shrink: 0; }
.pub-queue-channel-text { min-width: 0; }
.pub-queue-channel-name { font-weight: 700; font-size: 14px; color: #f1f5f9; margin: 0 0 3px; letter-spacing: -0.02em; }
.pub-queue-channel-sub { font-size: 12px; color: #94a3b8; line-height: 1.4; word-break: break-word; }
.pub-queue-times {
  margin: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 11px;
  border: 1px solid #1e293b;
  background: rgba(8, 12, 22, 0.55);
}
.pub-queue-time-row {
  display: grid;
  grid-template-columns: minmax(100px, 132px) minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 2px;
  align-items: start;
  margin: 0;
}
@media (max-width: 440px) {
  .pub-queue-time-row {
    grid-template-columns: 1fr;
  }
  .pub-queue-time-k {
    padding-top: 0;
    margin-bottom: 2px;
  }
}
.pub-queue-time-k {
  margin: 0;
  padding-top: 2px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  line-height: 1.35;
}
.pub-queue-time-v {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  min-width: 0;
  word-break: break-word;
}
.pub-queue-time-row-muted .pub-queue-time-v,
.pub-ltime.pub-ltime-muted { color: #94a3b8; font-weight: 500; }
.pub-queue-utc-fallback { font-size: 12px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.pub-queue-job {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #818cf8;
  text-decoration: none;
  word-break: break-all;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 520px) {
  .pub-queue-job {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
    flex: 1 1 auto;
    max-width: min(420px, 55vw);
  }
}
.pub-queue-job:hover { text-decoration: underline; color: #a5b4fc; }
.pub-queue-when { color: #64748b; }
.pub-queue-global-hint {
  margin: 0 0 14px !important;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #273449;
  background: rgba(30, 41, 59, 0.35);
  line-height: 1.5;
}
.pub-queue-vid-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.pub-queue-studio {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #818cf8;
  text-decoration: none;
}
.pub-queue-studio:hover { text-decoration: underline; color: #a5b4fc; }
.pub-queue-privacy { font-size: 11px; color: #94a3b8; text-transform: lowercase; }
.pub-queue-vid {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: #38bdf8;
  text-decoration: none;
}
.pub-queue-vid:hover { text-decoration: underline; }
.pub-queue-dash { color: #475569; }
.pub-queue-err {
  margin: 8px 0 0;
  font-size: 12px;
  color: #fca5a5;
  line-height: 1.4;
}
.pub-pill-status { text-transform: lowercase; }
.pub-pill--scheduled { border-color: #854d0e; background: rgba(120, 53, 15, 0.35); color: #fcd34d; }
.pub-pill--uploading { border-color: #1e3a8a; background: rgba(30, 58, 138, 0.45); color: #93c5fd; }
.pub-pill--done { border-color: #166534; background: rgba(22, 101, 52, 0.35); color: #86efac; }
.pub-pill--failed { border-color: #991b1b; background: rgba(127, 29, 29, 0.35); color: #fecaca; }
.pub-pill--cancelled { border-color: #475569; background: rgba(51, 65, 85, 0.45); color: #cbd5e1; }

.pub-queue-actions {
  display: flex;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed #243045;
}
.pub-queue-cancel-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
}
.pub-queue-cancel-hint { margin: 0 !important; }

/* Compose */
.pub-crumb-link { color: #a5b4fc; text-decoration: none; font-weight: 700; letter-spacing: 0.06em; }
.pub-crumb-link:hover { text-decoration: underline; color: #c7d2fe; }
.pub-crumb-sep { color: #475569; margin: 0 6px; font-weight: 400; }
.pub-compose-steps {
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #1e293b;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.25) 0%, rgba(15, 23, 42, 0.9) 100%);
}
.pub-step-track {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  flex-wrap: wrap;
  max-width: 560px;
}
.pub-step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pub-step-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}
.pub-step-node:has(.pub-step-done) .pub-step-label {
  color: #a5b4fc;
}
.pub-step-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  border: 2px solid #334155;
  background: #1e293b;
  color: #64748b;
}
.pub-step-dot.pub-step-done {
  border-color: #818cf8;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.35);
}
.pub-step-line {
  flex: 1;
  min-width: 24px;
  max-width: 72px;
  height: 3px;
  border-radius: 999px;
  background: #273449;
  margin: 0 6px;
  margin-bottom: 26px;
  align-self: center;
}
.pub-step-line.pub-step-line-done {
  background: linear-gradient(90deg, #6366f1, #4338ca);
}
.pub-step-hint {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
}

.pub-compose-layout {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 300px);
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .pub-compose-layout { grid-template-columns: 1fr; }
}
.pub-compose-card {
  border: 1px solid #2f3f5a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.32);
  background: linear-gradient(165deg, rgba(67, 56, 202, 0.14) 0%, #0f172a 38%, #080c16 100%);
}
.pub-compose-card-head {
  margin-bottom: 6px;
  padding: 4px 4px 14px;
  border-bottom: 1px solid #1e293b;
}
.pub-compose-card-lead { margin: 8px 0 0 !important; line-height: 1.5; }
.pub-compose-form { padding-top: 4px; }
.pub-compose-field-group {
  padding: 14px 0 16px;
  border-bottom: 1px solid #1e293b;
}
.pub-compose-field-group:last-of-type {
  border-bottom: none;
  padding-bottom: 8px;
}
.pub-compose-group-lbl {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #818cf8;
  margin-bottom: 10px;
}
.pub-time-block-card {
  padding: 14px 14px 10px;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid #273449;
  background: radial-gradient(ellipse 100% 80% at 50% 0%, rgba(99, 102, 241, 0.12), transparent 55%), rgba(8, 12, 24, 0.75);
}
.pub-check-pill {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: rgba(30, 41, 59, 0.55);
}
.pub-select-focus:focus {
  outline: none;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.28);
}
.pub-compose-aside {
  border-radius: 16px;
  border: 1px solid #2f3f5a;
  background: linear-gradient(180deg, #111827 0%, #0a0f1c 100%);
}
.pub-compose-card .pub-compose-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.pub-compose-submit { display: inline-flex; align-items: center; gap: 8px; }
.pub-job-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #312e81;
  background: rgba(49, 46, 129, 0.2);
  margin-bottom: 4px;
}
.pub-job-chip-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #818cf8; }
.pub-job-chip-link code { font-size: 12px; color: #e0e7ff; }
.pub-opt { font-size: 11px; font-weight: 600; color: #64748b; margin-left: 6px; }
.pub-time-block { margin-top: 4px; }
.pub-time-label { display: block; font-size: 13px; font-weight: 600; color: #cbd5e1; margin-bottom: 8px; }
.pub-time-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.pub-datetime { flex: 1; min-width: 200px; max-width: 320px; }
.pub-check-inline { margin: 0; align-items: center; }
.pub-time-hint { margin-top: 8px !important; }

.pub-compose-aside .pub-aside-list {
  margin: 0;
  padding-left: 18px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.55;
}
.pub-compose-aside .pub-aside-list li { margin-bottom: 10px; }
.pub-compose-aside .pub-aside-list strong { color: #e2e8f0; }

/* Compose: выбор платформы */
.pub-platform-fieldset {
  border: none;
  margin: 0 0 8px;
  padding: 0;
}
.pub-platform-legend {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #818cf8;
  margin-bottom: 12px;
}
.pub-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.pub-platform-card {
  display: block;
  cursor: pointer;
  margin: 0;
  border-radius: 14px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.65);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.pub-platform-card:hover { border-color: #475569; transform: translateY(-1px); }
.pub-platform-card--active {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35), 0 12px 36px rgba(0, 0, 0, 0.35);
  background: linear-gradient(145deg, rgba(79, 70, 229, 0.2) 0%, rgba(15, 23, 42, 0.92) 60%);
}
.pub-platform-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pub-platform-card-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 16px;
}
.pub-platform-ico {
  font-size: 18px;
  line-height: 1;
  opacity: 0.9;
  color: #fb7185;
}
.pub-platform-ico-ig {
  color: #f472b6;
  font-size: 20px;
}
.pub-platform-title { font-weight: 700; font-size: 15px; color: #f1f5f9; }
.pub-platform-desc { font-size: 12px; line-height: 1.45; color: #94a3b8; }
.pub-zernio-warn { margin: 8px 0 12px; padding: 10px 12px; border-radius: 10px; }

/* Admin: карточка Zernio / Instagram */
.pub-zernio-card {
  margin-bottom: 22px;
  border-radius: 16px;
  border: 1px solid rgba(244, 114, 182, 0.25);
  background: linear-gradient(148deg, rgba(157, 23, 77, 0.12) 0%, #0f172a 42%, #0b1020 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.pub-zernio-head { align-items: flex-start !important; }
.pub-zernio-lead { margin-top: 8px !important; max-width: 72ch; }
.pub-zernio-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pub-pill-ok {
  border-color: #15803d !important;
  background: rgba(21, 128, 61, 0.18) !important;
  color: #86efac !important;
}
.pub-pill-warn {
  border-color: #b45309 !important;
  background: rgba(180, 83, 9, 0.18) !important;
  color: #fdba74 !important;
}
.pub-pill-tight { font-size: 10px; padding: 2px 8px; }
.pub-zernio-sync-form { flex-shrink: 0; }
.pub-zernio-sync-btn { white-space: nowrap; }
.pub-zernio-empty { padding: 16px 12px; margin-top: 8px; }
.pub-zernio-enable-form { margin-top: 8px; }
.pub-zernio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.pub-zernio-tile {
  border-radius: 12px;
  border: 1px solid #334155;
  padding: 12px 12px 10px;
  background: rgba(30, 41, 59, 0.35);
  transition: border-color 0.15s;
}
.pub-zernio-tile--on {
  border-color: rgba(244, 114, 182, 0.45);
  background: rgba(131, 24, 67, 0.12);
}
.pub-zernio-enable-lbl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  margin: 0;
}
.pub-zernio-tile-title { font-weight: 700; color: #f8fafc; font-size: 14px; }
.pub-zernio-tile-sub { font-size: 12px; color: #94a3b8; }
.pub-zernio-id {
  display: block;
  margin-top: 8px;
  font-size: 10px;
  color: #64748b;
  word-break: break-all;
}
.pub-zernio-settings { margin-top: 22px; padding-top: 18px; border-top: 1px solid #1e293b; }
.pub-zernio-settings-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
}
.pub-zernio-acc {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid #273449;
  background: rgba(15, 23, 42, 0.5);
  overflow: hidden;
}
.pub-zernio-acc-sum {
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-weight: 600;
  color: #e2e8f0;
}
.pub-zernio-acc-sum::-webkit-details-marker { display: none; }
.pub-zernio-acc-name { flex: 1; min-width: 0; }
.pub-zernio-acc-body { padding: 0 14px 14px; border-top: 1px solid #1e293b; }
.pub-zernio-defaults-form { padding-top: 12px; }

/* Очередь: платформа */
.pub-pill-platform {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pub-pill-platform-yt { background: rgba(239, 68, 68, 0.15) !important; color: #fca5a5 !important; border-color: rgba(239, 68, 68, 0.35) !important; }
.pub-pill-platform-ig { background: rgba(236, 72, 153, 0.15) !important; color: #f9a8d4 !important; border-color: rgba(236, 72, 153, 0.35) !important; }
.pub-pill-platform-tt { background: rgba(56, 189, 248, 0.15) !important; color: #7dd3fc !important; border-color: rgba(56, 189, 248, 0.35) !important; }
.pub-queue-zernio-id code { font-size: 11px; color: #cbd5e1; }
.pub-queue-channel-ico-ig { color: #f472b6; font-size: 18px; }

.dash-publish-form label { margin-top: 4px; }

@media (max-width: 640px) {
  .pub-hero { padding: 18px 16px; }
  .pub-title { font-size: 24px; }
  .pub-acc-summary {
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
  }
  .pub-acc-tags { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ═══ Шаг «текст»: вырезка интервалов из оригинального рилса ═══ */
.reel-cut-shell {
  margin: 20px 0 24px;
  padding: 20px 22px 22px;
  border-radius: 16px;
  border: 1px solid #1e293b;
  background: linear-gradient(155deg, rgba(30, 27, 75, 0.55) 0%, #0f172a 55%, #0b1020 100%);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.28);
}
.reel-cut-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.reel-cut-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.3px;
}
.reel-cut-sub { margin: 0; max-width: 62ch; line-height: 1.45; }
.reel-cut-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.45);
  border: 1px solid #b45309;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.reel-cut-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .reel-cut-grid { grid-template-columns: 1fr; }
}
.reel-cut-video-frame {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #312e81;
  background: #000;
  max-height: min(72vh, 520px);
  margin: 0 auto;
  max-width: 340px;
}
.reel-cut-video {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: bottom;
}
.reel-cut-timebar-wrap { margin-top: 12px; }
.reel-cut-timebar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  cursor: pointer;
  overflow: hidden;
}
.reel-cut-timebar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  pointer-events: none;
}
.reel-cut-timebar-markers {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
}
.reel-cut-marker {
  position: absolute;
  top: 1px;
  bottom: 1px;
  background: rgba(248, 113, 113, 0.55);
  border-left: 1px solid #f87171;
  border-right: 1px solid #f87171;
  border-radius: 2px;
}
.reel-cut-time-readout {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
}
.reel-cut-time-sep { color: #475569; font-weight: 400; }

.reel-cut-controls-col { display: flex; flex-direction: column; gap: 16px; }
.reel-cut-mark-panel {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.75);
}
.reel-cut-mark-label { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: #cbd5e1; }
.reel-cut-mark-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.reel-cut-btn { flex: 1; min-width: 140px; }
.reel-cut-btn-wide { width: 100%; margin-top: 4px; }
.reel-cut-mark-readout {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 10px;
}
.reel-cut-list-wrap {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: #0b1120;
}
.reel-cut-list-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: #e2e8f0; }
.reel-cut-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reel-cut-li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #111827;
  font-size: 13px;
}
.reel-cut-li-range { font-family: ui-monospace, monospace; color: #e2e8f0; }
.reel-cut-li-dur { color: #64748b; font-size: 12px; }
.reel-cut-li-del { margin-left: auto; color: #fca5a5; font-size: 13px; }
.reel-cut-li-del:hover { color: #fecaca; }
.reel-cut-list-empty { margin: 0; font-size: 12px; }
.reel-cut-status { margin: 0; font-size: 13px; padding: 10px 12px; border-radius: 10px; border: 1px solid #334155; }
.reel-cut-status-ok { background: #0f1d3a; color: #93c5fd; border-color: #1d4ed8; }
.reel-cut-status-err { background: #2d0a0a; color: #fecaca; border-color: #991b1b; }
.reel-cut-apply { width: 100%; padding: 12px 18px; font-weight: 700; }
.reel-cut-foot { margin: 0; font-size: 12px; line-height: 1.45; }

/* Три колонки текста (шаг перед генерацией аватара) */
.transcript-trio-shell {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 28px 0 8px;
  padding: 22px 22px 26px;
  border-radius: 16px;
  border: 1px solid #2d3b55;
  background: linear-gradient(165deg, #0f172a 0%, #0c1220 45%, #0a101c 100%);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.transcript-trio-shell *,
.transcript-trio-shell *::before,
.transcript-trio-shell *::after {
  box-sizing: border-box;
}
.transcript-trio-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.transcript-trio-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f1f5f9;
}
.transcript-trio-sub {
  margin: 0;
  max-width: 72ch;
  line-height: 1.55;
  color: #94a3b8;
}
.transcript-trio-banner {
  flex: 1 1 280px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
}
.transcript-trio-banner.transcript-trio-banner-warn {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}
.transcript-trio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}
.transcript-trio-shell-2col .transcript-trio-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .transcript-trio-grid,
  .transcript-trio-shell-2col .transcript-trio-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
.transcript-trio-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(45, 59, 85, 0.95);
  background: rgba(11, 17, 32, 0.92);
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.transcript-trio-card.is-active {
  border-color: rgba(96, 165, 250, 0.75);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.35),
    0 20px 40px rgba(15, 23, 42, 0.65);
  background: rgba(15, 26, 48, 0.98);
}
.transcript-trio-card[data-variant="raw"] {
  border-left: 3px solid #64748b;
}
.transcript-trio-card[data-variant="manual"] {
  border-left: 3px solid rgba(52, 211, 153, 0.7);
}
.transcript-trio-card[data-variant="qwen"] {
  border-left: 3px solid rgba(129, 140, 248, 0.9);
}
.transcript-trio-card-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(45, 59, 85, 0.65);
  background: rgba(15, 23, 42, 0.55);
}
.transcript-trio-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: #f1f5f9;
}
.transcript-trio-card-desc {
  margin: 0;
  padding: 10px 16px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
  border-bottom: 1px solid rgba(38, 49, 68, 0.55);
  flex-shrink: 0;
}
.transcript-trio-ta-frame {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.transcript-trio-ta-frame--needs-edit {
  margin: 10px 14px 0;
  padding: 10px 12px 12px;
  border-radius: 10px;
  border: 2px solid rgba(239, 68, 68, 0.88);
  background: rgba(239, 68, 68, 0.07);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.12);
}
.transcript-trio-edit-hint {
  margin: 0 0 8px;
  padding: 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #f87171;
}
.transcript-trio-ta-frame--needs-edit textarea.transcript-trio-ta {
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.transcript-trio-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.45);
}
textarea.transcript-trio-ta {
  display: block;
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 260px;
  margin: 0;
  resize: vertical;
  box-sizing: border-box;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  padding: 16px 18px 18px;
  border: 0;
  border-radius: 0;
  background: #080d18;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
textarea.transcript-trio-ta::placeholder {
  color: #475569;
}
textarea.transcript-trio-ta:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.45);
}
.transcript-trio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px 16px;
  margin-top: 0;
  background: rgba(10, 14, 24, 0.5);
  border-top: 1px solid rgba(38, 49, 68, 0.55);
}
.transcript-trio-actions > button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  border-radius: 10px;
  cursor: pointer;
}
.transcript-trio-actions .btn-secondary {
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  border: 1px solid rgba(71, 85, 105, 0.6);
}
.transcript-trio-actions .btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(96, 165, 250, 0.5);
}
.transcript-trio-actions .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: 1px solid #2563eb;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}
.transcript-trio-actions .btn-primary:hover {
  filter: brightness(1.05);
}
.transcript-trio-status {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 12px;
  line-height: 1.4;
}
.transcript-trio-status.is-ok {
  color: #86efac;
}
.transcript-trio-status.is-err {
  color: #fca5a5;
}
.transcript-trio-regen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0 16px 12px;
  background: rgba(10, 14, 24, 0.5);
}
.transcript-trio-regen-row > .btn-trio-regen {
  flex: 0 0 auto;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(76, 29, 149, 0.35);
  color: #e9d5ff;
  border: 1px solid rgba(129, 140, 248, 0.55);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.transcript-trio-regen-row > .btn-trio-regen:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.45);
  border-color: rgba(165, 180, 252, 0.75);
}
.transcript-trio-regen-row > .btn-trio-regen:disabled {
  opacity: 0.65;
  cursor: progress;
}
.transcript-trio-regen-hint {
  flex: 1 1 180px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #64748b;
}
.transcript-trio-confirm {
  padding: 8px 0 12px;
  margin-top: 22px;
}
.transcript-trio-confirm .btn-primary {
  width: 100%;
  max-width: 420px;
  padding: 14px 20px;
  font-weight: 700;
  border-radius: 12px;
}

/* Выбор Avatar / Voice перед генерацией (шаг 3) —
   без appearance:none Safari/macOS рисует select системным белым фоном */
.generate-identity-shell {
  margin-bottom: 4px;
}
.generate-identity-shell .generate-identity-badge.reel-cut-badge {
  flex-shrink: 0;
  align-self: center;
}
.generate-identity-card .transcript-trio-card-desc {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(38, 49, 68, 0.55);
}
.generate-identity-field {
  padding: 12px 16px 17px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.generate-identity-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}
.generate-identity-field > .generate-identity-label:not(:first-child) {
  margin-top: 16px;
}
/* chevron SVG — stroke %2394a3b8 */
.generate-identity-select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  cursor: pointer;
  min-height: 44px;
  padding: 10px 40px 10px 14px;
  border-radius: 10px;
  border: 1px solid #334155;
  background-color: #0f172a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.generate-identity-select::-ms-expand {
  display: none;
}
.generate-identity-select option,
.generate-identity-select optgroup {
  background-color: #0f172a;
  color: #e2e8f0;
}
.generate-identity-manual-input {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.generate-identity-select:focus,
.generate-identity-manual-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}
.generate-identity-select:disabled,
.generate-identity-manual-input:disabled {
  opacity: 0.55;
  cursor: progress;
}
#confirm-generate-form > .btn-primary {
  max-width: none;
  width: 100%;
}
@media (min-width: 520px) {
  #confirm-generate-form > .btn-primary {
    max-width: 480px;
  }
}

/* Live montage progress — компактный зелёный троббер (шаг ~5) */
@keyframes montage-throbber-soft {
  0%,
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 0 transparent);
  }
  50% {
    opacity: 0.92;
    filter: drop-shadow(0 0 5px rgba(74, 222, 128, 0.25));
  }
}
.montage-live-card {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #2d3b4f;
  background: rgba(15, 23, 42, 0.88);
}
.montage-live-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.montage-throbber {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  animation: montage-throbber-soft 2.2s ease-in-out infinite;
}
.montage-throbber-svg {
  display: block;
  width: 32px;
  height: 32px;
}
.montage-ring-bg {
  fill: none;
  stroke: #273549;
  stroke-width: 2.75;
}
.montage-ring-fg {
  fill: none;
  stroke: #4ade80;
  stroke-width: 2.75;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease;
}
.montage-live-text {
  flex: 1;
  min-width: 0;
}
.montage-live-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 4px;
}
.montage-live-title-row strong {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}
.montage-pct-inline {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #86efac;
  letter-spacing: 0.02em;
}
.montage-live-detail {
  margin: 0 0 3px;
  line-height: 1.4;
  font-size: 12px;
  max-width: 56ch;
}
.montage-live-eta {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
}

/* Publish: audience radios + quiet hero */
.pub-sub-quiet { color: #94a3b8; font-size: 14px; max-width: 44rem; line-height: 1.45; }
.pub-fieldset-lead { margin: 0 0 12px !important; }
.pub-radio-group {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.55);
}
.pub-radio-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pub-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 6px 0;
  font-size: 14px;
  color: #e2e8f0;
  cursor: pointer;
}
.pub-radio input { margin-top: 3px; flex-shrink: 0; }

/* Сворачиваемые блоки (<details>) — дашборд, страница задачи */
.ui-collapsible > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.ui-collapsible > summary::-webkit-details-marker {
  display: none;
}
.ui-collapsible > summary:focus {
  outline: none;
}
.ui-collapsible > summary:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 3px;
  border-radius: 10px;
}
.ui-collapsible-chevron {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  border-radius: 9px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.ui-collapsible > summary:hover .ui-collapsible-chevron {
  border-color: #475569;
  background: rgba(30, 41, 59, 0.9);
}
.ui-collapsible-chevron::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #94a3b8;
  transform: rotate(-90deg);
  margin-left: 2px;
  transition: transform 0.2s ease;
}
.ui-collapsible[open] > summary .ui-collapsible-chevron::before {
  transform: rotate(0deg);
  margin-left: 0;
  margin-top: 2px;
}

/* Dashboard: теги (карточка + чипы как в современных UI) */
details.dash-tags-panel {
  margin-bottom: 16px;
  padding-bottom: 4px;
}
.dash-tags-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.dash-tags-summary-text {
  flex: 1;
  min-width: 0;
}
.dash-tags-details-body {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid #1a2236;
}
.dash-tags-panel-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.02em;
}
.dash-tags-panel-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
  max-width: 52ch;
}
.dash-tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  min-height: 2px;
}
.dash-tags-panel a.dash-filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  border: 1px solid #273349;
  background: #0f172a;
  color: #94a3b8 !important;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.dash-tags-panel a.dash-filter-pill:hover {
  border-color: #4f46e5;
  color: #e2e8f0 !important;
}
.dash-tags-panel a.dash-filter-pill.is-active {
  border-color: #6366f1;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.35) 0%, rgba(99, 102, 241, 0.12) 100%);
  color: #eef2ff !important;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}
.dash-tag-chip {
  --tag-accent: #6366f1;
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  border: 1px solid #273349;
  background: #0c1222;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
.dash-tags-panel .dash-tag-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 6px 12px;
  text-decoration: none !important;
  color: #e2e8f0 !important;
  font-size: 13px;
  font-weight: 600;
  max-width: 200px;
  transition: background 0.12s;
}
.dash-tags-panel .dash-tag-chip-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc !important;
}
.dash-tags-panel .dash-tag-chip-link.is-active {
  background: rgba(99, 102, 241, 0.18);
  color: #eef2ff !important;
}
.dash-tag-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--tag-accent);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.9);
}
.dash-tag-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-tag-chip-del {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
}
.dash-tag-chip-x {
  margin: 0;
  padding: 0 11px;
  border: none;
  border-left: 1px solid #1e293b;
  background: transparent;
  color: #64748b;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s;
}
.dash-tag-chip-x:hover {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.35);
}
.dash-tags-panel .dash-tag-create {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  padding-top: 16px;
  border-top: 1px solid #1a2236;
}
.dash-tags-panel .dash-tag-create-label {
  flex: 1 1 200px;
  min-width: 180px;
  max-width: 360px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-tag-create-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.dash-tag-create-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 14px;
  color-scheme: dark;
}
.dash-tag-create-input::placeholder {
  color: #475569;
}
.dash-tag-create-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.dash-tag-create-colors {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-tag-create-colors-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.dash-tag-swatch-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
/* Глобально label { flex-direction: column } — ломает чипы цвета; переопределяем */
.dash-tags-panel .dash-swatch {
  position: relative;
  cursor: pointer;
  line-height: 0;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 0;
  width: 28px;
  height: 28px;
}
.dash-tags-panel .dash-swatch input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}
.dash-swatch-dot {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sw, #6366f1);
  box-shadow: 0 0 0 2px #111827, 0 0 0 3px #334155;
  transition: transform 0.15s, box-shadow 0.15s;
}
.dash-swatch:hover .dash-swatch-dot {
  transform: scale(1.06);
}
.dash-swatch input:checked + .dash-swatch-dot {
  box-shadow: 0 0 0 2px #111827, 0 0 0 3px #e0e7ff, 0 0 12px rgba(99, 102, 241, 0.45);
  transform: scale(1.08);
}
.dash-tags-panel .dash-tag-create-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: #fff !important;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%) !important;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.dash-tags-panel .dash-tag-create-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(79, 70, 229, 0.45);
  background: linear-gradient(135deg, #5b52f0 0%, #7c74f5 50%, #8b4df0 100%) !important;
}
@media (max-width: 560px) {
  .dash-tags-panel .dash-tag-create {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-tags-panel .dash-tag-create-label { max-width: none; }
  .dash-tags-panel .dash-tag-create-btn { width: 100%; }
}
.dash-exclude-section {
  margin-bottom: 18px;
  padding-top: 4px;
  border-top: 1px solid #1e293b;
}
.dash-exclude-heading {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}
.dash-exclude-hint {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  color: #64748b;
  max-width: 62ch;
}
.dash-exclude-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
/* Высокая специфичность + сброс UA (:link/:visited), иначе ссылки выглядят как синий подчёркнутый текст */
details.dash-tags-panel .dash-exclude-chips a.dash-exclude-pill:link,
details.dash-tags-panel .dash-exclude-chips a.dash-exclude-pill:visited {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none !important;
  border: 1px solid #273349;
  background: #0f172a;
  color: #94a3b8 !important;
  -webkit-text-fill-color: #94a3b8;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}
details.dash-tags-panel .dash-exclude-chips a.dash-exclude-pill:hover {
  border-color: #4f46e5;
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0;
}
details.dash-tags-panel .dash-exclude-chips a.dash-exclude-pill.is-on:link,
details.dash-tags-panel .dash-exclude-chips a.dash-exclude-pill.is-on:visited {
  border-color: #b45309;
  background: rgba(180, 83, 9, 0.14);
  color: #fdba74 !important;
  -webkit-text-fill-color: #fdba74;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.22);
}
details.dash-tags-panel .dash-exclude-chips a.dash-exclude-pill.is-on:hover {
  border-color: #f59e0b;
  color: #fde68a !important;
  -webkit-text-fill-color: #fde68a;
}
.dash-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #1e293b;
}
.dash-card-jobs .dash-page-nav {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0 !important;
  transition: border-color 0.15s, background 0.15s;
}
.dash-card-jobs a.dash-page-nav:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.12);
}
.dash-card-jobs .dash-page-nav.is-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.dash-page-meta {
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}
.dash-job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dash-job-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.dash-publish-btn { text-transform: none; letter-spacing: 0; }

/* Job page: сворачиваемый блок названия и тегов */
.job-meta-details {
  margin: 12px 0 18px;
  max-width: 560px;
  border-radius: 14px;
  border: 1px solid #273349;
  background: rgba(15, 23, 42, 0.45);
  overflow: hidden;
}
.job-meta-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}
.job-meta-summary-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.job-meta-summary-title {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.01em;
}
.job-meta-summary-preview {
  font-size: 12px;
  line-height: 1.35;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-meta-details-inner {
  padding: 14px 16px 16px;
  border-top: 1px solid #1e293b;
  background: rgba(11, 15, 20, 0.35);
}
.job-meta-title-form {
  margin: 0 0 4px;
  max-width: 520px;
}
.job-meta-details-inner .job-tags-card {
  margin-top: 14px;
  margin-bottom: 0;
}

/* Job page: tags + publish CTA */
.job-tags-card {
  margin: 12px 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #312e81;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(15, 23, 42, 0.5) 100%);
}
.job-tags-title { margin: 0 0 10px; font-size: 15px; color: #c7d2fe; }
.job-tags-form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.job-tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.job-tag-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #e2e8f0;
  cursor: pointer;
}
.job-publish-cta { margin-top: 16px; }
.job-publish-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #5b21b6 100%);
  box-shadow: 0 8px 28px rgba(79, 70, 229, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.job-publish-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(79, 70, 229, 0.45);
  color: #fff;
}
.job-publish-btn-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 14px;
}
.job-publish-btn-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.job-publish-btn-text strong { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.job-publish-btn-text small { font-size: 12px; font-weight: 400; opacity: 0.88; color: #e0e7ff; }

/* Admin: uniquifier (UTM → short redirect) */
.uniq-hero {
  margin: 0 0 24px;
  padding: 28px 24px 26px;
  border-radius: 18px;
  border: 1px solid #312e81;
  background: linear-gradient(135deg, rgba(67, 56, 202, 0.35) 0%, rgba(15, 23, 42, 0.92) 45%, rgba(15, 23, 42, 0.98) 100%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.uniq-hero__inner { max-width: 820px; }
.uniq-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a5b4fc;
}
.uniq-title {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #f8fafc;
}
.uniq-lead {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.55;
  color: #cbd5e1;
  max-width: 52rem;
}
.uniq-breadcrumb a {
  color: #93c5fd;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.uniq-breadcrumb a:hover { text-decoration: underline; }
.uniq-two-links {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
  font-size: 14px;
  line-height: 1.55;
  color: #cbd5e1;
  max-width: 52rem;
}
.uniq-two-links p { margin: 0 0 10px; }
.uniq-two-links p:last-child { margin-bottom: 0; }
.uniq-two-links code { font-size: 12px; color: #fde68a; }
.uniq-flash { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; }
.uniq-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 18px;
  margin-bottom: 28px;
}
@media (max-width: 900px) {
  .uniq-grid { grid-template-columns: 1fr; }
}
.uniq-card {
  border-radius: 16px;
  border: 1px solid #1e293b;
  background: rgba(17, 24, 39, 0.85);
  padding: 20px 20px 22px;
}
.uniq-card-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: #e2e8f0;
}
.uniq-label-text {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}
.uniq-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  padding: 12px 14px;
}
.uniq-select {
  width: 100%;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.4;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  padding: 10px 12px;
}
.uniq-submit { margin-top: 6px; align-self: flex-start; padding: 12px 20px; border-radius: 12px; }
.uniq-hint-box {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px dashed #334155;
}
.uniq-hint-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}
.uniq-hint-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #94a3b8;
}
.uniq-hint-list code { font-size: 12px; color: #fcd34d; }
.uniq-status { margin: 12px 0 0; font-size: 13px; }
.uniq-steps {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.uniq-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.45;
  color: #cbd5e1;
}
.uniq-step-num {
  flex: 0 0 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #4f46e5;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.uniq-table-section { margin-top: 8px; }
.uniq-table-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: #e2e8f0;
}
.uniq-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #1e293b;
  background: #0f172a;
}
.uniq-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.uniq-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  padding: 12px 14px;
  border-bottom: 1px solid #1e293b;
  background: rgba(30, 41, 59, 0.5);
}
.uniq-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #1e293b;
  vertical-align: top;
  font-size: 13px;
}
.uniq-table tr:last-child td { border-bottom: none; }
.uniq-cell-alias { min-width: 240px; }
.uniq-code {
  display: block;
  word-break: break-all;
  font-size: 12px;
  color: #86efac;
  margin-bottom: 8px;
  line-height: 1.4;
}
.uniq-copy {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.uniq-cell-target { max-width: 280px; }
.uniq-ellipsis {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
  color: #cbd5e1;
}
.uniq-empty { padding: 16px; border-radius: 12px; border: 1px dashed #334155; }

.uniq-analytics-section {
  margin-top: 28px;
  padding: 22px 22px 26px;
  border-radius: 16px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.65);
}
.uniq-analytics-title {
  margin: 0 0 14px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #f1f5f9;
}
.uniq-analytics-intro {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid #3d4f66;
}
.uniq-analytics-subtitle {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
}
.uniq-analytics-chart-panel,
.uniq-analytics-table-panel,
.uniq-per-link-panel {
  margin-top: 22px;
}
.uniq-chart-wrap {
  position: relative;
  height: 240px;
  margin-top: 8px;
}
.uniq-chart-placeholder { margin-top: 10px; }
.uniq-series-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #334155;
}
.uniq-series-table { margin: 0; border-radius: 12px; }
.uniq-click-details-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.uniq-click-details {
  border-radius: 12px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.85);
  overflow: hidden;
}
.uniq-click-summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
  font-size: 13px;
  color: #cbd5e1;
}
.uniq-click-summary::-webkit-details-marker { display: none; }
.uniq-click-sum-alias {
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  color: #fde68a;
  word-break: break-all;
}
.uniq-click-sum-meta {
  margin-left: auto;
  font-size: 12px;
  color: #94a3b8;
}
.uniq-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  font-size: 11px;
}
.uniq-click-log-body {
  padding: 12px 14px 16px;
  border-top: 1px solid #334155;
  font-size: 13px;
}
.uniq-day-block { margin-bottom: 16px; }
.uniq-day-block:last-child { margin-bottom: 0; }
.uniq-day-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
}
.uniq-day-count { font-weight: 400; color: #94a3b8; font-size: 13px; }
.uniq-click-ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.uniq-click-li {
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid #3f4f63;
  color: #cbd5e1;
  line-height: 1.45;
}
.uniq-click-time { font-family: ui-monospace, monospace; color: #a5b4fc; }
.uniq-click-ip { color: #94a3b8; }
.uniq-click-meta {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: #64748b;
  word-break: break-word;
}
.uniq-click-note { margin-bottom: 10px; }
.uniq-bot-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.14);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.35);
  vertical-align: middle;
}
.uniq-reconcile-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.uniq-reconcile-btn { padding: 10px 18px; border-radius: 10px; }
.uniq-reconcile-hint { font-size: 12px; color: #94a3b8; max-width: 420px; }

/* Admin: тест детекта окна автора / вшитых субтитров */
.dt-test-page .dt-test-card { margin-bottom: 18px; }
.dt-test-form { max-width: 520px; }
.dt-test-preview-wrap {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: #0b1220;
  overflow: auto;
}
.dt-test-preview {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.dt-test-video-block {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dt-test-video {
  width: 100%;
  max-height: 320px;
  border-radius: 8px;
  background: #000;
}
.dt-test-scrub {
  width: 100%;
  accent-color: #38bdf8;
}
.dt-test-time {
  font-size: 0.85rem;
  color: #94a3b8;
}
.dt-test-mode-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #1e293b;
  background: #0b1220;
  margin-top: 6px;
}
.dt-test-mode-group > .st-mini-hint {
  margin-right: 4px;
  font-weight: 500;
  color: #94a3b8;
}
.dt-test-mode-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  color: #e2e8f0;
  user-select: none;
}
.dt-test-mode-opt input[type="radio"] {
  accent-color: #38bdf8;
  margin: 0;
}


/* ===================================================================================
   Глобальный фикс HTML-атрибута `hidden`.
   Базовая UA-стилизация даёт `display: none`, но любой класс с `display: flex/grid`
   побеждает по специфичности → элементы остаются видимыми. Это правило с !important
   восстанавливает семантику HTML-спеки и нужно для правильной работы поповеров,
   bulkbar-а и форм-офферов.                                                            */
/* =================================================================================== */
[hidden] { display: none !important; }

/* ===================================================================================
   Dashboard v3 — полный редизайн: компактные поповеры с поиском, inline-rename папок,
   stylish job rows, чёткая визуальная иерархия.
   ----------------------------------------------------------------------------------- */

/* --- Заголовок секции «Мои задачи» ---------------------------------------------- */
.dash-jobs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.dash-jobs-head .st-card-title { margin: 0; }
.dash-jobs-hint {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
  flex: 1 1 280px;
  text-align: right;
}

/* --- Папки: вкладки ------------------------------------------------------------ */
.dash-folders-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  margin: 0 0 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid #1f2937;
}
.dash-folder-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.65);
  color: #cbd5e1;
  border: 1px solid #334155;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
  white-space: nowrap;
}
.dash-folder-tab:hover {
  background: rgba(45, 60, 90, 0.85);
  color: #f1f5f9;
  transform: translateY(-1px);
}
.dash-folder-tab.is-active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border-color: #3b82f6;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32);
}
.dash-folder-tab--ghost {
  background: transparent;
  border-style: dashed;
}
.dash-folder-tab--colored.is-active {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--folder-accent, #6366f1) 100%, white 0%) 0%,
    color-mix(in srgb, var(--folder-accent, #6366f1) 70%, black 30%) 100%);
  border-color: color-mix(in srgb, var(--folder-accent, #6366f1) 65%, white 35%);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--folder-accent, #6366f1) 38%, transparent);
}
.dash-folder-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--folder-accent, #6366f1);
  flex-shrink: 0;
}
.dash-folder-tab--colored.is-active .dash-folder-tab-dot {
  background: rgba(255, 255, 255, 0.95);
}
.dash-folder-tab-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}
.dash-folder-tab-wrap .dash-folder-tab {
  padding-right: 30px;
}
.dash-folder-tab-edit {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(203, 213, 225, 0.65);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 1px;
}
.dash-folder-tab-edit:hover {
  color: #f8fafc;
  background: rgba(248, 250, 252, 0.12);
}
.dash-folder-tab.is-active + .dash-folder-tab-edit,
.dash-folder-tab-wrap .dash-folder-tab.is-active ~ .dash-folder-tab-edit { color: rgba(255, 255, 255, 0.85); }

.dash-folder-tab--add {
  background: transparent;
  color: #60a5fa;
  border-style: dashed;
  border-color: rgba(96, 165, 250, 0.5);
}
.dash-folder-tab--add:hover {
  background: rgba(96, 165, 250, 0.1);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.8);
}

/* Inline-rename — input заменяет таб без скачков размера */
.dash-folder-tab-input {
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--folder-accent, #3b82f6);
  border-radius: 999px;
  padding: 0;
  overflow: hidden;
}
.dash-folder-tab-input input {
  background: transparent;
  border: none;
  outline: none;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  min-width: 140px;
}
.dash-folder-tab-input button {
  background: transparent;
  border: none;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
  cursor: pointer;
  padding: 7px 10px;
  font-size: 12px;
  color: #cbd5e1;
}
.dash-folder-tab-input button:hover { color: #f8fafc; background: rgba(255, 255, 255, 0.04); }
.dash-folder-tab-input button.dash-fti-go { color: #4ade80; }
.dash-folder-tab-input button.dash-fti-del { color: #f87171; }

/* Меню действий папки (после клика на ⋯) */
.dash-folder-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: #0b1220;
  border: 1px solid #243041;
  border-radius: 10px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.55);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dashFadeIn .14s ease;
}
.dash-folder-menu button {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  color: #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
}
.dash-folder-menu button:hover { background: rgba(45, 60, 90, 0.7); color: #f8fafc; }
.dash-folder-menu button.is-danger:hover { background: rgba(127, 29, 29, 0.5); color: #fecaca; }

/* Форма «новая папка» — компактный двухстрочный лейаут */
.dash-folder-create-form {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name name"
    "colors colors"
    "submit cancel";
  gap: 10px 8px;
  padding: 14px;
  margin: 0 0 14px;
  background: linear-gradient(180deg, rgba(20, 32, 60, 0.55) 0%, rgba(15, 23, 42, 0.7) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  animation: dashFadeIn .18s ease;
}
.dash-folder-create-form input[type="text"] {
  grid-area: name;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}
.dash-folder-create-colors {
  grid-area: colors;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.dash-folder-create-form #dash-folder-create-go { grid-area: submit; }
.dash-folder-create-form #dash-folder-create-cancel { grid-area: cancel; }

/* --- Bulkbar: показывается только при sel>0, чёткая иерархия ------------------- */
.dash-bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  position: sticky;
  top: 70px;
  z-index: 25;
  padding: 12px 16px;
  margin: 0 0 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #1e3a8a 100%);
  border: 1px solid rgba(96, 165, 250, 0.55);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.32);
  animation: dashBulkSlide .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes dashBulkSlide {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.dash-bulkbar-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dbeafe;
  font-size: 14px;
  font-weight: 500;
}
.dash-bulkbar-count strong {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  padding: 2px 10px;
  border-radius: 999px;
  min-width: 28px;
  text-align: center;
}
.dash-bulkbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.dash-bulkbar .st-btn-secondary,
.dash-bulkbar .st-btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.dash-bulkbar .st-btn-secondary:hover,
.dash-bulkbar .st-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

/* --- Универсальный поповер (теги/папки/строка-теги) --------------------------- */
.dash-bulk-popover {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #0d1426 0%, #08101e 100%);
  border: 1px solid #243041;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
  animation: dashFadeIn .14s ease;
}
@keyframes dashFadeIn { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: translateY(0); } }
.dash-bulk-popover[hidden] { display: none !important; }
.dash-bulkbar-popover-shell {
  flex-basis: 100%;
  margin-top: 6px;
}

.dash-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dash-pop-title {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
}
.dash-pop-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #243041;
  color: #e2e8f0;
  font-size: 13px;
}
.dash-pop-search:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.dash-bulk-pop-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px 4px 4px 0;
}
.dash-bulk-pop-list::-webkit-scrollbar { width: 6px; }
.dash-bulk-pop-list::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.25); border-radius: 999px; }

.dash-bulk-pop-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  border: 1px solid #334155;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease, border-color .12s ease;
  position: relative;
  white-space: nowrap;
}
.dash-bulk-pop-item:hover {
  background: rgba(45, 60, 90, 0.95);
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.35);
}
.dash-bulk-pop-item.is-busy { opacity: .55; pointer-events: none; }
.dash-bulk-pop-item--match {
  border-color: var(--tag-accent, var(--folder-accent, #6366f1));
  box-shadow: 0 0 0 1px var(--tag-accent, var(--folder-accent, #6366f1)) inset;
}
.dash-bulk-pop-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tag-accent, var(--folder-accent, #6366f1));
  flex-shrink: 0;
}
.dash-bulk-pop-item--ghost {
  background: transparent;
  border-style: dashed;
  color: #cbd5e1;
}
.dash-bulk-pop-empty {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  padding: 8px 0;
}

.dash-bulk-flash {
  position: absolute;
  top: -28px;
  right: -4px;
  background: #22c55e;
  color: #052e1a;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  animation: dashFlashPop 1.4s ease;
}
@keyframes dashFlashPop {
  0% { opacity: 0; transform: translateY(4px); }
  12% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-4px); }
}

/* --- Список задач: header + grid-row + чекбокс ------------------------------- */
.dash-job-header-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  margin: 0 0 4px;
  font-size: 12px;
  color: #94a3b8;
}
.dash-job-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
  border-radius: 8px;
}
.dash-job-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
  margin: 0;
}
.dash-job-header-meta {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.dash-job-list { display: flex; flex-direction: column; gap: 6px; }

/* ──────────────────────────────────────────────────────────────────────────
   Карточка задачи: 3-колоночный grid (чекбокс / контент / правый stack).
   Контент — двухстрочная колонка: title (полная ширина с ellipsis) + meta-строка
   с тегами и id. Правый stack: статус, дата, кнопка «теги». Длинный статус (как
   «ожидание подтверждения генерации») переносится на 2 строки и не ломает грид.
   Длинный _id-моноширинный обрезается ellipsis-ом.
   ────────────────────────────────────────────────────────────────────────── */
.dash-job-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-areas: "check main side";
  align-items: stretch;
  gap: 14px;
  padding: 13px 16px;
  margin: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 28, 46, 0.55) 0%, rgba(15, 23, 42, 0.55) 100%);
  border: 1px solid rgba(36, 48, 65, 0.85);
  transition: background .16s ease, border-color .16s ease, transform .12s ease, box-shadow .16s ease;
  text-decoration: none;
}
.dash-job-row:hover {
  background: linear-gradient(180deg, rgba(28, 40, 70, 0.65) 0%, rgba(20, 32, 60, 0.6) 100%);
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}
.dash-job-row > .dash-job-check { grid-area: check; align-self: center; }
.dash-job-row > .dash-job-main { grid-area: main; }
.dash-job-row > .dash-job-side { grid-area: side; }

/* === Главная колонка: title + meta-строка ============================== */
.dash-job-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  align-self: center;
}
.dash-job-title {
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.35;
  color: #f1f5f9;
  /* до 2 строк с многоточием — длинные названия читаются, layout не ломается */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.dash-job-row:hover .dash-job-title { color: #fff; }

.dash-job-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}
.dash-job-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.dash-job-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-job-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  color: #64748b;
  letter-spacing: 0.02em;
  /* ВАЖНО: id — длинная hex-строка без пробелов, без этих свойств ломает grid */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14ch;     /* ~ «69fa390b5f5e…» */
  flex-shrink: 1;
  cursor: help;
}

/* === Правая колонка: статус + дата + кнопка «теги» ====================== */
.dash-job-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  max-width: 240px;
}
.dash-job-side .status {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  /* Длинный статус («ожидание подтверждения генерации») переносится на 2 строки */
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  max-width: 220px;
  border-radius: 999px;
}
.dash-job-date {
  font-size: 11px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dash-job-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
}
.dash-job-tag-btn:hover {
  background: rgba(99, 102, 241, 0.22);
  color: #e0e7ff;
  border-color: rgba(99, 102, 241, 0.7);
}
.dash-job-tag-btn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  flex-shrink: 0;
}
.dash-job-tag-btn-text { line-height: 1; }

/* --- Inline-теги поповер строки --------------------------------------------- */
.dash-row-tag-popover {
  position: absolute;
  width: 280px;
  z-index: 60;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #0d1426 0%, #08101e 100%);
  border: 1px solid #243041;
  box-shadow: 0 28px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: dashFadeIn .14s ease;
}
.dash-row-tag-pop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-row-tag-pop-title {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}
.dash-row-tag-pop-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.dash-row-tag-pop-close:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #f1f5f9;
}
.dash-row-tag-pop-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.dash-row-tag-pop-list::-webkit-scrollbar { width: 6px; }
.dash-row-tag-pop-list::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.25); border-radius: 999px; }

.dash-row-tag-pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(36, 48, 65, 0.7);
  font-size: 13px;
  color: #e2e8f0;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.dash-row-tag-pop-item:hover {
  background: rgba(45, 60, 90, 0.7);
  border-color: rgba(148, 163, 184, 0.35);
}
.dash-row-tag-pop-item:has(.dash-row-tag-pop-check:checked) {
  background: rgba(45, 60, 90, 0.85);
  border-color: var(--tag-accent, #6366f1);
}
.dash-row-tag-pop-check {
  width: 16px;
  height: 16px;
  accent-color: var(--tag-accent, #6366f1);
  flex-shrink: 0;
  margin: 0;
}
.dash-row-tag-pop-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tag-accent, #6366f1);
  flex-shrink: 0;
}
.dash-row-tag-pop-label { flex: 1; min-width: 0; }
.dash-row-tag-pop-foot,
.dash-row-tag-pop-empty {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

/* --- Settings: единая форма «Создать оффер» + переименование ----------------- */
.custom-offer-create-toggle {
  margin-top: 12px;
  margin-bottom: 14px;
}
.custom-offer-create-toggle.is-open .custom-offer-create-plus {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.10);
}
.custom-offer-create-plus {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1.5px dashed rgba(99, 102, 241, 0.5);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  cursor: pointer;
  font: inherit;
  transition: border-color .15s, background .15s, transform .12s;
  text-align: left;
}
.custom-offer-create-plus:hover {
  border-color: rgba(99, 102, 241, 0.9);
  background: rgba(99, 102, 241, 0.10);
  transform: translateY(-1px);
}
.custom-offer-create-plus-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.32), rgba(56, 189, 248, 0.32));
  color: #f1f5f9;
  font-size: 26px; font-weight: 300;
  border: 1px solid rgba(99, 102, 241, 0.55);
  line-height: 1;
}
.custom-offer-create-plus-text { display: flex; flex-direction: column; gap: 2px; }
.custom-offer-create-plus-text strong { font-size: 15px; font-weight: 700; color: #f1f5f9; }
.custom-offer-create-plus-text small { font-size: 12px; color: #94a3b8; }

.custom-offer-create-card {
  margin-top: 4px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.4);
  background: linear-gradient(180deg, rgba(35, 51, 95, 0.55) 0%, rgba(15, 23, 42, 0.85) 100%);
  box-shadow: 0 18px 32px rgba(8, 12, 28, 0.45);
  position: relative;
}
.custom-offer-create-head { margin-bottom: 12px; padding-right: 36px; }
.custom-offer-create-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
}
.custom-offer-create-hint { margin: 0; font-size: 13px; }
.custom-offer-create-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 14px; line-height: 1;
  transition: background .15s, border-color .15s;
}
.custom-offer-create-close:hover {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.45);
  color: #fecaca;
}

/* Краткая сводка по уже созданному офферу (вместо дублирующей формы) */
.custom-offer-summary {
  margin: 10px 0 6px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(51, 65, 85, 0.55);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.custom-offer-summary-line {
  margin: 0;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}
.custom-offer-summary-label {
  color: #94a3b8;
  font-weight: 600;
  margin-right: 4px;
}
.custom-offer-summary-line code {
  background: rgba(2, 6, 23, 0.6);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: #bfdbfe;
}
.custom-offer-summary-script {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-offer-extend {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 10px;
}
.custom-offer-extend summary {
  cursor: pointer;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.custom-offer-extend summary::-webkit-details-marker { display: none; }
.custom-offer-extend summary::before {
  content: "+ ";
  font-weight: 700;
  margin-right: 2px;
}
.custom-offer-extend[open] summary::before { content: "− "; }
.custom-offer-extend form { margin-top: 10px; }
.custom-offer-create-form { gap: 14px; }
.custom-offer-create-form .custom-offer-kind { margin-top: 4px; }
.custom-offer-field--invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
  background: rgba(127, 29, 29, 0.1) !important;
}
.custom-offer-field--invalid-shake { animation: customOfferShake .35s ease; }
@keyframes customOfferShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.custom-offer-field-error {
  color: #fca5a5;
  font-size: 12px;
  margin-top: 4px;
  display: inline-block;
}
.custom-offer-create-status {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
}
.custom-offer-create-status--err { color: #fca5a5; }
.custom-offer-create-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.custom-offer-ready-hint {
  padding: 10px 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}

.custom-offers-list { margin-top: 22px; }
.custom-offers-empty {
  margin: 18px 0;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
  padding: 22px;
  border: 1px dashed #243041;
  border-radius: 12px;
}
.custom-offer-rename-target {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.custom-offer-name-edit {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
}
.custom-offer-name-edit:hover {
  color: #f1f5f9;
  background: rgba(148, 163, 184, 0.12);
}

/* --- Адаптив ---------------------------------------------------------------- */
@media (max-width: 860px) {
  .dash-jobs-hint { text-align: left; }
  .dash-job-row {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas:
      "check main"
      "check side";
    gap: 8px 10px;
    padding: 12px;
  }
  .dash-job-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    max-width: 100%;
    gap: 6px 10px;
  }
  .dash-job-side .status { max-width: 100%; }
  .dash-bulkbar { top: 56px; flex-direction: column; align-items: stretch; gap: 10px; }
  .dash-bulkbar-actions { justify-content: stretch; }
  .dash-bulkbar-actions > * { flex: 1 1 0; }
  .dash-folder-create-form { grid-template-columns: 1fr; grid-template-areas: "name" "colors" "submit" "cancel"; }
}

/* === Multi-avatar (мульти-аватарная группа) ============================== */
/* Используется на странице дашборда (форма "Авто (ссылка)") и на странице
   задачи (шаг 3 — Аватар и голос для генерации) для управления списком
   аватаров одной группы. */

.multi-avatar-block {
  margin: 4px 0 2px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.07), rgba(99, 102, 241, 0.02));
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.multi-avatar-head { display: flex; flex-direction: column; gap: 2px; }
.multi-avatar-title {
  font-weight: 600; font-size: 13.5px; color: #c7d2fe;
  letter-spacing: 0.01em;
}
.multi-avatar-sub { font-size: 12px; color: #94a3b8; line-height: 1.4; }
.multi-avatar-list { display: flex; flex-direction: column; gap: 10px; }
.multi-avatar-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 10px;
}
.multi-avatar-row-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.multi-avatar-row-num {
  font-weight: 700; font-size: 12.5px; color: #e2e8f0;
}
.multi-avatar-row-hint { font-size: 11.5px; color: #94a3b8; }
.multi-avatar-row-hint a { color: #93c5fd; }
.multi-avatar-row-remove {
  appearance: none; background: rgba(239, 68, 68, 0.18);
  color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px; padding: 4px 10px; cursor: pointer;
  font-size: 11px; font-weight: 600;
}
.multi-avatar-row-remove:hover { background: rgba(239, 68, 68, 0.3); color: #fff; }
.multi-avatar-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
@media (max-width: 640px) {
  .multi-avatar-fields { grid-template-columns: 1fr; }
}
.multi-avatar-field { display: flex; flex-direction: column; gap: 4px; }
.multi-avatar-field span {
  font-size: 11.5px; color: #94a3b8; font-weight: 500;
}
.multi-avatar-field input {
  padding: 9px 10px; background: #0f172a;
  border: 1px solid rgba(51, 65, 85, 0.75); border-radius: 8px;
  color: #e2e8f0; font-size: 13px; outline: none;
  transition: border-color .12s ease, background .12s ease;
}
.multi-avatar-field input:focus {
  border-color: #6366f1;
  background: #0b1228;
}
.multi-avatar-add-btn {
  appearance: none;
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  background: rgba(99, 102, 241, 0.16);
  border: 1px dashed rgba(99, 102, 241, 0.55);
  color: #c7d2fe;
  padding: 8px 14px; border-radius: 10px;
  font-weight: 600; font-size: 12.5px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.multi-avatar-add-btn:hover {
  background: rgba(99, 102, 241, 0.28);
  border-style: solid;
  color: #fff;
}
.multi-avatar-add-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(99, 102, 241, 0.5);
  color: #fff; font-weight: 800; line-height: 1; font-size: 13px;
}
.multi-avatar-foot { font-size: 11.5px; color: #64748b; margin: 4px 0 0; }

/* === Group variants bar (на странице задачи) ============================ */
.group-variants-bar {
  margin: 10px 0 18px;
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.02));
  border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: 12px;
}
.group-variants-head { display: flex; align-items: flex-start; gap: 12px; }
.group-variants-title-block { flex: 1 1 auto; min-width: 0; }
.group-variants-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #818cf8;
}
.group-variants-title {
  margin: 4px 0 4px; font-size: 16px; font-weight: 700; color: #e2e8f0;
}
.group-variants-sub { font-size: 12.5px; color: #94a3b8; margin: 0; line-height: 1.5; }
.group-variants-sub a { color: #93c5fd; }

.group-variants-list {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.group-variant-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(51, 65, 85, 0.65);
  border-radius: 10px;
  transition: border-color .15s ease, transform .12s ease, background .12s ease;
}
.group-variant-card:hover {
  border-color: rgba(99, 102, 241, 0.7);
  transform: translateY(-1px);
}
.group-variant-card.is-self {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.08);
}
.group-variant-link {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px 12px;
  color: inherit; text-decoration: none;
}
.group-variant-top {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.group-variant-num { font-size: 12px; font-weight: 700; color: #e2e8f0; }
.group-variant-pill {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(99, 102, 241, 0.3); color: #c7d2fe;
}
.group-variant-pill-self { background: rgba(34, 197, 94, 0.32); color: #bbf7d0; }
.group-variant-pill-primary { background: rgba(234, 179, 8, 0.3); color: #fde68a; }
.group-variant-status {
  font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-self: flex-start;
  padding: 3px 9px; border-radius: 999px;
}
.group-variant-meta {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: #94a3b8; line-height: 1.35;
}
.group-variant-aid, .group-variant-vid {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.group-variant-aid-empty { color: #64748b; font-style: italic; }

.group-variant-card.group-uniq-subtask {
  border-color: rgba(139, 92, 246, 0.45);
  background: linear-gradient(165deg, rgba(76, 29, 149, 0.22), rgba(15, 23, 42, 0.58));
  grid-column: 1 / -1;
}
@media (min-width: 720px) {
  .group-variant-card.group-uniq-subtask { grid-column: span 2; }
}
.group-uniq-subtask-inner {
  padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.group-variant-pill-uniq {
  background: rgba(139, 92, 246, 0.35);
  color: #e9d5ff;
}
.uniq-sub-progress-wrap {
  display: flex; align-items: center; gap: 10px;
}
.uniq-sub-progress {
  flex: 1; height: 8px; border-radius: 999px;
  overflow: hidden;
  accent-color: #a78bfa;
}
.uniq-sub-progress-label {
  font-size: 11px; font-weight: 700; color: #c4b5fd; min-width: 34px; text-align: right;
}
.uniq-sub-err {
  margin: 0; font-size: 12px; color: #fca5a5; line-height: 1.35;
}
.uniq-sub-actions { margin-top: 2px; }
.uniq-sub-music-form { margin-top: 4px; }
.uniq-sub-music-label {
  font-size: 11.5px; font-weight: 600; color: #cbd5e1;
}
.uniq-sub-music-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.uniq-sub-music-select {
  flex: 1; min-width: 160px;
  font-size: 12px; padding: 6px 8px; border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.85); color: #e2e8f0;
}
.uniq-sub-music-save { font-size: 12px; padding: 6px 12px; }
.uniq-shadow-banner {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px;
  margin: 10px 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(139, 92, 246, 0.45);
  background: linear-gradient(120deg, rgba(76, 29, 149, 0.22), rgba(15, 23, 42, 0.7));
}
.uniq-shadow-banner-body { flex: 1; min-width: 0; }
.uniq-shadow-banner-title {
  display: block;
  font-size: 14px;
  color: #ddd6fe;
  margin-bottom: 4px;
}
.uniq-shadow-banner-text {
  margin: 0;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}
.uniq-sub-open-hint {
  font-size: 11.5px;
  color: #c4b5fd;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.group-uniq-subtask.is-self {
  outline: 2px solid rgba(196, 181, 253, 0.55);
}
.group-variant-link.is-self-current {
  display: block;
  cursor: default;
  text-decoration: none;
  color: inherit;
}

/* === Multi-step3 variants на странице задачи ========================== */
.multi-step3-variants {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 10px;
}
.multi-step3-variant {
  padding: 12px 14px 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 12px;
}
.multi-step3-variant.is-primary {
  border-color: rgba(234, 179, 8, 0.55);
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.06), rgba(15, 23, 42, 0.55));
}
.multi-step3-variant.is-new {
  border-style: dashed; border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.06);
}
.multi-step3-variant-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.multi-step3-variant-num {
  font-weight: 700; font-size: 13.5px; color: #e2e8f0;
}
.multi-step3-variant-num small { font-weight: 500; font-size: 11px; color: #fde68a; }
.multi-step3-variant-tag {
  margin-left: 6px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(234, 179, 8, 0.28);
}
.multi-step3-variant-id { font-size: 11px; }
.multi-step3-variant-remove {
  appearance: none; background: rgba(239, 68, 68, 0.18);
  color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px; padding: 4px 12px; cursor: pointer;
  font-size: 11.5px; font-weight: 600;
}
.multi-step3-variant-remove:hover { background: rgba(239, 68, 68, 0.3); color: #fff; }
.multi-step3-new-list { display: flex; flex-direction: column; gap: 12px; }
.multi-step3-new-list:not(:empty) { margin-top: 12px; }
.multi-step3-actions-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; flex-wrap: wrap;
}
.multi-step3-add-btn {
  appearance: none;
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px dashed rgba(99, 102, 241, 0.6);
  color: #c7d2fe;
  padding: 9px 16px; border-radius: 10px;
  font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.multi-step3-add-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-style: solid; color: #fff;
}
.multi-step3-add-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(99, 102, 241, 0.55);
  color: #fff; font-weight: 800; line-height: 1; font-size: 14px;
}
.multi-step3-add-hint { font-size: 11.5px; color: #94a3b8; margin: 0; flex: 1 1 240px; min-width: 0; }
.multi-step3-confirm-btn { margin-top: 14px; }

/* Бейдж «*N аватаров» на карточке задачи в дашборде — отмечает primary
   мульти-аватарной группы. Sibling-задачи на дашборде не показываются
   как отдельные строки; только primary с пометкой количества вариантов. */
.dash-job-group-badge {
  display: inline-flex; align-items: center;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.32), rgba(236, 72, 153, 0.28));
  border: 1px solid rgba(165, 180, 252, 0.5);
  color: #ede9fe;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: middle;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.4);
}
.dash-job-main--group .dash-job-title {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
}

/* Sibling в статусе awaiting_group_share — ждёт primary */
.group-share-waiting {
  margin: 10px 0 14px;
  display: flex; gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.06), rgba(234, 179, 8, 0.02));
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 12px;
}
.group-share-waiting-icon { font-size: 24px; line-height: 1; }
.group-share-waiting-body { flex: 1 1 auto; min-width: 0; }
.group-share-waiting-title {
  display: block; font-size: 14px; font-weight: 700;
  color: #fde68a; margin-bottom: 4px;
}
.group-share-waiting-text {
  margin: 0; font-size: 12.5px; color: #e2e8f0; line-height: 1.5;
}
.group-share-waiting-text a { color: #93c5fd; }

/* Баннер «синхронизация с Основным» на странице sibling в шаге 3 */
.group-sync-banner {
  margin: 10px 0 14px;
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.group-sync-banner.is-synced {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.07), rgba(56, 189, 248, 0.02));
  border-color: rgba(56, 189, 248, 0.35);
}
.group-sync-banner.is-detached {
  background: linear-gradient(180deg, rgba(244, 114, 182, 0.08), rgba(244, 114, 182, 0.02));
  border-color: rgba(244, 114, 182, 0.45);
}
.group-sync-banner-icon { font-size: 22px; line-height: 1.1; }
.group-sync-banner-body { flex: 1 1 auto; min-width: 0; }
.group-sync-banner-title {
  display: block; font-size: 14px; font-weight: 700;
  margin-bottom: 4px;
}
.group-sync-banner.is-synced .group-sync-banner-title { color: #bae6fd; }
.group-sync-banner.is-detached .group-sync-banner-title { color: #fbcfe8; }
.group-sync-banner-text {
  margin: 0; font-size: 12.5px; color: #e2e8f0; line-height: 1.55;
}
.group-sync-banner-text a { color: #93c5fd; }
.group-sync-banner-form { flex: 0 0 auto; margin: 0; }
.group-sync-banner-btn {
  appearance: none; cursor: pointer;
  padding: 9px 14px; border-radius: 10px;
  border: 1px solid rgba(244, 114, 182, 0.55);
  background: rgba(244, 114, 182, 0.18);
  color: #fbcfe8;
  font-size: 12.5px; font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
}
.group-sync-banner-btn:hover {
  background: rgba(244, 114, 182, 0.28);
  transform: translateY(-1px);
}

/* Бейдж «редактируется отдельно» в variants-bar */
.group-variant-detached {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(244, 114, 182, 0.18);
  color: #fbcfe8;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.02em;
}

/* Бейдж и состояние «отвязан» в multi-step3 карточке варианта */
.multi-step3-variant-detached {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(244, 114, 182, 0.16);
  color: #fbcfe8;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.02em;
}
.multi-step3-variant.is-detached {
  border-color: rgba(244, 114, 182, 0.4);
  background: linear-gradient(180deg, rgba(244, 114, 182, 0.05), rgba(244, 114, 182, 0.01));
}

/* Уникализированный монтаж (мульти-аватар) — карточка в стиле платформы */
.uniq-montage-panel {
  margin-top: 18px;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: linear-gradient(145deg, rgba(30, 27, 75, 0.92), rgba(15, 23, 42, 0.88));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.uniq-montage-panel-inner {
  padding: 18px 20px 20px;
}
.uniq-montage-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.22);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 10px;
}
.uniq-montage-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -0.02em;
}
.uniq-montage-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: #94a3b8;
}
.uniq-montage-desc strong {
  color: #c7d2fe;
  font-weight: 600;
}
.uniq-montage-status {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
}
.uniq-montage-status--run { color: #fde047; }
.uniq-montage-status--ok { color: #86efac; }
.uniq-montage-status--err { color: #fca5a5; }
.uniq-montage-files {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.uniq-montage-files li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
}
.uniq-montage-file-label {
  flex: 1;
  min-width: 140px;
  font-size: 13px;
  color: #e2e8f0;
}
.uniq-montage-dl {
  font-size: 12px;
  white-space: nowrap;
}
.uniq-montage-form {
  margin: 4px 0 0;
}
.uniq-montage-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
