/* ---------- Board: Dashboard stats (compact single-row strip) ----------
   Was a two-tier stack of full-height cards (icon, then a big number on
   its own line, then a label, then a secondary line) — 8 metrics
   rendered as two rows of tall cards, taking up roughly as much
   vertical space as the actual board below it. The board (the real
   work surface — the complaints themselves) was only "half the view"
   as a direct result of this. Redesigned as one row of slim chips —
   icon, value, and label all on one compact line — so all 8 metrics
   still show, just without competing with the board for primary
   billing. */
.cx-scope .board-stat-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-3); }
.cx-scope .board-stat-chip {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 7px 10px; flex: 1 1 150px; min-width: 0;
}
.cx-scope .board-stat-chip.card-interactive { cursor: pointer; }
.cx-scope .board-stat-chip.card-interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.cx-scope .board-stat-chip.board-stat-card-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cx-scope .board-stat-chip .stat-icon {
  width: 22px; height: 22px; border-radius: var(--radius-sm); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.cx-scope .board-stat-chip .stat-icon.tone-neutral { background: var(--accent-soft); color: var(--accent); }
.cx-scope .board-stat-chip .stat-icon.tone-danger  { background: var(--danger-soft);  color: var(--danger); }
.cx-scope .board-stat-chip .stat-icon.tone-warning { background: var(--warning-soft); color: var(--warning); }
.cx-scope .board-stat-chip .stat-icon.tone-info    { background: var(--info-soft);    color: var(--info); }
.cx-scope .board-stat-chip .stat-body { min-width: 0; line-height: 1.25; }
.cx-scope .board-stat-chip .stat-value-row { display: flex; align-items: baseline; gap: 5px; }
.cx-scope .board-stat-chip .stat-value { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); }
.cx-scope .board-stat-chip .stat-label { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-scope .board-stat-chip .stat-secondary { font-size: 9.5px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-scope .board-stat-chip .board-stat-card-checkmark {
  position: absolute; top: -5px; right: -5px;
  width: 15px; height: 15px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.cx-scope .board-filter-bar {
  display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3);
  font-size: 12.5px; color: var(--text-secondary);
}
.cx-scope .board-filter-bar .btn { height: 26px; padding: 0 var(--space-3); font-size: 12px; }
.cx-scope .stat-secondary { font-size: 11.5px; color: var(--text-tertiary); margin-top: -4px; }

/* ---------- Board: complaint cards (Stage 3) ---------- */
.cx-scope .board-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.cx-scope .board-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.cx-scope .board-card-sla-green  { border-left-color: var(--success); }
.cx-scope .board-card-sla-amber  { border-left-color: var(--warning); }
.cx-scope .board-card-sla-red    { border-left-color: var(--danger); }
.cx-scope .board-card-sla-none   { border-left-color: var(--border); }
.cx-scope .board-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.cx-scope .board-card-top-right { display: flex; align-items: center; gap: 4px; }
.cx-scope .board-card-complaint-id { font-size: 9.5px; font-weight: 600; color: var(--text-tertiary); font-family: var(--font-mono, monospace); }
.cx-scope .board-card-ribbons { display: flex; gap: 3px; }
.cx-scope .board-card-ribbon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: var(--radius-sm);
  background: var(--warning-soft); color: var(--warning);
}
.cx-scope .board-card-ribbon svg { width: 12px; height: 12px; }
.cx-scope .board-card-ribbon.ribbon-danger { background: var(--danger-soft); color: var(--danger); }
/* Client name is the visual anchor of the card — what a human scans for
   first, not the ID. Priority moved to a clear top-right marker instead
   of being buried mid-card. */
.cx-scope .board-card-client { font-size: 13px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; line-height: 1.2; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-scope .board-card-category { font-size: 10.5px; color: var(--text-secondary); margin-top: -2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-scope .board-card-meta-row { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-tertiary); margin-top: 1px; flex-wrap: wrap; }
.cx-scope .board-card-health { font-weight: 700; padding: 1px 6px; border-radius: var(--radius-full); font-size: 9.5px; }
.cx-scope .board-card-health-good     { background: var(--success-soft); color: var(--success); }
.cx-scope .board-card-health-watch    { background: var(--warning-soft); color: var(--warning); }
.cx-scope .board-card-health-critical { background: var(--danger-soft);  color: var(--danger); }
.cx-scope .board-card-age { color: var(--text-tertiary); }
.cx-scope .board-card-stage-time { display: inline-flex; align-items: center; gap: 2px; color: var(--text-tertiary); }
.cx-scope .board-card-stage-time svg { width: 10px; height: 10px; flex: 0 0 auto; }
/* Single status line answering "why hasn't this moved" — blocked takes
   priority over waiting since it's the more urgent state. Blocked reasons
   previously had zero text representation on the card at all. */
.cx-scope .board-card-status { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; padding: 4px 6px; border-radius: var(--radius-md); }
.cx-scope .board-card-status svg { width: 11px; height: 11px; flex: 0 0 auto; }
.cx-scope .board-card-status-waiting { background: var(--warning-soft); color: var(--warning); }
.cx-scope .board-card-status-blocked { background: var(--danger-soft); color: var(--danger); }
.cx-scope .board-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 2px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 10px; }
.cx-scope .board-card-investigator { color: var(--text-secondary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-scope .board-card-phase { color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Board: skeleton loading ---------- */
.cx-scope .board-column-skeleton { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }

/* ---------- Board: responsive collapse ---------- */
@media (max-width: 900px) {
  .cx-scope .board-dashboard-row { grid-template-columns: repeat(2, 1fr); }
  .cx-scope .board-stat-card .stat-value { font-size: 18px; }
}
@media (max-width: 560px) {
  .cx-scope .board-dashboard-row { grid-template-columns: 1fr 1fr; }
  .cx-scope .board-quickactions .btn span.qa-label { display: none; }
}

/* ---------- Badges / Status Pills ---------- */
.cx-scope .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.cx-scope .badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.cx-scope .badge-neutral { background: var(--bg-overlay); color: var(--text-secondary); }

/* status */
.cx-scope .badge-status-new { background: rgba(99,102,241,.12); color: var(--status-new); }
.cx-scope .badge-status-open { background: rgba(59,130,246,.12); color: var(--status-open); }
.cx-scope .badge-status-pending { background: rgba(245,158,11,.12); color: var(--status-pending); }
.cx-scope .badge-status-resolved { background: rgba(34,197,94,.12); color: var(--status-resolved); }
.cx-scope .badge-status-closed { background: rgba(124,138,154,.14); color: var(--status-closed); }

/* priority */
.cx-scope .badge-priority-critical { background: rgba(239,68,68,.12); color: var(--priority-critical); }
.cx-scope .badge-priority-high { background: rgba(249,115,22,.12); color: var(--priority-high); }
.cx-scope .badge-priority-medium { background: rgba(234,179,8,.14); color: #a16207; }
.cx-scope [data-theme="dark"] .badge-priority-medium { color: var(--priority-medium); }
.cx-scope .badge-priority-low { background: rgba(34,197,94,.12); color: var(--priority-low); }

/* risk */
.cx-scope .badge-risk-critical { background: rgba(220,38,38,.12); color: var(--risk-critical); }
.cx-scope .badge-risk-high { background: rgba(234,88,12,.12); color: var(--risk-high); }
.cx-scope .badge-risk-medium { background: rgba(202,138,4,.14); color: #92660a; }
.cx-scope [data-theme="dark"] .badge-risk-medium { color: var(--risk-medium); }
.cx-scope .badge-risk-low { background: rgba(22,163,74,.12); color: var(--risk-low); }

/* ---------- Tables ---------- */
.cx-scope .table-wrap { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cx-scope table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cx-scope .data-table thead th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-tertiary); padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border); background: var(--bg-sunken);
  white-space: nowrap; user-select: none;
}
.cx-scope .data-table thead th.sortable { cursor: pointer; }
.cx-scope .data-table thead th.sortable:hover { color: var(--text-secondary); }
.cx-scope .data-table thead th .sort-arrow { display: inline-block; margin-left: 4px; opacity: .5; }
.cx-scope .data-table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); cursor: pointer; }
.cx-scope .data-table tbody tr:last-child { border-bottom: none; }
.cx-scope .data-table tbody tr:hover { background: var(--bg-hover); }
.cx-scope .data-table td { padding: var(--space-3) var(--space-4); vertical-align: middle; }
.cx-scope .data-table .col-id { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.cx-scope .table-checkbox { width: 36px; }

.cx-scope .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--forest-400), var(--forest-600));
  color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cx-scope .avatar-sm { width: 20px; height: 20px; font-size: 9px; }
.cx-scope .avatar-lg { width: 36px; height: 36px; font-size: 13px; }

.cx-scope .pagination { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-secondary); }
.cx-scope .pagination-controls { display: flex; align-items: center; gap: var(--space-1); }

/* ---------- Tabs ---------- */
.cx-scope .tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); }
.cx-scope .tab {
  padding: var(--space-3) var(--space-1); margin-right: var(--space-5);
  font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
  border-bottom: 2px solid transparent; transition: color var(--transition), border-color var(--transition);
}
.cx-scope .tab:hover { color: var(--text-primary); }
.cx-scope .tab.active { color: var(--forest-600); border-color: var(--forest-500); }
.cx-scope [data-theme="dark"] .tab.active { color: var(--forest-300); border-color: var(--forest-300); }

/* ---------- Dropdown / Select ---------- */
.cx-scope .dropdown { position: relative; display: inline-block; }
.cx-scope .dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px; z-index: 60;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: var(--space-2);
  opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
.cx-scope .dropdown-menu.left { right: auto; left: 0; }
.cx-scope .dropdown-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.cx-scope .dropdown-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary); }
.cx-scope .dropdown-item:hover { background: var(--bg-hover); }
.cx-scope .dropdown-item svg { width: 15px; height: 15px; color: var(--text-tertiary); }
.cx-scope .dropdown-divider { height: 1px; background: var(--border); margin: var(--space-2) 0; }
.cx-scope .dropdown-label { padding: var(--space-2) var(--space-3) var(--space-1); font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-tertiary); }

.cx-scope .select-field, .cx-scope .input-field, .cx-scope .textarea-field {
  width: 100%; background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 0 var(--space-3); height: 36px;
  font-size: 13.5px; color: var(--text-primary); transition: border-color var(--transition), box-shadow var(--transition);
}
.cx-scope .textarea-field { height: auto; padding: var(--space-3); resize: vertical; min-height: 90px; line-height: 1.5; }
.cx-scope .select-field:focus, .cx-scope .input-field:focus, .cx-scope .textarea-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cx-scope .field-group { display: flex; flex-direction: column; gap: 6px; }
.cx-scope .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.cx-scope .field-label .req { color: var(--danger); }
.cx-scope .field-hint { font-size: 11.5px; color: var(--text-tertiary); }
.cx-scope .field-error { font-size: 11.5px; color: var(--danger); }

/* ---------- Dialogs / Modals ---------- */
.cx-scope .overlay {
  position: fixed; inset: 0; background: rgba(10,13,15,.5); backdrop-filter: blur(2px);
  z-index: 90; display: flex; align-items: center; justify-content: center; padding: var(--space-4);
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.cx-scope .overlay.open { opacity: 1; pointer-events: auto; }
.cx-scope .dialog {
  background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  width: 100%; max-width: 440px; transform: scale(.96) translateY(8px); transition: transform var(--transition);
  border: 1px solid var(--border);
}
.cx-scope .overlay.open .dialog { transform: scale(1) translateY(0); }
.cx-scope .dialog-lg { max-width: 640px; }
.cx-scope .dialog-header { padding: var(--space-5) var(--space-5) var(--space-2); display: flex; align-items: center; justify-content: space-between; }
.cx-scope .dialog-title { font-size: 16px; font-weight: 700; }
.cx-scope .dialog-body { padding: var(--space-2) var(--space-5) var(--space-5); color: var(--text-secondary); font-size: 13.5px; }
.cx-scope .dialog-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--space-2); }
.cx-scope .dialog-icon-danger { width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--danger-soft); color: var(--danger); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-3); }

/* ---------- Drawers / Side Panels ---------- */
.cx-scope .drawer-overlay {
  position: fixed; inset: 0; background: rgba(10,13,15,.4); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity var(--transition-slow);
}
.cx-scope .drawer-overlay.open { opacity: 1; pointer-events: auto; }
.cx-scope .drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 92vw;
  background: var(--bg-surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-xl);
  z-index: 91; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--transition-slow);
}
.cx-scope .drawer-overlay.open .drawer { transform: translateX(0); }
.cx-scope .drawer-header { padding: var(--space-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cx-scope .drawer-title { font-size: 15px; font-weight: 700; }
.cx-scope .drawer-body { padding: var(--space-5); overflow-y: auto; flex: 1; }
.cx-scope .drawer-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* ---------- File Uploader ---------- */
.cx-scope .uploader {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-5); text-align: center; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.cx-scope .uploader:hover, .cx-scope .uploader.dragover { border-color: var(--accent); background: var(--accent-soft); }
.cx-scope .uploader-icon { width: 36px; height: 36px; margin: 0 auto var(--space-3); color: var(--text-tertiary); }
.cx-scope .uploader-text { font-size: 13.5px; font-weight: 600; }
.cx-scope .uploader-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.cx-scope .upload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.cx-scope .upload-item { position: relative; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 1; background: var(--bg-sunken); }
.cx-scope .upload-item img { width: 100%; height: 100%; object-fit: cover; }
.cx-scope .upload-item .file-icon-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-secondary); font-size: 10px; padding: var(--space-2); text-align: center; }
.cx-scope .upload-item .file-icon-wrap svg { width: 24px; height: 24px; }
.cx-scope .upload-remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.cx-scope .upload-remove svg { width: 11px; height: 11px; }
.cx-scope .upload-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: rgba(0,0,0,.15); }
.cx-scope .upload-progress-bar { height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- Search Bar ---------- */
.cx-scope .search-bar { position: relative; display: flex; align-items: center; }
.cx-scope .search-bar svg.search-icon { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-tertiary); pointer-events: none; }
.cx-scope .search-bar input { width: 100%; height: 40px; padding-left: var(--space-8); padding-right: var(--space-3); background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); font-size: 13.5px; }
.cx-scope .search-bar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cx-scope .search-kbd { position: absolute; right: var(--space-2); font-size: 11px; color: var(--text-tertiary); background: var(--bg-overlay); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }

/* ---------- Filter Panel / Chips ---------- */
.cx-scope .filter-bar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.cx-scope .filter-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--bg-surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
}
.cx-scope .filter-chip:hover { border-color: var(--text-tertiary); color: var(--text-primary); }
.cx-scope .filter-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--forest-700); }
.cx-scope [data-theme="dark"] .filter-chip.active { color: var(--forest-300); }
.cx-scope .filter-chip svg { width: 13px; height: 13px; }
.cx-scope .filter-chip .count { background: var(--bg-overlay); border-radius: var(--radius-full); padding: 0 6px; font-size: 11px; }

/* Compact one-row chip variant — e.g. "Received via" on intake. Smaller
   than .filter-chip and never wraps: this control must stay a single,
   glanceable row so selecting it costs one click and no thought. */
.cx-scope .chip-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
.cx-scope .chip-sm {
  display: inline-flex; align-items: center; flex: 0 0 auto;
  height: 26px; padding: 0 10px; border-radius: var(--radius-full, 999px);
  border: 1px solid var(--border-strong); background: var(--bg-surface);
  font-size: 11.5px; font-weight: 600; color: var(--text-secondary); white-space: nowrap;
}
.cx-scope .chip-sm:hover { border-color: var(--text-tertiary); color: var(--text-primary); }
.cx-scope .chip-sm.active { background: var(--accent-soft); border-color: var(--accent); color: var(--forest-700); }
.cx-scope [data-theme="dark"] .chip-sm.active { color: var(--forest-300); }

/* ---------- Breadcrumbs handled in base.css ---------- */

/* ---------- Loading / Skeleton ---------- */
.cx-scope .skeleton { background: linear-gradient(90deg, var(--bg-overlay) 25%, var(--bg-hover) 37%, var(--bg-overlay) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.cx-scope .skeleton-text { height: 12px; border-radius: 4px; }
.cx-scope .skeleton-card { height: 90px; border-radius: var(--radius-lg); }

.cx-scope .spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cx-scope .spinner-lg { width: 28px; height: 28px; border-width: 3px; }

/* ---------- Empty States ---------- */
.cx-scope .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--space-12) var(--space-6); color: var(--text-secondary); }
.cx-scope .empty-state-icon { width: 52px; height: 52px; border-radius: var(--radius-full); background: var(--bg-overlay); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-4); color: var(--text-tertiary); }
.cx-scope .empty-state-icon svg { width: 24px; height: 24px; }
.cx-scope .empty-state-title { font-size: 14.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.cx-scope .empty-state-text { font-size: 13px; max-width: 320px; margin-bottom: var(--space-4); }

/* ---------- Notification Banners ---------- */
.cx-scope .banner { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: 13px; border: 1px solid; }
.cx-scope .banner svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.cx-scope .banner-info { background: var(--info-soft); border-color: rgba(59,130,246,.25); color: #1d4ed8; }
.cx-scope .banner-success { background: var(--success-soft); border-color: rgba(34,197,94,.25); color: #15803d; }
.cx-scope .banner-warning { background: var(--warning-soft); border-color: rgba(245,158,11,.25); color: #b45309; }
.cx-scope .banner-danger { background: var(--danger-soft); border-color: rgba(239,68,68,.25); color: #b91c1c; }
.cx-scope [data-theme="dark"] .banner-info { color: #93c5fd; }
.cx-scope [data-theme="dark"] .banner-success { color: #86efac; }
.cx-scope [data-theme="dark"] .banner-warning { color: #fcd34d; }
.cx-scope [data-theme="dark"] .banner-danger { color: #fca5a5; }

/* ---------- Toasts ---------- */
.cx-scope #toast-container { position: fixed; bottom: var(--space-5); right: var(--space-5); z-index: 100; display: flex; flex-direction: column; gap: var(--space-2); }
.cx-scope .toast {
  display: flex; align-items: center; gap: var(--space-3); background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  font-size: 13px; font-weight: 500; min-width: 260px; max-width: 360px;
  animation: toast-in .25s cubic-bezier(.4,0,.2,1);
}
.cx-scope .toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
.cx-scope .toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.cx-scope .toast-success .toast-icon { color: var(--success); }
.cx-scope .toast-error .toast-icon { color: var(--danger); }
.cx-scope .toast-info .toast-icon { color: var(--info); }

/* Small-caps section label (review summaries, people cards, etc.) */
.cx-scope .review-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); margin-bottom: var(--space-2); }

/* Tag chips (used by tag inputs and the staff picker's selected bar) */
.cx-scope .tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-overlay); border-radius: var(--radius-full); padding: 3px 8px 3px 10px; font-size: 12px; font-weight: 600; }
.cx-scope .tag-chip button { display: flex; }
.cx-scope .person-chip { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-full); font-size: 12.5px; }
.cx-scope .person-chip .sub { color: var(--text-tertiary); font-size: 11px; }

/* ---------- Progress / Steps (wizard) ---------- */
.cx-scope .steps { display: flex; align-items: center; gap: var(--space-2); }
.cx-scope .step { display: flex; align-items: center; gap: var(--space-2); color: var(--text-tertiary); font-size: 12.5px; font-weight: 600; }
.cx-scope .step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-overlay); display: flex; align-items: center; justify-content: center; font-size: 11px; transition: background var(--transition), color var(--transition); }
.cx-scope .step.active .step-num { background: var(--accent); color: #fff; }
.cx-scope .step.done .step-num { background: var(--success); color: #fff; }
.cx-scope .step.active, .cx-scope .step.done { color: var(--text-primary); }
.cx-scope .step-line { width: 28px; height: 1.5px; background: var(--border-strong); }

/* responsive component tweaks */
@media (max-width: 768px) {
  .cx-scope .drawer { width: 100%; max-width: 100%; }
  .cx-scope .table-wrap { overflow-x: auto; }
  .cx-scope table.data-table { min-width: 720px; }
}

/* ============================================================
   PHASE 2 — People / Booking / Investigation Setup
   ============================================================ */

/* Role / assignment badges */
.cx-scope .badge-role-primary { background: rgba(47,128,88,.14); color: var(--forest-700); }
.cx-scope [data-theme="dark"] .badge-role-primary { color: var(--forest-300); }
.cx-scope .badge-role-support { background: rgba(59,130,246,.12); color: var(--info); }
.cx-scope .badge-role-leader { background: rgba(236,72,153,.12); color: #be185d; }
.cx-scope [data-theme="dark"] .badge-role-leader { color: #f9a8d4; }
.cx-scope .badge-role-supportstaff { background: rgba(148,163,184,.18); color: var(--text-secondary); }
.cx-scope .badge-role-other { background: var(--bg-overlay); color: var(--text-secondary); }

/* People cards (client, staff, investigation team) */
.cx-scope .people-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-surface); transition: border-color var(--transition), background var(--transition); }
.cx-scope .people-card:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.cx-scope .people-card-info { min-width: 0; flex: 1; }
.cx-scope .people-card-name { font-weight: 600; font-size: 13.5px; }
.cx-scope .people-card-sub { font-size: 12px; color: var(--text-secondary); }
.cx-scope .people-card-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.cx-scope .empty-slot {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); border: 1.5px dashed var(--border-strong);
  color: var(--text-tertiary); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.cx-scope .empty-slot:hover { border-color: var(--accent); color: var(--forest-600); background: var(--accent-soft); }
.cx-scope [data-theme="dark"] .empty-slot:hover { color: var(--forest-300); }

/* Avatar stack */
.cx-scope .avatar-stack { display: flex; align-items: center; }
.cx-scope .avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--bg-surface); }
.cx-scope .avatar-stack .avatar:first-child { margin-left: 0; }
.cx-scope .avatar-stack-more { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-overlay); color: var(--text-secondary); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-left: -8px; border: 2px solid var(--bg-surface); }

/* History stat rows */
.cx-scope .history-stat-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) 0; font-size: 12.5px; }
.cx-scope .history-stat-row .v { font-weight: 700; }
.cx-scope .history-stat-row .v.muted { color: var(--text-tertiary); font-weight: 500; }
.cx-scope .history-stat-row .v.warn { color: var(--priority-high); }

/* Validation banner list */
.cx-scope .validation-banner { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }

/* Staff Picker drawer */
.cx-scope .staff-picker-list { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 220px); overflow-y: auto; }
.cx-scope .staff-picker-row {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); cursor: pointer; transition: background var(--transition);
}
.cx-scope .staff-picker-row:hover, .cx-scope .staff-picker-row.kb-active { background: var(--bg-hover); }
.cx-scope .staff-picker-row.selected { background: var(--accent-soft); }
.cx-scope .staff-picker-row .check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.cx-scope .staff-picker-row.selected .check { background: var(--accent); border-color: var(--accent); }
.cx-scope .staff-picker-empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--text-tertiary); font-size: 13px; }
.cx-scope .staff-picker-selected-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: var(--space-3); border-bottom: 1px solid var(--border); }

/* Three-column investigation workspace (Module 13) */
.cx-scope .people-workspace {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.cx-scope .people-col { display: flex; flex-direction: column; gap: var(--space-4); }
@media (max-width: 1100px) {
  .cx-scope .people-workspace { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .cx-scope .people-workspace { grid-template-columns: 1fr; }
}

/* ============================================================
   PHASE 3 — Investigation Workspace / Engine
   ============================================================ */

/* Health badge */
.cx-scope .health-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-full); font-size: 12.5px; font-weight: 700; }

/* Stage tracker (horizontal stepper) */
.cx-scope .stage-tracker { display: flex; align-items: flex-start; overflow-x: auto; padding-bottom: 4px; gap: 0; }
.cx-scope .stage-tracker-item { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 108px; position: relative; }
.cx-scope .stage-tracker-connector { flex: 1; height: 2px; margin-top: 13px; min-width: 16px; background: var(--border-strong); }
.cx-scope .stage-tracker-connector.complete { background: var(--success); }
.cx-scope .stage-dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; border: 2px solid var(--border-strong); background: var(--bg-surface); color: var(--text-tertiary); flex-shrink: 0; }
.cx-scope .stage-dot.complete { background: var(--success); border-color: var(--success); color: #fff; }
.cx-scope .stage-dot.current { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.cx-scope .stage-dot.blocked { background: var(--danger); border-color: var(--danger); color: #fff; }
.cx-scope .stage-dot.waiting { border-color: var(--border-strong); color: var(--text-secondary); }
.cx-scope .stage-dot.locked { opacity: .5; }
.cx-scope .stage-tracker-label { font-size: 10.5px; font-weight: 600; text-align: center; margin-top: 6px; color: var(--text-tertiary); line-height: 1.3; padding: 0 2px; }
.cx-scope .stage-tracker-item.current .stage-tracker-label, .cx-scope .stage-tracker-item.complete .stage-tracker-label { color: var(--text-primary); }
.cx-scope .stage-tracker-item.blocked .stage-tracker-label { color: var(--danger); }

/* ---- Stage-accordion workspace (stages ARE the navigation) ---- */
.cx-scope .workspace-shell { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-5); align-items: flex-start; }
@media (max-width: 1024px) { .cx-scope .workspace-shell { grid-template-columns: 1fr; } .cx-scope .workspace-sidebar { order: -1; } }
.cx-scope .workspace-sidebar { position: sticky; top: var(--space-4); }
@media (max-width: 1024px) { .cx-scope .workspace-sidebar { position: static; } }

.cx-scope .stage-accordion { display: flex; flex-direction: column; gap: var(--space-3); }
.cx-scope .stage-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color .15s ease; }
.cx-scope .stage-card.expanded { border-color: var(--accent); }
.cx-scope .stage-card-blocked { border-color: rgba(239,68,68,.35); }
.cx-scope .stage-card-header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); cursor: pointer; }
.cx-scope .stage-card-header-text { flex: 1; min-width: 0; }
.cx-scope .stage-card-title { font-weight: 700; font-size: 14.5px; }
.cx-scope .stage-card-summary { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-scope .stage-card-chevron { color: var(--text-tertiary); flex-shrink: 0; }
.cx-scope .stage-card-body { padding: 0 var(--space-5) var(--space-5); border-top: 1px solid var(--border); padding-top: var(--space-5); }
.cx-scope .stage-card-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); background: var(--bg-subtle, rgba(0,0,0,.015)); }
.cx-scope .stage-card-missing { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--warning); margin-top: 4px; }
.cx-scope .completion-score-badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-full); flex-shrink: 0; }
.cx-scope .completion-score-badge.full { background: var(--success-soft); color: var(--success); }
.cx-scope .completion-score-badge.mid { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.cx-scope .completion-score-badge.low { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ---- Phase F: Case Snapshot ---- */
.cx-scope .snapshot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
@media (max-width: 900px) { .cx-scope .snapshot-grid { grid-template-columns: repeat(2, 1fr); } }
.cx-scope .snapshot-cell { min-width: 0; }
.cx-scope .snapshot-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-scope .snapshot-value { font-size: 15px; font-weight: 700; }
.cx-scope .snapshot-stmt-strip { display: flex; gap: var(--space-2); margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); flex-wrap: wrap; }
.cx-scope .snapshot-stmt-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-full); }
.cx-scope .snapshot-stmt-chip.success { background: var(--success-soft); color: var(--success); }
.cx-scope .snapshot-stmt-chip.warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.cx-scope .snapshot-stmt-chip.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
@media (max-width: 760px) { .cx-scope .quick-action-label { display: none; } }
.cx-scope .snapshot-why { margin-top: var(--space-3); font-size: 12.5px; color: var(--text-secondary); }
.cx-scope .snapshot-why-label { font-weight: 700; color: var(--text-primary); margin-right: 4px; }
.cx-scope .report-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); }
.cx-scope .report-section { margin-bottom: var(--space-4); }
.cx-scope .report-placeholder { font-size: 12.5px; color: var(--text-tertiary); font-style: italic; }
.cx-scope .missing-info-row { padding: 6px 0; cursor: pointer; border-radius: var(--radius-sm); transition: background var(--transition); }
.cx-scope .missing-info-row:hover { background: var(--bg-hover); }
.cx-scope .stage-card-outcome { margin-top: 6px; padding: var(--space-3); background: var(--bg-sunken, var(--bg-subtle)); border-radius: var(--radius-md); }
.cx-scope .stage-card-outcome-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); margin-bottom: 4px; }
.cx-scope .stage-card-outcome-line { font-size: 12.5px; line-height: 1.6; }
.cx-scope .conversational-panel { border-left: 3px solid var(--accent); }
.cx-scope .conversational-list { margin: 0; padding-left: 0; list-style: none; }
.cx-scope .conversational-list li { font-size: 13px; padding: 4px 0 4px 20px; position: relative; cursor: pointer; }
.cx-scope .conversational-list li:hover { color: var(--accent); }
.cx-scope .conversational-list li::before { content: '•'; position: absolute; left: 4px; color: var(--accent); }

/* Current stage card */
.cx-scope .current-stage-card { padding: var(--space-5); }
.cx-scope .current-stage-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.cx-scope .progress-bar-track { height: 6px; border-radius: var(--radius-full); background: var(--bg-overlay); overflow: hidden; }
.cx-scope .progress-bar-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width .3s ease; }
.cx-scope .stage-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-4); }
.cx-scope .stage-meta-item .k { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.cx-scope .stage-meta-item .v { font-size: 13.5px; font-weight: 600; margin-top: 2px; }

/* Required actions list */
.cx-scope .action-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.cx-scope .action-row:last-child { border-bottom: none; }
.cx-scope .action-check { width: 20px; height: 20px; border-radius: var(--radius-full); border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; color: #fff; transition: background var(--transition), border-color var(--transition); }
.cx-scope .action-check.done { background: var(--success); border-color: var(--success); }
.cx-scope .action-check.blocking:not(.done) { border-color: var(--danger); }
.cx-scope .action-check.readonly { cursor: default; opacity: .7; }
.cx-scope .action-label { font-size: 13.5px; font-weight: 500; flex: 1; min-width: 0; }
.cx-scope .action-label.done { text-decoration: line-through; color: var(--text-tertiary); }
.cx-scope .action-meta { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; }

/* Placeholder panels (Evidence, Timeline, Staff Statements) */
.cx-scope .future-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--space-8) var(--space-4); color: var(--text-tertiary); }
.cx-scope .future-placeholder-icon { width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--bg-overlay); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-3); }
.cx-scope .future-placeholder-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.cx-scope .future-placeholder-text { font-size: 12px; margin-top: 2px; }

/* Investigation note cards */
.cx-scope .inv-note { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.cx-scope .inv-note:last-child { border-bottom: none; }
.cx-scope .inv-note-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: 6px; flex-wrap: wrap; }
.cx-scope .inv-note-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: var(--radius-full); background: var(--bg-overlay); color: var(--text-secondary); }
.cx-scope .inv-note-text { font-size: 13.5px; white-space: pre-wrap; line-height: 1.6; }

/* Ready-to-close checklist */
.cx-scope .checklist-row { display: flex; align-items: center; gap: var(--space-2); padding: 6px 0; font-size: 12.5px; }
.cx-scope .checklist-icon { width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.cx-scope .checklist-icon.met { background: var(--success); }
.cx-scope .checklist-icon.unmet { background: var(--bg-overlay); color: var(--text-tertiary); }

/* Sticky summary sidebar */
.cx-scope .inv-summary-sidebar { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); }
@media (max-width: 1024px) { .cx-scope .inv-summary-sidebar { position: static; } }

/* Investigation workspace grid (Module 4 / 13 layout) */
.cx-scope .inv-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 300px;
  gap: var(--space-5);
  align-items: start;
}
.cx-scope .inv-workspace-main { display: flex; flex-direction: column; gap: var(--space-5); grid-column: span 2; }
.cx-scope .inv-workspace-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
@media (max-width: 1100px) {
  .cx-scope .inv-workspace-grid { grid-template-columns: 1fr; }
  .cx-scope .inv-workspace-main { grid-column: span 1; }
  .cx-scope .inv-workspace-row { grid-template-columns: 1fr; }
}

/* Notification bell */
.cx-scope .notif-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--bg-surface); }
.cx-scope .notif-item { padding: var(--space-3); border-bottom: 1px solid var(--border); font-size: 12.5px; }
.cx-scope .notif-item:last-child { border-bottom: none; }
.cx-scope .notif-item .t { color: var(--text-tertiary); font-size: 11px; margin-top: 2px; }

/* ============================================================
   PHASE 4 — Evidence & Case Records
   ============================================================ */

/* Summary stat strip */
.cx-scope .evidence-summary-strip { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.cx-scope .evidence-summary-stat { display: flex; flex-direction: column; gap: 2px; }
.cx-scope .evidence-summary-stat .n { font-size: 22px; font-weight: 700; line-height: 1; }
.cx-scope .evidence-summary-stat .l { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }

/* Category chips */
.cx-scope .evidence-cat-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--space-3); border-radius: var(--radius-full); border: 1px solid var(--border-strong); background: var(--bg-surface); font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.cx-scope .evidence-cat-chip.active { color: #fff; border-color: transparent; }
.cx-scope .evidence-cat-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* View toggle */
.cx-scope .view-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-md); overflow: hidden; }
.cx-scope .view-toggle button { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); background: var(--bg-surface); }
.cx-scope .view-toggle button.active { background: var(--accent); color: #fff; }

/* Evidence grid / list */
.cx-scope .evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-4); }
.cx-scope .evidence-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: box-shadow var(--transition), border-color var(--transition); background: var(--bg-surface); }
.cx-scope .evidence-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.cx-scope .evidence-card-thumb { aspect-ratio: 4/3; background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); position: relative; overflow: hidden; }
.cx-scope .evidence-card-thumb img, .cx-scope .evidence-card-thumb video { width: 100%; height: 100%; object-fit: cover; }
.cx-scope .evidence-card-body { padding: var(--space-3); }
.cx-scope .evidence-card-title { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.cx-scope .evidence-card-meta { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.cx-scope .evidence-list-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-bottom: 1px solid var(--border); cursor: pointer; }
.cx-scope .evidence-list-row:hover { background: var(--bg-hover); }
.cx-scope .evidence-list-row:last-child { border-bottom: none; }
.cx-scope .evidence-list-thumb { width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); flex-shrink: 0; overflow: hidden; }
.cx-scope .evidence-list-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Preview drawer */
.cx-scope .evidence-preview-area { background: var(--bg-sunken); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; min-height: 220px; max-height: 360px; overflow: hidden; margin-bottom: var(--space-4); }
.cx-scope .evidence-preview-area img, .cx-scope .evidence-preview-area video { max-width: 100%; max-height: 360px; }
.cx-scope .evidence-preview-area iframe { width: 100%; height: 360px; border: none; }
.cx-scope .evidence-preview-fallback { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); color: var(--text-tertiary); padding: var(--space-6); }

/* Evidence timeline */
.cx-scope .evidence-timeline-row { display: flex; gap: var(--space-3); padding: var(--space-2) 0; font-size: 12.5px; }
.cx-scope .evidence-timeline-time { color: var(--text-tertiary); width: 56px; flex-shrink: 0; font-family: var(--font-mono); font-size: 11px; padding-top: 1px; }

/* Missing evidence */
.cx-scope .missing-evidence-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
.cx-scope .missing-evidence-row .label { flex: 1; font-size: 13px; }
.cx-scope .missing-evidence-row .label.met { text-decoration: line-through; color: var(--text-tertiary); }

/* ============================================================
   PHASE 5 — Timeline & Activity Intelligence
   ============================================================ */

.cx-scope .timeline-summary-strip { display: flex; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-4); }

.cx-scope .timeline-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; }
.cx-scope .timeline-date-group { display: flex; flex-direction: column; }
.cx-scope .timeline-date-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); padding: var(--space-3) var(--space-2) 4px; }
.cx-scope .timeline-date-group:first-child .timeline-date-heading { padding-top: 0; }
.cx-scope .timeline-event { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-radius: var(--radius-md); cursor: pointer; transition: background var(--transition); border-left: 2px solid transparent; }
.cx-scope .timeline-event:hover { background: var(--bg-hover); }
.cx-scope .timeline-event.manual { border-left-color: var(--accent); background: var(--accent-soft); }
.cx-scope .timeline-event-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cx-scope .timeline-event-body { min-width: 0; flex: 1; }
.cx-scope .timeline-event-title { font-size: 13px; font-weight: 600; }
.cx-scope .timeline-event-desc { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.cx-scope .timeline-event-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cx-scope .timeline-cat-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; padding: 1px 6px; border-radius: var(--radius-full); }

.cx-scope .timeline-toolbar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.cx-scope .timeline-change-row { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; margin: var(--space-1) 0; }
.cx-scope .timeline-change-pill { padding: 2px 8px; border-radius: var(--radius-sm); background: var(--bg-overlay); font-weight: 600; font-size: 12px; }

/* ============================================================
   PHASE 6 — Task Management & SLA Engine
   ============================================================ */

/* Task status badges */
.cx-scope .task-status-not_started { background: var(--bg-overlay); color: var(--text-secondary); }
.cx-scope .task-status-in_progress { background: rgba(59,130,246,.12); color: var(--info); }
.cx-scope .task-status-waiting { background: rgba(245,158,11,.12); color: var(--warning); }
.cx-scope .task-status-blocked { background: rgba(239,68,68,.12); color: var(--danger); }
.cx-scope .task-status-completed { background: rgba(34,197,94,.12); color: var(--success); }
.cx-scope .task-status-cancelled { background: var(--bg-overlay); color: var(--text-tertiary); }

/* Task checklist row */
.cx-scope .task-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-radius: var(--radius-md); transition: background var(--transition); }
.cx-scope .task-row:hover { background: var(--bg-hover); }
.cx-scope .task-row.completed .task-title { text-decoration: line-through; color: var(--text-tertiary); }
.cx-scope .task-row.cancelled { opacity: .55; }
.cx-scope .task-check { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--border-strong); flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; color: #fff; cursor: pointer; }
.cx-scope .task-check.completed { background: var(--success); border-color: var(--success); }
.cx-scope .task-check.in_progress { border-color: var(--info); }
.cx-scope .task-check.blocked { border-color: var(--danger); }
.cx-scope .task-title { font-size: 13px; font-weight: 600; }
.cx-scope .task-meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cx-scope .task-priority-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cx-scope .task-overdue { color: var(--danger); font-weight: 700; }
.cx-scope .task-actions { margin-left: auto; flex-shrink: 0; }

/* Task columns (kanban-style) */
.cx-scope .task-columns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 768px) { .cx-scope .task-columns { grid-template-columns: 1fr; } }
.cx-scope .task-col-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); margin-bottom: var(--space-2); display: flex; align-items: center; gap: 6px; }

/* SLA strip */
.cx-scope .sla-strip { display: flex; flex-direction: column; gap: var(--space-2); }
.cx-scope .sla-row { display: flex; align-items: center; gap: var(--space-3); font-size: 12.5px; }
.cx-scope .sla-label { width: 160px; flex-shrink: 0; color: var(--text-secondary); }
.cx-scope .sla-status { display: flex; align-items: center; gap: 5px; font-weight: 600; }
.cx-scope .sla-status.met { color: var(--success); }
.cx-scope .sla-status.breached { color: var(--danger); }
.cx-scope .sla-status.warning { color: var(--warning); }
.cx-scope .sla-status.pending { color: var(--text-tertiary); }
.cx-scope .sla-bar-track { flex: 1; height: 5px; border-radius: var(--radius-full); background: var(--bg-overlay); overflow: hidden; }
.cx-scope .sla-bar-fill { height: 100%; border-radius: var(--radius-full); transition: width .3s; }

/* ============================================================
   PHASE 7 — Staff Statements & Interviews
   ============================================================ */

/* Statement status badge helpers — colours set inline from STATUS_META */
.cx-scope .stmt-status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 700; white-space: nowrap; }

/* Statement row in the list */
.cx-scope .stmt-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); cursor: pointer; transition: background var(--transition), border-color var(--transition); border: 1px solid transparent; }
.cx-scope .stmt-row:hover { background: var(--bg-hover); }
.cx-scope .stmt-row.selected { background: var(--accent-soft); border-color: var(--accent); }

/* Statement detail panel */
.cx-scope .stmt-detail-panel { display: flex; flex-direction: column; gap: var(--space-4); }
.cx-scope .stmt-answer-block { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.cx-scope .stmt-answer-block:last-child { border-bottom: none; }
.cx-scope .stmt-answer-q { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); margin-bottom: 4px; }
.cx-scope .stmt-answer-v { font-size: 13.5px; white-space: pre-wrap; line-height: 1.6; }

/* Follow-up card */
.cx-scope .followup-card { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.cx-scope .followup-question { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.cx-scope .followup-answer { font-size: 13px; color: var(--text-secondary); margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); white-space: pre-wrap; }

/* Interview record card */
.cx-scope .interview-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.cx-scope .interview-header { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 13px; margin-bottom: var(--space-2); }
.cx-scope .interview-notes { font-size: 13px; color: var(--text-secondary); white-space: pre-wrap; }

/* Statement workspace layout */
.cx-scope .stmt-workspace { display: grid; grid-template-columns: 280px 1fr; gap: var(--space-5); align-items: start; }
@media (max-width: 900px) { .cx-scope .stmt-workspace { grid-template-columns: 1fr; } }

/* Statement portal (staff-statement.html) */
.cx-scope .portal-card { max-width: 680px; margin: 0 auto; background: var(--bg-surface); border-radius: var(--radius-xl); border: 1px solid var(--border); box-shadow: var(--shadow-xl); }
.cx-scope .portal-header { background: linear-gradient(135deg, var(--forest-800), var(--forest-600)); border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: var(--space-6); color: #fff; }
.cx-scope .portal-body { padding: var(--space-6); }
.cx-scope .portal-section { background: var(--bg-sunken); border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-5); }
.cx-scope .portal-section-title { font-size: 15px; font-weight: 700; margin-bottom: var(--space-4); }
.cx-scope .portal-question { margin-bottom: var(--space-4); }
.cx-scope .portal-question-label { font-size: 13.5px; font-weight: 600; margin-bottom: var(--space-2); color: var(--text-primary); }
.cx-scope .portal-question-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.cx-scope .portal-yesno { display: flex; gap: var(--space-2); }
.cx-scope .portal-yesno label { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.cx-scope .portal-yesno input[type=radio]:checked + span { color: var(--forest-600); }
.cx-scope .portal-yesno label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cx-scope .declaration-box { background: var(--warning-soft); border: 1.5px solid rgba(245,158,11,.3); border-radius: var(--radius-md); padding: var(--space-4); display: flex; gap: var(--space-3); align-items: flex-start; }
.cx-scope .declaration-text { font-size: 13.5px; font-style: italic; line-height: 1.6; }
.cx-scope .portal-success { text-align: center; padding: var(--space-10) var(--space-6); }
.cx-scope .portal-success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: flex; align-items: center; justify-content: center; margin: 0 auto var(--space-4); }
.cx-scope .portal-version-tab { display: flex; gap: var(--space-1); flex-wrap: wrap; margin-bottom: var(--space-3); }
.cx-scope .portal-version-btn { padding: 4px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; border: 1.5px solid var(--border-strong); background: var(--bg-surface); color: var(--text-secondary); }
.cx-scope .portal-version-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   PHASE 8 — Findings & Decision Engine
   ============================================================ */

/* Findings workspace uses the same 2-col grid as the investigation workspace */
.cx-scope .findings-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
@media (max-width: 900px) { .cx-scope .findings-workspace { grid-template-columns: 1fr; } }
.cx-scope .findings-col { display: flex; flex-direction: column; gap: var(--space-4); }

/* Finding cards */
.cx-scope .finding-card { padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.cx-scope .finding-card:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.cx-scope .finding-card.selected { border-color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 8%, transparent); }
.cx-scope .finding-title { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.cx-scope .finding-type-badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: var(--radius-full); }

/* Confidence indicator */
.cx-scope .conf-high { background: var(--success-soft); color: var(--success); }
.cx-scope .conf-medium { background: var(--warning-soft); color: #b45309; }
.cx-scope .conf-low { background: var(--danger-soft); color: var(--danger); }
.cx-scope [data-theme="dark"] .conf-medium { color: var(--warning); }

/* Evidence assessment rows */
.cx-scope .evidence-assess-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.cx-scope .evidence-assess-row:last-child { border-bottom: none; }
.cx-scope .ea-thumb { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-tertiary); }
.cx-scope .ea-name { flex: 1; min-width: 0; font-weight: 600; }
.cx-scope .ea-name .sub { font-weight: 400; color: var(--text-tertiary); font-size: 11px; }
.cx-scope .reliability-pip { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Evidence matrix */
.cx-scope .ev-matrix-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; overflow: hidden; border-radius: var(--radius-md); border: 1px solid var(--border); }
.cx-scope .ev-matrix-table th, .cx-scope .ev-matrix-table td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.cx-scope .ev-matrix-table th:first-child, .cx-scope .ev-matrix-table td:first-child { text-align: left; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.cx-scope .ev-matrix-table thead th { background: var(--bg-sunken); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); }
.cx-scope .ev-matrix-table tbody tr:last-child td { border-bottom: none; }
.cx-scope .ev-matrix-table tbody tr:hover { background: var(--bg-hover); }
.cx-scope .matrix-cell { cursor: pointer; border-radius: var(--radius-sm); padding: 4px 8px; font-weight: 700; font-size: 13px; user-select: none; min-width: 36px; display: inline-block; }
.cx-scope .matrix-cell:hover { filter: brightness(1.1); }

/* Root cause chips */
.cx-scope .root-cause-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: var(--radius-full); border: 1.5px solid var(--border-strong); background: var(--bg-surface); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.cx-scope .root-cause-chip.selected { background: #8b5cf6; color: #fff; border-color: #8b5cf6; }
.cx-scope .rc-taxonomy-group { margin-bottom: var(--space-3); }
.cx-scope .rc-taxonomy-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); margin-bottom: 6px; }

/* Outcome cards */
.cx-scope .outcome-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1.5px solid var(--border-strong); cursor: pointer; transition: all var(--transition); }
.cx-scope .outcome-card:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.cx-scope .outcome-card.selected { border-color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 8%, transparent); }
.cx-scope .outcome-card-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Recommendations */
.cx-scope .rec-card { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 12.5px; }
.cx-scope .rec-card-body { flex: 1; min-width: 0; }
.cx-scope .rec-type-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #8b5cf6; }

/* Policy assessment */
.cx-scope .policy-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.cx-scope .policy-row:last-child { border-bottom: none; }

/* Decision summary */
.cx-scope .decision-outcome-display { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); }
.cx-scope .finalized-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: var(--radius-full); background: var(--success); color: #fff; font-size: 12px; font-weight: 700; }

/* ============================================================
   PHASE 9 — Resolution & Coaching
   ============================================================ */

.cx-scope .resolution-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
@media (max-width: 900px) { .cx-scope .resolution-workspace { grid-template-columns: 1fr; } }
.cx-scope .resolution-col { display: flex; flex-direction: column; gap: var(--space-4); }

/* Resolution action cards */
.cx-scope .res-card { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); transition: border-color var(--transition); }
.cx-scope .res-card:hover { border-color: var(--border-strong); }
.cx-scope .res-card-body { flex: 1; min-width: 0; }
.cx-scope .res-card-title { font-size: 13px; font-weight: 600; }
.cx-scope .res-card-meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cx-scope .res-card-icon { width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cx-scope .res-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Resolution status badge */
.cx-scope .res-status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); font-size: 10.5px; font-weight: 700; white-space: nowrap; }

/* Progress strip */
.cx-scope .res-progress-strip { display: flex; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-3); }
.cx-scope .res-progress-stat { display: flex; flex-direction: column; gap: 2px; }
.cx-scope .res-progress-stat .n { font-size: 20px; font-weight: 700; line-height: 1; }
.cx-scope .res-progress-stat .l { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }

/* Staff outcome chips — colour by outcome type */
.cx-scope .outcome-chip { padding: 5px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; display: inline-block; }
.cx-scope .outcome-no_action { background: var(--bg-overlay); color: var(--text-secondary); }
.cx-scope .outcome-coaching { background: rgba(59,130,246,.12); color: var(--info); }
.cx-scope .outcome-retraining { background: rgba(245,158,11,.12); color: var(--warning); }
.cx-scope .outcome-recognition { background: rgba(34,197,94,.12); color: var(--success); }
.cx-scope .outcome-warning { background: rgba(239,68,68,.12); color: var(--danger); }
.cx-scope .outcome-other { background: var(--bg-overlay); color: var(--text-secondary); }

/* Coaching record */
.cx-scope .coaching-card { padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); }
.cx-scope .coaching-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cx-scope .coaching-topic { font-size: 13px; font-weight: 700; }
.cx-scope .coaching-meta { font-size: 11.5px; color: var(--text-tertiary); }

/* Learning Library badge */
.cx-scope .learning-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); background: rgba(16,185,129,.12); color: #10b981; font-size: 10.5px; font-weight: 700; }

/* Follow-up rows */
.cx-scope .followup-res-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.cx-scope .followup-res-row:last-child { border-bottom: none; }
.cx-scope .followup-res-date { font-weight: 600; white-space: nowrap; }
.cx-scope .followup-res-date.overdue { color: var(--danger); }

/* Recognition card */
.cx-scope .recognition-card { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.2); border-radius: var(--radius-md); }
.cx-scope .recognition-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--success); margin-bottom: 2px; }
.cx-scope .recognition-desc { font-size: 13px; }
.cx-scope .recognition-staff { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

/* ============================================================
   PHASE 10 — Quality Assurance & Case Closure
   ============================================================ */

/* Closure workspace */
.cx-scope .closure-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
@media (max-width: 900px) { .cx-scope .closure-workspace { grid-template-columns: 1fr; } }
.cx-scope .closure-col { display: flex; flex-direction: column; gap: var(--space-4); }

/* Readiness header panel */
.cx-scope .readiness-header { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); flex-wrap: wrap; }
.cx-scope .readiness-status { display: flex; align-items: center; gap: var(--space-3); }
.cx-scope .readiness-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cx-scope .readiness-label { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.cx-scope .readiness-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* Validation checklist */
.cx-scope .validation-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.cx-scope .validation-row:last-child { border-bottom: none; }
.cx-scope .validation-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.cx-scope .validation-icon.pass { background: var(--success); color: #fff; }
.cx-scope .validation-icon.fail.blocking { background: var(--danger); color: #fff; }
.cx-scope .validation-icon.fail.warning { background: var(--warning); color: #fff; }
.cx-scope .validation-label { font-size: 13px; font-weight: 600; line-height: 1.3; }
.cx-scope .validation-detail { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.cx-scope .validation-section-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: var(--radius-full); background: var(--bg-overlay); color: var(--text-tertiary); margin-left: auto; flex-shrink: 0; align-self: flex-start; }

/* QA review */
.cx-scope .qa-category-row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); align-items: start; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.cx-scope .qa-category-row:last-child { border-bottom: none; }
.cx-scope .qa-category-label { font-size: 13px; font-weight: 600; }
.cx-scope .qa-rating-pills { display: flex; gap: 4px; }
.cx-scope .qa-pill { padding: 4px 10px; border-radius: var(--radius-full); border: 1.5px solid var(--border-strong); font-size: 11.5px; font-weight: 700; cursor: pointer; }
.cx-scope .qa-pill[data-rating="pass"].active { background: var(--success); color: #fff; border-color: var(--success); }
.cx-scope .qa-pill[data-rating="minor_issues"].active { background: var(--warning); color: #fff; border-color: var(--warning); }
.cx-scope .qa-pill[data-rating="major_issues"].active { background: var(--danger);  color: #fff; border-color: var(--danger); }
.cx-scope .qa-comments { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; font-style: italic; max-width: 100%; overflow-wrap: break-word; }

/* QA outcome badges */
.cx-scope .qa-outcome-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: var(--radius-full); font-size: 12.5px; font-weight: 700; }

/* Approval stage row */
.cx-scope .approval-stage-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.cx-scope .approval-stage-row:last-child { border-bottom: none; }
.cx-scope .approval-stage-label { flex: 1; font-size: 13px; font-weight: 600; }
.cx-scope .approval-stage-info { font-size: 11.5px; color: var(--text-secondary); }

/* Quality score ring */
.cx-scope .qs-ring-wrap { display: flex; align-items: center; gap: var(--space-5); }
.cx-scope .qs-score-big { font-size: 42px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.cx-scope .qs-grade { font-size: 22px; font-weight: 800; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.cx-scope .qs-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cx-scope .qs-list li { font-size: 12px; display: flex; align-items: center; gap: 6px; }

/* Audit trail */
.cx-scope .audit-row { display: flex; gap: var(--space-3); padding: var(--space-2) 0; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.cx-scope .audit-row:last-child { border-bottom: none; }
.cx-scope .audit-row .audit-time { color: var(--text-tertiary); white-space: nowrap; font-size: 11px; font-family: var(--font-mono); padding-top: 1px; }
.cx-scope .audit-row .audit-action { flex: 1; }

/* Outstanding item rows */
.cx-scope .outstanding-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); cursor: pointer; }
.cx-scope .outstanding-row:hover { background: var(--bg-hover); }

/* Closed banner */
.cx-scope .case-closed-banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--success-soft); border: 1.5px solid rgba(34,197,94,.3); color: var(--success); font-size: 14px; font-weight: 700; margin-bottom: var(--space-5); }

/* ============================================================
   PHASE 11 — Final Investigation Summary
   ============================================================ */

/* Section headers inside the summary */
.cx-scope .summary-section { margin-bottom: var(--space-5); }
.cx-scope .summary-section-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.cx-scope .summary-section-number { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cx-scope .summary-section-title { font-size: 14px; font-weight: 700; }

/* Satisfaction / recovery selector */
.cx-scope .sat-grid { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.cx-scope .sat-pill { padding: 6px 14px; border-radius: var(--radius-full); border: 1.5px solid var(--border-strong); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.cx-scope .sat-pill.selected { color: #fff; border-color: transparent; }

/* Metrics grid */
.cx-scope .metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
.cx-scope .metric-box { background: var(--bg-sunken); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.cx-scope .metric-box .n { font-size: 22px; font-weight: 800; line-height: 1; }
.cx-scope .metric-box .l { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; }

/* Communication matrix */
.cx-scope .comm-row { display: grid; grid-template-columns: 140px 100px 1fr 120px; gap: var(--space-3); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.cx-scope .comm-row:last-child { border-bottom: none; }
.cx-scope .comm-row-header { font-weight: 700; color: var(--text-tertiary); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }

/* Prevention / lessons tags */
.cx-scope .prevent-chip { display: inline-flex; align-items: center; gap: 6px; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--bg-sunken); border: 1px solid var(--border); font-size: 12.5px; margin-bottom: var(--space-2); }
.cx-scope .prevent-chip-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); }

/* Compact preview card on complaints list */
.cx-scope .complaint-preview-card { background: var(--bg-sunken); border-top: 1px solid var(--border); padding: var(--space-4) var(--space-5); }
.cx-scope .preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-3); }
.cx-scope .preview-item .pk { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); margin-bottom: 3px; }
.cx-scope .preview-item .pv { font-size: 13px; font-weight: 600; }

/* Star tab highlight */
.cx-scope .tab.star { color: var(--forest-600); }
.cx-scope [data-theme="dark"] .tab.star { color: var(--forest-300); }

/* Playbook banner */
.cx-scope .playbook-banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: color-mix(in srgb, #a855f7 10%, transparent); border: 1px solid color-mix(in srgb, #a855f7 25%, transparent); color: #a855f7; font-size: 12.5px; font-weight: 600; margin-bottom: var(--space-4); }

/* Task progress bar */
.cx-scope .task-progress-wrap { margin-bottom: var(--space-4); }
.cx-scope .task-progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.cx-scope .task-progress-label strong { color: var(--text-primary); }

/* Dashboard task widgets */
.cx-scope .dash-task-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); font-size: 12.5px; cursor: pointer; transition: background var(--transition); }
.cx-scope .dash-task-row:last-child { border-bottom: none; }
.cx-scope .dash-task-row:hover { background: var(--bg-hover); }
.cx-scope .dash-task-row .t { font-weight: 600; flex: 1; min-width: 0; }
.cx-scope .dash-task-row .d { color: var(--text-tertiary); white-space: nowrap; }

/* ============================================================
   PHASE 12 — Analytics & Reporting
   ============================================================ */

/* KPI stat strip */
.cx-scope .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.cx-scope .kpi-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); }
.cx-scope .kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.cx-scope .kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-top: 4px; }
.cx-scope .kpi-trend { font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 3px; margin-top: 6px; }
.cx-scope .kpi-trend.up { color: var(--danger); }
.cx-scope .kpi-trend.down { color: var(--success); }
.cx-scope .kpi-trend.flat { color: var(--text-tertiary); }

/* Chart cards */
.cx-scope .chart-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cx-scope .chart-card-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5) var(--space-2); }
.cx-scope .chart-card-title { font-size: 13.5px; font-weight: 700; }
.cx-scope .chart-card-body { padding: var(--space-3) var(--space-5) var(--space-4); }
.cx-scope .chart-empty { padding: var(--space-6); text-align: center; color: var(--text-tertiary); font-size: 13px; }

/* Analytics grid layout */
.cx-scope .analytics-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); margin-bottom: var(--space-5); }
.cx-scope .analytics-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-5); margin-bottom: var(--space-5); }
@media (max-width: 1024px) { .cx-scope .analytics-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px) { .cx-scope .analytics-grid-2, .cx-scope .analytics-grid-3 { grid-template-columns: 1fr; } }

/* Staff performance table */
.cx-scope .staff-perf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cx-scope .staff-perf-table th { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-tertiary); padding: var(--space-2) var(--space-3); text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.cx-scope .staff-perf-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.cx-scope .staff-perf-table tr:last-child td { border-bottom: none; }
.cx-scope .staff-perf-table tr:hover td { background: var(--bg-hover); }

/* Date range filter */
.cx-scope .date-filter-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }

/* Satisfaction bar mini */
.cx-scope .sat-bar-row { display: flex; align-items: center; gap: var(--space-3); padding: 6px 0; font-size: 12.5px; }
.cx-scope .sat-bar-fill { height: 8px; border-radius: var(--radius-full); }
.cx-scope .sat-bar-track { flex: 1; background: var(--bg-overlay); border-radius: var(--radius-full); overflow: hidden; height: 8px; }

/* Print styles */
@media print {
  .cx-scope .sidebar, .cx-scope .topbar, .cx-scope .bottom-nav, .cx-scope .page-actions, .cx-scope .btn, .cx-scope #toast-container { display: none !important; }
  .cx-scope .main { margin-left: 0 !important; }
  .cx-scope .page { padding: 0 !important; }
  .cx-scope .chart-card, .cx-scope .kpi-card { break-inside: avoid; border: 1px solid #ccc !important; }
  .cx-scope body { background: white !important; color: black !important; }
}

/* ============================================================
   REVIEW GUIDE, KNOWLEDGE LIBRARY & RESPONSE BUILDER
   ============================================================ */

/* Knowledge Library entry cards */
.cx-scope .kl-entry { padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: var(--space-3); background: var(--bg-surface); transition: border-color var(--transition); }
.cx-scope .kl-entry:hover { border-color: var(--border-strong); }
.cx-scope .kl-entry-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.cx-scope .kl-entry-preview { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* Responsibility factor chips — same style as root-cause-chip */
.cx-scope .resp-factor-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: var(--radius-full); border: 1.5px solid var(--border-strong); background: var(--bg-surface); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.cx-scope .resp-factor-chip.selected { background: var(--forest-600); color: #fff; border-color: var(--forest-600); }

/* Response builder preview */
.cx-scope .response-preview { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.cx-scope .response-internal { background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.25); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; }

/* Inline field hint with icon */
.cx-scope .field-coaching { display: flex; align-items: flex-start; gap: 5px; font-size: 11.5px; color: var(--forest-600); margin-top: 5px; line-height: 1.4; }
.cx-scope [data-theme="dark"] .field-coaching { color: var(--forest-300); }
.cx-scope .field-coaching svg { flex-shrink: 0; margin-top: 1px; }

/* Writing check issue card */
.cx-scope .wc-issue { padding: var(--space-3); border: 1px solid rgba(245,158,11,.3); border-left: 3px solid var(--warning); border-radius: var(--radius-md); background: var(--warning-soft); margin-bottom: var(--space-2); }
.cx-scope .wc-issue-label { font-size: 12px; font-weight: 700; color: #b45309; margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.cx-scope [data-theme="dark"] .wc-issue-label { color: var(--warning); }
.cx-scope .wc-excerpt { font-size: 12px; font-style: italic; color: var(--text-secondary); margin-bottom: 4px; }
.cx-scope .wc-suggestion { font-size: 12px; color: var(--text-secondary); }

