/* DL Annotation UI — EG_Pipeline (bd-108).
   --------------------------------------------------------------------------
   Aligned to the EG home aesthetic (static/index.html): blue accent
   (#4A90E2), teal secondary (#50C9C3), larger radii (6/10/16), system
   fonts. Mirrors LP's annotation_service/JS structure but with EG
   palette tokens — NOT a copy of LP's CSS.

   Vanilla CSS, air-gapped EC2 (no CDN fonts).
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces (match EG home) */
  --bg-primary:        #FAFBFC;
  --bg-surface:        #FFFFFF;
  --bg-muted:          #F8F9FA;
  --bg-control:        #F1F3F5;

  /* Text */
  --text-primary:      #1A1D21;
  --text-secondary:    #4F5763;
  --text-tertiary:     #6B7280;
  --text-muted:        #9AA1A9;

  /* Borders */
  --border-primary:    #E5E8EB;
  --border-divider:    #EEF0F2;

  /* Accents (EG palette — blue primary, teal secondary) */
  --accent-primary:    #4A90E2;
  --accent-hover:      #3A7BC8;
  --accent-wash:       #F0F7FF;
  --secondary:         #50C9C3;

  /* Status colours */
  --color-success:     #28A745;
  --color-warning:     #FFC107;
  --color-error:       #DC3545;
  --success-wash:      #E8F5E9;
  --warning-wash:      #FFF8E1;
  --error-wash:        #FDECEA;

  /* Fonts (system stacks; no CDN) */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue',
                  Helvetica, Arial, sans-serif;
  --font-mono:    'SF Mono', 'JetBrains Mono', 'Fira Code', 'IBM Plex Mono',
                  Menlo, Consolas, 'Liberation Mono', monospace;

  /* Radii (match EG home: 6 / 10 / 16) */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Spacing */
  --r-1: .25rem; --r-2: .5rem; --r-3: .75rem; --r-4: 1rem;
  --r-5: 1.5rem; --r-6: 2rem; --r-8: 3rem;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.08);

  /* Legacy aliases JS reads (rerunSpinner uses --accent) */
  --bg:       var(--bg-primary);
  --fg:       var(--text-primary);
  --muted:    var(--text-secondary);
  --border:   var(--border-primary);
  --accent:   var(--accent-primary);
  --ok:       var(--color-success);
  --warn:     var(--color-warning);
  --bad:      var(--color-error);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color .15s;
}
a:hover { color: var(--accent-hover); }

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--accent-primary);
  color: #FFF;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button:disabled { opacity: .5; cursor: not-allowed; }

button.secondary {
  background: var(--bg-control);
  color: var(--text-primary);
  border-color: var(--border-primary);
}
button.secondary:hover:not(:disabled) {
  background: #E5E8EB;
  border-color: #D8D8D8;
}

input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--accent-primary);
  vertical-align: -2px;
  cursor: pointer;
}
input[type="number"] { width: auto; }

textarea { resize: vertical; line-height: 1.5; }

/* ─── Header (EG home aesthetic) ────────────────────────────────────────── */

.header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-primary);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header-logo {
  width: 36px; height: 36px;
  background: var(--accent-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #FFF;
}
.header-logo svg { width: 18px; height: 18px; }
.header-title-group { display: flex; flex-direction: column; gap: 2px; }
.header-title    { font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: -.01em; }
.header-subtitle { font-size: 12px; color: var(--text-tertiary); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-control);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}
.btn-back:hover { background: #E5E8EB; color: var(--text-primary); }
.btn-back svg { width: 14px; height: 14px; stroke: var(--text-secondary); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Sidebar primitives ────────────────────────────────────────────────── */

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.divider {
  height: 1px;
  background: var(--border-divider);
  margin: 16px 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.form-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.row-2 > * { min-width: 0; }
.row-2 input, .row-2 select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.sidebar input[type="date"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
}

.btn-primary {
  width: 100%;
  background: var(--accent-primary);
  color: #FFF;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Queue layout ──────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1440px;
  margin: 0 auto;
  align-items: start;
}

.sidebar, .filters {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 76px;
}

.sidebar .section-label:not(:first-child) { margin-top: 0; }
.sidebar input, .sidebar select { width: 100%; font-size: 13px; }
.sidebar .hint {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-divider);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

.queue {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.selectionBar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-wash);
  border-bottom: 1px solid #C8DCF2;
  font-size: 13px;
  color: var(--text-primary);
}
.selectionBar.visible { display: flex; }
.selectionBar .count { font-weight: 600; color: var(--accent-primary); }
.selectionBar .spacer { flex: 1; }
.selectionBar button.secondary { background: var(--bg-surface); }

.queue table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.queue col.col-sel    { width: 36px;  }
.queue col.col-created{ width: 140px; }
.queue col.col-tenant { width: 200px; }
.queue col.col-subj   { width: 80px;  }
.queue col.col-grade  { width: 60px;  }
.queue col.col-score  { width: 80px;  }
.queue col.col-revs   { width: 70px;  }
.queue col.col-status { /* flex */ }
.queue col.col-action { width: 120px; }

.queue th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-muted);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.queue th:nth-child(5), .queue th:nth-child(6), .queue th:nth-child(7) { text-align: center; }
.queue td:nth-child(5), .queue td:nth-child(6), .queue td:nth-child(7) { text-align: center; }
.queue th:last-child { text-align: right; }
.queue td:last-child { text-align: right; }

.queue td {
  padding: 12px;
  border-bottom: 1px solid var(--border-divider);
  font-size: 13px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.queue td.statusCell { white-space: normal; line-height: 1.35; }

.queue tbody tr { transition: background .12s; }
.queue tbody tr:hover { background: var(--bg-muted); }
.queue tbody tr.selected { background: var(--accent-wash); }

.queue td.empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 56px 0;
  font-size: 13px;
}

.queue td .ts { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.queue td .tenant { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }
.queue td .score { font-family: var(--font-mono); font-weight: 600; }
.queue td a { font-size: 12px; font-weight: 500; }

.queue .pager {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border-divider);
  background: var(--bg-muted);
}
.queue .pager button {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  padding: 6px 12px;
  font-size: 12px;
}
.queue .pager button:hover:not(:disabled) { background: var(--bg-control); }
.queue .pager #pageLabel { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }

.rowRerunSpin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-primary);
}

/* ─── Badges (3-state queue status) ─────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
}
.badge-none        { background: var(--bg-control);   color: var(--text-secondary); }
.badge-ai_reviewed { background: var(--accent-wash);  color: var(--accent-hover);   border: 1px solid #BFD9F2; }
.badge-dl_reviewed { background: var(--success-wash); color: #1B6D2E;               border: 1px solid #B7E4C7; }
/* Legacy aliases kept for BC */
.badge-in_review   { background: var(--warning-wash); color: #92400E; }
.badge-annotated   { background: var(--success-wash); color: #166534; }
.badge-exported    { background: var(--accent-wash);  color: var(--accent-hover); }

/* bd-122: environment pill in the queue table — prod (live) vs stage. */
.env {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
}
.env-prod  { background: var(--success-wash); color: #166534; border: 1px solid #B7E4C7; }
.env-stage { background: var(--warning-wash); color: #92400E; border: 1px solid #FDE68A; }

/* bd-122: human-readable exam render in the item editor (replaces the raw JSON
   dump). Holds the generation-time exam_paper HTML; contain it so the exam's
   own table/heading markup stays inside the left panel and scrolls if wide. */
.examRender {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
}
.examRender table { border-collapse: collapse; max-width: 100%; }
.examRender td, .examRender th { border: 1px solid var(--border, #e5e7eb); padding: 6px 8px; vertical-align: top; }
.examRender img { max-width: 100%; height: auto; }

/* ─── Item page layout ──────────────────────────────────────────────────── */

.itemLayout {
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 20px;
  padding: 20px;
  max-width: 1640px;
  margin: 0 auto;
  align-items: start;
}

.itemLeft, .itemRight {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.itemLeft { min-height: 60vh; }

.authBar {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-divider);
}
.authBar .section-label { margin-bottom: 8px; }
.authBar .authRow {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.authBar .authRow label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 9rem;
  min-width: 9rem;
}
.authBar .authRow input { width: 100%; font-size: 12px; }
.authBar .authRow button { padding: 8px 18px; }

.itemRight {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  padding-bottom: 0;
}
.itemRight::-webkit-scrollbar { width: 8px; }
.itemRight::-webkit-scrollbar-track { background: transparent; }
.itemRight::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 4px; }
.itemRight::-webkit-scrollbar-thumb:hover { background: #D0D0D0; }

.crumb {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-divider);
}

.meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 12px;
  line-height: 1.65;
}
.meta strong { color: var(--text-primary); font-weight: 600; }

#itemContent {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
}
#itemContent pre {
  font-family: var(--font-mono);
  background: var(--bg-muted) !important;
  border: 1px solid var(--border-primary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 14px !important;
  font-size: 12px !important;
  line-height: 1.55;
}
#itemContent code { font-family: var(--font-mono); background: var(--bg-muted); padding: 1px 6px; border-radius: 3px; font-size: 12px; }

/* ─── Review widget ─────────────────────────────────────────────────────── */

.reviewHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.reviewHeader h2 {
  margin: 0;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  font-weight: 600;
}
.reviewHeader button {
  flex-shrink: 0;
  font-size: 12px;
  padding: 6px 12px;
}

#reviewMeta {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-divider);
}

#rerunStatus {
  background: var(--accent-wash);
  border: 1px solid #C8DCF2;
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 16px;
  color: var(--accent-hover);
  font-family: var(--font-mono);
  font-size: 11px;
}

.rerunSpinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--accent-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: rerunSpin .8s linear infinite;
  margin-right: 8px;
  vertical-align: -1px;
}
@keyframes rerunSpin { to { transform: rotate(360deg); } }

.emptyReview {
  text-align: center;
  padding: 32px 16px;
  background: var(--bg-muted);
  border: 1px dashed var(--border-primary);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.emptyReview .icon { font-size: 28px; color: var(--text-muted); margin-bottom: 8px; }
.emptyReview h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.emptyReview p { margin: 0 0 16px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.emptyReview button { font-size: 12px; padding: 8px 16px; }

/* bd-109: top-of-review digest box (overall_summary + strengths + other issues) */
.reviewDigest {
  background: var(--bg-muted);
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 0 0 14px;
}
.reviewDigest .reviewSummary {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  font-style: italic;
}
.reviewDigest .reviewListLabel {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 8px 0 4px;
}
.reviewDigest .reviewStrengths ul,
.reviewDigest .reviewIssues ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.55;
}
.reviewDigest .reviewStrengths { border-left: 3px solid var(--color-success); padding-left: 10px; }
.reviewDigest .reviewStrengths li { color: #1B6D2E; margin-bottom: 4px; }
.reviewDigest .reviewIssues   { border-left: 3px solid var(--color-error);   padding-left: 10px; margin-top: 10px; }
.reviewDigest .reviewIssues   li { color: #991B1B; margin-bottom: 4px; }

#reviewCriteria { counter-reset: crit; }

.criterion {
  position: relative;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px 14px 38px;
  margin-bottom: 10px;
  background: var(--bg-surface);
  transition: border-color .15s, box-shadow .15s;
}
.criterion[open] {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.criterion::before {
  counter-increment: crit;
  content: counter(crit, decimal-leading-zero);
  position: absolute;
  top: 12px;
  left: 12px;
  width: 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-primary);
}

.criterion summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
  outline: none;
}
.criterion summary::-webkit-details-marker { display: none; }
.criterion summary::after {
  content: "+";
  float: right;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-tertiary);
}
.criterion[open] summary::after { content: "−"; color: var(--accent-primary); }

.criterion p.meta {
  margin: 8px 0 10px;
  padding: 8px 10px;
  background: var(--bg-muted);
  border-left: 2px solid var(--border-primary);
  border-radius: 2px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.55;
}

.criterion .verdictRow {
  display: flex;
  gap: 6px;
  margin: 12px 0;
}
.criterion .verdictRow label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  text-transform: capitalize;
  transition: all .12s;
}
.criterion .verdictRow label:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
  background: var(--bg-muted);
}
.criterion .verdictRow input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
}
.criterion .verdictRow label:has(input[value="agree"]:checked) {
  background: var(--success-wash);
  border-color: var(--color-success);
  color: #1B6D2E;
  font-weight: 600;
}
.criterion .verdictRow label:has(input[value="disagree"]:checked) {
  background: var(--error-wash);
  border-color: var(--color-error);
  color: #991B1B;
  font-weight: 600;
}
.criterion .verdictRow label:has(input[value="partial"]:checked) {
  background: var(--warning-wash);
  border-color: var(--color-warning);
  color: #92400E;
  font-weight: 600;
}

.criterion .scoreRow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.criterion .scoreRow input[type="number"] {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  width: 4.5em !important;
  text-align: center;
  margin-left: 6px;
}

.criterion textarea {
  width: 100%;
  min-height: 3.5em;
  margin-top: 6px;
  font-size: 12px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-color: var(--border-primary);
}

.subchecks {
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  position: relative;
}
.subchecks::before {
  content: "sub-checks";
  position: absolute;
  top: -7px;
  left: 8px;
  padding: 0 6px;
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.subcheck {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-divider);
}
.subcheck:last-child { border-bottom: 0; }
.subcheck > div:first-child {
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.subcheckLabel {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-left: 4px;
}
.subcheck textarea { font-size: 11px; min-height: 2.5em; }

/* ─── Status cell (badge + verdict-coverage subline) ─────────────────── */

.queue .statusCell { text-align: left; }
.queue .statusCell .badge { margin: 0; }
.queue .statusCell .verdictMeta {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.queue .statusCell .verdictMeta strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ─── Drawer (inline review under each row) ──────────────────────────── */

.queue .openLink { display: inline-flex; align-items: center; gap: 4px; }
.queue .toggleDrawer {
  display: inline-block;
  cursor: pointer;
  padding: 2px 6px;
  margin-right: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-control);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  user-select: none;
  transition: background .12s, color .12s;
}
.queue .toggleDrawer:hover { background: var(--accent-wash); color: var(--accent-primary); }
.queue tr.expanded .toggleDrawer { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }

.queue tr.drawerRow { background: var(--bg-muted); }
.queue tr.drawerRow.hidden { display: none; }
.queue tr.drawerRow > td {
  padding: 0;
  border-bottom: 1px solid var(--border-primary);
  white-space: normal;
}
.queue .drawer {
  padding: 16px 20px;
  border-left: 3px solid var(--accent-primary);
  background: var(--bg-surface);
  margin: 0 12px 12px 36px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.queue .drawer .drawerHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.queue .drawer .drawerHeader h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.queue .drawer .drawerHeader .drawerMeta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.queue .drawer .drawerActions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-divider);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.queue .drawer .drawerActions a.btn {
  background: var(--accent-primary);
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}
.queue .drawer .drawerActions a.btn:hover { background: var(--accent-hover); }

.queue .drawer .criterion {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-surface);
  position: relative;
  padding-left: 38px;
}
.queue .drawer .criterion::before {
  counter-increment: dcrit;
  content: counter(dcrit, decimal-leading-zero);
  position: absolute;
  top: 10px;
  left: 12px;
  width: 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-primary);
}
.queue .drawer .criteriaList { counter-reset: dcrit; }
.queue .drawer .criterion .critTitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.queue .drawer .criterion .critScore {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-control);
  padding: 2px 7px;
  border-radius: 10px;
}
.queue .drawer .criterion .critRationale {
  margin-top: 6px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.5;
}
.queue .drawer .criterion .verdictsRow {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.queue .drawer .verdictChip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
}
.queue .drawer .verdictChip.agree    { background: var(--success-wash); color: #1B6D2E; }
.queue .drawer .verdictChip.disagree { background: var(--error-wash);   color: #991B1B; }
.queue .drawer .verdictChip.partial  { background: var(--warning-wash); color: #92400E; }
.queue .drawer .emptyReviewInline {
  padding: 16px;
  background: var(--bg-muted);
  border: 1px dashed var(--border-primary);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Overall note + sticky action footer ────────────────────────────── */

.itemRight > label[for="overallNote"] {
  display: block;
  margin-top: 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
#overallNote {
  width: 100%;
  min-height: 3.5em;
  margin-top: 6px;
  font-size: 12px;
}

.actions {
  position: sticky;
  bottom: 0;
  margin: 20px -24px 0;
  padding: 14px 24px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--bg-surface) 25%);
  border-top: 1px solid var(--border-divider);
  display: flex;
  align-items: center;
  gap: 10px;
}
.coverage {
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.coverage strong {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
#markCompleteBtn:not(:disabled) {
  background: var(--color-success);
  border-color: var(--color-success);
}
#markCompleteBtn:not(:disabled):hover {
  background: #218838;
  border-color: #218838;
}

/* ─── Toast ──────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--text-primary);
  color: var(--bg-surface);
  font-size: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 100;
  max-width: 28rem;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok  { border-left-color: var(--color-success); }
.toast.bad { border-left-color: var(--color-error); }

/* ─── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .layout, .itemLayout {
    grid-template-columns: 1fr;
  }
  .sidebar, .filters, .itemRight {
    position: static;
    max-height: none;
  }
  .header { padding: 0 16px; }
  .authBar .authRow label { flex-basis: 100%; min-width: 0; }
  .actions { margin: 16px -16px 0; padding: 12px 16px; }
}
