/* Super-admin Release Notes pages: Releases index, release detail, Start new
 * release, preview as tenant, note history. Category chips, note cards and the tenant release layout come
 * from release_notes.css (Track A): use those classes, never redefine them.
 * Editor-only styles live in release_notes_editor.css. Prefix: .rna-
 * Design system: ai_reference/design_system/design-system.md (tokens only). */

.rna-page [hidden] { display: none !important; }

.rna-page { padding-bottom: 32px; }
.rna-page--narrow { max-width: 720px; }

.rna-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ── Breadcrumbs, ids, small text ─────────────────────────────────────── */
.rna-crumbs { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.rna-crumbs a { color: var(--muted); }
.rna-crumbs a:hover { color: var(--ink); }
.rna-sep { margin: 0 6px; color: var(--light); }
.rna-id { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--light); margin-left: 4px; }
.rna-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.rna-nil { color: var(--light); }
.rna-hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; line-height: 1.45; }
.rna-warn-text { display: inline-block; font-size: 11px; font-weight: 600; color: var(--amber); }
.rna-count {
  display: inline-block; min-width: 20px; padding: 1px 8px; margin-left: 4px;
  border-radius: 10px; background: var(--surface-alt); border: 1px solid var(--border);
  font-size: 10px; font-weight: 600; color: var(--muted); text-align: center;
}
.rna-field { margin-bottom: 16px; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.rna-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 12px; border-bottom: 1px solid var(--border); }
.rna-tab {
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.rna-tab:hover { color: var(--ink); text-decoration: none; }
.rna-tab.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.rna-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── Filters ──────────────────────────────────────────────────────────── */
.rna-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 16px; margin-bottom: 12px; }
.rna-filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 0; padding: 0; margin: 0; }
.rna-filter-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin-right: 4px; float: left; padding: 0;
}
.rna-pill {
  display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 6px;
  background: var(--border-light); color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
}
.rna-pill:hover { color: var(--ink); }
.rna-pill.is-on, .rna-pill:has(input:checked) { background: var(--ink); color: var(--surface); }
.rna-pill:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.rna-select { width: auto; min-width: 160px; padding: 6px 10px; font-size: 12px; }
.rna-seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
  padding: 0; margin: 0; overflow: hidden;
}
.rna-seg:disabled { opacity: 0.5; }
.rna-seg__opt { padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.rna-seg__opt.is-on, .rna-seg__opt:has(input:checked) { background: var(--ink); color: var(--surface); }
.rna-seg__opt:focus-within { outline: 2px solid var(--blue); outline-offset: -2px; }
.rna-filter-actions { display: flex; gap: 8px; margin-left: auto; }

.rna-mode-banner, .rna-preview-banner, .rna-banner, .rna-callout {
  padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius-sm);
  background: var(--blue-tint); color: var(--ink); font-size: 13px; line-height: 1.5;
  border: 1px solid #dbeafe;
}
.rna-preview-banner { background: var(--amber-tint); border-color: #fde68a; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.rna-table-card { padding: 0; overflow: hidden; }
.rna-table-wrap { overflow-x: auto; }
.rna-releases-table td, .rna-notes-table td, .rna-deploys-table td { vertical-align: top; }
.rna-group-row th {
  background: var(--surface-alt); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); text-align: left; padding: 8px 18px;
}
.rna-row-open { background: #fbfcff; }
.rna-release-title { font-weight: 700; color: var(--ink); }
.rna-release-title:hover { color: var(--blue); }
.rna-notes-count { font-weight: 700; }
.rna-notes-count small { font-weight: 500; color: var(--muted); }
.rna-row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.rna-inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.rna-range-link { font-size: 12px; color: var(--ink); white-space: nowrap; }
.rna-range-link:hover { color: var(--blue); }
.rna-dots { color: var(--light); margin: 0 1px; }

.rna-badge-open, .rna-badge-ledger {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; padding: 2px 8px;
  border-radius: 4px; font-size: 10px; font-weight: 700;
}
.rna-badge-open { background: var(--blue-tint); color: var(--blue); }
.rna-badge-open::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.rna-badge-ledger { background: var(--amber-tint); color: #92400e; }

.rna-status {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
}
.rna-status--draft { background: var(--stone-tint); color: var(--stone); }
.rna-status--published { background: var(--green-tint); color: var(--green); }

.rna-empty { text-align: center; padding: 40px 20px; }
.rna-empty h2 { font-size: 16px; margin: 0 0 6px; }
.rna-empty p { font-size: 13px; color: var(--muted); max-width: 520px; margin: 0 auto 14px; }
.rna-empty-line { font-size: 13px; color: var(--muted); margin: 6px 0; }

/* ── Release detail header ────────────────────────────────────────────── */
.rna-head { margin-bottom: 14px; }
.rna-head__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.rna-head__main { flex: 1 1 420px; min-width: 0; }
.rna-head__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
/* A blocked Publish must look blocked (the shared .btn has no disabled state). */
.rna-head__actions .btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.rna-title-form { display: flex; align-items: center; gap: 8px; }
.rna-title-input {
  flex: 1; min-width: 0; font: inherit; font-size: 22px; font-weight: 700; color: var(--ink);
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 4px 8px; margin-left: -8px; background: transparent;
}
.rna-title-input:hover { border-color: var(--border); }
.rna-title-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.08); background: var(--surface); }
.rna-title-save { opacity: 0; transition: opacity 0.15s; }
.rna-title-form:focus-within .rna-title-save, .rna-title-save:focus { opacity: 1; }
.rna-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 10px; }
.rna-badges .rna-badge-open { margin-top: 0; }
.rna-badges .rna-sub { display: inline; margin: 0; }
.rna-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.rna-meta dt { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.rna-meta dd { margin: 2px 0 0; font-size: 13px; }

.rna-checks { border-top: 1px solid var(--border-light); margin-top: 14px; padding-top: 12px; }
.rna-checks__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 0 0 8px; }
.rna-checks__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rna-issue {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 8px 12px;
  border-radius: var(--radius-sm); font-size: 13px; border: 1px solid transparent;
}
.rna-issue--error { background: var(--red-tint); border-color: #fecaca; }
.rna-issue--warn { background: var(--amber-tint); border-color: #fde68a; }
.rna-issue--ok { background: var(--green-tint); border-color: #bbf7d0; }
.rna-issue__tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.rna-issue--error .rna-issue__tag { color: var(--red); }
.rna-issue--warn .rna-issue__tag { color: #92400e; }
.rna-issue__text { flex: 1 1 300px; }

/* ── Sections (deploys, notes) ────────────────────────────────────────── */
.rna-section { margin-bottom: 14px; }
.rna-section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rna-section-title { font-size: 14px; font-weight: 700; margin: 0; }
.rna-section-title .rna-sub, .rna-section-title .rna-hint { display: inline; margin-left: 6px; font-weight: 400; }
.rna-section__actions { display: flex; gap: 8px; }

.rna-rv { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.rna-rv::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.rna-rv--todo { color: #92400e; }
.rna-rv--todo::before { background: var(--amber); }
.rna-rv--ok { color: var(--green); }
.rna-rv--ok::before { background: var(--green); }
.rna-report-row > td { background: var(--surface-alt); }

.rna-ar__title { font-size: 12px; font-weight: 700; margin: 0 0 8px; }
.rna-ar__title .rna-sub { display: inline; margin-left: 4px; font-weight: 400; }
.rna-ar__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; }
.rna-ar-cat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.rna-ar-cat__head { font-size: 12px; font-weight: 700; margin: 0 0 8px; }
.rna-ar-item { border-top: 1px solid var(--border-light); padding: 8px 0; }
.rna-ar-item:first-of-type { border-top: 0; padding-top: 0; }
.rna-ar-item__what { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.rna-ar-item__subject { color: var(--ink); overflow-wrap: anywhere; }
.rna-ar-item__why { font-size: 11px; color: var(--muted); margin: 3px 0 0; }
.rna-ar-item__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
/* The resolve form (note picker + action buttons) wraps inside a narrow report
   card instead of overflowing it. */
.rna-ar-item__actions .rna-inline-form { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.rna-ar-item__actions .rna-select { max-width: 100%; min-width: 0; }
/* Busy state (busy_actions_controller.js): once an action is clicked the whole
   row is locked until the next page loads, and the clicked one spins. Selects
   are locked with aria-disabled (not disabled) so the chosen note still posts. */
.rna-busy-row[aria-busy="true"] .btn:disabled,
.rna-busy-row[aria-busy="true"] a[aria-disabled="true"],
.rna-busy-row[aria-busy="true"] select[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.rna-busy-row .btn[aria-busy="true"] { opacity: 0.85; cursor: progress; }
.rna-busy-row .btn[aria-busy="true"]::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 7px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .rna-busy-row .btn[aria-busy="true"]::after { animation: none; }
}
.rna-sha { font-size: 11px; background: #f0f0ee; padding: 1px 6px; border-radius: 4px; color: var(--ink); white-space: nowrap; }
.rna-ar-clear { font-size: 12px; font-weight: 600; color: var(--green); }
.rna-ar-resolved { margin-top: 8px; font-size: 12px; }
.rna-ar-resolved summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.rna-ar-resolved ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.rna-ar-resolved li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rna-ar-resolved li .rna-sub { display: inline; margin: 0; }

.rna-record { margin-top: 12px; }
.rna-record > summary, .rna-attach > summary { display: inline-flex; list-style: none; cursor: pointer; }
.rna-record > summary::-webkit-details-marker, .rna-attach > summary::-webkit-details-marker { display: none; }
.rna-record__form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; margin-top: 10px; align-items: end; }
.rna-record__form > button { justify-self: start; margin-bottom: 16px; }

/* ── Notes list ───────────────────────────────────────────────────────── */
.rna-attach { margin-bottom: 12px; }
.rna-attach__list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.rna-attach__list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-light); }
.rna-attach__list .rna-sub { display: inline; margin: 0; }
.rna-attach__title { flex: 1 1 240px; font-size: 13px; font-weight: 600; }
.rna-order-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.rna-order-label__state { display: inline-flex; align-items: center; gap: 8px; }
.rna-order-label__state[hidden] { display: none; }
.rna-link-button {
  background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.rna-link-button:hover { text-decoration: underline; }
.rna-note-list { list-style: none; margin: 0; padding: 0; }
.rna-note {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 12px 0;
  border-top: 1px solid var(--border-light);
}
.rna-note:first-child { border-top: 0; }
.rna-note--fc { box-shadow: inset 3px 0 0 var(--ink); padding-left: 8px; }
.rna-note--error { background: var(--red-tint); }
.rna-note:target { background: var(--blue-tint); }
.rna-note__pos { display: flex; flex-direction: column; align-items: center; gap: 2px; }
/* Notes filters (release_notes_audience_filter_controller): "Customer-facing" and
   "Seen by <company>" set [hidden] on notes and data-filtering on #notes, which
   hides the Move arrows (they would step past hidden notes); the position
   numbers stay. The toggle reuses .rn-view-toggle. */
#notes .rna-note[hidden] { display: none; }
#notes[data-filtering] .rna-move { visibility: hidden; }
.rna-seen-by { display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 0 0; }
.rna-seen-by__label { font-size: 12px; font-weight: 600; color: var(--muted); }
.rna-filter-hint { margin: 0 0 8px; }
.rna-section__actions .rn-view-toggle { margin-right: 8px; }
.rn-view-toggle__opt { border: 0; background: transparent; font-family: inherit; cursor: pointer; }
.rn-view-toggle__opt .rna-count { margin-left: 4px; }
.rna-move {
  width: 26px; height: 22px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  color: var(--muted); cursor: pointer; font-size: 12px; line-height: 1;
}
.rna-move:hover:not(:disabled) { color: var(--ink); border-color: var(--border-hover); }
.rna-move:disabled { opacity: 0.35; cursor: default; }
.rna-note__num { font-size: 11px; font-weight: 700; color: var(--light); }
.rna-note__main { min-width: 0; }
.rna-note__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rna-note__top .rna-sub { display: inline; margin: 0; }
.rna-note__title { font-size: 14px; font-weight: 700; margin: 6px 0 4px; }
.rna-note__body { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.rna-note__commits summary { cursor: pointer; font-size: 12px; color: var(--blue); font-weight: 600; }
.rna-note__commits ul { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12px; display: grid; gap: 3px; }
.rna-note__commits li { display: flex; gap: 8px; }
.rna-note__actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }

.rna-history td { font-size: 12px; }

@media (max-width: 768px) {
  .rna-note { grid-template-columns: 30px 1fr; }
  .rna-note__actions { grid-column: 2; }
  .rna-filter-actions { margin-left: 0; }
  .rna-title-save { opacity: 1; }
}
