/* Human-QA review tool. Reuses the design tokens from style.css (loaded first). */

.review-header {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 22px; border-bottom: 1px solid var(--hairline);
  background: var(--canvas); position: sticky; top: 0; z-index: 20;
}
.review-header .brand { flex: 0 0 auto; text-decoration: none; }
.review-header .brand-word { font-size: 22px; }
.review-bar { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; }
.review-nav { display: flex; gap: 6px; flex: 1 1 auto; }
.review-nav button {
  font: inherit; font-size: .88rem; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink); }
.review-nav button.active { background: var(--surface-dark); color: var(--on-dark);
  border-color: var(--surface-dark); }
.review-nav button:hover:not(.active) { background: var(--surface-soft); }
.review-status { font-size: .85rem; color: var(--muted); flex: 0 0 auto; }
.review-status .gate-badge { margin-left: 8px; }

/* Mobile: collapse the view tabs + status behind the hamburger (matches the homepage). */
@media (max-width: 720px) {
  .review-header { flex-wrap: wrap; }
  .review-header .brand-logo { height: 46px; }
  .review-header .brand-word { font-size: 20px; }
  .review-toggle { display: flex; margin-left: auto; }
  .review-bar { display: none; }
  .review-header.nav-open .review-bar {
    display: flex; flex-direction: column; align-items: stretch; width: 100%;
    gap: 10px; padding-top: 12px; border-top: 1px solid var(--hairline); }
  .review-header.nav-open .review-nav { flex-direction: column; }
  .review-header.nav-open .review-nav button { text-align: left; }
}

.review-root { max-width: 1180px; margin: 0 auto; padding: 20px 22px 80px; }
.review-loading, .review-error { padding: 60px 0; text-align: center; color: var(--slate-600); }
.review-error { color: var(--red-900); }

.queue { max-width: 720px; margin: 0 auto; }
.queue h2 { color: var(--navy); font-size: 1.3rem; margin-bottom: 14px; }
.queue-item { display: block; text-decoration: none; border: 1px solid var(--slate-200);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; background: #fff; }
.queue-item:hover { border-color: var(--blue-700); box-shadow: 0 2px 12px rgba(26,79,196,.12); }
.qi-title { font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.qi-meta { font-size: .8rem; color: var(--slate-600); }

.mode-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.mode-tabs button {
  border: 1px solid var(--slate-200); background: #fff; color: var(--slate-700);
  border-radius: 999px; padding: 7px 16px; font-weight: 600; cursor: pointer; font-size: .9rem;
}
.mode-tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---- Guided wizard ---- */
.wiz { max-width: 760px; margin: 0 auto; }
.wiz-head { text-align: center; margin-bottom: 14px; }
.wiz-head h2 { font-size: 1.3rem; color: var(--navy); margin: 0 0 4px; }
.wiz-head p { color: var(--slate-600); margin: 0; }
.wiz-progress { display: flex; gap: 6px; justify-content: center; margin: 14px 0 22px; }
.wiz-progress i {
  width: 26px; height: 6px; border-radius: 3px; background: var(--slate-200); display: block;
}
.wiz-progress i.done { background: var(--green-900); }
.wiz-progress i.current { background: var(--blue-700); }

.wiz-card { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 2px 14px rgba(15,26,61,.05); }
.wiz-thumb { float: right; width: 190px; margin: 0 0 12px 18px; border: 1px solid var(--slate-200);
  border-radius: 8px; position: relative; overflow: hidden; background: var(--slate-50); }
.wiz-thumb img { width: 100%; display: block; }
.wiz-reason { background: #fffbeb; border: 1px solid #fde68a; color: var(--amber-900);
  border-radius: 8px; padding: 10px 12px; font-size: .88rem; margin-bottom: 14px; }
.wiz-reason b { display: block; margin-bottom: 3px; }
.wiz-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--slate-600); margin-bottom: 6px; }
.hear-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.hear-line .said { color: var(--slate-700); font-style: italic; }
textarea.u-edit {
  width: 100%; min-height: 74px; border: 1px solid var(--slate-300, #cbd5e1); border-radius: 8px;
  padding: 10px 12px; font: inherit; font-size: .98rem; color: var(--slate-900); resize: vertical;
}
textarea.u-edit:focus { outline: 2px solid var(--blue-700); border-color: var(--blue-700); }
.wiz-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.wiz-actions .btn { width: auto; }
.wiz-done { text-align: center; padding: 40px 0; }
.wiz-done h2 { color: var(--green-900); }

/* ---- Full editor ---- */
.ed-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
  padding-bottom: 14px; border-bottom: 1px solid var(--slate-200); }
.ed-toolbar .btn { width: auto; }
.ed-toolbar .tool-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 16px; width: auto;
  font-size: .92rem; line-height: 1; white-space: nowrap;
}
.ed-toolbar .tool-primary { min-width: 118px; }
.ed-toolbar .spacer { flex: 1; }
.ed-summary { font-size: .85rem; color: var(--slate-700); background: var(--slate-50);
  border: 1px solid var(--slate-200); border-radius: 8px; padding: 9px 13px; margin-bottom: 14px; }
.ed-split { display: grid; grid-template-columns: 42% 58%; gap: 20px; align-items: start; }
@media (max-width: 900px) { .ed-split { grid-template-columns: 1fr; } }

.ed-page { position: sticky; top: 78px; border: 1px solid var(--slate-200); border-radius: 8px;
  overflow: hidden; background: var(--slate-50); }
.ed-page .canvas { position: relative; }
.ed-page img { width: 100%; display: block; }
.ed-page .hl { position: absolute; border: 2px solid var(--blue-700);
  background: rgba(26,79,196,.14); border-radius: 3px; pointer-events: none;
  transition: all .12s ease; }
.ed-page .page-caption { font-size: .75rem; color: var(--slate-600); padding: 6px 10px;
  border-top: 1px solid var(--slate-200); background: #fff; }

.ed-list-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ed-pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--slate-200); background: #fff; border-radius: 8px; padding: 8px 10px; }
.ed-pager .pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; min-width: 76px; padding: 0 10px; white-space: nowrap;
}
.ed-page-select {
  height: 32px; min-width: 180px; max-width: 100%; border: 1px solid var(--slate-200);
  border-radius: 6px; padding: 0 30px 0 10px; font-size: .82rem; color: var(--slate-700);
  background: #fff;
}
.ed-page-info { color: var(--slate-600); font-size: .8rem; margin-left: auto; }
.ed-list { display: flex; flex-direction: column; gap: 8px; }
.ed-empty { border: 1px dashed var(--slate-200); border-radius: 8px; color: var(--slate-600);
  background: var(--slate-50); padding: 16px; text-align: center; font-size: .9rem; }
.unit-card { border: 1px solid var(--slate-200); border-radius: 9px; padding: 10px 12px;
  background: #fff; cursor: pointer; }
.unit-card.selected { border-color: var(--blue-700); box-shadow: 0 0 0 2px rgba(26,79,196,.18); }
.unit-card.flagged { border-left: 4px solid var(--amber-900); }
.unit-card.skipped { opacity: .6; background: var(--slate-50); }
.unit-card.figure { background: var(--surface-soft); }
.unit-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.u-role { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: #fff; background: var(--slate-600); border-radius: 5px; padding: 2px 7px; }
.u-role.heading { background: var(--navy); }
.u-role.figure { background: var(--blue-700); }
.u-flag { color: var(--amber-900); font-size: .78rem; font-weight: 700; }
.u-order { color: var(--slate-600); font-size: .72rem; margin-left: auto; }
.u-text { color: var(--slate-900); font-size: .92rem; line-height: 1.4; white-space: pre-wrap;
  border: 1px dashed transparent; border-radius: 6px; padding: 2px 4px; }
.u-text:focus { outline: none; border-color: var(--blue-700); background: #fff; }
.u-skip-reason { color: var(--slate-600); font-style: italic; }
.u-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.btn-sm { border: 1px solid var(--slate-200); background: #fff; color: var(--slate-700);
  border-radius: 6px; padding: 5px 10px; min-height: 28px; min-width: 28px; font-size: .8rem;
  font-weight: 600; cursor: pointer; }   /* >= 24x24 target (WCAG 2.5.8) */
.btn-sm:hover { background: var(--slate-100); }
.btn-sm:disabled { opacity: .4; cursor: default; }
.btn-sm.danger { color: var(--red-900); }
.u-actions .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; min-width: 32px; padding: 0; font-size: .95rem;
}
.u-actions .row-action {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; min-width: 72px; padding: 0 12px; line-height: 1; white-space: nowrap;
}
.u-actions select,
.u-actions .row-select {
  height: 32px; min-width: 104px; border: 1px solid var(--slate-200); border-radius: 6px;
  padding: 0 30px 0 10px; font-size: .8rem; color: var(--slate-700); background: #fff;
}
.unit-card[draggable="true"] { }
.unit-card.dragging { opacity: .4; }
.unit-card.drop-target { border-top: 3px solid var(--blue-700); }

.busy-overlay { position: fixed; inset: 0; background: rgba(15,26,61,.35); display: none;
  align-items: center; justify-content: center; z-index: 60; }
.busy-card { background: #fff; border-radius: 12px; padding: 20px 26px; display: flex; gap: 14px;
  align-items: center; box-shadow: 0 10px 40px rgba(0,0,0,.3); font-weight: 600; color: var(--navy);
  max-width: 82%; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--slate-200); flex: none;
  border-top-color: var(--blue-700); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dl-note { color: var(--green-900); font-weight: 600; margin-top: 4px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: .9rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 40; max-width: 90%; }
.toast.err { background: var(--red-900); }
.speaking { box-shadow: 0 0 0 2px var(--green-900) !important; }

/* Read-only table unit + complex-table banner (Addendum C.2 — human reviews flagged tables) */
.u-role.table { background: var(--surface-cream-strong); color: var(--ink); }
.u-table { overflow-x: auto; margin: 6px 0; }
.review-tbl { border-collapse: collapse; font-size: 0.85rem; }
.review-tbl th, .review-tbl td { border: 1px solid var(--hairline); padding: 4px 8px; text-align: left; }
.review-tbl th { background: var(--surface-soft); font-weight: 700; }
.u-table-warn { background: #fef3c7; border: 1px solid #92400e; border-radius: 6px;
  padding: 6px 10px; font-size: 0.85rem; color: #92400e; margin: 4px 0; }
.u-table-note { font-size: 0.8rem; color: var(--muted); margin: 4px 0 2px; font-style: italic; }

/* Confidence "ready" view (clean result) */
.ready { max-width: 640px; margin: 8px auto; padding: 8px 4px; }
.ready-badge { display: inline-block; background: var(--green-900); color: #fff; font-weight: 700;
  font-size: .8rem; padding: 3px 10px; border-radius: 999px; }
.ready-badge.warn { background: #92400e; }
.ready-head { margin: 10px 0 4px; color: var(--navy); }
.ready-sub { color: var(--slate-700); margin: 0 0 14px; }
.ready-did { list-style: none; padding: 0; margin: 0 0 14px; }
.ready-did li { padding: 6px 0 6px 26px; position: relative; border-bottom: 1px solid var(--slate-50); }
.ready-did li::before { content: "✓"; position: absolute; left: 4px; color: var(--green-900);
  font-weight: 700; }
.ready-score { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin: 12px 0; }
.ready-metric { border: 1px solid var(--slate-200); border-radius: 8px; background: #fff;
  padding: 10px 12px; min-width: 0; }
.ready-metric span { display: block; color: var(--slate-600); font-size: .78rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.ready-metric strong { display: block; color: var(--navy); font-size: 1.05rem; line-height: 1.2; }
.ready-metric small { display: block; color: var(--slate-600); font-size: .78rem; line-height: 1.35;
  margin-top: 4px; }
.ready-metric.warn { border-color: #92400e; background: #fff7ed; }
.ready-metric.ok { border-color: var(--success); background: var(--surface-card); }
.ready-match { border-left: 4px solid var(--blue-700); background: var(--slate-50);
  border-radius: 8px; padding: 10px 12px; color: var(--slate-800); font-size: .9rem;
  margin: 0 0 14px; }
.ready-note { background: var(--surface-card); border: 1px solid var(--success); border-radius: var(--r-md);
  padding: 10px 12px; font-size: .9rem; color: var(--success); margin: 0 0 14px; }
.ready-audit-scope { background: #fff7ed; border: 1px solid #c2410c; border-radius: var(--r-md);
  padding: 12px 14px; font-size: .9rem; color: var(--slate-800); margin: 0 0 14px; }
.ready-audit-scope h3 { margin: 0 0 6px; font-size: 1rem; color: var(--navy); }
.ready-audit-scope h4 { margin: 12px 0 5px; font-size: .9rem; color: var(--navy); }
.ready-audit-scope p { margin: 0 0 8px; }
.ready-audit-scope ul,
.ready-audit-scope ol { margin: 0; padding-left: 20px; }
.ready-audit-scope li { margin: 6px 0; line-height: 1.45; }
.ready-audit-scope strong { color: #92400e; }
.ready-flag { background: #fef3c7; border: 1px solid #92400e; border-radius: 8px;
  padding: 10px 12px; font-size: .9rem; color: #92400e; margin: 0 0 14px; }
.ready-scope { font-size: .85rem; color: var(--slate-700); background: var(--slate-50);
  border-radius: 8px; padding: 10px 12px; margin: 0 0 18px; }
.ready-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (max-width: 720px) { .ready-score { grid-template-columns: 1fr; } }
