/* Generate Document (handoff screen 09, README section 6 row 09).
 * Left: page head, the vertical stepper and the plan card (Back / Generate are the launch controls).
 * Right: the current step only: the deal picker, the template gallery (scrolling in its own box) with
 * its options pinned below, the two source cards; step 4 is the generating / done stage below.
 * Shared vocabulary (mg-tile, tile-head, btn, sfig, lbl, st, meter, rpt-tile__cover, sheet, cv) comes
 * from magnum-app.css; everything page-specific is prefixed gx- here. */

/* ── page grid ─────────────────────────────────────────────────────────── */
body.gen-compose-page .df-content.gx { container-type: inline-size; }
.gx-grid {
  display: grid; grid-template-columns: 344px minmax(0, 1fr); column-gap: 40px; align-items: start;
  grid-template-areas: "head work" "steps work" "plan work"; grid-template-rows: auto auto 1fr;
}
.gx-head { grid-area: head; min-width: 0; }
.gx-steps { grid-area: steps; }
.gx-work { grid-area: work; min-width: 0; container-type: inline-size; }
.gx-plan { grid-area: plan; }
.gx-lead { max-width: 344px; }
[data-step-panel][hidden], .gx-cov[hidden], .gx-drop[hidden], .gx-lib__more[hidden], .gx-plan__why[hidden],
.gx-quiet[hidden], #dr-tip-host[hidden], .gx-opts[hidden] { display: none !important; }

/* ── stepper: done in ink, the current step in gold, the next one outlined ── */
.gx-steps { list-style: none; margin: 26px 0 0; padding: 22px 0 0; border-top: 1px solid rgba(25,25,24,.08); display: flex; flex-direction: column; }
.gx-step { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 14px; padding-bottom: 22px; }
.gx-step:last-child { padding-bottom: 0; }
.gx-step:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 32px; bottom: 6px; width: 1px; background: rgba(25,25,24,.14); }
.gx-step.is-done:not(:last-child)::after { background: #191918; }
.gx-step__mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: 600 12px/1 var(--mg-sans, Inter, sans-serif);
  font-variant-numeric: tabular-nums; background: #fff; box-shadow: inset 0 0 0 1px rgba(25,25,24,.24); color: #33322f; }
.gx-step__mark .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.gx-step.is-done .gx-step__mark { background: #191918; box-shadow: none; color: #fffef2; }
.gx-step.is-now .gx-step__mark { background: #fcaa2d; box-shadow: none; color: #191918; }
.gx-step__body { min-width: 0; }
.gx-step__t { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font: 600 14px/26px var(--mg-sans, Inter, sans-serif); color: #191918; }
.gx-step.is-next .gx-step__t { font-weight: 500; color: #33322f; }
.gx-step__edit { border: 0; background: none; padding: 0; cursor: pointer; font: 500 13px/1 var(--mg-sans, Inter, sans-serif); color: #191918;
  text-decoration: underline; text-decoration-color: rgba(25,25,24,.3); text-underline-offset: 3px; }
.gx-step__edit:hover { text-decoration-color: #191918; }
.gx-step__v { margin-top: 3px; font: 400 17px/1.25 var(--mg-serif, 'Newsreader', Georgia, serif); letter-spacing: -.01em; font-optical-sizing: auto; color: #191918; overflow-wrap: anywhere; }
.gx-step__v2 { margin-top: 3px; font: 500 13px/1.35 var(--mg-sans, Inter, sans-serif); color: #191918; overflow-wrap: anywhere; }
.gx-step__d { margin-top: 3px; font: 400 13px/1.45 var(--mg-sans, Inter, sans-serif); color: #555550; }
.gx-step__d--tight { margin-top: 1px; }

/* ── plan card ─────────────────────────────────────────────────────────── */
.gx-plan { margin-top: 28px; display: flex; flex-direction: column; overflow: hidden; }
.gx-plan .rpt-tile__cover { --tray-pt: 18px; border-radius: calc(var(--mg-r-tile, 12px) - 1px) calc(var(--mg-r-tile, 12px) - 1px) 0 0; }
.gx-plan__body { padding: 16px 20px 18px; }
.gx-plan__name { font: 600 14px/1.35 var(--mg-sans, Inter, sans-serif); color: #191918; overflow-wrap: anywhere; }
.gx-plan__meta { margin-top: 3px; font: 400 12px/1.35 var(--mg-sans, Inter, sans-serif); color: #555550; }
.gx-plan__figs { display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(25,25,24,.08); }
.gx-plan__figs > div + div { padding-left: 18px; border-left: 1px solid rgba(25,25,24,.08); }
.gx-plan__figs .sfig { display: block; margin-top: 6px; }
.gx-plan__note { margin-top: 12px; font: 400 12px/1.5 var(--mg-sans, Inter, sans-serif); color: #33322f; }
.gx-plan__note b { font-weight: 600; color: #191918; }
.gx-plan__why { margin: 0; padding: 0 20px 14px; font: 500 12px/1.45 var(--mg-sans, Inter, sans-serif); color: #33322f; }
.gx-plan__why::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fcaa2d; margin-right: 7px; vertical-align: 1px; }
.gx-plan__foot { display: flex; gap: 8px; padding: 12px 16px; }
.gx-plan__foot .btn--primary { flex: 1; }
.gx-plan__foot .btn { white-space: nowrap; }
.gx-plan__foot .btn--primary.is-running:disabled { background: #191918; color: #fffef2; }
.gx-plan--bare .gx-plan__cover, .gx-plan--bare .gx-plan__body { display: none; }
/* Snapshot covers: the picture fills the sheet from the top (a tall full-page picture scrolls on hover, CoverFlip). */
.gx .sheet > img { position: absolute; inset: 0 0 auto 0; width: 100%; height: auto; min-height: 100%; object-fit: cover; object-position: top; display: block; }

/* ── work area ─────────────────────────────────────────────────────────── */
.gx-work__head { margin: 6px 0 20px; }
.gx-work__title { margin-top: 8px; font: 600 20px/1.25 var(--mg-sans, Inter, sans-serif); letter-spacing: -.015em; color: #191918; outline: none; }
.gx-work__sub { margin-top: 6px; font: 400 14px/1.5 var(--mg-sans, Inter, sans-serif); color: #33322f; max-width: 620px; text-wrap: pretty; }
.gx-panel__foot { display: flex; justify-content: flex-end; margin-top: 20px; }
.gx-quiet { border: 0; background: transparent; padding: 0; font: 500 13px/1 var(--mg-sans, Inter, sans-serif); color: #191918; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(25,25,24,.3); text-underline-offset: 3px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.gx-quiet:hover { text-decoration-color: #191918; }
.gx-quiet .ic { width: 14px; height: 14px; }
.gx-mark { position: relative; display: inline-block; flex: none; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: #fcaa2d;
  box-shadow: 0 0 0 2px rgba(252,170,45,.22); vertical-align: 1px; }
.gx-search { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px; background: #fff;
  box-shadow: inset 0 0 0 1px rgba(25,25,24,.16); color: #555550; }
.gx-search:focus-within { box-shadow: inset 0 0 0 2px #191918; }
.gx-search .ic { width: 16px; height: 16px; flex: none; }
.gx-search input, .mg-app-ui .gx-search input:focus-visible { outline: none; }
.gx-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 14px/1 var(--mg-sans, Inter, sans-serif); color: #191918; }
.gx-search input::placeholder { color: #6b6b66; }

/* ── step 1: deals ─────────────────────────────────────────────────────── */
.gx-deals { overflow: hidden; }
.gx-deals__tools { padding: 16px 20px; border-bottom: 1px solid rgba(25,25,24,.08); }
.gx-deals__tools .gx-search { max-width: 360px; }
.gx-deals__cols, .gx-deal { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(max-content, .8fr) 20px; column-gap: 16px; align-items: center; }
.gx-deals__cols { padding: 10px 20px; font: 500 12px/1.3 var(--mg-sans, Inter, sans-serif); color: #555550; background: #fafaf7; border-bottom: 1px solid rgba(25,25,24,.06); }
.gx-deal { width: 100%; min-height: 60px; padding: 10px 20px; border: 0; border-bottom: 1px solid rgba(25,25,24,.06); background: #fff; text-align: left;
  font: inherit; color: inherit; cursor: pointer; }
.gx-deal:last-child { border-bottom: 0; }
.gx-deal:hover { background: #fafaf7; }
.gx-deal:focus-visible { outline: 2px solid #191918; outline-offset: -2px; }
.gx-deal.is-on { background: #fffaf0; box-shadow: inset 3px 0 0 #fcaa2d; }
.gx-deal__main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.gx-deal__code { font: 400 17px/1.25 var(--mg-serif, 'Newsreader', Georgia, serif); letter-spacing: -.01em; color: #191918; overflow-wrap: anywhere; }
.gx-deal__target { font: 400 13px/1.35 var(--mg-sans, Inter, sans-serif); color: #555550; overflow-wrap: anywhere; }
.gx-deal__type { font: 400 13px/1.35 var(--mg-sans, Inter, sans-serif); color: #33322f; overflow-wrap: anywhere; }
.gx-deal__stage { min-width: 0; }
.gx-deal__stage .st { white-space: normal; }
.gx-deal__go { color: #555550; display: grid; place-items: center; }
.gx-deals__list .cs-empty { padding: 28px 20px; }

/* ── step 2: the gallery scrolls in its own box; options and Continue stay pinned below ── */
/* The panel fills the viewport under the topbar (64px) and the content padding (32px top, 24px kept
   below), so head, tools, grid box, options and Continue fit without page scroll. */
.gx-panel[data-step-panel="2"]:not([hidden]) { display: flex; flex-direction: column; height: calc(100dvh - 120px); min-height: 600px; }
.gx-panel[data-step-panel="2"] > .gx-work__head { flex: none; margin-bottom: 16px; }
/* No overflow clip on the tile: the grid is the only scroller, so a card scrolled out of view is not "cut". */
.gx-gal { flex: 1 1 auto; min-height: 260px; display: flex; flex-direction: column; }
.gx-gal__tools { flex: none; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; padding: 14px 20px;
  border-bottom: 1px solid rgba(25,25,24,.08); }
.gx-gal__tools .gen-cat-pills { margin: 0; }
.gx-search--sm { width: 240px; max-width: 100%; height: 34px; }
.gx-gal .cs-tpl-grid { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 20px 20px; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; align-content: start; }
.gx-panel[data-step-panel="2"] > .gx-opts, .gx-panel[data-step-panel="2"] > .gx-panel__foot { flex: none; }
.gx-panel[data-step-panel="2"] > .gx-panel__foot { margin-top: 14px; }

/* Options: row 1 = Style and Layout side by side, row 2 = Instructions on one line (three on focus). */
.gx-opts { margin-top: 14px; padding: 14px 20px 16px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 24px; }
.gx-opts > .gx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gx-opts > #styleBlock { flex: none; }
.gx-opts > #layoutBlock { flex: 1 1 360px; }
.gx-opts > .gx-field--wide { flex: 1 0 100%; }
.gx-opts .gx-field__label { margin: 0; }
.gx-field--wide { grid-column: 1 / -1; }
.gx-field__label { display: block; margin-bottom: 8px; font: 600 14px/1.3 var(--mg-sans, Inter, sans-serif); color: #191918; }
.gen-style { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: #f1f0ea; }
.gen-style__opt { position: relative; cursor: pointer; }
.gen-style__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.gen-style__opt span { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 7px; font: 500 13px/1 var(--mg-sans, Inter, sans-serif); color: #33322f; }
.gen-style__opt input:checked + span { background: #fff; color: #191918; font-weight: 600; box-shadow: 0 1px 2px rgba(25,25,24,.1); }
.gen-style__opt input:focus-visible + span { outline: 2px solid #191918; outline-offset: 1px; }
.gen-layout, .gx-opts-list { display: flex; flex-direction: column; gap: 8px; }
.gx-opts .gen-layout { flex: 1; min-width: 0; flex-direction: row; flex-wrap: wrap; }
.gx-opts .gen-layout__opt { flex: 1 1 170px; padding: 7px 12px; }
.gx-opts .gen-layout__hint { margin-top: 1px; }
.gen-layout__opt, .gx-opt { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; padding: 12px; border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(25,25,24,.12); cursor: pointer; background: #fff; font: 400 13px/1.35 var(--mg-sans, Inter, sans-serif); color: #191918; }
.gen-layout__opt:has(input:checked), .gx-opt:has(input:checked) { box-shadow: inset 0 0 0 1.5px #191918; }
.gen-layout__opt:has(input:focus-visible), .gx-opt:has(input:focus-visible) { outline: 2px solid #191918; outline-offset: 2px; }
.gen-layout__opt strong, .gx-opt__t { display: block; font-weight: 600; }
.gen-layout__hint, .gx-opt__d { display: block; margin-top: 3px; font: 400 12px/1.45 var(--mg-sans, Inter, sans-serif); color: #555550; }
.gx-rdo { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(25,25,24,.32); background: #fff; margin-top: 1px; }
input:checked + .gx-rdo { box-shadow: inset 0 0 0 5px #191918; }
.gen-layout__opt > input, .gx-opt > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.gen-instructions { display: block; width: 100%; min-width: 0; box-sizing: border-box; height: 40px; padding: 9px 12px; border: 0; border-radius: 8px; background: #fff;
  box-shadow: inset 0 0 0 1px rgba(25,25,24,.16); color: #191918; font: 400 14px/1.5 var(--mg-sans, Inter, sans-serif); resize: none; outline: none;
  transition: height .15s ease; }
/* One ink ring: the inset shadow (as .search / .input:focus-within); the generic gold focus outline is off. */
.gen-instructions:focus { height: 82px; box-shadow: inset 0 0 0 2px #191918; }
.mg-app-ui .gen-instructions:focus-visible, .gen-instructions:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { .gen-instructions { transition: none; } }
.gen-instructions::placeholder { color: #6b6b66; }

/* ── step 3: the source cards ──────────────────────────────────────────── */
.gx-cols { --pad: 24px; display: grid; grid-template-columns: minmax(470px, 1.9fr) minmax(230px, 1fr); gap: 20px; align-items: stretch; }
.gx-cols > .gx-lib { --pad: 20px; }
/* Side by side only while the Deal Data Room keeps 470px (whole file names) and the Firm Library 230px. */
@container (max-width: 719px) { .gx-cols { grid-template-columns: minmax(0, 1fr); } .gx-cols > .gx-lib { --pad: 24px; } }
.gx-cols .tile-head { flex-wrap: wrap; row-gap: 4px; padding-inline: var(--pad); }
.gx-th > * { white-space: nowrap; }
.gx-sel { margin-left: auto; font: 500 13px/1 var(--mg-sans, Inter, sans-serif); color: #191918; font-variant-numeric: tabular-nums; }
.gx-sel:empty { display: none; }
.gx-dr { display: flex; flex-direction: column; }
.gx-cov { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; row-gap: 8px; margin: 14px var(--pad) 0;
  padding: 12px 14px 13px; border-radius: 8px; background: #fafaf7; box-shadow: inset 0 0 0 1px rgba(25,25,24,.06); }
.gx-cov__t { font: 400 12px/1.3 var(--mg-sans, Inter, sans-serif); color: #555550; }
.gx-cov__t b { font: 600 13px/1 var(--mg-sans, Inter, sans-serif); color: #191918; font-variant-numeric: tabular-nums; }
.gx-cov .meter { grid-column: 1 / -1; }
.gx-cov .st { font-size: 12px; }
.gx-srclist { display: flex; flex-direction: column; flex: 1 0 auto; min-width: 0; overflow: hidden; border-radius: 0 0 calc(var(--mg-r-tile, 12px) - 1px) calc(var(--mg-r-tile, 12px) - 1px); }
.gx-srclist > * { flex: none; }
/* Step 3 cards never grow past the browser: the file tree and the library list scroll inside their
   card; the head, coverage bar, upload zone, Show all row and the missing-data choice stay put. */
@media (min-width: 641px) {
  .gx-cols > .mg-tile { max-height: var(--mg-card-cap, calc(100vh - 116px)); }
  .gx-dr > .tile-head, .gx-dr > .gx-cov { flex: none; }
  .gx-srclist { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  .gx-srclist > .gx-tree { flex: 1 1 auto; min-height: 0; overflow: auto; }
  .gx-lib > .tile-head, .gx-lib > .gx-lib__note, .gx-lib > .gx-lib__more, .gx-lib > .gx-miss { flex: none; }
  .gx-libl { flex: 1 1 auto; min-height: 0; overflow: auto; }
}
.gx-tree { margin-top: 12px; border-top: 1px solid rgba(25,25,24,.08); }
.gx-grp__head { display: grid; grid-template-columns: 24px 16px minmax(0, 1fr) auto; column-gap: 8px; align-items: center; min-height: 40px;
  padding: 0 var(--pad) 0 calc(var(--pad) - 6px); border-bottom: 1px solid rgba(25,25,24,.06); }
.gx-grp.is-open .gx-grp__head { background: #fafaf7; }
.gx-grp:last-child:not(.is-open) .gx-grp__head { border-bottom: 0; }
.gx-grp__tog { width: 24px; height: 24px; }
.gx-grp__tog .ic { width: 14px; height: 14px; }
.gx-grp__check { display: grid; cursor: pointer; border-radius: 4px; }
.gx-grp__name { display: flex; align-items: center; min-width: 0; font: 500 14px/1.3 var(--mg-sans, Inter, sans-serif); color: #191918; }
.gx-grp__n { flex: none; width: 24px; font: 500 13px/1 var(--mg-sans, Inter, sans-serif); color: #555550; font-variant-numeric: tabular-nums; }
.gx-grp__count { font: 400 13px/1 var(--mg-sans, Inter, sans-serif); color: #555550; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gx-grp__count b { font-weight: 600; color: #191918; }
.gx-grp__rows[hidden] { display: none; }
.gx-cbx { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: #fff; box-shadow: inset 0 0 0 1px rgba(25,25,24,.32); color: #fffef2; flex: none; }
.gx-cbx .ic { width: 14px; height: 14px; stroke-width: 2.6; opacity: 0; }
.gx-cbx i { display: none; width: 8px; height: 2px; background: #fffef2; }
.cs-row--on > .gx-cbx, [aria-checked="true"] > .gx-cbx { background: #191918; box-shadow: none; }
.cs-row--on > .gx-cbx .ic, [aria-checked="true"] > .gx-cbx .ic { opacity: 1; }
[aria-checked="mixed"] > .gx-cbx { background: #191918; box-shadow: none; }
[aria-checked="mixed"] > .gx-cbx i { display: block; }
.gx-file { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; column-gap: 8px; align-items: center; min-height: 36px;
  padding: 0 var(--pad) 0 calc(var(--pad) + 26px); background: #fafaf7; border-bottom: 1px solid rgba(25,25,24,.06); cursor: pointer; }
.gx-file:hover { background: #f5f4ee; }
.gx-file__name { display: flex; align-items: center; gap: 8px; min-width: 0; font: 400 13px/1.3 var(--mg-sans, Inter, sans-serif); color: #33322f; }
.gx-file__name > .ic { width: 14px; height: 14px; color: #555550; flex: none; }
.gx-file__name .cs-row__name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx-file__end { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.cs-row__size { font: 400 12px/1 var(--mg-sans, Inter, sans-serif); color: #555550; font-variant-numeric: tabular-nums; }
.cs-row__status { font-size: 12px; }
.cs-row--wait { cursor: default; }
.cs-row--wait.cs-row--on { cursor: pointer; }
.cs-row--wait .cs-row__name { color: #555550; }
.cs-row--wait:not(.cs-row--on) > .gx-cbx { background: #f1f0ea; box-shadow: inset 0 0 0 1px rgba(25,25,24,.18); }
.cs-row--wait.cs-row--on > .gx-cbx { background: #8a8a83; }
.cs-row__retry { flex: none; border: 0; background: transparent; padding: 2px 0; font: 500 12px/1 var(--mg-sans, Inter, sans-serif); color: #191918; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(25,25,24,.3); text-underline-offset: 3px; }
.gx-tree > .cs-empty, .gx-libl > .cs-empty { padding: 24px var(--pad); text-align: left; }
.gx-drop { display: flex; align-items: center; gap: 12px; margin: auto 0 0; padding: 14px var(--pad) 16px; border-top: 1px solid rgba(25,25,24,.08);
  background: #fafaf7; cursor: pointer; }
.gx-drop:hover { background: #f5f4ee; }
.gx-drop:focus-visible { outline: 2px solid #191918; outline-offset: -2px; }
.gx-drop.cs-drop--hot { background: #fff6e5; box-shadow: inset 0 0 0 2px #fcaa2d; }
.gx-drop__ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px rgba(25,25,24,.1); }
.gx-drop__ic .ic { color: #33322f; }
.gx-drop__t { display: block; font: 600 13px/1.3 var(--mg-sans, Inter, sans-serif); color: #191918; }
.gx-drop__d { display: block; margin-top: 2px; font: 400 12px/1.4 var(--mg-sans, Inter, sans-serif); color: #555550; text-wrap: balance; }
.gx-srclist .dr-upload-queue { margin: 12px var(--pad); }

.gx-lib { display: flex; flex-direction: column; }
.gx-lib__note { margin: 6px var(--pad) 0; font: 400 12px/1.45 var(--mg-sans, Inter, sans-serif); color: #555550; }
.gx-lib__note b { font-weight: 600; color: #191918; }
.gx-lib__note .gx-mark { margin: 0 1px 0 3px; }
.gx-lib__note .ic { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; color: #8a5e07; }
.gx-libl { margin-top: 10px; border-top: 1px solid rgba(25,25,24,.08); padding: 4px 0 2px; }
.gx-libcat { padding: 10px var(--pad) 4px; font: 500 12px/1.2 var(--mg-sans, Inter, sans-serif); color: #555550; }
.gx-librow { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 10px; align-items: center; min-height: 32px; padding: 4px var(--pad); cursor: pointer; }
.gx-librow:hover { background: #fafaf7; }
.gx-librow__name { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; min-width: 0; font: 400 13px/1.35 var(--mg-sans, Inter, sans-serif); color: #33322f; }
.gx-librow__name .cs-row__name { overflow-wrap: anywhere; min-width: 0; }
.gx-librow__name .st { margin-left: 8px; }
.gx-lib__more { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; padding: 12px var(--pad) 14px;
  border-top: 1px solid rgba(25,25,24,.06); font: 400 13px/1 var(--mg-sans, Inter, sans-serif); color: #555550; }
.gx-lib__more { flex-wrap: wrap; row-gap: 8px; }
.gx-lib__more > span:first-child { white-space: nowrap; }
.gx-lib__acts { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; }
.gx-librow__name .gx-mark { margin-left: 6px; }
.gx-miss { margin-top: auto; border-top: 1px solid rgba(25,25,24,.08); padding: 16px var(--pad) 20px; }
.gx-miss__t { font: 600 14px/1.3 var(--mg-sans, Inter, sans-serif); color: #191918; margin: 0 0 12px; }
.cs-card--waiting .gx-th .gx-sel { display: none; }

/* Keyboard focus: a dark 2px ring (>= 3:1 on white and on the cream rows). */
.cs-row:focus-visible, .gx-grp__check:focus-visible { outline: 2px solid #191918; outline-offset: -2px; }
.gx-grp__check:focus-visible { outline-offset: 2px; }
.gx-step__edit:focus-visible, .gx-quiet:focus-visible, .cs-row__retry:focus-visible { outline: 2px solid #191918; outline-offset: 2px; border-radius: 2px; }

/* category pills */
.gen-cat-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.gen-cat-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 0; box-shadow: inset 0 0 0 1px rgba(25,25,24,.14); background: #fff; color: #33322f; font: 500 13px/1 var(--mg-sans, Inter, sans-serif); white-space: nowrap; }
.gen-cat-pill:hover { box-shadow: inset 0 0 0 1px rgba(25,25,24,.32); color: #191918; }
.gen-cat-pill.active { background: #191918; box-shadow: none; color: #fffef2; }
.gen-cat-pill__n { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.gen-cat-pill:focus-visible { outline: 2px solid #191918; outline-offset: 2px; }

/* template cards (a radio and a Preview button side by side in each) */
.cs-tpl { position: relative; min-height: 318px; display: flex; flex-direction: column; background: #fff; border-radius: 10px; overflow: hidden; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(25,25,24,.1), 0 1px 2px rgba(25,25,24,.05); transition: box-shadow .18s, transform .18s; text-align: left; color: inherit; text-decoration: none; }
.cs-tpl:hover { box-shadow: 0 0 0 1px rgba(25,25,24,.18), 0 8px 20px -6px rgba(25,25,24,.18); transform: translateY(-1px); }
.cs-tpl__radio { flex: 1 0 auto; display: flex; flex-direction: column; outline: none; cursor: pointer; }
.cs-tpl:has(.cs-tpl__radio:focus-visible) { outline: 2px solid #191918; outline-offset: 2px; }
.cs-tpl--on { box-shadow: 0 0 0 2px #191918; }
.cs-tpl--on:hover { box-shadow: 0 0 0 2px #191918, 0 8px 20px -6px rgba(25,25,24,.18); }
.cs-tpl__tick { position: absolute; top: 8px; right: 8px; z-index: 5; width: 22px; height: 22px; border-radius: 50%; background: #191918; color: #fffef2;
  display: none; place-items: center; box-shadow: 0 1px 3px rgba(25,25,24,.25); }
.cs-tpl--on .cs-tpl__tick { display: grid; }
.cs-tpl__tick .ic { width: 12px; height: 12px; stroke-width: 2.6; }
/* The cover keeps its 150px band; the name and description below it show in full (the card grows, the row stretches). */
.cs-tpl__pane { flex: 0 0 150px; height: 150px; width: 100%; min-width: 0; overflow: hidden; background: #efeee7; display: block; position: relative; }
.cs-tpl__pane > img { position: relative; z-index: 1; width: 100%; height: 100%; display: block; object-fit: cover; object-position: top; }
.cs-tpl__cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.cs-tpl__cover .ic { width: 28px; height: 28px; }
.cs-tpl__cover--amber { background: linear-gradient(135deg, rgba(252,170,45,.20), rgba(252,170,45,.04)); color: #8a5e07; }
.cs-tpl__cover--blue  { background: linear-gradient(135deg, rgba(59,130,246,.18), rgba(59,130,246,.04)); color: #1d4ed8; }
.cs-tpl__cover--green { background: linear-gradient(135deg, rgba(22,163,74,.18), rgba(22,163,74,.04)); color: #15803d; }
.cs-tpl__cover--navy  { background: linear-gradient(135deg, rgba(8,29,58,.20), rgba(8,29,58,.04)); color: #0d2847; }
.cs-tpl__cover--rose  { background: linear-gradient(135deg, rgba(220,38,38,.16), rgba(220,38,38,.04)); color: #be123c; }
.cs-tpl__cover--sand  { background: linear-gradient(135deg, rgba(180,140,90,.20), rgba(180,140,90,.04)); color: #6f5730; }
.cs-tpl__cover--gray  { background: linear-gradient(135deg, rgba(25,25,24,.08), rgba(25,25,24,.02)); color: #555550; }
.cs-tpl__foot { display: block; flex: 1 0 auto; width: 100%; min-width: 0; padding: 10px 12px 0; border-top: 1px solid rgba(25,25,24,.08); background: #fff; }
.cs-tpl__typerow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.cs-tpl__type { flex: 0 1 auto; min-width: 0; font: 500 12px/1.3 var(--mg-sans, Inter, sans-serif); color: #555550; overflow-wrap: anywhere; }
.cs-tpl__pinnote { flex: 1 0 100%; font: 400 12px/1.3 var(--mg-sans, Inter, sans-serif); color: #555550; }
.cs-tpl__chips { display: inline-flex; flex-wrap: wrap; gap: 4px; flex: 0 1 auto; min-width: 0; max-width: 100%; margin-left: auto; }
.gen-tpl__engine { display: inline-flex; align-items: center; max-width: 100%; padding: 0; border-radius: 0; background: none;
  font: 400 12px/1.4 var(--mg-sans, Inter, sans-serif); color: #555550; white-space: normal; }   /* plain words, no coloured capsules (handoff rule) */
.gen-tpl__engine--failed { color: #b91c1c; cursor: help; }
.gen-tpl__engine--failed::before, .gen-tpl__engine--compiling::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; margin-right: 5px; }
.cs-tpl__name { display: block; margin-top: 3px; font: 600 14px/1.35 var(--mg-sans, Inter, sans-serif); color: #191918; overflow-wrap: anywhere; }
.cs-tpl__meta { display: block; margin-top: 2px; overflow-wrap: anywhere; font: 400 12px/1.35 var(--mg-sans, Inter, sans-serif); color: #555550; }
.cs-tpl__actions { padding: 6px 12px 11px; background: #fff; }
.cs-tpl__preview { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px; border: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(25,25,24,.14); background: #fff; color: #191918; font: 500 12px/1 var(--mg-sans, Inter, sans-serif); }
.cs-tpl__preview:hover { background: #fafaf7; }
.cs-tpl__preview:focus-visible { outline: 2px solid #191918; outline-offset: 2px; }
.cs-tpl--compiling .cs-tpl__radio { cursor: not-allowed; opacity: .6; }
.cs-tpl--ghost { align-items: center; justify-content: center; gap: 8px; padding: 14px; background: #fcfcf9; text-align: center; box-shadow: inset 0 0 0 1px rgba(25,25,24,.14); }
.cs-tpl--ghost .ic { width: 32px; height: 32px; padding: 8px; box-sizing: border-box; border-radius: 50%; background: #f1f0ea; color: #33322f; }
.cs-tpl--ghost b { font: 600 13px/1.3 var(--mg-sans, Inter, sans-serif); color: #191918; }
.cs-tpl--ghost span { font: 400 12px/1.3 var(--mg-sans, Inter, sans-serif); color: #555550; }
.cs-tpl--ghost:focus-visible { outline: 2px solid #191918; outline-offset: 2px; }
.cs-tpl-grid > .cs-empty { grid-column: 1 / -1; }

/* ── shared states ─────────────────────────────────────────────────────── */
.cs-empty { padding: 20px; font: 400 13px/1.45 var(--mg-sans, Inter, sans-serif); color: #33322f; text-align: center; }
.cs-empty a { color: #191918; }
.cs-loading .ic, .cs-loading svg { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; color: #8a5e07; }
.cs-error { display: flex; flex-direction: column; align-items: center; gap: 10px; font: 400 13px/1.45 var(--mg-sans, Inter, sans-serif); color: #33322f; text-align: center; }
.cs-error b { font-weight: 600; color: #191918; }
.cs-retry { font: 500 13px/1 var(--mg-sans, Inter, sans-serif); padding: 8px 14px; border-radius: 8px; border: 0; background: #191918; color: #fff; cursor: pointer; }
.cs-retry:focus-visible { outline: 2px solid #191918; outline-offset: 2px; }
.cs-retry--inline { padding: 4px 10px; margin-left: 6px; font-size: 12px; }
.ic--spin { animation: gc-spin .9s linear infinite; }
@keyframes gc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ic--spin { animation: none; } }

/* Upload chips (derek dr-upload-chip): % while sending, Reading… while the server reads,
   Added · <category> when ready, Couldn't add <name> + Retry on failure. */
.dr-upload-queue { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; }
.dr-upload-chip {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 8px 12px; background: #fff; border: 1px solid var(--df-border); border-radius: 12px;
}
.dr-upload-chip__icon { font-size: 14px; color: var(--df-text-muted); flex: 0 0 auto; }
.dr-upload-chip__name { flex: 1 1 140px; min-width: 96px; font-size: 13px; font-weight: 500; color: var(--df-text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-upload-chip__size { font-size: 11px; font-weight: 500; color: var(--df-text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; }
.dr-upload-chip__status { font-size: 11px; font-weight: 500; color: var(--df-accent-text, #8A5E07); white-space: nowrap; flex: 0 1 auto; min-width: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.dr-upload-chip--ready .dr-upload-chip__status { color: #4a5a72; }
.dr-upload-chip--failed .dr-upload-chip__status { color: var(--df-red, #dc2626); }
/* A failed chip spends its room on the name and the reason, not on a dead bar. */
.dr-upload-chip--failed .doc-upload-bar, .dr-upload-chip--failed .dr-upload-chip__size { display: none; }
.dr-upload-chip__retry {
  flex: 0 0 auto; border: 1px solid var(--df-border); background: #fff; border-radius: 999px;
  padding: 3px 10px; font: inherit; font-size: 11px; font-weight: 600; color: var(--df-text-primary); cursor: pointer;
}
.dr-upload-chip__retry:hover { border-color: var(--df-border-3); }
.dr-upload-chip__close { background: none; border: none; cursor: pointer; color: var(--df-text-muted); font-size: 13px; padding: 2px; border-radius: 4px; flex: 0 0 auto; }
.dr-upload-chip__close:hover { color: var(--df-text-primary); }
.doc-upload-bar { position: relative; width: 72px; height: 4px; flex-shrink: 0; border-radius: 999px; background: var(--df-border); overflow: hidden; }
.doc-upload-bar__fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #E8A41C, #FFB923, #FFC547); transition: width .18s linear; }
.doc-upload-bar--indeterminate .doc-upload-bar__fill { width: 40% !important; animation: doc-upload-sweep 1.1s ease-in-out infinite; }
.doc-upload-bar--failed .doc-upload-bar__fill { background: var(--df-red, #dc2626); }
@keyframes doc-upload-sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.dr-shimmer-text {
  background: linear-gradient(90deg, var(--df-text-muted) 25%, var(--df-accent-text) 50%, var(--df-text-muted) 75%);
  background-size: 200px 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: dr-shimmer 1.5s ease-in-out infinite;
}
@keyframes dr-shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }

/* Upload chips: readable sizes in the handoff type scale. */
.dr-upload-chip { border: 0; box-shadow: inset 0 0 0 1px rgba(25,25,24,.12); border-radius: 8px; }
.dr-upload-chip__icon { width: 14px; height: 14px; }
.dr-upload-chip__close .ic { width: 14px; height: 14px; }
.dr-upload-chip__size, .dr-upload-chip__status, .dr-upload-chip__retry { font-size: 12px; }
.dr-upload-chip__status { color: #6b4a06; }
.dr-upload-chip--ready .dr-upload-chip__status { color: #33322f; }
.dr-upload-chip--failed .dr-upload-chip__status { color: #b91c1c; }

/* ── one column: the work area could not show a whole file name next to the guide ── */
@container (max-width: 900px) {
  .gx-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "steps" "work" "plan"; grid-template-rows: auto; }
  .gx-lead { max-width: 620px; }
  .gx-steps { margin-bottom: 28px; }
  .gx-plan { margin-top: 24px; }
  .gx-plan__body { padding-inline: 24px; }
  .gx-plan__foot { padding-inline: 24px; }
}
@container (max-width: 560px) {
  .gx-deals__cols { display: none; }
  .gx-deal { grid-template-columns: minmax(0, 1fr) 20px; row-gap: 4px; }
  .gx-deal__main { grid-column: 1; }
  .gx-deal__type, .gx-deal__stage { grid-column: 1; }
  .gx-deal__go { grid-column: 2; grid-row: 1 / span 3; }
  .gx-cols { --pad: 16px; }
  .gx-cols > .gx-lib { --pad: 16px; }
  .gx-opts { padding: 16px; }
  .gx-opts > .gx-field { flex: 1 0 100%; }
  .gx-gal__tools { padding: 12px 16px; }
}
/* Phone: the shell's sidebar steps aside; the page keeps a 16px gutter and 44px targets. */
@media (max-width: 640px) {
  body.gen-compose-page .df-sidebar { display: none; }
  body.gen-compose-page .df-main { margin-left: 0; }
  body.gen-compose-page .df-topbar__search, body.gen-compose-page .tb-search { display: none; }
  body.gen-compose-page .df-content.gx { padding: 20px 16px 48px; }
  .gx-panel[data-step-panel="2"]:not([hidden]) { height: auto; min-height: 0; }
  .gx-gal { flex: none; }
  .gx-gal .cs-tpl-grid { flex: none; max-height: 62dvh; padding: 14px 16px 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .gx-search--sm { width: 100%; }
  .gx-file { min-height: 44px; }
  .gx-librow { min-height: 44px; }
  .gx-grp__head { min-height: 44px; }
  .gx-grp__tog { width: 32px; height: 32px; }
  .gx-grp__head { grid-template-columns: 32px 16px minmax(0, 1fr) auto; }
  .gx-file { padding-left: calc(var(--pad) + 34px); }
  .doc-upload-bar, .dr-upload-chip__size { display: none; }
  .gx-plan__foot .btn { height: 44px; }
  .gx-cov { grid-template-columns: minmax(0, 1fr); }
  /* The stepper opens only the current step: done steps keep their one-line value, the next ones their title
     (the panel head below repeats the current step's description). */
  .gx-step { padding-bottom: 14px; }
  .gx-step:not(:last-child)::after { top: 30px; bottom: 2px; }
  .gx-step.is-next .gx-step__d, .gx-step.is-now .gx-step__d, .gx-step.is-done .gx-step__d--tight { display: none; }
}

/* ── step 4: generating / done ─────────────────────────────────────────── */
.cs-eyebrow { font: 500 13px/1.3 var(--mg-sans, Inter, sans-serif); color: #555550; }
.cs-desc { font: 400 13px/1.5 var(--mg-sans, Inter, sans-serif); color: #33322f; margin: 7px 0 0; max-width: 560px; }
.cs-gen, .cs-done { padding: 24px; }
.cs-done__actions .btn { text-decoration: none; }
.cs-feed__mark .ic, .cs-done__badge .ic, .cs-done__note .ic, .cs-done__flag .ic { width: 12px; height: 12px; }
.cs-done__note .ic, .cs-done__flag .ic { width: 14px; height: 14px; flex: none; }
.cs-phase__icon .ic { width: 14px; height: 14px; }
/* ── generating / done (derek, verbatim) ── */
/* ── generating ────────────────────────────────────────────────────── */
.cs-gen {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
  gap: 40px; align-items: start;
  animation: csUp .45s cubic-bezier(.16,.84,.3,1) both;
}
.cs-gen__side { max-width: 460px; }
.cs-meta {
  margin-top: 22px; border: 1px solid var(--df-border); border-radius: 8px;
  background: #FCFCF7; padding: 13px 15px; display: flex; flex-direction: column; gap: 8px;
}
.cs-meta__row { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; }
.cs-meta__row span:first-child { color: var(--df-text-secondary); }
.cs-meta__row span:last-child { font-weight: 600; text-align: right; }
.cs-live { margin-top: 18px; display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--df-text-secondary); }
.cs-live__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--df-accent, #FFB923); flex: 0 0 7px; animation: csPulse 1.6s ease infinite; }

.cs-gen__panel {
  border: 1px solid var(--df-border); border-radius: 14px; background: #fff;
  box-shadow: 0 1px 2px rgba(20,19,15,.04), 0 4px 12px rgba(20,19,15,.05); overflow: hidden;
}
.cs-stage {
  position: relative; height: 212px; border-bottom: 1px solid var(--df-border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(560px 190px at 50% 116%, rgba(255,185,35,.13), transparent 65%),
              linear-gradient(180deg, #FCFCF6, #F7F7EC);
}
.cs-stage__halo {
  position: absolute; width: 320px; height: 320px; border-radius: 50%;
  left: 50%; top: 50%; margin: -160px 0 0 -160px;
  background: radial-gradient(circle, rgba(255,185,35,.13), transparent 62%);
  animation: csHalo 3.2s ease-in-out infinite;
}
.cs-stage__ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 2px solid transparent; }
.cs-stage__ring--a { width: 236px; height: 236px; margin: -118px 0 0 -118px; border-top-color: #E8A41C; border-right-color: #FFC547; animation: csOrbit 2.6s linear infinite; }
.cs-stage__ring--b { width: 262px; height: 262px; margin: -131px 0 0 -131px; border-top-color: var(--df-accent, #FFB923); animation: csOrbitR 4.4s linear infinite; }
.cs-stage--settled .cs-stage__ring { opacity: 0; transition: opacity .5s; }

/* The document being drafted, as a cover: the handoff sheet (.sheet > .cv from magnum-app.css),
   portrait for a document and landscape for a presentation. Same anatomy in the Done panel, larger. */
.cs-cover { position: relative; z-index: 1; }
.cs-cover--sm { width: 146px; }
.cs-cover--lg { width: 100%; }
.cs-cover .sheet { border-radius: 4px; }
.cs-cover--sm .sheet { box-shadow: 0 0 0 1px rgba(25,25,24,.06), 0 10px 26px -8px rgba(25,25,24,.3); }

.cs-prog__head { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 22px 0; }
.cs-prog__head > span:first-child { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.cs-prog__pct { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cs-prog__pct i { font-size: 11px; color: var(--df-text-muted); font-weight: 500; font-style: normal; margin-left: 2px; }
.cs-prog { margin: 9px 22px 4px; height: 7px; border-radius: 999px; background: #ECEDE3; overflow: hidden; }
.cs-prog__fill {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #E8A41C, #FFB923 55%, #FFC547);
  transition: width .55s cubic-bezier(.22,.9,.3,1);
}
.cs-feed {
  margin: 12px 22px 0; border: 1px solid var(--df-border); border-radius: 9px;
  background: #FCFCF8; padding: 8px 14px; height: 112px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.cs-feed__line {
  flex: 0 0 auto; display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; color: var(--df-text-secondary); padding: 5px 0;
  white-space: nowrap; overflow: hidden;
  animation: csUp .4s cubic-bezier(.16,.84,.3,1) both;
}
.cs-feed__mark {
  width: 14px; height: 14px; flex: 0 0 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,185,35,.18); color: var(--df-accent-dim, #C8910C); font-size: 8px;
}
.cs-feed__line b { color: #3A3B33; font-weight: 600; }
.cs-phases { padding: 8px 22px 18px; }
.cs-phase { display: flex; gap: 13px; padding: 12px 2px; align-items: flex-start; border-top: 1px solid var(--df-border); }
.cs-phase:first-child { border-top: none; }
.cs-phase__icon {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--df-bg-elevated); color: var(--df-text-secondary); font-size: 13px;
  transition: background .3s, color .3s;
}
.cs-phase--now .cs-phase__icon,
.cs-phase--done .cs-phase__icon { background: rgba(255,185,35,.18); color: var(--df-accent-dim, #C8910C); }
.cs-phase__body { flex: 1; min-width: 0; }
.cs-phase__name { display: block; font-size: 13px; font-weight: 600; color: var(--df-text-muted); }
.cs-phase--now .cs-phase__name, .cs-phase--done .cs-phase__name { color: var(--df-text-primary); }
.cs-phase__desc { display: block; font-size: 11.5px; margin-top: 2px; color: var(--df-text-muted); }
.cs-phase__st {
  font-size: 12px; font-weight: 500;
  white-space: nowrap; padding-top: 2px; color: var(--df-text-muted);
}
.cs-phase--now .cs-phase__st { color: var(--df-accent-text, #8A5E07); }

/* ── done ──────────────────────────────────────────────────────────── */
.cs-done {
  display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 44px;
  align-items: start; max-width: 1020px;
  animation: csUp .45s cubic-bezier(.16,.84,.3,1) both;
}
.cs-done__cover { position: relative; }
.cs-done__badge {
  position: relative; margin-bottom: 12px; z-index: 5;   /* above the sheet, not over its masthead */
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--df-border); border-radius: 999px;
  padding: 5px 11px; font-size: 11px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(20,19,15,.12);
}
.cs-done__badge i {
  width: 15px; height: 15px; border-radius: 50%; background: var(--df-accent, #FFB923);
  display: flex; align-items: center; justify-content: center; color: #14130F; font-size: 8px;
}
.cs-chips {
  font-size: 12px; color: var(--df-text-secondary); margin-top: 10px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cs-chips__sep { color: var(--df-text-muted); }
.cs-chips .st { font-size: 12px; }
.cs-done__actions { display: flex; gap: 9px; margin-top: 24px; }
.cs-inside { margin-top: 26px; }
.cs-inside__h { margin-bottom: 10px; }
.cs-inside__item {
  display: flex; align-items: baseline; gap: 9px; font-size: 13px;
  color: var(--df-text-secondary); padding: 5px 0;
}
.cs-inside__item::before { content: "•"; color: #858580; font-size: 14px; }
.cs-done__note {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--df-border);
  display: flex; gap: 9px; font-size: 12.5px; color: var(--df-text-secondary); line-height: 1.6;
}
.cs-done__note i { color: var(--df-text-muted); margin-top: 3px; }

@keyframes csUp   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes csPulse{ 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes csHalo { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: .6; } }
@keyframes csOrbit  { to { transform: rotate(360deg); } }
@keyframes csOrbitR { to { transform: rotate(-360deg); } }


/* magnum additions to derek's generating / done stages */
.cs-gen[hidden], .cs-done[hidden] { display: none; }
.cs-h2 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 0; color: var(--df-text-primary); }
.cs-gen .cs-desc { max-width: 460px; line-height: 1.6; }
.cs-gen .cs-h2 + .cs-desc { margin-top: 6px; }
.cs-stage__doc { position: relative; z-index: 2; }
.cs-prog--indeterminate .cs-prog__fill { width: 35% !important; animation: csSweep 1.3s ease-in-out infinite; }
@keyframes csSweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.cs-done__flag {
  display: flex; gap: 9px; align-items: flex-start; margin-top: 16px; padding: 10px 14px; border-radius: 8px;
  background: var(--df-amber-glow, rgba(255,185,35,.08)); border: 1px solid var(--df-amber-dim, rgba(255,185,35,.35));
  color: var(--df-accent-text, #8A5E07); font-size: 12.5px; line-height: 1.5;
}
.cs-done__flag--review { background: var(--df-bg-elevated); border-color: var(--df-border); color: var(--df-text-secondary); display: block; }
.cs-done__flag i { margin-top: 2px; }
.cs-done__actions a { text-decoration: none; }
@media (max-width: 1100px) { .cs-done { grid-template-columns: 1fr; gap: 24px; } .cs-done__cover { max-width: 360px; } }
@media (max-width: 640px) {
  .cs-gen { grid-template-columns: 1fr; gap: 20px; }
  .cs-done { grid-template-columns: 1fr; gap: 20px; }
  .cs-cover--lg { height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-gen, .cs-done, .cs-feed__line, .cs-stage__halo, .cs-stage__ring, .cs-live__dot { animation: none; }
  .cs-prog__fill { transition: none; }
  .cs-prog--indeterminate .cs-prog__fill { animation: none; }
}

/* ==== track:x2-templates — generating / done / failed stages (handoff components, no behaviour change) ==== */
.cs-gen, .cs-done { background: #fff; border-radius: 12px; box-shadow: 0 0 0 1px rgba(25,25,24,.08), 0 1px 2px rgba(25,25,24,.05); }
.cs-eyebrow { text-transform: none; letter-spacing: 0; font: 500 13px/1.3 var(--mg-sans, Inter, sans-serif); color: #555550; }
.cs-phase { border-top-color: rgba(25,25,24,.08); }
.cs-phase__st { display: inline-flex; align-items: center; gap: 7px; text-transform: none; letter-spacing: 0;
  font: 500 13px/1.2 var(--mg-sans, Inter, sans-serif); color: #191918; }
.cs-phase__st:empty { display: none; }
.cs-phase__st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #9a9a93; flex: none; }
.cs-phase--done .cs-phase__st { color: #191918; }
.cs-phase--done .cs-phase__st::before { background: #16a34a; }
.cs-phase--now .cs-phase__st { color: #191918; }
.cs-phase--now .cs-phase__st::before { background: #c8910c; }
.cs-done__badge { text-transform: none; letter-spacing: 0; font: 500 13px/1 var(--mg-sans, Inter, sans-serif); }
.cs-done__note { font: 400 13px/1.45 var(--mg-sans, Inter, sans-serif); color: #555550; }
/* ==== /track:x2-templates ==== */
