*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

:root {
  --pr-navy: #1A2C55;
  --pr-navy-deep: #0e1830;
  --pr-red: #FF0103;
  --bg: #f0f2f5;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-soft: #f3f4f6;
  --card: #ffffff;
}

html, body { background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  padding-bottom: 2rem;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
  transition: background 0.2s ease;
}
body.damage-mode {
  background: #fef2f2;
}
body.damage-mode .header {
  background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
}

button { font-family: inherit; }

/* ─── Header ─── */
.header {
  background: linear-gradient(135deg, var(--pr-navy) 0%, var(--pr-navy-deep) 100%);
  color: white;
  padding: 0.55rem 0.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: background 0.2s ease;
}
.header-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.back-btn {
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: white;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.back-btn:hover { background: rgba(255,255,255,0.22); }
.brand-block { min-width: 0; }
.brand-name { display: flex; align-items: center; gap: 0.2rem; line-height: 1; }
.brand-pro  { font-size: 1rem; font-weight: 800; color: var(--pr-red); letter-spacing: -0.4px; }
.brand-rent { font-size: 1rem; font-weight: 800; color: #fff; letter-spacing: -0.4px; }
.header-subtitle {
  font-size: 0.65rem; opacity: 0.85; margin-top: 0.1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ─── Status pill ─── */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 20px;
  font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  white-space: nowrap; flex-shrink: 0;
}
.status-pill.pending  { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.25); }
.status-pill.approved { background: #d1fae5; color: #065f46; }
.status-pill.rejected { background: #fee2e2; color: #991b1b; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-pill.pending  .status-dot { background: rgba(255,255,255,0.7); }
.status-pill.approved .status-dot { background: #10b981; }
.status-pill.rejected .status-dot { background: #ef4444; }

/* ─── Metadata strip ─── */
.damage-banner {
  display: block;
  background: linear-gradient(90deg, #991b1b 0%, #7f1d1d 100%);
  color: white;
  text-align: center;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.6px;
  padding: 0.5rem 0.75rem;
  text-transform: uppercase;
  position: sticky;
  top: 49px;
  z-index: 99;
  box-shadow: 0 2px 6px rgba(127,29,29,0.4);
}
.damage-banner[hidden] { display: none; }

.metadata-strip {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.metadata-strip::-webkit-scrollbar { display: none; }
.metadata-strip-inner { display: inline-flex; align-items: center; }
.meta-item {
  display: inline-flex; flex-direction: column;
  padding: 0 0.75rem;
  border-right: 1px solid var(--border);
}
.meta-item:first-child { padding-left: 0; }
.meta-item:last-child  { border-right: none; }
.meta-label {
  font-size: 0.55rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted);
}
.meta-value { font-size: 0.72rem; font-weight: 600; color: #111827; margin-top: 0.05rem; }
.meta-value.empty { color: #9ca3af; font-weight: 400; font-style: italic; }

/* ─── Main ─── */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.6rem 0.6rem 1rem;
}

/* ─── Verdict (Clean / Dirty) ─── */
.verdict {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.verdict-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800;
  color: white;
}
.verdict-body { min-width: 0; flex: 1; }
.verdict-title {
  font-size: 1rem; font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.verdict-reasons {
  font-size: 0.7rem;
  margin-top: 0.15rem;
  line-height: 1.35;
  word-break: break-word;
}
.verdict.clean { background: #d1fae5; border: 1.5px solid #6ee7b7; }
.verdict.clean .verdict-icon { background: #10b981; }
.verdict.clean .verdict-title { color: #065f46; }
.verdict.clean .verdict-reasons { color: #047857; }
.verdict.dirty { background: #fee2e2; border: 1.5px solid #fca5a5; }
.verdict.dirty .verdict-icon { background: #ef4444; }
.verdict.dirty .verdict-title { color: #991b1b; }
.verdict.dirty .verdict-reasons { color: #b91c1c; }

.return-complete-row {
  display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.6rem;
  padding: 0.45rem 0.7rem;
  background: white;
  border-radius: 8px;
  font-size: 0.72rem; font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.return-complete-row .pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.return-complete-row .pill.done { background: #d1fae5; color: #065f46; }
.return-complete-row .pill.pending { background: #fef3c7; color: #92400e; }

/* ─── Inspection status (replaces supervisor approval cards) ─── */
.inspection-status {
  background: white;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  border-left: 4px solid #10b981;
}
.inspection-status.blocked {
  border-left-color: #f59e0b;
  background: #fffbeb;
}
.status-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.25rem 0;
}
.status-row + .status-row { border-top: 1px solid var(--border-soft); }
.status-label { font-size: 0.78rem; font-weight: 600; color: #111827; }
.status-pill-mini {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.18rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.status-pill-mini.done { background: #d1fae5; color: #065f46; }
.status-pill-mini.pending { background: #fef3c7; color: #92400e; }
.status-pill-mini.alert { background: #fee2e2; color: #991b1b; }
.status-pill-mini-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  font-size: 0.65rem; font-weight: 800;
}
.status-pill-mini.done .status-pill-mini-mark { background: #10b981; color: white; }
.status-pill-mini.pending .status-pill-mini-mark { background: #f59e0b; color: white; }
.status-pill-mini.alert .status-pill-mini-mark { background: #ef4444; color: white; }
.status-block-hint {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px dashed #fcd34d;
  font-size: 0.7rem; color: #92400e;
  font-weight: 600;
}

/* ─── QBO Final document card ─── */
.qbo-final-card {
  background: white;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  border-left: 4px solid #7c3aed;
}
.qbo-final-card.empty {
  border-left-color: #d1d5db;
  opacity: 0.85;
}
.qbo-final-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  filter: grayscale(0);
}
.qbo-final-card.empty .qbo-final-icon { filter: grayscale(1); opacity: 0.6; }
.qbo-final-body { flex: 1; min-width: 0; }
.qbo-final-title { font-size: 0.78rem; font-weight: 700; color: #111827; }
.qbo-final-filename {
  font-size: 0.7rem; color: var(--muted);
  margin-top: 0.1rem;
  word-break: break-word;
}
.qbo-final-btn {
  flex-shrink: 0;
  background: #7c3aed;
  color: white;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  text-decoration: none;
  transition: background 0.2s ease;
}
.qbo-final-btn:hover { background: #6d28d9; }

/* ─── Queue bar ─── */
.queue-bar {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: white;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  box-shadow: 0 1px 4px rgba(91,33,182,0.3);
}
.queue-bar.single {
  background: white;
  color: var(--muted);
  border: 1px dashed #d1d5db;
  box-shadow: none;
}
.queue-bar-label { font-weight: 700; }
.queue-bar.single .queue-bar-label { font-weight: 500; font-size: 0.7rem; }
.queue-bar-position {
  background: rgba(255,255,255,0.2);
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.72rem;
  margin-right: auto;
}
.queue-bar-exit, .queue-bar-enter {
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.68rem; font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}
.queue-bar.single .queue-bar-enter {
  background: #7c3aed;
  border-color: #7c3aed;
  color: white;
}
.queue-bar-exit:hover, .queue-bar-enter:hover { opacity: 0.9; }

.queue-bar { flex-direction: column; align-items: stretch; }
.queue-bar-main {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%;
}
.queue-bar-main .queue-bar-exit { margin-left: auto; }
.queue-bar-meta {
  display: flex; flex-direction: column;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255,255,255,0.18);
  line-height: 1.3;
  gap: 0.1rem;
}
.queue-bar-so {
  font-weight: 700; font-size: 0.8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-bar-dates { font-size: 0.7rem; opacity: 0.9; font-weight: 500; letter-spacing: 0.2px; }

/* ─── Queue continue banner ─── */
.queue-continue {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: white;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 4px 12px rgba(91,33,182,0.35);
  animation: queueContinuePop 0.25s ease;
}
@keyframes queueContinuePop {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.queue-continue.done {
  background: #f3f4f6;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.queue-continue.stopped {
  background: white;
  color: #374151;
  border: 1px dashed #d1d5db;
  box-shadow: none;
}
.queue-continue-text strong { display: block; font-size: 0.95rem; font-weight: 800; }
.queue-continue-text p { font-size: 0.76rem; margin-top: 0.15rem; opacity: 0.95; }
.queue-continue-text a { color: inherit; text-decoration: underline; }
.queue-continue-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.5rem;
}
.qc-btn {
  border: none;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-size: 0.78rem; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.qc-btn.stop { background: rgba(255,255,255,0.18); color: white; border: 1px solid rgba(255,255,255,0.4); }
.qc-btn.stop:hover { background: rgba(255,255,255,0.28); }
.qc-btn.go { background: white; color: #5b21b6; }
.qc-btn.go:hover { background: #f3f4f6; }

.empty-queue {
  background: white;
  border-radius: 14px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin-top: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.empty-queue-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  font-size: 1.8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.empty-queue-title {
  font-size: 1.1rem; font-weight: 700;
  color: #065f46;
  margin-bottom: 0.4rem;
}
.empty-queue-body {
  font-size: 0.8rem; color: var(--muted);
  line-height: 1.55;
}

/* ─── Alert bar ─── */
.alert-bar {
  background: #FCEBEB;
  border: 1.5px solid #f5a0a0;
  border-radius: 10px;
  padding: 0.7rem 0.875rem;
  margin-bottom: 0.75rem;
}
.alert-bar-text { font-size: 0.8rem; color: #7f1d1d; line-height: 1.5; }
.alert-bar-title { font-weight: 700; }

/* ─── Summary grid ─── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.summary-card { border-radius: 10px; padding: 0.75rem 0.875rem; text-align: center; }
.summary-card.ok      { background: #EAF3DE; }
.summary-card.changed { background: #FAEEDA; }
.summary-card.flag    { background: #FCEBEB; }
.summary-card.na      { background: #F1EFE8; }
.summary-count { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.summary-card.ok      .summary-count { color: #27500A; }
.summary-card.changed .summary-count { color: #854F0B; }
.summary-card.flag    .summary-count { color: #A32D2D; }
.summary-card.na      .summary-count { color: #5F5E5A; }
.summary-label {
  font-size: 0.65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; margin-top: 0.2rem;
}
.summary-card.ok      .summary-label { color: #3a6b14; }
.summary-card.changed .summary-label { color: #9a5a0e; }
.summary-card.flag    .summary-label { color: #b53434; }
.summary-card.na      .summary-label { color: #6b6a67; }

.section-hint {
  font-size: 0.72rem; color: var(--muted);
  text-align: center;
  padding: 0.35rem 0 0.6rem;
  font-style: italic;
}

/* ─── Comparison sections ─── */
.comparison-section {
  background: white;
  border-radius: 12px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
  background: white;
  border: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
}
.section-header:hover { background: #f9fafb; }
.section-header-left { display: flex; align-items: center; gap: 0.6rem; }
.section-title { font-size: 0.78rem; font-weight: 700; color: #111827; }
.section-badge {
  display: inline-flex; align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.section-badge.ok      { background: #d1fae5; color: #065f46; }
.section-badge.changed { background: #fed7aa; color: #92400e; }
.section-badge.flag    { background: #fee2e2; color: #991b1b; font-weight: 800; }
.section-badge.na      { background: #f3f4f6; color: var(--muted); }
.section-chevron {
  color: #9ca3af;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.comparison-section.expanded .section-chevron { transform: rotate(180deg); }
.section-body { display: none; border-top: 1px solid var(--border-soft); }
.comparison-section.expanded .section-body { display: block; }

.section-narrative {
  display: none;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-top: 1px solid var(--border-soft);
}
.comparison-section .section-narrative { display: block; }
.section-narrative.ok { background: #ecfdf5; color: #047857; }
.section-narrative.flag { background: #fef2f2; color: #b91c1c; }
.section-narrative.changed { background: #fffbeb; color: #92400e; }
.section-narrative.na { background: #f9fafb; color: var(--muted); }

/* ─── Auto-flag pills ─── */
.autoflag-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-soft);
}
.autoflag-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.72rem; font-weight: 600;
}
.autoflag-pill.active { background: #fee2e2; color: #991b1b; }
.autoflag-pill.clear  { background: #d1fae5; color: #065f46; }

/* ─── Field table ─── */
.field-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.field-table thead th {
  padding: 0.5rem 0.75rem;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted);
  background: #f9fafb;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.field-table thead th .col-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 0.3rem; vertical-align: middle;
}
.field-table thead th.col-mr  { color: #1d4ed8; }
.field-table thead th.col-ret { color: #b45309; }
.field-table thead th.col-mr  .col-dot { background: #3b82f6; }
.field-table thead th.col-ret .col-dot { background: #d97706; }
.field-table tbody td {
  padding: 0.35rem 0.55rem;
  font-size: 0.7rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}
.field-table tbody tr:last-child td { border-bottom: none; }
.field-table tbody tr.row-ok      { background: #f0fdf4; }
.field-table tbody tr.row-changed { background: #fffbeb; }
.field-table tbody tr.row-flag    { background: #fff5f5; }
.field-table tbody tr.row-na      { background: transparent; }
.field-table tbody tr.row-computed td {
  background: #f8fafc;
  color: #64748b;
  font-style: italic;
}
.field-name {
  color: #374151; font-weight: 500;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}
.field-value {
  color: #111827;
  word-break: break-word;
  overflow-wrap: break-word;
}
.field-value.empty { color: #9ca3af; font-style: italic; font-size: 0.72rem; }
.section-body { overflow-x: hidden; }
.field-delta { font-size: 0.7rem; font-weight: 600; margin-left: 0.25rem; }
.field-delta.positive { color: #059669; }
.field-delta.negative { color: #dc2626; }
.row-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-right: 0.35rem; vertical-align: middle;
}
.dot-ok      { background: #10b981; }
.dot-changed { background: #f59e0b; }
.dot-flag    { background: #ef4444; }
.dot-na      { background: #d1d5db; }

/* ─── View photos ─── */
.view-photos-row {
  padding: 0.6rem 0.875rem;
  border-top: 1px solid var(--border-soft);
}
.view-photos-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.875rem;
  border-radius: 6px;
  border: 1.5px solid #3b82f6;
  background: transparent;
  color: #2563eb;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.view-photos-btn:hover { background: #eff6ff; }
.view-photos-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Photos accordion ─── */
.photos-body { padding: 0.5rem 0.65rem 0.75rem; }
.photo-group { margin-bottom: 0.7rem; }
.photo-group:last-of-type { margin-bottom: 0.4rem; }
.photo-group-title {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 0.3rem;
  padding-left: 0.15rem;
}
.photo-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 0.4rem;
}
.photo-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: #f3f4f6;
  cursor: pointer;
  padding: 0;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-tag {
  position: absolute;
  top: 4px; left: 4px;
  font-size: 0.55rem; font-weight: 800;
  padding: 1px 5px;
  border-radius: 8px;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: white;
}
.photo-thumb-tag.mr  { background: #3b82f6; }
.photo-thumb-tag.ret { background: #d97706; }
.photo-thumb:hover { border-color: #7c3aed; }
.photos-compare-row { padding: 0.5rem 0 0; }

/* ─── Comments / supervisor cards ─── */
.card {
  background: white;
  border-radius: 12px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.card-title-bar {
  padding: 0.55rem 0.85rem;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 700; color: #374151;
}
.bubbles { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.bubble { padding: 0.75rem 0.875rem; }
.bubble:first-child { border-right: 1px solid var(--border-soft); }

/* ─── Comments / Communication History ─── */
.comments-card .card-title-bar.comments-title {
  display: flex; align-items: center; justify-content: space-between;
}
.comments-expand-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: #2563eb;
  font-size: 0.65rem; font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
}
.comments-expand-btn:hover { background: #eff6ff; }
.comments-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-soft);
  background: white;
}
.comments-tab {
  flex: 1;
  background: white;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.55rem 0.4rem;
  font-size: 0.7rem; font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.comments-tab.active { color: var(--pr-navy); border-bottom-color: var(--pr-navy); }
.comments-grid {
  display: grid;
  grid-template-columns: 1fr;
  background: white;
}
.comments-col { display: none; padding: 0; }
.comments-grid[data-active-tab="mr"] .comments-col[data-tab="mr"],
.comments-grid[data-active-tab="ret"] .comments-col[data-tab="ret"],
.comments-grid[data-active-tab="order"] .comments-col[data-tab="order"] { display: block; }

.comments-card.expanded .comments-tabs { display: none; }
.comments-card.expanded .comments-grid { grid-template-columns: 1fr 1fr 1fr; }
.comments-card.expanded .comments-col {
  display: block !important;
  border-right: 1px solid var(--border-soft);
  max-height: 360px;
  overflow-y: auto;
}
.comments-card.expanded .comments-col:last-child { border-right: none; }

@media (min-width: 769px) {
  .comments-tabs { display: none; }
  .comments-grid { grid-template-columns: 1fr 1fr 1fr; }
  .comments-col {
    display: block !important;
    border-right: 1px solid var(--border-soft);
    max-height: 280px;
    overflow-y: auto;
  }
  .comments-col:last-child { border-right: none; }
}
.stage-label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 0.4rem;
}
.stage-label.mr  { color: #1d4ed8; }
.stage-label.ret { color: #b45309; }
.bubble-text {
  font-size: 0.72rem; color: #374151;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.bubble-text.empty { color: #9ca3af; font-style: italic; }

/* ─── Supervisor approvals ─── */
.supervisor-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.18rem 0;
  font-size: 0.7rem;
}
.supervisor-card .bubble { padding: 0.55rem 0.75rem; }
.supervisor-row-label { color: var(--muted); }
.supervisor-row-value {
  color: #111827; font-weight: 500; text-align: right;
  max-width: 55%; word-break: break-word;
}
.checkmark-yes { color: #059669; font-weight: 600; }
.checkmark-no  { color: var(--muted); }
.completion-flags {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.75rem 0.875rem;
  border-top: 1px solid var(--border-soft);
}
.completion-flag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 12px;
  font-size: 0.7rem; font-weight: 600;
}
.completion-flag.done    { background: #d1fae5; color: #065f46; }
.completion-flag.pending { background: #f3f4f6; color: var(--muted); }
.completion-flag.alert   { background: #fee2e2; color: #991b1b; }

/* ─── Approval panel ─── */
.approval-panel {
  background: white;
  border-radius: 12px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.approval-body { padding: 0.875rem; }
.approval-textarea {
  width: 100%;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
  color: #374151;
  outline: none;
  transition: border-color 0.2s ease;
}
.approval-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.approval-textarea:disabled { background: #f9fafb; color: var(--muted); }
.approval-hint {
  font-size: 0.72rem;
  color: #b45309;
  margin-top: 0.4rem;
  font-weight: 600;
}
.approval-hint.satisfied {
  color: #059669;
}
.approval-hint.satisfied::before {
  content: "✓ ";
}
.approval-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.75rem;
}
.approval-btn {
  padding: 0.6rem 0.85rem;
  border: none;
  border-radius: 8px;
  font-size: 0.78rem; font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.approval-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.approval-btn.approve { background: #10b981; color: white; }
.approval-btn.approve:hover:not(:disabled) { background: #059669; }
.approval-btn.reject { background: #ef4444; color: white; }
.approval-btn.reject:hover:not(:disabled) { background: #dc2626; }

/* ─── Result banner ─── */
.result-banner {
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.6rem;
  display: none;
}
.result-banner.approved { display: block; background: #d1fae5; border: 1.5px solid #6ee7b7; }
.result-banner.rejected { display: block; background: #fee2e2; border: 1.5px solid #fca5a5; }
.result-banner-text strong { display: block; font-size: 0.9rem; font-weight: 700; }
.result-banner.approved .result-banner-text strong { color: #065f46; }
.result-banner.rejected .result-banner-text strong { color: #991b1b; }
.result-banner-text p { font-size: 0.78rem; margin-top: 0.15rem; }
.result-banner.approved .result-banner-text p { color: #047857; }
.result-banner.rejected .result-banner-text p { color: #b91c1c; }

/* ─── Compare lightbox ─── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}
.lightbox.active { display: flex; }
.lightbox-close {
  position: fixed; top: 0.75rem; right: 0.75rem;
  background: rgba(0,0,0,0.7);
  border: 1.5px solid rgba(255,255,255,0.3);
  color: white;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 1001;
}
.lightbox-close:hover { background: rgba(0,0,0,0.9); }
.lightbox-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 100vh;
  padding: 3.5rem 0.5rem 1rem;
}
.lightbox-header { margin-bottom: 0.5rem; text-align: center; color: white; }
.lightbox-category { font-size: 1rem; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.lightbox-stage    { font-size: 0.75rem; color: rgba(255,255,255,0.8); margin-top: 0.1rem; }
.lightbox-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 95%;
  width: 100%;
}
.compare-panel {
  position: relative;
  display: flex; flex-direction: column;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}
.compare-panel-header {
  padding: 0.6rem 0.75rem;
  text-align: center;
  background: rgba(0,0,0,0.35);
  color: white;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.compare-panel-content {
  position: relative;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
  max-height: 65vh;
  overflow: hidden;
}
.compare-panel-image { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.compare-panel-nav {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  border: none; color: white;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  font-size: 1.1rem;
}
.compare-panel-nav:hover { background: rgba(0,0,0,0.7); }
.compare-panel-nav.prev { left: 0.35rem; }
.compare-panel-nav.next { right: 0.35rem; }
.compare-panel-counter {
  position: absolute; bottom: 0.4rem; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-size: 0.7rem;
}
.compare-no-image {
  color: rgba(255,255,255,0.5);
  font-style: italic;
  font-size: 0.8rem;
  text-align: center;
  padding: 1.5rem;
}
.lightbox-categories {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  margin-top: 0.75rem;
  justify-content: center;
}
.lightbox-categories button {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 14px;
  cursor: pointer;
}
.lightbox-categories button.active {
  background: rgba(255,255,255,0.95);
  color: #111827;
  font-weight: 600;
}

/* ─── Progress overlay ─── */
.progress-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: none;
  align-items: center; justify-content: center;
}
.progress-overlay.active { display: flex; }
.progress-card {
  background: white;
  padding: 1.75rem 2rem;
  border-radius: 14px;
  text-align: center;
  min-width: 260px;
  max-width: 90%;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--pr-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.875rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-title { font-size: 0.9rem; font-weight: 600; color: #374151; }

/* ─── Toast ─── */
.toast-container {
  position: fixed; top: 5rem; right: 1rem;
  z-index: 3000;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: white;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  border-left: 4px solid #10b981;
  max-width: 280px;
  font-size: 0.82rem;
  color: #374151;
  transform: translateX(110%);
  transition: transform 0.3s ease;
  pointer-events: auto;
}
.toast.show { transform: translateX(0); }
.toast.error { border-left-color: #ef4444; }

/* ─── Mobile ─── */
@media (max-width: 768px) {
  .header-subtitle { max-width: 140px; }
  .lightbox-content {
    grid-template-columns: 1fr;
    max-height: 70vh;
    overflow-y: auto;
    gap: 0.5rem;
  }
  .compare-panel-content { min-height: 35vh; max-height: 55vh; }
  .lightbox-header {
    background: rgba(0,0,0,0.5);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
  }
  .bubbles { grid-template-columns: 1fr; }
  .bubble:first-child { border-right: none; border-bottom: 1px solid var(--border-soft); }
  .field-table { font-size: 0.7rem; }
  .field-table tbody td { padding: 0.32rem 0.4rem; }
  .field-table thead th { padding: 0.4rem 0.4rem; }
  .section-header { padding: 0.75rem 0.875rem; }
}

@media (max-width: 480px) {
  .field-table { font-size: 0.66rem; }
  .field-table tbody td { padding: 0.3rem 0.35rem; }
  .field-table thead th { font-size: 0.58rem; padding: 0.35rem 0.35rem; }
  .row-status-dot { margin-right: 0.2rem; }
}

@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-count { font-size: 1.5rem; }
}
