﻿@media (max-width: 980px) {
  [data-project-timeline] .prompt-bubble,
  [data-project-timeline] .timeline-no-assets-block {
    max-width: 100%;
  }
}

/* Typed Seedance references: audio must never be rendered as an image, while
   video keeps a real playable preview even when no poster variant exists. */
[data-project-timeline] .aidc-ref-thumb--video {
  width: 112px;
  height: 112px;
  max-width: 112px;
  max-height: 112px;
  flex: 0 0 112px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: #0d0d0d;
  object-fit: contain;
}

[data-project-timeline] .aidc-ref-media-card--audio {
  width: 220px;
  min-height: 112px;
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  box-sizing: border-box;
  border: 1px solid rgba(89, 206, 255, 0.38);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(14, 28, 40, 0.96), rgba(10, 12, 18, 0.98));
}

[data-project-timeline] .aidc-ref-media-card__label {
  color: #8ae7ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

[data-project-timeline] .aidc-ref-audio-preview {
  width: 100%;
  height: 34px;
}

@media (max-width: 600px) {
  [data-project-timeline] .aidc-ref-thumb--video {
    width: min(100%, 180px);
    height: auto;
    max-width: 180px;
    max-height: 220px;
    flex: 0 1 180px;
    aspect-ratio: 9 / 16;
  }

  [data-project-timeline] .aidc-ref-media-card--audio {
    width: 100%;
    min-width: 0;
    min-height: 88px;
    flex: 1 1 100%;
  }
}
[data-project-timeline] .timeline-no-assets-block {
  width: 100%;
  background: #18181c;
  border: 1.5px solid #fff3b0;
  border-radius: 12px;
  margin: 0;
  padding: 24px 16px 18px 16px;
  color: #fff3b0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  font-size: 15px;
  font-weight: 500;
  position: relative;
  max-width: 900px;
}

[data-project-timeline] .timeline-no-assets-block b {
  color: #fffbe6;
  font-weight: 700;
  font-size: 15px;
}

[data-project-timeline] .timeline-no-assets-block span {
  color: #fff3b0;
  font-size: 13px;
}

[data-project-timeline] .timeline-no-assets-block .timeline-no-assets-btn {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

[data-project-timeline] .timeline-no-assets-block button.timeline-no-assets-btn {
  border-radius: 999px;
  padding: 6px 16px;
  border: 1.5px solid #fff3b0;
  background: #23232a;
  color: #fff3b0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
[data-project-timeline] .timeline-no-assets-block button.timeline-no-assets-btn:hover {
  background: #fff3b0;
  color: #18181c;
  border-color: #fff3b0;
}
[data-project-timeline] .timeline-error-block {
  width: 100%;
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.55);
  border-radius: 12px;
  padding: 10px 12px;
  color: #ffb3c3;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 900px;
}
[data-project-timeline] .timeline-error-title {
  font-weight: 700;
  color: #ffd0dc;
  letter-spacing: 0.02em;
}
[data-project-timeline] .timeline-error-text {
  color: #ffd6e0;
  word-break: break-word;
}
[data-project-timeline] * {
  box-sizing: border-box;
}

[data-project-timeline] {
  --bg: rgba(6,7,12,0.96);
  --panel: rgba(12,14,24,0.92);
  --border: rgba(255,255,255,0.08);
  --text: #f4f4ff;
  --muted: #a6a8bc;
  --pink: #ff62c5;
  --cyan: #00b4ff;
  --violet: #7156ff;
  --shadow: 0 18px 48px rgba(0,0,0,0.72);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: block;
}

[data-project-timeline].panel {
  border-radius: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.02);
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

[data-project-timeline] > .aidc-scroll {
  flex: 1 1 auto;
  min-height: 0;
}

[data-project-timeline] .panel-title {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d5d6e4;
}

[data-project-timeline] .timeline-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

[data-project-timeline] .timeline-head-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 820px;
}

[data-project-timeline] .timeline-project {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #f1f1ff;
  font-weight: 650;
}

[data-project-timeline] .timeline-project-name {
  font-size: 17px;
}

[data-project-timeline] .timeline-project-tag {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

[data-project-timeline] .timeline-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

[data-project-timeline] .timeline-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

[data-project-timeline] .chip {
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: #e8e8f4;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: default;
  white-space: nowrap;
}

[data-project-timeline] .chip.stats {
  background: rgba(255,255,255,0.07);
  height: 28px;
}

[data-project-timeline] .timeline-filter {
  position: relative;
  z-index: 3;
}

[data-project-timeline] .timeline-filter__toggle {
  cursor: pointer;
  gap: 6px;
  height: 28px;
  pointer-events: auto;
}

[data-project-timeline] .timeline-filter__chevron {
  display: inline-flex;
  align-items: center;
}

[data-project-timeline] .timeline-filter__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--aidc-bg-elevated, #212225);
  box-shadow:
    0 24px 64px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.04);
  display: none;
  z-index: 2000;
}

[data-project-timeline] .timeline-filter.is-open .timeline-filter__menu {
  display: block;
}

[data-project-timeline] .timeline-filter__menu .chip.filter {
  width: 100%;
  justify-content: flex-start;
  margin: 4px 0;
  padding: 6px 12px;
  height: 28px;
}

[data-project-timeline] .chip.filter {
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.14);
  transition: 0.16s ease;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  z-index: 1;
  padding: 3px 12px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 4px 12px rgba(0,0,0,0.3);
  color: #c8cad4;
}

[data-project-timeline] .chip.filter::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 28%, rgba(255,255,255,0.06), transparent 40%),
    radial-gradient(circle at 82% 72%, rgba(255,255,255,0.04), transparent 46%);
  opacity: 0;
  transition: inherit;
  z-index: 0;
}

[data-project-timeline] .chip.filter:hover {
  border-color: rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.07);
}

[data-project-timeline] .chip.filter.active {
  background: rgba(255,255,255,0.10);
  color: #ffffff;
  font-weight: 700;
  border-color: rgba(255,255,255,0.35);
  box-shadow:
    0 4px 12px rgba(0,0,0,0.3),
    0 0 0 1px rgba(255,255,255,0.18);
}

[data-project-timeline] .chip.filter.active::before {
  opacity: 1;
}

[data-project-timeline] .chip.filter .count {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.12);
  font-weight: 700;
  font-size: 11px;
}

[data-project-timeline] .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: radial-gradient(circle at 20% 0, #fff, #999);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.06);
}

[data-project-timeline] .dot--pink {
  background: radial-gradient(circle at 30% 10%, #ffd0ef, var(--pink));
}

[data-project-timeline] .dot--cyan {
  background: radial-gradient(circle at 30% 10%, #d0f5ff, var(--cyan));
}

[data-project-timeline] .dot--violet {
  background: radial-gradient(circle at 30% 10%, #e2d9ff, var(--violet));
}

[data-project-timeline] .dot--3d {
  background: radial-gradient(circle at 30% 10%, #d0ffe5, #11f7a7);
}

[data-project-timeline] .timeline-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0 6px;
}

[data-project-timeline] .timeline-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  /* Гарантируем, что список занимает всю ширину панели и не схлопывается
     по min-content вложенного медиа. */
  width: 100%;
  min-width: 0;
}

[data-project-timeline] .timeline-empty {
  padding: 16px;
  color: var(--muted);
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 12px;
  text-align: center;
  background: rgba(255,255,255,0.02);
}

[data-project-timeline] .timeline-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-radius: 16px;
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
  /* Карточка всегда тянется на всю ширину списка (а не сжимается по
     контенту), иначе flex/grid-причуды делают её узкой колонкой. */
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Контент-колонка карточки не должна схлопываться под жёсткой шириной
   вложенного медиа/референсов — иначе текст промпта переносится по словам.
   Грид-трек уже minmax(0,1fr), здесь дублируем min-width:0 на сам айтем. */
[data-project-timeline] .timeline-card > .card-body {
  min-width: 0;
}

[data-project-timeline] .timeline-card--clickable {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

[data-project-timeline] .timeline-card--clickable:hover {
  border-color: rgba(0,180,255,0.35);
  box-shadow: 0 14px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,180,255,0.12);
}

[data-project-timeline] .timeline-card::after {
  display: none;
}

[data-project-timeline] .timeline-card--highlight .card-body {
  box-shadow: 0 0 0 2px rgba(255,98,197,0.5), 0 20px 50px rgba(255,0,140,0.18);
  border-radius: 16px;
  animation: aidcTimelinePulse 0.8s ease-out 3;
}

@keyframes aidcTimelinePulse {
  0% { box-shadow: 0 0 0 0 rgba(255,98,197,0.6), 0 0 0 2px rgba(255,98,197,0.45); }
  50% { box-shadow: 0 0 0 10px rgba(255,98,197,0.0), 0 0 0 2px rgba(255,98,197,0.45); }
  100% { box-shadow: 0 0 0 0 rgba(255,98,197,0.0), 0 0 0 2px rgba(255,98,197,0.2); }
}

[data-project-timeline] .rail {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 100%;
}

[data-project-timeline] .rail::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: -18px;
  width: 2px;
  background: linear-gradient(180deg, rgba(255,98,197,0.9), rgba(0,180,255,0.85));
  box-shadow: 0 0 14px rgba(255,98,197,0.35), 0 0 14px rgba(0,180,255,0.35);
  opacity: 0.85;
}

[data-project-timeline] .timeline-card:last-child .rail::before {
  display: none;
}

[data-project-timeline] .timeline-list[data-view-mode="project"] .timeline-card:last-child .rail::before {
  display: block;
}

[data-project-timeline] .rail-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.6);
  background: linear-gradient(135deg, #ff62c5, #00b4ff);
  box-shadow: 0 0 0 6px rgba(255,255,255,0.03), 0 0 20px rgba(255,0,140,0.55);
  position: relative;
  z-index: 1;
}

[data-project-timeline] .rail-dot.type-image {
  background: linear-gradient(135deg, #ff62c5, #ff9fd6);
}

[data-project-timeline] .rail-dot.type-video {
  background: linear-gradient(135deg, #00b4ff, #2ad8ff);
}

[data-project-timeline] .rail-dot.type-audio {
  background: linear-gradient(135deg, #ffd86f, #ff62c5);
}

[data-project-timeline] .rail-dot.type-text {
  background: linear-gradient(135deg, #7a7ad6, #00b4ff);
}

[data-project-timeline] .rail-dot.type-3d {
  background: linear-gradient(135deg, #11f7a7, #00b4ff);
}

[data-project-timeline] .timeline-card:last-child .rail::before {
  display: none;
}

[data-project-timeline] .card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

[data-project-timeline] .timeline-placeholder-body {
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
}

[data-project-timeline] .timeline-placeholder-title {
  font-weight: 600;
  font-size: 16px;
  color: #fefefe;
  margin-bottom: 4px;
}

[data-project-timeline] .timeline-placeholder-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  line-height: 1.4;
}

[data-project-timeline] .timeline-placeholder-note {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  line-height: 1.4;
}

[data-project-timeline] .card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

[data-project-timeline] .type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--aidc-timeline-type-border);
}

[data-project-timeline] .type-badge.type-image {
}

[data-project-timeline] .type-badge.type-video {
}

[data-project-timeline] .type-badge.type-audio {
}

[data-project-timeline] .type-badge.type-text {
}

[data-project-timeline] .type-badge.type-3d {
}

[data-project-timeline] .card-time {
  color: var(--muted);
  font-size: 12px;
}

[data-project-timeline] .card-tags {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
[data-project-timeline] .card-tags--with-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
[data-project-timeline] .card-tags--with-actions .tl-card-icon {
  margin-left: auto;
}

[data-project-timeline] .card-tag {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 11px;
  color: #dfe1f4;
}

[data-project-timeline] .prompt-bubble {
  background: rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 12px 14px;
  color: #d4d6e0;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(3px);
  max-width: 900px;
  width: 100%;
  margin: 0;
}

/* Prompt row: prompt bubble + copy button */
[data-project-timeline] .prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 900px;
  width: 100%;
}
[data-project-timeline] .prompt-row .prompt-bubble {
  flex: 1 1 auto;
  min-width: 0;
}

/* MJ flags inside prompt bubble (--ar, --q, --s, etc.) */
[data-project-timeline] .prompt-mj-flags {
  color: #7b6ff0;
  font-weight: 500;
  white-space: pre-wrap;
}

/* Card-level icon buttons (copy prompt, trash) */
[data-project-timeline] .tl-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  background: transparent;
  transition: color 0.15s, background 0.15s, transform 0.1s;
  padding: 0;
  flex: 0 0 auto;
}
[data-project-timeline] .tl-card-icon:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}
[data-project-timeline] .tl-card-copy-prompt.is-copied {
  color: #4ade80;
}
[data-project-timeline] .tl-card-repeat.is-copied {
  color: #60a5fa;
}
[data-project-timeline] .tl-card-trash {
  align-self: flex-end;
  margin-left: auto;
}
[data-project-timeline] .tl-card-trash:hover {
  color: #f87171;
  background: rgba(220,38,38,0.15);
}
[data-project-timeline] .tl-card-icon svg {
  pointer-events: none;
}

/* Trash navigation button in timeline header */
[data-project-timeline] .tl-trash-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
[data-project-timeline] .tl-trash-nav-btn:hover {
  color: #f87171;
  background: rgba(220,38,38,0.10);
  border-color: rgba(220,38,38,0.30);
}
/* Active state: visually indicate trash mode is on (persistent, not just hover) */
[data-project-timeline] .tl-trash-nav-btn.active {
  color: #f87171;
  background: rgba(220,38,38,0.15);
  border-color: rgba(220,38,38,0.45);
  box-shadow: 0 0 0 1px rgba(220,38,38,0.12);
}

[data-project-timeline] .media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 520px;
  justify-items: start;
  align-items: start;
}

[data-project-timeline] .media-row {
  display: grid;
  grid-template-columns: minmax(320px, 440px) max-content;
  gap: 14px;
  align-items: start;
  align-content: start;
}

[data-project-timeline] .ref-media {
  width: 440px;
  max-width: 440px;
  min-width: 440px;
  grid-template-columns: repeat(4, 100px);
  grid-template-rows: repeat(4, 100px);
  grid-auto-rows: 100px;
  grid-auto-flow: row dense;
  gap: 10px;
  align-content: start;
  justify-content: flex-start;
  padding: 0;
}

[data-project-timeline] .ref-media.media.compact {
  width: 440px;
  max-width: 440px;
  min-width: 440px;
  grid-template-columns: repeat(4, 100px);
  grid-template-rows: repeat(4, 100px);
  grid-auto-rows: 100px;
}

[data-project-timeline] .media.compact {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  max-width: 520px;
}

[data-project-timeline] .timeline-head-actions .chip {
  padding: 4px 10px;
  font-size: 11px;
  gap: 6px;
  box-shadow: none;
}

[data-project-timeline] .timeline-head-actions .dot {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}

[data-project-timeline] .media img,
[data-project-timeline] .media video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  object-fit: contain;
  border: 0;
  background: transparent;
  box-shadow: none;
}

[data-project-timeline] .media.compact img,
[data-project-timeline] .media.compact video {
  object-fit: contain;
}

[data-project-timeline] .ref-media img {
  aspect-ratio: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: none;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #0a0c15;
}

[data-project-timeline] .card-body {
  gap: 12px;
}

[data-project-timeline] .timeline-card {
  cursor: pointer;
}

[data-project-timeline] .media.large {
  grid-template-columns: 1fr;
  max-width: 520px;
  justify-items: start;
}

/* MJ-style 2×2 grid: exactly 2 columns with consistent gap */
[data-project-timeline] .media.grid-2x2 {
  grid-template-columns: 1fr 1fr;
  max-width: 520px;
  gap: 6px;
}

[data-project-timeline] .media.grid-2x2 img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}

/* Ensure media-cell fills the grid cell and clips badge overflow */
[data-project-timeline] .media.grid-2x2 .tl-media-cell {
  display: block;
  width: 100%;
  overflow: hidden;
  position: relative;
}
[data-project-timeline] .media.grid-2x2 .tl-media-cell > img {
  width: 100%;
  max-width: 100%;
  max-height: none;
}

[data-project-timeline] .video-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  width: auto;
  max-width: 476px;
  max-height: 55vh;
  display: inline-block;
  background: transparent;
}

[data-project-timeline] .video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.65) 100%);
}

[data-project-timeline] .video-thumb img {
  width: 100%;
  height: auto;
  max-height: 55vh;
  display: block;
  object-fit: contain;
}

[data-project-timeline] .play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  color: #f4f6ff;
  box-shadow: 0 8px 22px rgba(0,0,0,0.6);
}

[data-project-timeline] .play-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

[data-project-timeline] .audio-bar {
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255,98,197,0.2), rgba(0,180,255,0.16));
  border: 1px solid rgba(255,255,255,0.12);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

[data-project-timeline] .audio-wave {
  position: relative;
  height: 46px;
  overflow: hidden;
}

[data-project-timeline] .audio-wave::before,
[data-project-timeline] .audio-wave::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.75) 0,
    rgba(255,255,255,0.75) 4px,
    rgba(255,255,255,0.05) 4px,
    rgba(255,255,255,0.05) 8px
  );
  opacity: 0.28;
}

[data-project-timeline] .audio-wave::after {
  background: repeating-linear-gradient(
    90deg,
    rgba(0,0,0,0.05) 0,
    rgba(0,0,0,0.05) 4px,
    rgba(0,0,0,0.12) 4px,
    rgba(0,0,0,0.12) 8px
  );
  opacity: 0.18;
}

[data-project-timeline] .audio-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #f2f3ff;
}

[data-project-timeline] .audio-meta .muted {
  color: var(--muted);
}

[data-project-timeline] .pill-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

[data-project-timeline] .pill-btn {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: #f4f4ff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

[data-project-timeline] .pill-btn.primary {
  background: linear-gradient(120deg, #ff62c5, #ff008c);
  color: #0c060f;
  font-weight: 650;
  border-color: rgba(255,0,140,0.36);
}

[data-project-timeline] .pill-btn.ghost {
  border-style: dashed;
  color: var(--muted);
}

body.aidc-gal-open {
  overflow: hidden !important;
}

.aidc-gal[hidden] {
  display: none !important;
}

.aidc-gal {
  position: fixed;
  inset: 0;
  z-index: 999999;
}

.aidc-gal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.aidc-gal__modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1100px, calc(100vw - 48px));
  height: min(86vh, calc(100vh - 48px));
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 16px;
  box-sizing: border-box;
  border-radius: 16px;
  background: rgba(10, 10, 12, 0.65);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.aidc-gal__close {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
}

.aidc-gal__stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding-top: 18px;
}

.aidc-gal__stage img,
.aidc-gal__stage video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #05070d;
  object-fit: contain;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.65);
  width: auto;
  height: auto;
}

.aidc-gal__stage video {
  background: #000;
  user-select: none;
}

.aidc-gal__stage img.is-placeholder {
  background: radial-gradient(circle at 0% 0%, rgba(99, 224, 255, 0.25), rgba(4, 16, 28, 0.35)),
    linear-gradient(135deg, rgba(26, 104, 255, 0.45), rgba(99, 224, 255, 0.4));
}

.aidc-gal__stage img.is-zoomed {
  cursor: grab;
}

.lightbox-caption {
  text-align: center;
  font-size: 13px;
  color: #c2c3d9;
  margin-bottom: 8px;
  max-width: 100%;
}

.lightbox-caption [data-timeline-lightbox-title] {
  font-weight: 600;
  color: #f5f5ff;
}

.lightbox-caption > div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  border-radius: 14px;
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
  cursor: pointer;
  z-index: 2;
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-nav[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.aidc-gal__toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(5, 5, 10, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 10px 14px;
}

.lb-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lb-btn.active {
  color: #ff62c5;
  border-color: rgba(255, 98, 197, 0.6);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5ff;
  cursor: pointer;
}

@media (max-width: 780px) {
  [data-project-timeline] .timeline-card {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  [data-project-timeline] .rail {
    display: none;
  }
}

.video-thumb {
  position: relative;
}

.image-thumb {
  position: relative;
  display: inline-block;
}

.image-thumb--pending,
.video-thumb--pending {
  width: min(100%, 520px);
  aspect-ratio: var(--timeline-pending-aspect, 4 / 3);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: 0;
  background: #0a0c15;
}

.video-thumb--failed {
  width: min(100%, 520px);
  min-height: 220px;
  aspect-ratio: var(--timeline-pending-aspect, 16 / 9);
  border: 1px solid rgba(255, 77, 109, 0.42);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(28, 12, 20, 0.96), rgba(10, 12, 18, 0.98));
  overflow: hidden;
}

.image-thumb--pending img,
.video-thumb--pending img {
  opacity: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: block;
  object-fit: contain;
  background: #0a0c15;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* MJ-style multi-slot grid: when compact media has 2+ pending thumbs, shrink them */
.media.compact:has(.image-thumb--pending + .image-thumb--pending) .image-thumb--pending {
  width: min(100%, 220px);
}

.media.compact:has(.image-thumb--pending + .image-thumb--pending) .image-thumb--pending img {
  object-fit: cover;
}

/* Error preview — fill the card container like a normal preview */
.aidc-preview-error {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  display: block;
  border-radius: 14px;
  object-fit: contain;
  background: #0a0c15;
}

.timeline-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ff4dd8;
  animation: aidc-spin 0.8s linear infinite;
  pointer-events: none;
}

.timeline-status {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(5, 7, 13, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-status--error {
  background: rgba(255, 77, 109, 0.12);
  border-color: rgba(255, 77, 109, 0.7);
  color: #ffb3c3;
}

@keyframes aidc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Show all button for refs/results */
[data-project-timeline] .show-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 180, 255, 0.12);
  border: 1px solid rgba(0, 180, 255, 0.35);
  color: #bde8ff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-top: 8px;
}
[data-project-timeline] .show-all-btn:hover {
  background: rgba(0, 180, 255, 0.22);
  border-color: rgba(0, 180, 255, 0.55);
}
[data-project-timeline] .show-all-results {
  margin-top: 12px;
  display: block;
}

/* Refs label */
[data-project-timeline] .refs-label {
  font-size: 11px;
  color: #9fa0b7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  grid-column: 1 / -1;
}

/* ===== Timeline media cell overlay actions ===== */
[data-project-timeline] .tl-media-cell,
[data-project-timeline] .video-thumb {
  position: relative;
  overflow: hidden;
}
[data-project-timeline] .tl-media-cell {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
  overflow: hidden;
  border-radius: 14px;
}
[data-project-timeline] .tl-media-cell > img,
[data-project-timeline] .tl-media-cell > video {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 55vh;
  border-radius: 0 !important;
}
[data-project-timeline] .tl-media-actions {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s;
}
[data-project-timeline] .tl-media-cell:hover .tl-media-actions,
[data-project-timeline] .video-thumb:hover .tl-media-actions {
  opacity: 1;
}
[data-project-timeline] .video-thumb .tl-media-actions {
  z-index: 10;
}
[data-project-timeline] .tl-act-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.1s;
  padding: 0;
}
[data-project-timeline] .tl-act-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}
[data-project-timeline] .tl-act-btn.tl-act-del:hover {
  background: rgba(220, 38, 38, 0.85);
}
[data-project-timeline] .tl-act-btn.tl-act-variate:hover {
  background: rgba(79, 70, 229, 0.85);
}
[data-project-timeline] .tl-act-btn.tl-act-fav.is-active {
  color: #facc15;
  background: rgba(0, 0, 0, 0.7);
}
/* Always show the favorite star overlay when it is active (not just on hover) */
[data-project-timeline] .tl-fav-overlay:has(.tl-act-fav.is-active) {
  opacity: 1;
}
/* Fallback: show only the fav button itself always when active */
[data-project-timeline] .tl-act-btn.tl-act-fav.is-active {
  opacity: 1;
}
[data-project-timeline] .tl-act-btn svg {
  pointer-events: none;
}
/* Veo GET/Extend button labels */
[data-project-timeline] .tl-act-label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
[data-project-timeline] .tl-act-cost {
  font-size: 9px;
  font-weight: 500;
  opacity: 0.7;
  line-height: 1;
  pointer-events: none;
}
[data-project-timeline] .tl-act-get1080,
[data-project-timeline] .tl-act-get4k,
[data-project-timeline] .tl-act-extend {
  flex-direction: column;
  gap: 1px;
  min-width: 32px;
  padding: 3px 4px;
}

/* ⭐ Favorite overlay — bottom-left of the image/video */
[data-project-timeline] .tl-fav-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s;
}
[data-project-timeline] .tl-media-cell:hover .tl-fav-overlay,
[data-project-timeline] .video-thumb:hover .tl-fav-overlay {
  opacity: 1;
}

/* "Повторить" overlay — legacy / fallback (no longer used separately, kept for compat) */
[data-project-timeline] .tl-recreate-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s;
}
[data-project-timeline] .tl-media-cell:hover .tl-recreate-overlay,
[data-project-timeline] .video-thumb:hover .tl-recreate-overlay {
  opacity: 1;
}
[data-project-timeline] .tl-act-recreate {
  display: flex;
  align-items: center;
  gap: 0;
  height: 32px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  padding: 0 8px;
  transition: background 0.15s, gap 0.2s, padding 0.2s;
  white-space: nowrap;
  overflow: hidden;
}
[data-project-timeline] .tl-act-recreate:hover {
  background: rgba(0, 0, 0, 0.8);
  gap: 6px;
}
[data-project-timeline] .tl-recreate-label {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 12px;
  font-weight: 500;
  transition: max-width 0.25s ease, opacity 0.2s;
}
[data-project-timeline] .tl-act-recreate:hover .tl-recreate-label {
  max-width: 100px;
  opacity: 1;
}

/* Old standalone recreate button (kept for legacy compat) */
[data-project-timeline] .tl-recreate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #c5c6e0;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 4px;
}
[data-project-timeline] .tl-recreate-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ── MJ Grid Action Buttons ── */
[data-project-timeline] .mj-grid-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 4px;
  align-items: center;
}

[data-project-timeline] .mj-grid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #c5c6e0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  user-select: none;
  font-family: inherit;
  line-height: 1;
}

[data-project-timeline] .mj-grid-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.22);
}

[data-project-timeline] .mj-grid-btn:active:not(:disabled) {
  transform: scale(0.95);
}

[data-project-timeline] .mj-grid-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-project-timeline] .mj-grid-btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

[data-project-timeline] .mj-grid-btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid transparent;
  border-top-color: #a78bfa;
  animation: mj-btn-spin 0.6s linear infinite;
}

@keyframes mj-btn-spin {
  to { transform: rotate(360deg); }
}

[data-project-timeline] .mj-grid-btn.is-done {
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
}

/* Upscale buttons — blue accent */
[data-project-timeline] .mj-grid-btn--upscale:hover:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.4);
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

/* Vary buttons — purple accent */
[data-project-timeline] .mj-grid-btn--vary:hover:not(:disabled) {
  border-color: rgba(167, 139, 250, 0.4);
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
}

/* Reroll button — orange accent */
[data-project-timeline] .mj-grid-btn--reroll:hover:not(:disabled) {
  border-color: rgba(251, 191, 36, 0.4);
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

/* Reroll SVG icon inside button */
[data-project-timeline] .mj-grid-btn--reroll svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── MJ Grid Image Number Badge ── */
[data-project-timeline] .tl-mj-index-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: 0.02em;
  font-family: inherit;
}

/* ── MJ Sub-menu (Upscale type / Vary type popup) ── */
.mj-sub-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 210px;
  padding: 6px;
  border-radius: 10px;
  background: #181824;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.4);
  animation: mj-sub-menu-in 0.15s ease-out;
}

@keyframes mj-sub-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

[data-project-timeline] .mj-sub-menu__item,
.mj-sub-menu .mj-sub-menu__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #c5c6e0;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
}

[data-project-timeline] .mj-sub-menu__item:hover,
.mj-sub-menu .mj-sub-menu__item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

[data-project-timeline] .mj-sub-menu__item--subtle:hover,
.mj-sub-menu .mj-sub-menu__item--subtle:hover {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

[data-project-timeline] .mj-sub-menu__item--creative:hover,
.mj-sub-menu .mj-sub-menu__item--creative:hover {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

[data-project-timeline] .mj-sub-menu__item--strong:hover,
.mj-sub-menu .mj-sub-menu__item--strong:hover {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

[data-project-timeline] .mj-sub-menu__label,
.mj-sub-menu .mj-sub-menu__label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

[data-project-timeline] .mj-sub-menu__desc,
.mj-sub-menu .mj-sub-menu__desc {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.6;
  line-height: 1.3;
}

/* v1.9.29  inline 3D viewer in timeline cards: hide auxiliary toolbar */
.aidc-3d-card-media .aidc-3d-viewer-toolbar { display: none !important; }
.aidc-3d-card-media .aidc-3d-inline-viewer { cursor: grab; }
.aidc-3d-card-media .aidc-3d-inline-viewer:active { cursor: grabbing; }


/* ============================================================
   АДАПТАЦИЯ ЛЕНТЫ ПОД УЗКУЮ КОЛОНКУ (zoom-safe, без container queries)
   ------------------------------------------------------------
   ВАЖНО: сайт применяет html { zoom: 0.85/0.82/0.78/... } через
   responsive-scaling.css. CSS-zoom КОНФЛИКТУЕТ с container-type:
   inline-size в Chrome (containment неверно резолвит ширину →
   @container не матчит / схлопывает блок). Поэтому container queries
   тут НЕ используем.

   Корень «разваливания в узкие колонки» — ДВЕ причины:
   1) Грид карточки был `32px 1fr`, где 1fr = minmax(auto,1fr): auto-min
      раздувался под min-content вложенного медиа/референсов (440px) —
      классический grid blowout. Фикс: `32px minmax(0,1fr)` + width:100%
      на карточку (см. .timeline-card выше).
   2) Внутри карточки основное медиа стояло В РЯД с блоком референсов
      (.media-row → flex из JS), а .ref-media был жёстко зафиксирован
      (width/min-width/max-width: 440px). На узкой колонке рефы не
      сжимались, забирали всю ширину, основное медиа и текст сжимались
      в тонкие колонки.

   Решение — flex-wrap на .media-row + снятие фикс-ширины с .ref-media:
   рефы естественно переносятся под медиа, когда не помещаются, и тянутся
   в ряд, когда места хватает. Работает при ЛЮБОМ zoom и ЛЮБОЙ ширине, без
   media/container queries. ============================================ */

/* media-row: разрешаем перенос блока референсов под основное медиа.
   JS задаёт инлайн display:flex/gap/align-items, но НЕ flex-wrap —
   поэтому wrap добавляем здесь (важнее инлайна за счёт отсутствия
   инлайнового flex-wrap у row). */
[data-project-timeline] .media-row {
  flex-wrap: wrap !important;
}

/* Референсы больше НЕ фиксированы на 440px: min-width:0 позволяет блоку
   сжиматься, а media-row выше — переносить его под основное медиа.
   (refsContainer из JS — flex-wrap, поэтому миниатюры 112px внутри сами
   раскладываются по рядам; grid-template здесь не нужен.) */
[data-project-timeline] .ref-media,
[data-project-timeline] .ref-media.media.compact {
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Основное медиа и его сетки не навязывают фикс-ширину */
[data-project-timeline] .media,
[data-project-timeline] .media.compact,
[data-project-timeline] .media.large,
[data-project-timeline] .media.grid-2x2 {
  min-width: 0;
}

/* Промпт/обёртка переносятся нормально, без схлопывания контента.
   ВАЖНО: overflow-wrap: break-word (НЕ anywhere!). `anywhere` уменьшает
   min-content блока до ОДНОГО символа — и если body по какой-то причине
   выравнивается не stretch, он сжимается в полоску шириной в 1 букву. */
[data-project-timeline] .prompt-row,
[data-project-timeline] .prompt-bubble {
  min-width: 0;
}
[data-project-timeline] .prompt-bubble {
  overflow-wrap: break-word;
}

/* Видео-превью не навязывает свою фикс-ширину контейнеру */
[data-project-timeline] .video-thumb {
  max-width: 100%;
}

/* ============================================================
   КОРНЕВОЙ ФИКС «УЗКИХ КОЛОНОК»: КАРТОЧКА НА FLEXBOX (не grid).
   ------------------------------------------------------------
   Диагностика (computed) показала: грид карточки = `32px minmax(0,1fr)`
   (две колонки, вторая ~595px — места полно), НО .card-body получал
   ширину ровно 32px = попадал в УЗКУЮ рельсовую колонку (col 1), а
   широкая col 2 пустовала. Текст промпта переносился по одной букве.

   Явный `grid-column: 2` это НЕ исправил (видимо, из-за взаимодействия
   CSS-grid с html{zoom} в Chrome — грид-треки пересчитываются неверно).
   Поэтому уходим от грида ВОВСЕ: переводим карточку на flexbox, где
   рельса — фикс-элемент 32px, а тело — растущий (flex:1; min-width:0).
   Flex не имеет «auto-placement», поэтому тело ГАРАНТИРОВАННО занимает
   всю оставшуюся ширину при любом zoom и любом состоянии рельсы.
   Внутренние гриды (.media, .refs-label[grid-column:1/-1] и т.п.) живут
   ВНУТРИ card-body/контейнеров и от смены карточки на flex не страдают.
   `!important` — чтобы перебить базовое `display:grid` карточки и
   `grid-template-columns:1fr` из @media(max-width:780px). =========== */
[data-project-timeline] .timeline-card {
  display: flex !important;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
}
[data-project-timeline] .timeline-card > .rail {
  flex: 0 0 32px;
  width: 32px;
  min-width: 32px;
}
[data-project-timeline] .timeline-card > .card-body,
[data-project-timeline] .timeline-card > .card-body--system,
[data-project-timeline] .timeline-card > .timeline-placeholder-body {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

/* Узкий режим: рельса скрыта (display:none из @media 780px) — тело
   само занимает всю ширину, дополнительных правил не нужно. */
