/* Publish screen — "Before you publish edition 4". Every class is prefixed pub-. Tokens only, no literal colours. */

/* position: relative keeps .sr-only nodes (absolute) inside the .content scroller instead of stretching the document. */
.pub-root { container: pub / inline-size; position: relative; }
/* Keep focused controls clear of the sticky publish bar (WCAG 2.4.11). */
.content:has(> .pub-root) { scroll-padding-top: 16px; scroll-padding-bottom: 150px; }

/* ── Header ─────────────────────────────────────────────── */
.pub-head { align-items: flex-end; }
.pub-head-main { flex: 1 1 420px; min-width: 0; }
.pub-eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pub-template { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: hsl(var(--muted-foreground)); margin-right: 2px; }

/* ── Layout: main column + edition history rail ─────────── */
.pub-layout { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 24px; align-items: start; }
.pub-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pub-rail { min-width: 0; }

/* ── Blocks ─────────────────────────────────────────────── */
.pub-block { padding: 20px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pub-block-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pub-step {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: hsl(var(--muted)); color: hsl(var(--foreground)); font-size: 12.5px; font-weight: 700; margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.pub-block-titles { flex: 1 1 260px; min-width: 0; }
.pub-block-titles h2 { margin: 0; font-size: 16px; line-height: 1.35; letter-spacing: -0.005em; }
.pub-block-titles p { margin: 3px 0 0; color: hsl(var(--muted-foreground)); font-size: 13px; max-width: 64ch; }
.pub-block-aside { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.pub-counts { display: flex; gap: 6px; flex-wrap: wrap; }

.pub-sub { display: flex; flex-direction: column; gap: 8px; }
.pub-sub-title { margin: 0; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--muted-foreground)); }

/* ── Check: issues ──────────────────────────────────────── */
.pub-issues { list-style: none; margin: 0; padding: 0; border-radius: 10px; overflow: hidden; }
.pub-issues.is-blocker { border: 1px solid hsl(var(--danger) / 0.55); background: hsl(var(--danger-soft) / 0.6); }
.pub-issues.is-warning { border: 1px solid hsl(var(--warning) / 0.35); background: hsl(var(--warning-soft) / 0.45); }
.pub-issue { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 16px; align-items: start; }
.pub-issues.is-warning .pub-issue + .pub-issue { border-top: 1px solid hsl(var(--warning) / 0.22); }
.pub-issue-icon { display: grid; place-items: center; height: 20px; }
.pub-issues.is-blocker .pub-issue-icon { color: hsl(var(--danger)); }
.pub-issues.is-warning .pub-issue-icon { color: hsl(var(--warning)); }
.pub-issue-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pub-issue-title { margin: 0; font-weight: 600; font-size: 14px; line-height: 1.4; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pub-issues.is-blocker .pub-issue-title { color: hsl(var(--danger)); }
.pub-issue-text { margin: 0; font-size: 13px; color: hsl(var(--foreground) / 0.78); max-width: 66ch; }
.pub-issue-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pub-issue-actions-side { margin-top: 0; align-self: center; }
.pub-issue .btn-ghost { color: hsl(var(--foreground) / 0.85); }
.pub-issue .btn-ghost:hover { background: hsl(var(--card) / 0.7); }
.pub-fix { border-color: hsl(var(--danger) / 0.5); }
.pub-btn-wrap { white-space: normal; height: auto; min-height: 32px; padding-top: 5px; padding-bottom: 5px; text-align: left; line-height: 1.3; }

.pub-resolved {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 16px;
  border: 1px solid hsl(var(--success) / 0.4); background: hsl(var(--success-soft) / 0.7); border-radius: 10px; animation: pop 180ms ease-out;
}
.pub-resolved .pub-issue-icon, .pub-resolved .pub-issue-title { color: hsl(var(--success)); }
.pub-none { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; color: hsl(var(--success)); font-weight: 550; }
.pub-dot { width: 6px; height: 6px; }
/* The success heading takes focus so screen readers hear it; it is not a control, so no ring. */
#pub-success-h:focus { outline: none; }

/* Band chart inside the blocker */
.pub-bands {
  margin-top: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; max-width: 480px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 8px;
}
.pub-band-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: center; }
.pub-band-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; min-width: 0; }
.pub-band-label > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-band-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.pub-band-cell { height: 14px; border-radius: 3px; background: hsl(var(--muted)); }
.pub-band-cell.is-on.t0 { background: hsl(var(--secondary) / 0.55); }
.pub-band-cell.is-on.t1 { background: hsl(var(--warning) / 0.55); }
.pub-band-cell.is-on.t2 { background: hsl(var(--primary) / 0.5); }
.pub-band-cell.is-clash {
  background: repeating-linear-gradient(135deg, hsl(var(--danger)) 0 3px, hsl(var(--danger) / 0.3) 3px 6px);
  box-shadow: 0 0 0 1.5px hsl(var(--danger));
}
.pub-band-axis { margin-top: 2px; }
.pub-band-tick { font-size: 11px; text-align: center; color: hsl(var(--muted-foreground)); }
.pub-band-tick.is-clash { color: hsl(var(--danger)); font-weight: 700; }

/* Passed checks */
.pub-passed { border: 1px solid hsl(var(--border)); border-radius: 10px; }
.pub-passed summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; list-style: none;
  font-size: 13.5px; font-weight: 550; border-radius: 10px;
}
.pub-passed summary::-webkit-details-marker { display: none; }
.pub-passed summary:hover { background: hsl(var(--muted) / 0.6); }
.pub-passed-icon { color: hsl(var(--success)); display: grid; }
.pub-chev { color: hsl(var(--muted-foreground)); transition: transform 140ms; }
.pub-passed[open] .pub-chev { transform: rotate(180deg); }
.pub-passed ul { list-style: none; margin: 0; padding: 4px 14px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.pub-passed li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; font-size: 13px; align-items: start; }
.pub-passed li .icon { color: hsl(var(--success)); margin-top: 2px; }
.pub-passed-label { font-weight: 550; }

/* ── What changed: groups ───────────────────────────────── */
.pub-group { display: flex; flex-direction: column; gap: 8px; }
.pub-group + .pub-group { padding-top: 16px; border-top: 1px solid hsl(var(--border)); }
.pub-group-title { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; flex-wrap: wrap; }
.pub-gicon { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.pub-gicon .icon { width: 14px; height: 14px; }
.pub-gcount {
  font-size: 11.5px; font-weight: 650; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums;
}
.pub-group.is-added .pub-gicon { background: hsl(var(--secondary-soft)); color: hsl(var(--secondary)); }
.pub-group.is-safe .pub-gicon { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.pub-group.is-breaking .pub-gicon { background: hsl(var(--danger-soft)); color: hsl(var(--danger)); }
.pub-group.is-breaking .pub-group-title { color: hsl(var(--danger)); }
.pub-group.is-breaking .pub-gcount { background: hsl(var(--danger-soft)); color: hsl(var(--danger)); }
.pub-safe-tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid hsl(var(--border-strong)); color: hsl(var(--muted-foreground));
}
.pub-safe-tag .icon { width: 12px; height: 12px; }
.pub-group-note { margin: -2px 0 0; font-size: 13px; color: hsl(var(--muted-foreground)); }

.pub-changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pub-change {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 8px;
  border: 1px solid hsl(var(--border)); background: hsl(var(--card)); font-size: 13.5px;
}
.pub-group.is-safe .pub-change { background: hsl(var(--muted) / 0.45); color: hsl(var(--foreground) / 0.85); }
.pub-change-label { flex: 1 1 240px; min-width: 0; }
.pub-section-chip {
  font-size: 11.5px; color: hsl(var(--muted-foreground)); background: hsl(var(--muted)); border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.pub-change.is-rich { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; border-color: hsl(var(--danger) / 0.35); border-left: 3px solid hsl(var(--danger)); }
.pub-change-head { display: flex; align-items: flex-start; gap: 8px 12px; flex-wrap: wrap; }
.pub-change-head .pub-change-label { font-weight: 600; }
.pub-change-detail { margin: -4px 0 0; font-size: 13px; color: hsl(var(--muted-foreground)); max-width: 70ch; }

.pub-impact {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: 8px;
  background: hsl(var(--danger-soft) / 0.55); border: 1px solid hsl(var(--danger) / 0.25); font-size: 13px;
}
.pub-impact .icon { color: hsl(var(--danger)); margin-top: 2px; }
.pub-impact p { margin: 0; }
.pub-time { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-size: 13.5px; color: hsl(var(--muted-foreground)); }
.pub-time .icon { margin-top: 2px; }
.pub-time b { color: hsl(var(--foreground)); font-weight: 600; }
.pub-impact b { font-weight: 650; }

.pub-decide-title { margin: 0; font-size: 12.5px; font-weight: 650; }

/* Answer mapping */
.pub-map { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 8px; background: hsl(var(--surface)); border: 1px solid hsl(var(--border)); }
.pub-map-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pub-map-sum { font-size: 12.5px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.pub-map-cols, .pub-map-row { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1.3fr); gap: 12px; align-items: start; }
.pub-map-cols { align-items: end; }
.pub-map-cols { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: hsl(var(--muted-foreground)); padding: 0 2px; }
.pub-map-row { padding: 8px 0; border-top: 1px solid hsl(var(--border)); }
.pub-map-old { display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.pub-map-opt { font-weight: 600; font-size: 13.5px; }
.pub-map-held { font-size: 12px; color: hsl(var(--muted-foreground)); }
.pub-map-arrow { color: hsl(var(--muted-foreground)); display: grid; place-items: center; height: 40px; }
.pub-map-new { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 340px; }
.pub-select { min-height: 40px; }
.pub-select.is-review { border-style: dashed; color: hsl(var(--foreground) / 0.8); }
.pub-map-note { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.pub-map-note .icon { width: 13px; height: 13px; }
.pub-map-note.is-same, .pub-map-note.is-moved { color: hsl(var(--success)); }
.pub-map-foot { margin: 2px 0 0; font-size: 12.5px; color: hsl(var(--muted-foreground)); }

/* Retire vs delete */
.pub-choice { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pub-choice legend { padding: 0; margin-bottom: 8px; }
.pub-choice-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pub-choice-opt {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px; min-height: 44px; cursor: pointer;
  border: 1px solid hsl(var(--border-strong)); border-radius: 10px; background: hsl(var(--card)); transition: border-color 120ms, background 120ms;
}
.pub-choice-opt:hover { border-color: hsl(var(--primary) / 0.55); }
.pub-choice-opt input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: hsl(var(--primary)); }
.pub-choice-opt:focus-within { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.pub-choice-opt input:focus-visible { outline: none; }
.pub-choice-opt.is-on { border-color: hsl(var(--primary)); background: hsl(var(--primary-soft)); box-shadow: inset 0 0 0 1px hsl(var(--primary)); }
.pub-choice-opt.is-delete.is-on { border-color: hsl(var(--danger)); background: hsl(var(--danger-soft)); box-shadow: inset 0 0 0 1px hsl(var(--danger)); }
.pub-choice-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pub-choice-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; font-size: 13.5px; }
.pub-choice-text { font-size: 12.5px; color: hsl(var(--foreground) / 0.75); }

/* Points change */
.pub-points { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px; background: hsl(var(--surface)); border: 1px solid hsl(var(--border)); }
.pub-points-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; font-size: 13.5px; }
.pub-points-band { font-weight: 600; }
.pub-points-vals { display: inline-flex; align-items: center; gap: 6px; }
.pub-points-vals .icon { color: hsl(var(--muted-foreground)); width: 14px; height: 14px; }
.pub-points-vals del, .pub-diff-pair del { color: hsl(var(--muted-foreground)); }
.pub-points-vals ins, .pub-diff-pair ins { text-decoration: none; font-weight: 650; }
.pub-points-vals ins.is-clash { color: hsl(var(--danger)); text-decoration: underline wavy hsl(var(--danger) / 0.6); text-underline-offset: 3px; }
.pub-points-same { margin: 0; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.pub-ok { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: hsl(var(--success)); font-weight: 600; }
.pub-ok .icon { width: 14px; height: 14px; }

/* Link-style buttons */
.pub-link {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 8px; margin: 0 -2px; border: 0; border-radius: 6px;
  background: none; font-size: 12.5px; font-weight: 550; color: hsl(var(--foreground) / 0.82); text-align: left;
}
.pub-link:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.pub-link .icon { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); }
.pub-link.is-danger, .pub-link.is-danger .icon { color: hsl(var(--danger)); }
.pub-link.is-danger:hover { background: hsl(var(--danger-soft)); }

/* ── Note ───────────────────────────────────────────────── */
.pub-note { display: flex; flex-direction: column; gap: 8px; }
.pub-note-input { min-height: 88px; font-size: 14px; field-sizing: content; }
.pub-note-input.is-ai { border-color: hsl(var(--ai-border)); background: hsl(var(--ai-soft) / 0.55); }
.pub-note-input.is-ai:focus { outline-color: hsl(var(--ai) / 0.5); border-color: hsl(var(--ai)); }
.pub-note-error { margin: 0; display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: hsl(var(--danger)); }
.pub-note-error .icon { width: 14px; height: 14px; margin-top: 2px; }
.pub-note-input[aria-invalid="true"] { border-color: hsl(var(--danger)); background: hsl(var(--card)); }
.pub-note-foot { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; font-size: 12.5px; }
.pub-note-hint { flex: 1 1 240px; color: hsl(var(--muted-foreground)); min-width: 0; }
.pub-note-count { color: hsl(var(--muted-foreground)); }
.pub-note-drafting {
  min-height: 88px; padding: 12px; border-radius: calc(var(--radius) - 1px); border: 1px solid hsl(var(--ai-border)); background: hsl(var(--ai-soft) / 0.55);
  display: flex; flex-direction: column; gap: 8px;
}
.pub-shim { display: block; height: 12px; width: 92%; }
.pub-shim.is-short { width: 58%; }

/* ── Publish bar (sticky inside the scrolling content) ──── */
.pub-bar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  padding: 12px 12px 12px 16px; border-radius: 12px; background: hsl(var(--card)); border: 1px solid hsl(var(--border-strong));
  box-shadow: 0 14px 34px -14px hsl(var(--shadow) / 0.35), 0 2px 6px -2px hsl(var(--shadow) / 0.12);
}
.pub-bar.is-blocked { border-color: hsl(var(--danger) / 0.45); }
.pub-bar-status { flex: 1 1 280px; min-width: 0; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13.5px; }
.pub-bar-status p { margin: 0; }
.pub-bar-icon { display: grid; place-items: center; height: 20px; }
.pub-bar.is-blocked .pub-bar-icon, .pub-bar.is-blocked b { color: hsl(var(--danger)); }
.pub-bar.is-ready .pub-bar-icon { color: hsl(var(--success)); }
.pub-publish { min-width: 190px; }
.pub-publish.is-disabled, .pub-publish[aria-busy="true"] { opacity: 0.5; cursor: not-allowed; }
.pub-publish.is-disabled:hover { background: hsl(var(--primary)); }
.pub-spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid hsl(var(--primary-foreground) / 0.35); border-top-color: hsl(var(--primary-foreground));
  animation: pub-spin 700ms linear infinite;
}
@keyframes pub-spin { to { transform: rotate(360deg); } }

/* ── Success ────────────────────────────────────────────── */
.pub-success { padding: 24px; display: flex; flex-direction: column; gap: 18px; animation: pop 200ms ease-out; border-color: hsl(var(--success) / 0.4); }
.pub-success-top { display: flex; gap: 14px; align-items: flex-start; }
.pub-success-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: hsl(var(--success-soft)); color: hsl(var(--success));
}
.pub-success-icon .icon { width: 28px; height: 28px; }
.pub-success h2 { font-size: 19px; line-height: 1.3; }
.pub-success h2:focus { outline: none; }
.pub-success h2:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 4px; }
.pub-next { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid hsl(var(--border)); border-radius: 10px; }
.pub-next li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 12px; padding: 12px 14px; font-size: 13.5px; }
.pub-next li + li { border-top: 1px solid hsl(var(--border)); }
.pub-next .icon { color: hsl(var(--muted-foreground)); margin-top: 2px; }
.pub-success-note { margin: 0; padding: 12px 14px; border-radius: 10px; background: hsl(var(--surface)); border: 1px solid hsl(var(--border)); }
.pub-success-note figcaption { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; color: hsl(var(--muted-foreground)); margin-bottom: 4px; flex-wrap: wrap; }
.pub-success-note blockquote { margin: 0; font-size: 14px; }
.pub-success-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pub-success-actions .btn { min-height: 44px; }
.pub-replay { margin: -6px 0 0; }
.pub-replay .pub-link { color: hsl(var(--muted-foreground)); }

/* ── Edition history rail ───────────────────────────────── */
.pub-rail-card { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.pub-rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pub-rail-head h2 { margin: 0; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.pub-rail-head h2 .icon { color: hsl(var(--muted-foreground)); }
.pub-rail-count { font-size: 12px; color: hsl(var(--muted-foreground)); }
.pub-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pub-ed { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.pub-ed:last-child { padding-bottom: 0; }
.pub-ed::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px; background: hsl(var(--border)); border-radius: 1px; }
.pub-ed:last-child::before { display: none; }
.pub-ed-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; background: hsl(var(--card)); border: 2px solid hsl(var(--border-strong)); position: relative; z-index: 1; }
.pub-ed.is-live .pub-ed-dot { border-color: hsl(var(--success)); background: hsl(var(--success)); box-shadow: 0 0 0 3px hsl(var(--success-soft)); }
.pub-ed.is-draft .pub-ed-dot { border-style: dashed; border-color: hsl(var(--warning)); }
.pub-ed.is-new { animation: pop 200ms ease-out; }
.pub-ed-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pub-ed-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pub-ed-title h3 { margin: 0; font-size: 14px; }
.pub-ed-meta { margin: 0; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.pub-ed-note { margin: 2px 0 0; font-size: 13px; }
.pub-ed.is-draft .pub-ed-note { color: hsl(var(--muted-foreground)); }
.pub-ed-ai { font-size: 11.5px; }
.pub-ed-ai .icon { width: 12px; height: 12px; }
.pub-ed-usage { margin: 2px 0 0; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.pub-ed-usage .icon { width: 13px; height: 13px; }
.pub-ed-actions { display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: 6px; }
.pub-tip {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; margin: 0; padding: 10px 12px; border-radius: 8px;
  background: hsl(var(--secondary-soft)); color: hsl(var(--foreground) / 0.85); font-size: 12.5px;
}
.pub-tip .icon { color: hsl(var(--secondary)); margin-top: 1px; }
.pub-tip p { margin: 0; }

/* ── Preview / Compare dialog ───────────────────────────── */
/* The shared overlay is an auto-sized grid, so .dialog's percentage max-height never binds; cap this dialog by the viewport. */
.dialog:has(.pub-dialog) { max-height: calc(100dvh - 32px); }
.pub-dialog { display: flex; flex-direction: column; gap: 14px; }
.pub-dialog .tabs { position: sticky; top: -4px; z-index: 1; background: hsl(var(--card)); }
.pub-dialog-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pub-compare { display: flex; flex-direction: column; gap: 12px; }
.pub-compare-lede { margin: 0; font-size: 13px; color: hsl(var(--muted-foreground)); }
.pub-diff { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pub-diff-row { padding: 10px 12px; border: 1px solid hsl(var(--border)); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.pub-diff-row.is-removed { border-left: 3px solid hsl(var(--danger)); }
.pub-diff-row.is-added { border-left: 3px solid hsl(var(--secondary)); }
.pub-diff-head { display: flex; align-items: flex-start; gap: 8px 12px; flex-wrap: wrap; }
.pub-diff-label { flex: 1 1 200px; min-width: 0; font-weight: 600; font-size: 13.5px; }
.pub-diff-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pub-diff-note { font-size: 12px; color: hsl(var(--muted-foreground)); }
.pub-diff-pair { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.pub-diff-pair .icon { width: 13px; height: 13px; color: hsl(var(--muted-foreground)); }
.pub-same summary { font-weight: 500; color: hsl(var(--muted-foreground)); }

.pub-preview { display: flex; flex-direction: column; gap: 14px; }
.pub-prev-sec h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--muted-foreground)); }
.pub-prev-sec ol { list-style: none; margin: 0; padding: 0; border: 1px solid hsl(var(--border)); border-radius: 8px; }
.pub-prev-sec li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; font-size: 13.5px; }
.pub-prev-sec li + li { border-top: 1px solid hsl(var(--border)); }
.pub-prev-num { color: hsl(var(--muted-foreground)); font-size: 12px; }
.pub-prev-label { min-width: 0; }
.pub-prev-type { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.pub-prev-type .icon { width: 13px; height: 13px; }

/* ── Responsive (container queries on .pub-root) ────────── */
@container pub (max-width: 900px) {
  .pub-layout { grid-template-columns: minmax(0, 1fr); }
  .pub-timeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px 20px; }
  .pub-ed { padding-bottom: 0; }
  .pub-ed::before { display: none; }
}
@container pub (max-width: 620px) {
  .pub-block { padding: 16px; gap: 16px; }
  .pub-block-aside { margin-left: 38px; }
  .pub-issue { grid-template-columns: 20px minmax(0, 1fr); padding: 12px; }
  .pub-issue-actions-side { grid-column: 2; margin-top: 6px; }
  .pub-resolved { grid-template-columns: 20px minmax(0, 1fr); }
  .pub-resolved > .btn { grid-column: 2; justify-self: start; }
  .pub-bands { padding: 10px 12px; gap: 8px; }
  .pub-band-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pub-band-label { justify-content: flex-start; }
  .pub-band-axis { margin-top: 0; }
  .pub-band-axis .pub-band-label { display: none; }
  .pub-choice-opts { grid-template-columns: minmax(0, 1fr); }
  .pub-map-cols { display: none; }
  .pub-map-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pub-map-old { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .pub-map-arrow { display: none; }
  .pub-bar { bottom: 12px; padding: 10px; gap: 8px; }
  .pub-bar-status { flex-basis: 100%; }
  .pub-bar-status .muted { display: none; }
  .pub-publish { width: 100%; }
  .pub-success { padding: 18px; }
  .pub-success-top { flex-direction: column; gap: 10px; }
  .pub-success-top .pub-block-titles { flex: none; }
  .pub-success-actions .btn { flex: 1 1 200px; }
}

/* Toasts sit above the sticky publish bar instead of over its button. */
.shell:has(.pub-bar) .toast-stack { bottom: 100px; }
@media (max-width: 700px) { .shell:has(.pub-bar) .toast-stack { bottom: 124px; } }
