:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #637083;
  --line: #dbe1ea;
  --brand: #0a5cc7;
  --ok: #168a53;
  --warn: #b7791f;
  --bad: #c24135;
  --review: #6b5bd6;
  --blocked: #46505f;
  --available: #0a5cc7;
  --error: #c24135;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.header-actions { display: flex; align-items: center; gap: 12px; }
.snapshot { color: var(--muted); font-size: 13px; }

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 11px;
  cursor: pointer;
}

button:hover { border-color: #aeb9c8; }
button:disabled {
  color: #9aa5b4;
  cursor: not-allowed;
  background: #f3f5f8;
}

.button-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 11px;
  text-decoration: none;
}

.hidden { display: none !important; }

main { padding: 22px 28px 40px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card, .panel, .stage-column, .person-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card { padding: 13px 14px; min-height: 82px; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { display: block; margin-top: 8px; font-size: 25px; font-weight: 760; }
.metric-note { color: var(--muted); font-size: 12px; }

.pipeline-funnel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.funnel-step {
  min-width: 120px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 10px;
}

.funnel-step--temporarily-hidden,
.funnel-step--avatar-guide-image,
.funnel-step--ai-video {
  display: none;
}

.funnel-name { font-size: 12px; color: var(--muted); min-height: 35px; }
.funnel-percent { font-weight: 760; margin-top: 8px; }
.bar { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar-fill { height: 100%; background: var(--brand); }

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-top: 8px;
  overflow-x: auto;
}

.tab {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 11px 12px;
  color: var(--muted);
}

.tab-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.tab.active {
  color: var(--brand);
  box-shadow: inset 0 -2px 0 var(--brand);
}

.toolbar {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, minmax(150px, .5fr));
  gap: 10px;
  margin: 16px 0;
}

.toolbar input, .toolbar select {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
}

.view { display: none; }
.active-view { display: block; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.3fr .8fr;
  gap: 14px;
}

.panel { padding: 14px; }
.panel + .panel { margin-top: 14px; }

.status-row {
  display: grid;
  grid-template-columns: 170px minmax(180px, 1fr) 72px;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}

.status-main {
  min-width: 0;
}

.status-counts {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stacked {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #eef2f7;
}

.seg-approved { background: var(--ok); }
.seg-rejected { background: var(--bad); }
.seg-pending { background: var(--warn); }
.seg-in_review { background: var(--review); }
.seg-blocked { background: var(--blocked); }
.seg-available { background: var(--available); }
.seg-error { background: var(--error); }

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 10px 0 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--muted);
}

.legend-dot.approved { background: var(--ok); }
.legend-dot.rejected, .legend-dot.error { background: var(--bad); }
.legend-dot.pending { background: var(--warn); }
.legend-dot.in_review { background: var(--review); }
.legend-dot.blocked { background: var(--blocked); }
.legend-dot.available { background: var(--available); }

.table-shell {
  max-height: calc(100vh - 260px);
  min-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #fbfcfe;
  position: sticky;
  top: 0;
  z-index: 4;
}

tr:last-child td { border-bottom: 0; }
.id-cell { font-weight: 720; white-space: nowrap; }
.name-cell { min-width: 210px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 650;
  background: #eef2f7;
  color: var(--muted);
  white-space: nowrap;
}

.badge.approved, .badge.complete { background: #e5f5ed; color: var(--ok); }
.badge.rejected, .badge.error { background: #fdebea; color: var(--bad); }
.badge.pending, .badge.incomplete { background: #fff4dd; color: var(--warn); }
.badge.needs_rework { background: #fff7df; color: var(--warn); }
.badge.in_review { background: #eeecff; color: var(--review); }
.badge.blocked { background: #eef0f3; color: var(--blocked); }
.badge.available { background: #e8f1ff; color: var(--available); }

.stage-grid, .people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.stage-column, .person-card { padding: 12px; }
.stage-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; color: var(--muted); }
.stage-stats strong { display: block; color: var(--text); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.asset-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.asset-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 740;
}

.asset-card-body { padding: 10px; }
.asset-path { margin-top: 6px; color: var(--muted); font-size: 12px; word-break: break-word; }

.reference-page-header {
  position: static;
}

.reference-page .app-header {
  padding: 16px 24px;
}

.reference-main {
  padding: 16px 24px 32px;
}

.edited-review-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.edited-review-page .reference-page-header {
  flex: 0 0 auto;
  padding: 10px 18px;
  gap: 14px;
}

.edited-review-page .reference-page-header h1 {
  font-size: 18px;
  line-height: 1.15;
}

.edited-review-page .reference-page-header .eyebrow {
  margin-bottom: 1px;
  font-size: 10px;
}

.edited-review-page .header-actions {
  gap: 8px;
}

.edited-review-page .snapshot {
  font-size: 12px;
}

.edited-review-page .button-link {
  padding: 6px 9px;
  font-size: 12px;
}

.edited-review-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.reference-queue-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.reference-queue-sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.reference-filter-drawer {
  border-bottom: 1px solid var(--line);
  margin: -14px -14px 12px;
  padding: 12px 14px;
}

.reference-filter-drawer summary {
  cursor: pointer;
  font-weight: 760;
}

.reference-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.reference-controls input,
.reference-controls select {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
}

.reference-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reference-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}

.reference-summary strong {
  color: var(--text);
}

.reference-list {
  display: grid;
  gap: 7px;
}

.reference-page-group {
  margin: 12px 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.reference-group + .reference-group {
  margin-top: 14px;
}

.reference-group h3 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.reference-row {
  display: grid;
  width: 100%;
  gap: 7px;
  text-align: left;
  border-radius: 8px;
  margin: 0;
  padding: 10px;
  background: #fbfcfe;
}

.reference-row.active {
  border-color: var(--brand);
  background: #eef6ff;
  box-shadow: inset 4px 0 0 var(--brand);
}

.reference-row-main,
.reference-row-main span,
.reference-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-row-main {
  display: flex;
  gap: 6px;
}

.reference-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reference-row small {
  color: var(--muted);
}

.reference-list-empty,
.reference-empty-state {
  padding: 18px;
  text-align: center;
}

.reference-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.reference-queue-head h2 {
  font-size: 17px;
}

.reference-detail {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.reference-review-hero,
.reference-decision-panel {
  display: grid;
  gap: 14px;
}

.reference-review-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.reference-review-title h2 {
  font-size: 22px;
  line-height: 1.2;
}

.reference-review-state {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.reference-nav-actions,
.reference-rating-row,
.reference-decision-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.reference-decision-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reference-decision-panel textarea,
.reference-decision-panel select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 10px;
  resize: vertical;
}

.review-action {
  color: #fff;
  border-color: transparent;
  font-weight: 760;
}

.review-action.approved { background: var(--ok); }
.review-action.needs_rework { background: var(--warn); }
.review-action.rejected { background: var(--bad); }

.review-decision {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
  color: #46505f;
  background: #eef2f7;
}

.review-decision.approved {
  color: #0f6b41;
  background: #e8f7ef;
}

.review-decision.rejected {
  color: #9d2f27;
  background: #fff0ee;
}

.review-decision.needs_rework {
  color: #8a5a12;
  background: #fff7df;
}

.review-decision.skipped {
  color: #485163;
  background: #edf0f5;
}

.reference-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.reference-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.reference-stage-panel,
.reference-asset-section {
  display: grid;
  gap: 12px;
}

.reference-stage-head,
.reference-asset-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-stage-head select {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 9px 10px;
}

.reference-section-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.reference-video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.reference-video-frame {
  position: relative;
  background: #101828;
}

.reference-video-card video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #101828;
}

.reference-media-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #101828;
}

.reference-audio-preview,
.reference-file-preview {
  display: grid;
  place-items: center;
  gap: 10px;
  width: 100%;
  min-height: 170px;
  padding: 18px;
  color: #e2e8f0;
  text-align: center;
}

.reference-audio-preview audio {
  width: min(100%, 420px);
}

.reference-file-preview span {
  color: #cbd5e1;
  font-size: 12px;
}

.reference-video-fallback {
  margin: 0;
  padding: 8px 10px;
  color: #cbd5e1;
  background: #101828;
  font-size: 12px;
}

.reference-video-body {
  padding: 12px;
}

.reference-video-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reference-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.reference-actions a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 11px;
  text-decoration: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.reference-video-pager {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.reference-section-pager {
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.edited-review-shell {
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

.edited-review-page .reference-queue-sidebar {
  position: static;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.edited-review-page .reference-filter-drawer,
.edited-review-page .reference-queue-head,
.edited-review-page .pager {
  flex: 0 0 auto;
}

.edited-review-page .reference-list {
  min-height: 0;
  overflow: auto;
}

.edited-review-detail {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.edited-video-row .reference-row-meta small {
  max-width: 190px;
}

.edited-exercise-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.edited-exercise-head h2 {
  font-size: 22px;
  line-height: 1.2;
}

.edited-exercise-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.edited-exercise-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.edited-exercise-stats strong {
  color: var(--text);
}

.edited-review-workspace {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(300px, 0.95fr) minmax(330px, 420px);
  gap: 14px;
  align-items: start;
}

.edited-context-panel,
.edited-selected-panel,
.edited-gif-box,
.edited-sibling-list {
  min-width: 0;
}

.edited-context-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.edited-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.edited-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.edited-section-title span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.edited-section-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--panel);
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.edited-section-toggle:hover {
  background: #eef6ff;
}

.edited-gif-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.edited-gif-box img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 7px;
  background: #101828;
}

.edited-missing-context {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}

.edited-missing-context strong {
  color: var(--text);
}

.edited-sibling-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.edited-sibling-list.collapsed .edited-section-title {
  margin-bottom: 0;
}

.edited-sibling-list.collapsed .edited-sibling-scroll {
  display: none;
}

.edited-sibling-scroll {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.edited-sibling-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 7px;
  text-align: left;
  background: var(--panel);
}

.edited-sibling-card.raw-context-card,
.edited-sibling-card.generated-context-card {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.edited-sibling-card.active {
  border-color: var(--brand);
  background: #eef6ff;
  box-shadow: inset 4px 0 0 var(--brand);
}

.edited-sibling-card video,
.edited-sibling-card img {
  width: 76px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 6px;
  background: #101828;
}

.edited-sibling-card img {
  object-fit: contain;
}

.edited-sibling-card-meta {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.edited-sibling-card-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edited-selected-panel {
  display: grid;
  gap: 12px;
  align-items: start;
}

.edited-selected-meta {
  display: grid;
  gap: 11px;
}

.edited-selected-meta h3 {
  font-size: 19px;
}

.edited-review-hero {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.edited-review-video-frame {
  overflow: hidden;
  border-radius: 8px;
  background: #101828;
}

.edited-review-video-frame video {
  display: block;
  width: 100%;
  max-height: 72vh;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: #101828;
}

.edited-review-hero-side {
  display: grid;
  gap: 12px;
}

.edited-review-hero-side h2 {
  font-size: 24px;
  line-height: 1.18;
}

.edited-review-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edited-review-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.edited-review-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.edited-review-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.edited-review-meta dd {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edited-checklist-panel {
  display: grid;
  gap: 12px;
  align-self: start;
  max-height: calc(100vh - 128px);
  overflow: auto;
}

.edited-review-toolbar,
.edited-review-submit-row {
  display: grid;
  gap: 12px;
}

.edited-review-toolbar h3 {
  font-size: 18px;
}

.edited-critical-warning {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid #f5b2aa;
  border-radius: 8px;
  color: #84261f;
  background: #fff0ee;
}

.edited-critical-warning span {
  font-size: 12px;
}

.edited-criteria-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.edited-compact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.edited-checklist-items {
  display: grid;
  gap: 8px;
}

.edited-checklist-item {
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.edited-checklist-item.critical {
  border-left: 4px solid var(--bad);
}

.edited-checklist-item legend {
  padding: 0 4px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.25;
}

.edited-checklist-item legend small {
  margin-left: 6px;
  border-radius: 999px;
  padding: 2px 6px;
  color: #84261f;
  background: #fff0ee;
  font-size: 9px;
  text-transform: uppercase;
}

.edited-checklist-options {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.edited-checklist-options.yesNo,
.edited-checklist-options.noYes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edited-checklist-options.quality,
.edited-checklist-options.pace {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.edited-checklist-option {
  display: flex;
  justify-content: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  text-align: center;
}

.edited-checklist-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.edited-checklist-option:has(input:checked) {
  border-color: var(--brand);
  color: #0f3d66;
  background: #eef6ff;
  box-shadow: inset 0 0 0 1px var(--brand);
}

.edited-checklist-option.issue:has(input:checked) {
  border-color: var(--warn);
  color: #7c4b0f;
  background: #fff7df;
  box-shadow: inset 0 0 0 1px var(--warn);
}

.edited-criterion {
  min-width: 0;
  margin: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.edited-criterion.critical {
  border-left: 4px solid var(--bad);
}

.edited-criterion.compact {
  padding: 10px;
}

.edited-criterion legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-weight: 760;
}

.edited-criterion legend small {
  border-radius: 999px;
  padding: 2px 7px;
  color: #84261f;
  background: #fff0ee;
  font-size: 10px;
  text-transform: uppercase;
}

.edited-criterion p {
  min-height: 36px;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.edited-criterion.compact p {
  min-height: 0;
  margin: 5px 0 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edited-criterion-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.edited-criterion.compact .edited-criterion-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.edited-criterion-option {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.edited-criterion.compact .edited-criterion-option {
  justify-content: center;
  padding: 7px 5px;
}

.edited-criterion.compact .edited-criterion-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.edited-criterion-option input {
  flex: 0 0 auto;
}

.edited-criterion-option:has(input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.edited-criterion-option.major_issue:has(input:checked) {
  border-color: var(--bad);
  color: #84261f;
  background: #fff0ee;
  box-shadow: inset 0 0 0 1px var(--bad);
}

.edited-criterion-option.minor_issue:has(input:checked) {
  border-color: var(--warn);
  color: #7c4b0f;
  background: #fff7df;
  box-shadow: inset 0 0 0 1px var(--warn);
}

.edited-notes-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.edited-notes-label textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
}

.pending-list { display: grid; gap: 10px; }
.pending-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(17, 24, 39, .38);
  z-index: 30;
}

.drawer.open { display: block; }
.drawer-panel {
  width: min(720px, 100%);
  height: 100%;
  margin-left: auto;
  overflow: auto;
  background: var(--panel);
  box-shadow: -16px 0 40px rgba(17, 24, 39, .18);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
}

#drawerBody { padding: 18px; }
.timeline { display: grid; gap: 9px; margin-top: 12px; }
.timeline-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.small-muted { color: var(--muted); font-size: 12px; }
.link-button { color: var(--brand); background: transparent; border: 0; padding: 0; }

@media (max-width: 980px) {
  .edited-review-page {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  .edited-review-main {
    display: block;
    min-height: 0;
    overflow: visible;
  }
  .edited-review-shell,
  .edited-review-detail,
  .edited-review-page .reference-queue-sidebar {
    overflow: visible;
  }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .reference-queue-shell { grid-template-columns: 1fr; }
  .edited-review-shell { grid-template-columns: 1fr; }
  .reference-queue-sidebar { position: static; max-height: none; }
  .reference-controls { grid-template-columns: 1fr 1fr; }
  .reference-list { max-height: 430px; overflow: auto; }
  .reference-review-hero { grid-template-columns: 1fr; }
  .edited-review-hero { grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); }
  .edited-review-workspace,
  .edited-selected-panel {
    grid-template-columns: 1fr;
  }
  .edited-context-panel {
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    align-items: start;
  }
  .edited-sibling-scroll {
    max-height: 340px;
  }
  .edited-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reference-review-state { justify-content: flex-start; }
  .table-shell { max-height: none; }
  th { position: static; }
  .status-row { grid-template-columns: 145px minmax(120px, 1fr) 64px; }
}

@media (max-width: 640px) {
  .app-header { align-items: flex-start; flex-direction: column; padding: 18px; }
  .header-actions { flex-wrap: wrap; }
  main { padding: 16px; }
  .metrics-grid, .toolbar { grid-template-columns: 1fr; }
  .reference-main { padding: 14px; }
  .reference-controls { grid-template-columns: 1fr; }
  .reference-video-grid { grid-template-columns: 1fr; }
  .reference-media-grid { grid-template-columns: 1fr; }
  .edited-review-hero,
  .edited-criteria-grid,
  .edited-compact-grid,
  .edited-context-panel,
  .edited-review-meta {
    grid-template-columns: 1fr;
  }
  .edited-exercise-head,
  .edited-exercise-stats {
    align-items: stretch;
    flex-direction: column;
  }
  .edited-exercise-stats {
    justify-content: flex-start;
  }
  .edited-sibling-scroll {
    max-height: 360px;
  }
  .edited-sibling-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .edited-sibling-card video,
  .edited-sibling-card img {
    width: 64px;
  }
  .edited-review-video-frame video {
    max-height: 70vh;
  }
  .edited-review-toolbar,
  .edited-review-submit-row {
    align-items: stretch;
    flex-direction: column;
  }
  .edited-criterion-options {
    grid-template-columns: 1fr;
  }
  .edited-criterion.compact .edited-criterion-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .reference-stage-head,
  .reference-asset-section-head {
    align-items: stretch;
    flex-direction: column;
  }
  .reference-stage-head select {
    min-width: 0;
    width: 100%;
  }
  .reference-row-main { display: block; }
  .reference-row-meta,
  .reference-rating-row,
  .reference-decision-actions,
  .reference-nav-actions,
  .pager {
    align-items: stretch;
    flex-direction: column;
  }
  .reference-decision-actions button,
  .reference-nav-actions button,
  .pager button {
    width: 100%;
  }
  .table-shell { min-height: 0; }
  table { min-width: 980px; }
  .timeline-row { grid-template-columns: 1fr; }
  .pending-item { flex-direction: column; }
  .status-row { grid-template-columns: 1fr; gap: 6px; }
  .status-counts { white-space: normal; }
}
