/* DL Annotation UI — aligned to the LP home palette (bd-104).
   --------------------------------------------------------------------------
   Shared by annotate.html + annotate_item.html on both LP_Pipeline and
   EG_Pipeline. Vanilla CSS, system fonts (air-gapped EC2 — no CDNs).

   Design tokens mirror static/index.html so the DL tool feels like the
   same product as the LP/EG generators. Differences from the home are
   strictly additive (criterion cards, verdict chips, sticky actions).
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces (match LP home) */
  --bg-primary:        #FAFAFA;
  --bg-surface:        #FFFFFF;
  --bg-muted:          #F8F8F8;
  --bg-control:        #F0F0F0;

  /* Text */
  --text-primary:      #1A1A1A;
  --text-secondary:    #666666;
  --text-tertiary:     #888888;
  --text-muted:        #AAAAAA;

  /* Borders */
  --border-primary:    #E5E5E5;
  --border-divider:    #F0F0F0;

  /* Accents */
  --accent-primary:    #0D6E6E;
  --accent-hover:      #0A5A5A;
  --accent-wash:       #E0EFEF;
  --accent-secondary:  #E07B54;

  /* Status colours */
  --color-success:     #22C55E;
  --color-warning:     #F59E0B;
  --color-error:       #EF4444;
  --success-wash:      #DCFCE7;
  --warning-wash:      #FEF3C7;
  --error-wash:        #FEE2E2;

  /* Fonts — system stacks that visually approximate Inter / JetBrains Mono.
     We cannot CDN-load fonts (air-gapped). System fonts get us 80% of the way. */
  --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 home: 4 / 8 / 12) */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* 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 via getComputedStyle (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;
}

h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.005em;
  margin: 0;
  color: var(--text-primary);
}

h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 var(--r-3);
}

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: #E5E5E5;
  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 (canonical pattern from reviewer.html / prompts.html) ─────── */

.header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-primary);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo {
  width: 28px; height: 28px;
  background: var(--accent-primary);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 700;
}
.header-title-group { display: flex; flex-direction: column; gap: 1px; }
.header-title    { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.header-subtitle { font-size: 12px; color: var(--text-tertiary); }

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

/* ─── Sidebar primitives (Authentication, section labels, form groups) ── */

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
  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;
}
/* bd-107: grid items default to min-content width — that lets a date input's
   intrinsic min-width push outside the cell. Force min-width:0 so the cell
   honours the grid track. */
.row-2 > * { min-width: 0; }
.row-2 input,
.row-2 select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
/* date inputs in particular have a wider intrinsic width on most browsers */
.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: 8px 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;
}

/* New canonical sidebar (replaces .filters); keep .filters fallback for safety */
.sidebar,
.filters {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 72px; /* below the sticky header */
}

.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);
  letter-spacing: .02em;
}

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

/* Selection toolbar — appears when ≥1 row selected */
.selectionBar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-wash);
  border-bottom: 1px solid #C5DEDE;
  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; /* bd-105 — colgroup widths win, no width drift on empty cells */
}

/* bd-105: explicit per-column widths so the table doesn't reflow per row.
   Total = 36 + 140 + 200 + 70 + 60 + 80 + 70 + auto + 110 = 766px + flex.
   The "DL status" column is the flex remainder so the verdict subline has
   room to wrap on narrower screens. */
.queue col.col-sel    { width: 36px;  }
.queue col.col-created{ width: 140px; }
.queue col.col-tenant { width: 200px; }
.queue col.col-subj   { width: 70px;  }
.queue col.col-grade  { width: 60px;  }
.queue col.col-score  { width: 80px;  }
.queue col.col-revs   { width: 70px;  }
.queue col.col-status { /* flex remainder */ }
.queue col.col-action { width: 110px; }

.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;
}

/* Right-align numeric headers for cleaner scanning */
.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: 10px 12px;
  border-bottom: 1px solid var(--border-divider);
  font-size: 13px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The DL-status cell has wrapping content (badge + subline) — allow it to wrap */
.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:first-child {
  width: 36px;
  text-align: center;
  padding-right: 0;
}

.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);
  letter-spacing: .02em;
}

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

/* ─── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
}

/* bd-106: 3-state queue badges — None / AI Reviewed / DL Reviewed */
.badge-none        { background: var(--bg-control);   color: var(--text-secondary); }
.badge-ai_reviewed { background: var(--accent-wash);  color: var(--accent-hover);   border: 1px solid #BFD9D9; }
.badge-dl_reviewed { background: var(--success-wash); color: #166534;               border: 1px solid #B7E4C7; }

/* Legacy badge classes kept for BC in case a stray template path renders an
   old enum value. Safe to delete after a few releases. */
.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-119: 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; }

/* ─── 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;
}

/* Item-page authentication bar (top of itemLeft, replaces former header auth) */
.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: 72px; /* below sticky header */
  max-height: calc(100vh - 88px);
  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 h1, #itemContent h2, #itemContent h3, #itemContent h4 {
  font-family: var(--font-primary);
  color: var(--text-primary);
  margin-top: 1.4em;
  margin-bottom: .4em;
}
#itemContent h1 { font-size: 18px; }
#itemContent h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text-primary); }
#itemContent h2::after { display: none; }
#itemContent h3 { font-size: 14px; font-weight: 600; }
#itemContent p { margin: .6em 0 1em; }
#itemContent ul, #itemContent ol { padding-left: 1.4em; }
#itemContent li { margin-bottom: .35em; }
#itemContent table {
  border-collapse: collapse; margin: 1em 0; width: 100%; font-size: 13px;
}
#itemContent th, #itemContent td {
  border: 1px solid var(--border-primary); padding: 7px 11px;
}
#itemContent th { background: var(--bg-muted); font-weight: 600; }
#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: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  font-weight: 600;
}
.reviewHeader h2::after { display: none; }
.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 #C5DEDE;
  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;
  letter-spacing: .02em;
}

.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); } }

/* Empty state — when no AI review is on the row */
.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;
}

/* Numbered criterion cards */
#reviewCriteria { counter-reset: crit; }

.criterion {
  position: relative;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px 14px 36px;
  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: 10px;
  width: 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-primary);
  letter-spacing: .04em;
}

.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);
  transition: transform .2s;
}
.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: #166534;
  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;
}

/* 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);
  letter-spacing: .04em;
}

.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: #16A34A;
  border-color: #16A34A;
}

/* ─── 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; }
}


/* ─── bd-105: status cell subline + expand-drawer ───────────────────────── */

/* Status cell: badge on top, verdict-coverage subline below */
.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);
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.queue .statusCell .verdictMeta strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Expand toggle in the actions cell */
.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); }

/* Drawer row */
.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; /* indent to align with row content */
  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); }

/* Read-only criterion blocks inside drawer */
.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);
  letter-spacing: .04em;
}
.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 .criterion .verdictsRow .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: #166534; }
.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);
}
