/* ==========================================================================
   FEED TIMING LAB - MODERN RESEARCH LIGHT THEME DESIGN SYSTEM
   Brand Video Attention Testing & Respondent Telemetry
   ========================================================================== */

:root {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f8fafc;
  --border-card: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --accent-live: #059669;
  --accent-live-bg: #ecfdf5;
  --accent-live-border: #a7f3d0;

  --accent-stream: #2563eb;
  --accent-stream-bg: #eff6ff;
  --accent-stream-border: #bfdbfe;

  --accent-target: #e11d48;
  --accent-target-bg: #fff1f2;
  --accent-target-border: #fecdd3;

  --accent-client: #7c3aed;
  --accent-client-bg: #f5f3ff;
  --accent-client-border: #ddd6fe;

  --accent-comp-beta: #d97706;
  --accent-comp-beta-bg: #fffbeb;
  --accent-comp-beta-border: #fde68a;

  --accent-comp-gamma: #2563eb;
  --accent-comp-gamma-bg: #eff6ff;
  --accent-comp-gamma-border: #bfdbfe;

  --accent-warn: #d97706;
  --accent-purple: #7c3aed;
  --accent-idle: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(124, 58, 237, 0.04) 0%, transparent 40%),
    linear-gradient(#e2e8f0 1px, transparent 1px),
    linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  background-position: 0 0, 0 0, -1px -1px, -1px -1px;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 20px;
}

/* ==========================================================================
   TOP GLOBAL HEADER (LIGHT THEME)
   ========================================================================== */

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  object-fit: cover;
  background: transparent;
  border: none;
  border-radius: 10px;
  display: block;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-text h1 span {
  color: #2563eb;
  font-weight: 800;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.telemetry-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
}

.telemetry-pill.live {
  background: var(--accent-live-bg);
  border-color: var(--accent-live-border);
  color: var(--accent-live);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-live);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-live);
  animation: radar-pulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes radar-pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.6);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 7px rgba(5, 150, 105, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
  }
}

.telemetry-pill.latency {
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-card);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.action-btn:hover {
  transform: translateY(-1px);
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn.sim-btn {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.action-btn.sim-btn:hover {
  background: #1d4ed8;
}

.action-btn.sim-btn.is-running {
  background: #e11d48;
  border-color: #be123c;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.25);
}

.action-btn.reset-btn {
  color: var(--text-secondary);
}

.action-btn.reset-btn:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* ==========================================================================
   CONTROL STRIP (TABS & FILTERS)
   ========================================================================== */

.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.tabs-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-item:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.tab-item.active {
  color: #2563eb;
  background: var(--accent-stream-bg);
  border: 1px solid var(--accent-stream-border);
}

.tab-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: var(--text-secondary);
}

.tab-item.active .tab-counter {
  background: #2563eb;
  color: #ffffff;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 34px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  width: 240px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.search-wrap input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  width: 280px;
}

.search-wrap input::placeholder {
  color: var(--text-muted);
}

.status-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
}

.filter-btn {
  padding: 5px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  background: #e2e8f0;
  color: var(--text-primary);
  font-weight: 600;
}

/* ==========================================================================
   MAIN VIEWPORT
   ========================================================================== */

.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   CARDS, KPI GRIDS & PANELS (LIGHT THEME)
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: var(--kpi-accent, #2563eb);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.kpi-icon {
  width: 22px;
  height: 22px;
  color: var(--kpi-accent, #2563eb);
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.kpi-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.kpi-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.kpi-badge.live {
  background: var(--accent-live-bg);
  color: var(--accent-live);
  border: 1px solid var(--accent-live-border);
}

.kpi-badge.cyan {
  background: var(--accent-stream-bg);
  color: var(--accent-stream);
  border: 1px solid var(--accent-stream-border);
}

.kpi-badge.rose {
  background: var(--accent-target-bg);
  color: var(--accent-target);
  border: 1px solid var(--accent-target-border);
}

.ratio-track {
  height: 8px;
  background: #fecdd3;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  margin-top: 4px;
}

.ratio-fill-target {
  height: 100%;
  background: #e11d48;
  transition: width 0.4s ease;
}

.ratio-fill-organic {
  height: 100%;
  background: #2563eb;
  transition: width 0.4s ease;
}

.panel-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   TABLES & BENCHMARK GRIDS (LIGHT THEME)
   ========================================================================== */

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

.telemetry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  background: var(--bg-surface);
}

.telemetry-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-card);
  white-space: nowrap;
}

.telemetry-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.telemetry-table tr:last-child td {
  border-bottom: 0;
}

.telemetry-table tr:hover td {
  background: #f8fafc;
}

/* Brand Group Badges */
.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.brand-badge.client {
  background: var(--accent-client-bg);
  border: 1px solid var(--accent-client-border);
  color: var(--accent-client);
}

.brand-badge.competitor {
  background: var(--accent-comp-beta-bg);
  border: 1px solid var(--accent-comp-beta-border);
  color: var(--accent-comp-beta);
}

.brand-badge.organic {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: var(--text-secondary);
}

/* Format Tag Badges */
.format-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.format-badge.official {
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  color: #6d28d9;
}

.format-badge.affiliate {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0369a1;
}

.format-badge.advocacy {
  background: #fce7f3;
  border: 1px solid #fbcfe8;
  color: #be185d;
}

.format-badge.organic {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.time-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #2563eb;
}

.bar-metric-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}

.bar-metric-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
}

.bar-metric-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.bar-metric-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
  border-radius: 3px;
}

/* ==========================================================================
   BRAND BENCHMARK HERO CARDS
   ========================================================================== */

.benchmark-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.benchmark-brand-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.benchmark-brand-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.benchmark-brand-card.is-client {
  border-color: #c4b5fd;
  background: linear-gradient(180deg, #faf5ff 0%, #ffffff 40%);
}

.benchmark-brand-card.is-client::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-client);
}

.benchmark-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.benchmark-brand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.benchmark-stat-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.benchmark-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.benchmark-stat-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   TAB: MULTI-USER LIVE MATRIX (LIGHT THEME)
   ========================================================================== */

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.user-live-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.user-live-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
}

.user-live-card.is-live {
  border-color: var(--accent-live-border);
}

.user-live-card.is-live::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, var(--accent-live) 0%, #2563eb 100%);
}

.user-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 12px;
}

.user-id-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.user-last-seen {
  font-size: 11px;
  color: var(--text-muted);
}

.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-status-pill.status-live {
  background: var(--accent-live-bg);
  border: 1px solid var(--accent-live-border);
  color: var(--accent-live);
}

.live-status-pill.status-paused {
  background: var(--accent-comp-beta-bg);
  border: 1px solid var(--accent-comp-beta-border);
  color: var(--accent-comp-beta);
}

.live-status-pill.status-idle {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: var(--text-muted);
}

/* On-Air Panel in Card */
.on-air-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.on-air-box.is-target {
  background: #fff1f2;
  border-color: #fecdd3;
}

.on-air-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.eq-bar {
  width: 3px;
  background: #059669;
  border-radius: 1px;
  animation: eq-bounce 0.8s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { height: 5px; animation-delay: 0.1s; }
.eq-bar:nth-child(2) { height: 13px; animation-delay: 0.3s; }
.eq-bar:nth-child(3) { height: 7px; animation-delay: 0.2s; }

@keyframes eq-bounce {
  0% { height: 3px; }
  100% { height: 13px; }
}

.on-air-video-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.realtime-clock-display {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.clock-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: -0.02em;
}

.clock-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.live-progress-track {
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.live-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #059669 100%);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.user-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  border: 1px solid var(--border-card);
}

.mini-stat-col {
  display: flex;
  flex-direction: column;
}

.mini-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.mini-stat-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ==========================================================================
   LIVE EVENT LOGS (LIGHT THEME)
   ========================================================================== */

.event-log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 550px;
  overflow-y: auto;
}

.event-log-row {
  display: grid;
  grid-template-columns: 80px 120px 110px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
}

.event-log-row:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.event-time {
  color: var(--text-muted);
}

.event-user-tag {
  color: #2563eb;
  font-weight: 700;
}

.event-action-pill {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.event-action-pill.type-impression { background: #e0f2fe; color: #0284c7; }
.event-action-pill.type-play { background: #dcfce7; color: #15803d; }
.event-action-pill.type-pause { background: #fef3c7; color: #b45309; }
.event-action-pill.type-resume { background: #e0f2fe; color: #0284c7; }
.event-action-pill.type-loop { background: #f3e8ff; color: #7e22ce; }
.event-action-pill.type-swipe { background: #ffe4e6; color: #e11d48; }
.event-action-pill.type-session { background: #f1f5f9; color: #475569; }

/* Empty state */
.empty-state-box {
  background: var(--bg-surface);
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  border-top: 1px solid var(--border-card);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-live);
}

/* Responsive */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .benchmark-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-layout { padding: 12px; }
  .top-nav { flex-direction: column; align-items: stretch; }
  .control-strip { flex-direction: column; align-items: stretch; }
  .tabs-nav { overflow-x: auto; }
  .kpi-grid { grid-template-columns: 1fr; }
  .event-log-row { grid-template-columns: 70px 100px 1fr; }
  .modal-body { grid-template-columns: 1fr; }
}

/* ==========================================================================
   PROJECT SAPPHIRE · FIELDWORK DASHBOARD
   ========================================================================== */

body {
  background: #f3f6f9;
  color: #17212b;
}

.app-layout {
  max-width: 1680px;
  padding: 18px 28px 34px;
  gap: 14px;
}

.top-nav {
  position: sticky;
  top: 12px;
  z-index: 60;
  padding: 14px 18px;
  border-color: #dfe6eb;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(24, 39, 52, 0.08);
}

.brand-icon {
  width: 42px;
  height: 42px;
  color: #087b72;
  background: #e6f6f3;
  border: 0;
  border-radius: 13px;
}

.project-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: #70808e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .15em;
}

.brand-text h1 { font-size: 19px; letter-spacing: -.035em; }
.brand-text h1 span { color: #087b72; }
.brand-sub { color: #70808e; font-size: 11px; }

.telemetry-pill { border-color: #e1e7eb; background: #f6f8fa; }
.telemetry-pill.live { background: #eaf8f4; border-color: #c1eadf; color: #087b72; }
.pulse-dot { background: #10a37f; box-shadow: none; }

.export-primary,
.danger-secondary,
.apk-secondary {
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
}

.export-primary { background: #087b72; color: white; box-shadow: 0 5px 14px rgba(8, 123, 114, .2); }
.export-primary:hover { background: #06675f; transform: translateY(-1px); }
.apk-secondary { background: #fff; color: #324454; border-color: #dce4e9; }
.danger-secondary { background: #fff; color: #b4232a; border-color: #f0cdcf; cursor: pointer; font: inherit; }
.danger-secondary:hover { background: #fdf3f3; border-color: #e3a9ad; }

.control-strip {
  top: 92px;
  padding: 5px;
  border-color: #dfe6eb;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(24, 39, 52, .05);
}

.tabs-nav { gap: 3px; }
.tab-item {
  min-height: 42px;
  padding: 9px 15px;
  border-radius: 10px;
  color: #697987;
  text-transform: none;
  letter-spacing: 0;
}
.tab-item.active { color: #087b72; background: #eaf7f5; box-shadow: none; }
.tab-item.active::after { display: none; }
.tab-counter { background: #dcefeb; color: #087b72; }
.filter-controls { padding-right: 5px; }
.search-wrap.is-hidden { display: none; }
.search-wrap { border-radius: 10px; border-color: #e0e7eb; background: #f8fafb; }

.main-viewport { display: flex; flex-direction: column; gap: 14px; }
.section-kicker { color: #087b72; font-size: 10px; font-weight: 800; letter-spacing: .14em; }

.sapphire-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 30px 32px;
  color: white;
  border-radius: 22px;
  background:
    radial-gradient(circle at 87% 15%, rgba(58, 190, 171, .3), transparent 25%),
    linear-gradient(125deg, #102f39 0%, #123e43 56%, #0b625a 100%);
  box-shadow: 0 18px 40px rgba(18, 62, 67, .16);
}

.sapphire-hero::after {
  content: '';
  position: absolute;
  width: 260px;
  height: 260px;
  right: -85px;
  bottom: -180px;
  border: 46px solid rgba(255,255,255,.06);
  border-radius: 50%;
}

.sapphire-hero-copy { position: relative; z-index: 1; max-width: 860px; }
.sapphire-hero .section-kicker { color: #66dbc8; }
.sapphire-hero h2 { margin: 7px 0 9px; font-size: clamp(25px, 3vw, 37px); line-height: 1.16; letter-spacing: -.04em; }
.sapphire-hero h2 em { color: #77e2d0; font-style: normal; }
.sapphire-hero p { max-width: 850px; color: #c8dcd9; font-size: 13px; line-height: 1.7; }

.sapphire-hero-sync {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background: rgba(5, 31, 34, .35);
  backdrop-filter: blur(12px);
}
.sync-orb { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; background: #5de2bc; box-shadow: 0 0 0 7px rgba(93,226,188,.12); }
.sapphire-hero-sync.is-offline .sync-orb { background: #f59e0b; box-shadow: 0 0 0 7px rgba(245,158,11,.12); }
.sapphire-hero-sync strong, .sapphire-hero-sync small { display: block; }
.sapphire-hero-sync strong { font-size: 12px; }
.sapphire-hero-sync small { margin-top: 3px; color: #a9c3c0; font: 9px var(--font-mono); }

.sapphire-kpis { display: grid; grid-template-columns: 1.25fr repeat(5, 1fr); gap: 12px; }
.rewind-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.rewind-summary > div { padding: 14px 16px; border: 1px solid #e3e9ee; border-radius: 12px; background: #fbfcfd; }
.rewind-summary span { display: block; color: #738391; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.rewind-summary strong { display: block; margin: 6px 0 2px; color: #17212b; font-size: 24px; line-height: 1; }
.rewind-summary strong small { color: #90a0ab; font-size: 12px; font-weight: 600; }
.rewind-summary em { color: #087b72; font-size: 12px; font-style: normal; font-weight: 700; }
.round-meta.rewind-yes { color: #b45309; font-weight: 600; }
.rewind-summary--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .rewind-summary--four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .rewind-summary { grid-template-columns: 1fr; } }
.sapphire-kpi {
  min-width: 0;
  padding: 18px 19px;
  border: 1px solid #e0e7eb;
  border-radius: 16px;
  background: white;
  box-shadow: 0 4px 16px rgba(28, 44, 55, .035);
}
.sapphire-kpi > span { color: #738391; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.sapphire-kpi > strong { display: block; margin: 8px 0 3px; color: #17212b; font-size: 29px; line-height: 1; letter-spacing: -.045em; }
.sapphire-kpi > strong small { color: #90a0ab; font-size: 13px; font-weight: 600; letter-spacing: 0; }
.sapphire-kpi p { color: #91a0aa; font-size: 10px; }
.sapphire-kpi.primary { background: #eef8f6; border-color: #cce9e3; }
.sapphire-kpi.primary > strong { color: #087b72; }
.kpi-progress { height: 5px; margin: 10px 0 7px; overflow: hidden; border-radius: 99px; background: #d9ebe7; }
.kpi-progress i { display: block; height: 100%; border-radius: inherit; background: #10a37f; }

.sapphire-flow {
  display: grid;
  grid-template-columns: 1fr 36px 1fr 36px 1fr 36px 1fr;
  align-items: center;
  padding: 15px 20px;
  border: 1px solid #e0e7eb;
  border-radius: 16px;
  background: white;
}
.flow-step { display: flex; align-items: center; gap: 11px; min-width: 0; }
.flow-step b { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; color: #087b72; background: #e9f6f3; font-size: 10px; }
.flow-step strong, .flow-step small { display: block; }
.flow-step strong { font-size: 11px; }
.flow-step small { margin-top: 2px; color: #8a99a4; font-size: 9px; }
.sapphire-flow > i { height: 1px; background: linear-gradient(90deg, #d2dfdf, #91c8bf); }

.sapphire-section {
  padding: 20px;
  border: 1px solid #e0e7eb;
  border-radius: 18px;
  background: white;
  box-shadow: 0 4px 18px rgba(28, 44, 55, .035);
}
.sapphire-section.no-pad { padding: 0; overflow: hidden; }
.sapphire-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sapphire-section-head h2 { margin: 3px 0; font-size: 17px; letter-spacing: -.025em; }
.sapphire-section-head p { color: #7b8b97; font-size: 10.5px; }
.section-action, button.section-action {
  padding: 7px 10px;
  border: 1px solid #dbe5e8;
  border-radius: 9px;
  color: #47606a;
  background: white;
  font: 700 10px var(--font-sans);
  text-decoration: none;
  cursor: pointer;
}

.panel-progress-grid { display: grid; grid-template-columns: repeat(6, minmax(135px, 1fr)); gap: 9px; }
.panel-progress-card { padding: 12px; border: 1px solid #e2e9ec; border-radius: 12px; background: #fbfcfd; }
.panel-progress-head, .panel-progress-foot { display: flex; justify-content: space-between; gap: 8px; }
.panel-progress-head span { color: #087b72; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.panel-progress-head strong { font: 700 10px var(--font-mono); }
.panel-progress-card h3 { overflow: hidden; margin: 8px 0 2px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.panel-progress-card p, .panel-progress-foot { color: #8b9aa5; font-size: 8.5px; }
.panel-progress-track { height: 4px; margin: 10px 0 7px; overflow: hidden; border-radius: 99px; background: #e7edef; }
.panel-progress-track span { display: block; height: 100%; border-radius: inherit; background: #10a37f; }
.panel-progress-card.is-done { border-color: #bce3db; background: #f1faf8; }

.sapphire-two-column { display: grid; grid-template-columns: 1.45fr .85fr; gap: 14px; }
.respondent-list { display: flex; flex-direction: column; }
.respondent-list-row { display: grid; grid-template-columns: 42px 1fr auto auto; align-items: center; gap: 12px; padding: 11px 2px; border-top: 1px solid #edf1f3; }
.respondent-list-row:first-child { border-top: 0; }
.respondent-id { display: flex; align-items: baseline; gap: 3px; color: #087b72; }
.respondent-id span { font-size: 8px; font-weight: 800; }
.respondent-id strong { font: 800 16px var(--font-mono); }
.respondent-main strong, .respondent-main span { display: block; }
.respondent-main strong { font-size: 11px; }
.respondent-main span { margin-top: 2px; color: #8a99a4; font-size: 9px; }
.respondent-rounds { display: flex; gap: 4px; }
.mini-round { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: #8c9aa4; background: #edf1f3; font: 700 9px var(--font-mono); }
.mini-round.pass { color: #087b72; background: #dff4ef; }
.mini-round.fail { color: #b45309; background: #fff2d8; }
.sapphire-status { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 5px 8px; border-radius: 99px; font-size: 8.5px; font-weight: 700; white-space: nowrap; }
.sapphire-status > span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.sapphire-status.is-complete { color: #087b72; background: #e7f7f3; }
.sapphire-status.is-progress { color: #2563eb; background: #eaf1ff; }
.sapphire-status.is-error { color: #dc2626; background: #fef0f0; }
.sapphire-status.is-muted { color: #7d8b95; background: #f0f3f5; }

.source-section { background: #fbfcfc; }
.source-card { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid #e1e8eb; border-radius: 12px; background: white; }
.source-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: white; background: #172f3a; font: 800 10px var(--font-mono); }
.source-card.cilink .source-icon { background: #087b72; }
.source-card strong { display: block; font-size: 11px; }
.source-card p { margin-top: 2px; color: #7d8c97; font-size: 9px; line-height: 1.45; }
.source-card em { color: #526672; font: normal 700 9px var(--font-mono); }
.source-connector { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 8px; color: #82919b; font-size: 8px; }
.source-connector strong { color: #087b72; font: 700 8px var(--font-mono); }

.sapphire-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; color: #8a99a4; text-align: center; }
.sapphire-empty strong { color: #536570; font-size: 12px; }
.sapphire-empty span { font-size: 10px; }
.sapphire-empty.large { min-height: 260px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 16px 4px 6px; }
.page-heading h2 { margin: 4px 0; font-size: 26px; letter-spacing: -.04em; }
.page-heading p { color: #758691; font-size: 11px; }
.page-count, .source-pill { padding: 7px 10px; border-radius: 99px; color: #087b72; background: #e8f5f3; font-size: 9px; font-weight: 800; }
.source-pill.app-source { color: #334155; background: #e8edf2; }

.sapphire-table-wrap { overflow-x: auto; }
.sapphire-table { width: 100%; border-collapse: collapse; }
.sapphire-table th { padding: 12px 14px; color: #82919c; background: #f7f9fa; border-bottom: 1px solid #e4eaed; font-size: 8.5px; text-align: left; text-transform: uppercase; letter-spacing: .09em; }
.sapphire-table td { min-width: 170px; padding: 14px; border-bottom: 1px solid #edf1f3; vertical-align: middle; }
.sapphire-table td:first-child { min-width: 100px; }
.sapphire-table tr:last-child td { border-bottom: 0; }
.table-id strong, .table-id span, .table-allocation strong, .table-allocation span, .cilink-cell > span, .cilink-cell > small { display: block; }
.table-id strong { color: #087b72; font: 800 13px var(--font-mono); }
.table-id span, .table-allocation span, .cilink-cell > span, .cilink-cell > small { margin-top: 3px; color: #8a99a4; font-size: 8.5px; }
.table-allocation strong { font-size: 10.5px; }
.round-cell { display: flex; flex-direction: column; gap: 4px; }
.round-cell-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.round-cell-top strong { font-size: 10px; }
.a0-chip { padding: 3px 6px; border-radius: 99px; font: 700 8px var(--font-mono); }
.a0-chip.pass { color: #087b72; background: #e4f7f2; }
.a0-chip.fail { color: #b45309; background: #fff2d8; }
.a0-chip.waiting { color: #7c8993; background: #edf1f3; }
.round-video, .round-meta { color: #7b8b96; font-size: 8px; }
.round-video { overflow: hidden; max-width: 170px; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.round-empty { color: #a0acb5; font-size: 9px; }
.cilink-cell { display: flex; flex-direction: column; align-items: flex-start; }

.result-kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 11px; }
@media (max-width: 1100px) { .result-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.result-kpi-grid article { padding: 17px; border: 1px solid #e0e7eb; border-radius: 15px; background: white; }
.result-kpi-grid article > span { color: #087b72; font: 800 9px var(--font-mono); }
.result-kpi-grid article > div { margin: 7px 0; }
.result-kpi-grid article > div strong { font-size: 27px; letter-spacing: -.04em; }
.result-kpi-grid article > div small { color: #9aa6ae; font-size: 10px; }
.result-kpi-grid h3 { font-size: 10px; }
.result-kpi-grid p { margin-top: 3px; color: #8c99a2; font-size: 8.5px; }
.format-result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.format-result-card { padding: 16px; border: 1px solid #e2e8eb; border-radius: 13px; background: #fbfcfd; }
.format-result-card.branded { border-top: 3px solid #2563eb; }
.format-result-card.affiliate { border-top: 3px solid #f59e0b; }
.format-result-card.advocacy { border-top: 3px solid #7c3aed; }
.format-result-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 11px; border-bottom: 1px solid #e7ecef; }
.format-result-head span { font-size: 13px; font-weight: 800; }
.format-result-head small { color: #8c9aa4; font-size: 8px; }
.format-metric { margin-top: 13px; }
.format-metric > div:first-child { display: flex; justify-content: space-between; gap: 10px; }
.format-metric span { color: #5f707c; font-size: 8.5px; }
.format-metric strong { font: 800 10px var(--font-mono); }
.format-metric small { display: block; margin-top: 3px; color: #9aa6ae; font-size: 7.5px; }
.metric-track { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: #e7edef; }
.metric-track i { display: block; height: 100%; border-radius: inherit; background: #087b72; }
.method-note { padding: 14px 17px; border: 1px solid #d6e5e2; border-radius: 13px; background: #f3faf8; }
.method-note strong { color: #087b72; font-size: 10px; }
.method-note p { margin-top: 3px; color: #62747d; font-size: 9px; }

.timeline-list { display: flex; flex-direction: column; }
.timeline-row { display: grid; grid-template-columns: 280px 1fr; gap: 24px; padding: 18px 20px; border-bottom: 1px solid #e9eef0; }
.timeline-row:last-child { border-bottom: 0; }
.timeline-meta { display: flex; align-items: center; gap: 12px; }
.timeline-meta > div:last-child strong, .timeline-meta > div:last-child span { display: block; }
.timeline-meta > div:last-child strong { font-size: 10.5px; }
.timeline-meta > div:last-child span { margin-top: 3px; color: #87959f; font-size: 8.5px; }
.timeline-bars { display: flex; flex-direction: column; gap: 7px; }
.timeline-bar-row { display: grid; grid-template-columns: 68px 1fr 46px; align-items: center; gap: 9px; }
.timeline-bar-row > span { color: #647681; font-size: 8.5px; }
.timeline-bar-row > strong { font: 700 8.5px var(--font-mono); text-align: right; }
.timeline-track { position: relative; height: 7px; overflow: hidden; border-radius: 99px; background: repeating-linear-gradient(90deg, #e6ecef 0, #e6ecef calc(10% - 1px), #fff calc(10% - 1px), #fff 10%); }
.timeline-track i { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 99px; }

.app-footer { color: #84939d; border-color: #e2e8eb; }
.footer-right { font-size: 9px; }

@media (max-width: 1250px) {
  .telemetry-bar { display: none; }
  .panel-progress-grid { grid-template-columns: repeat(3, 1fr); }
  .sapphire-kpis { grid-template-columns: repeat(3, 1fr); }
  .sapphire-kpi.primary { grid-column: span 1; }
  .control-strip { top: 90px; }
}

@media (max-width: 850px) {
  .app-layout { padding: 10px; }
  .top-nav { position: relative; top: auto; flex-wrap: nowrap; }
  .brand-sub { display: none; }
  .header-actions { margin-left: auto; }
  .control-strip { position: relative; top: auto; overflow-x: auto; }
  .tabs-nav { width: max-content; min-width: max-content; flex-wrap: nowrap; }
  .tab-item { flex: none; white-space: nowrap; }
  .filter-controls { display: none; }
  .sapphire-hero { align-items: flex-start; flex-direction: column; padding: 24px; }
  .sapphire-hero-sync { min-width: 0; width: 100%; }
  .sapphire-kpis { grid-template-columns: repeat(2, 1fr); }
  .sapphire-flow { grid-template-columns: 1fr; gap: 9px; }
  .sapphire-flow > i { width: 1px; height: 12px; margin-left: 14px; }
  .panel-progress-grid { grid-template-columns: repeat(2, 1fr); }
  .sapphire-two-column, .format-result-grid { grid-template-columns: 1fr; }
  .result-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline-row { grid-template-columns: 1fr; gap: 13px; }
  .footer-right { display: none; }
}

@media (max-width: 520px) {
  .brand-icon { display: none; }
  .brand-text h1 { font-size: 16px; }
  .project-eyebrow { font-size: 7px; }
  .export-primary span { display: none; }
  .apk-secondary { display: none; }
  .sapphire-kpis, .panel-progress-grid, .result-kpi-grid { grid-template-columns: 1fr 1fr; }
  .sapphire-kpi { padding: 14px; }
  .sapphire-kpi > strong { font-size: 23px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h2 { font-size: 22px; }
  .respondent-list-row { grid-template-columns: 38px 1fr auto; }
  .respondent-list-row .sapphire-status { grid-column: 2 / -1; }
}

/* ==========================================================================
   VIDEO SETUP & LIVE PREVIEW MODAL
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 92%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.is-open .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-card);
  background: #f8fafc;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-badge-id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: var(--radius-md);
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.modal-close-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.modal-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  padding: 22px;
  overflow-y: auto;
}

.video-player-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-aspect-container {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 420px;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.video-aspect-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-playback-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 0 4px;
}

.video-live-tag {
  color: #059669;
  font-weight: 700;
}

.video-setup-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input, .form-textarea, .form-select {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.radio-chip:has(input:checked) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.modal-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.setup-toast-msg {
  font-size: 12px;
  font-weight: 600;
  color: #059669;
}

.btn-table-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-table-action:hover {
  background: #2563eb;
  color: #ffffff;
}

/* Empty Hero States */
.empty-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-card);
  box-shadow: var(--shadow-sm);
  margin: 20px 0;
}

.empty-icon {
  width: 52px;
  height: 52px;
  color: #94a3b8;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.empty-sub {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: var(--brand-primary);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transition: all 0.15s ease;
}

.primary-btn:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
}


/* ==========================================================================
   PHÂN CẢNH & ĐOẠN ẤN TƯỢNG (Scene split / recall analytics)
   ========================================================================== */
.kpi-grid-compact .kpi-card {
  padding: 12px 14px;
}

.scene-accordion {
  display: flex;
  flex-direction: column;
}

.scene-brand-item {
  border-bottom: 1px solid var(--border-card);
}

.scene-brand-item:last-child {
  border-bottom: none;
}

.scene-row-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text-primary);
  flex-wrap: wrap;
}

.scene-row-head:hover {
  background: var(--bg-hover);
}

.scene-row-head.brand {
  background: var(--bg-subtle);
}

.scene-row-head.brand:hover {
  background: #eef2f7;
}

.scene-row-head.brand strong {
  font-size: 13.5px;
  font-weight: 800;
}

.scene-row-head.panel-toggle {
  padding: 13px 18px;
}

.scene-caret {
  font-size: 11px;
  color: var(--text-muted);
  width: 12px;
  flex: 0 0 12px;
}

.scene-row-user {
  font-size: 13px;
  font-weight: 700;
}

.scene-row-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.scene-row-spacer {
  flex: 1 1 auto;
}

.scene-pill {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-card);
  background: var(--bg-surface);
  color: var(--text-secondary);
  white-space: nowrap;
}

.scene-pill.hot {
  background: var(--accent-target-bg);
  border-color: var(--accent-target-border);
  color: var(--accent-target);
}

.scene-brand-body {
  padding: 6px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scene-video-item {
  border: 1px solid var(--border-card);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
}

.scene-video-item.has-data {
  border-color: var(--accent-target-border);
}

.scene-video-item.is-open {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.scene-row-body {
  padding: 4px 12px 14px;
  border-top: 1px solid var(--border-subtle);
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 9px;
}

/* Dải phân cảnh thu nhỏ (luôn hiện) */
.scene-mini {
  display: flex;
  gap: 2px;
  padding: 0 12px 10px;
}

.scene-mini-seg {
  height: 20px;
  min-width: 0;
  border: 1px solid var(--border-card);
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Dải phân cảnh đầy đủ (khi mở chi tiết) */
.scene-timeline {
  display: flex;
  gap: 3px;
  width: 100%;
  margin-top: 10px;
}

.scene-seg {
  border: 1px solid var(--border-card);
  border-radius: 7px;
  padding: 8px 6px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  overflow: hidden;
}

.scene-seg strong {
  font-size: 12px;
  font-weight: 800;
}

.scene-seg span {
  font-size: 10.5px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.scene-seg em {
  font-size: 9.5px;
  font-style: normal;
  font-weight: 700;
}

.scene-avg-track {
  position: relative;
  height: 20px;
  margin-top: 6px;
  background: var(--bg-subtle);
  border-radius: 6px;
}

.scene-avg-bar {
  position: absolute;
  top: 0;
  height: 20px;
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid var(--accent-stream);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-avg-bar span {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-stream);
  white-space: nowrap;
}

.scene-chip {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border-card);
  border-radius: 999px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.scene-chip.neutral {
  background: var(--accent-target-bg);
  color: var(--accent-target);
  border-color: var(--accent-target-border);
}

.scene-empty {
  padding: 12px;
  border: 1px dashed var(--border-card);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  margin-top: 10px;
}

.mini-bar-wrap {
  width: 70px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  margin-bottom: 3px;
}

.mini-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-target);
}

.scene-preview {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  background: var(--bg-subtle);
}

.scene-preview-head {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.scene-preview-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.scene-preview-empty {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Chip của từng lần dừng trong modal hành vi đáp viên */
.stop-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-card);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.stop-chip b {
  color: var(--accent-target);
  font-weight: 800;
}

.stop-chip.pause {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.stop-chip.pause b {
  color: #ea580c;
}

.stop-chip i {
  font-style: normal;
  color: var(--text-muted);
  font-size: 10px;
}

.stop-chip.pause i {
  color: #c2410c;
}

.panel-header .filter-group .filter-btn {
  white-space: nowrap;
}

.panel-header .filter-group {
  flex-wrap: nowrap;
}

/* Bảng nhiệt Điểm Rơi Chú Ý */
.retention-table th {
  font-size: 10.5px;
  padding: 7px 6px;
}

.retention-table td {
  padding: 8px 6px;
}

.retention-row {
  cursor: pointer;
}

.retention-row:hover {
  background: var(--bg-hover);
}

.retention-row.is-open {
  background: #eff6ff;
}

.ret-cell {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
}

.ret-cell.empty {
  background: transparent;
  color: #cbd5e1;
  font-weight: 400;
}

.retention-detail > td {
  background: #f8fafc;
  padding: 14px 16px !important;
}

.ret-step {
  min-width: 132px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  background: var(--bg-surface);
}

.ret-step-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.ret-step-still {
  font-size: 11.5px;
  color: #2563eb;
  font-weight: 700;
  font-family: var(--font-mono);
}

.ret-step-drop {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ret-step-drop.has-drop {
  color: #e11d48;
  font-weight: 700;
}

/* Quota hiện trường */
.quota-input {
  width: 70px;
  padding: 5px 8px;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  color: var(--text-primary);
  background: var(--bg-surface);
}

.quota-input:focus {
  outline: none;
  border-color: var(--accent-stream);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.quota-priority-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 16px 10px;
  padding: 9px 14px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  font-size: 12.5px;
  color: #9a3412;
}

.quota-act {
  white-space: nowrap;
  padding: 4px 8px;
  font-size: 11px;
}

/* Trạng thái nhận mẫu của brand */
.quota-status {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.quota-status.active {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.quota-status.paused {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.quota-act.is-resume {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
  font-weight: 700;
}

button.quota-status.paused {
  cursor: pointer;
  font-family: inherit;
}

button.quota-status.paused:hover {
  background: #ffedd5;
}

/* Trạng thái nơi lưu dữ liệu */
.telemetry-pill.storage {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.telemetry-pill.storage.is-ram {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* ==========================================================================
   BRIEF ALIGNMENT + CATALOG UX
   ========================================================================== */

.top-nav {
  position: sticky;
  top: 14px;
  z-index: 60;
  backdrop-filter: blur(14px);
}

.control-strip {
  position: sticky;
  top: 116px;
  z-index: 50;
  padding: 6px;
  background: rgba(248, 250, 252, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
  flex-wrap: nowrap;
}

.tabs-nav {
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.filter-controls {
  flex: 0 0 auto;
}

.status-filters.is-hidden {
  display: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  display: none;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 18px;
  cursor: pointer;
}

.search-clear.is-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.search-wrap input {
  padding-right: 34px;
}

.brief-alignment {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.brief-alignment::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed 48%, #e11d48);
}

.brief-alignment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-kicker {
  display: block;
  margin-bottom: 5px;
  color: #2563eb;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brief-alignment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brief-alignment-actions a.btn-table-action {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brief-alignment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 0;
}

.brief-check-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 112px;
  padding: 13px 14px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.brief-check-card strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brief-check-card > span:last-child {
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.45;
}

.brief-check-card.is-ready {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.brief-check-card.is-review {
  border-color: #fde68a;
  background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
}

.brief-check-card.is-pending {
  border-color: #fecdd3;
  background: linear-gradient(180deg, #ffffff 0%, #fff1f2 100%);
}

.brief-check-status {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.is-ready .brief-check-status { color: #047857; }
.is-review .brief-check-status { color: #b45309; }
.is-pending .brief-check-status { color: #be123c; }

.brief-gap-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.brief-gap-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(241, 245, 249, 0.72);
}

.brief-gap-item strong,
.brief-gap-item span {
  display: block;
}

.brief-gap-item strong {
  margin-bottom: 3px;
  font-size: 12px;
}

.brief-gap-item div span {
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.45;
}

.brief-gap-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 0 4px #ffe4e6;
}

.brief-gap-dot.is-review {
  background: #f59e0b;
  box-shadow: 0 0 0 4px #fef3c7;
}

.integration-panel {
  overflow: hidden;
}

.integration-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.integration-panel-head a {
  flex: 0 0 auto;
  text-decoration: none;
}

.integration-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
}

.integration-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.integration-table th,
.integration-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  font-size: 12px;
}

.integration-table th {
  color: var(--text-muted);
  background: #f8fafc;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.integration-table tbody tr:last-child td {
  border-bottom: 0;
}

.integration-table td > span.integration-id {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.integration-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.integration-status.complete { color: #047857; background: #d1fae5; }
.integration-status.ready { color: #1d4ed8; background: #dbeafe; }
.integration-status.running { color: #a16207; background: #fef3c7; }

.integration-empty {
  padding: 22px;
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-align: center;
}

.catalog-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, auto)) minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--border-card);
  border-bottom: 1px solid var(--border-card);
  background: linear-gradient(90deg, #f8fafc, #ffffff);
}

.catalog-summary-strip > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-right: 12px;
  border-right: 1px solid var(--border-card);
}

.catalog-summary-strip strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 16px;
}

.catalog-summary-strip span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.catalog-summary-strip p {
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.4;
}

.asset-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.asset-set-badge {
  padding: 2px 6px;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  font-weight: 800;
}

.hypothesis-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 92px;
  max-width: 170px;
}

.hypothesis-chip {
  padding: 2px 5px;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
}

.hypothesis-empty {
  color: var(--text-muted);
  font-size: 10px;
  font-style: italic;
}

@media (max-width: 1200px) {
  .control-strip { top: 108px; }
  .brief-alignment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-summary-strip { grid-template-columns: repeat(4, minmax(90px, 1fr)); }
  .catalog-summary-strip p { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .top-nav { position: relative; top: auto; }
  .control-strip { position: relative; top: auto; padding: 4px; }
  .brief-alignment-head { flex-direction: column; }
  .brief-alignment-grid,
  .brief-gap-list { grid-template-columns: 1fr; }
  .macro-group-grid,
  .quota-structure-grid { grid-template-columns: 1fr !important; min-width: 0; }
  .macro-group-metrics { grid-template-columns: 1fr !important; }
  .macro-group-grid > *,
  .quota-structure-grid > *,
  .panel-box { min-width: 0; }
  .catalog-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-summary-strip > div:nth-child(2n) { border-right: 0; }
  .catalog-summary-strip p { grid-column: 1 / -1; }
  .search-wrap input,
  .search-wrap input:focus { width: 100%; }
}

/* Final responsive precedence for the Sapphire shell. */
@media (max-width: 850px) {
  .top-nav {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    padding: 14px 16px;
  }
  .brand-section { width: auto; min-width: 0; flex: 1 1 auto; }
  .brand-logo { min-width: 0; }
  .brand-text { min-width: 0; }
  .header-actions { flex: 0 0 auto; margin-left: auto; }
  .control-strip { overflow-x: auto; }
  .tabs-nav { width: max-content; min-width: max-content; flex: 0 0 auto; flex-wrap: nowrap; }
  .tab-item { flex: 0 0 auto; white-space: nowrap; }
}

/* Customer-facing Sapphire components. */
.study-target-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, #99f6e4, #5eead4);
  color: #0f514b;
  font-size: 14px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, .12);
}

.overview-metric-list {
  display: flex;
  flex-direction: column;
}

.overview-metric-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 2px;
  border-top: 1px solid #edf1f3;
}

.overview-metric-list > div:first-child { border-top: 0; }
.overview-metric-list span { color: #536974; font-size: 11px; font-weight: 650; }
.overview-metric-list strong { color: #087b72; font-size: 19px; letter-spacing: -.03em; }
.overview-metric-list small { margin-left: 2px; color: #93a2ab; font-size: 9px; font-weight: 700; }

.catalog-client-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.catalog-client-summary article {
  display: flex;
  min-height: 92px;
  flex-direction: column;
  justify-content: center;
  padding: 17px 19px;
  border: 1px solid #e2e9ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(23, 44, 52, .045);
}

.catalog-client-summary strong { color: #0e746d; font-size: 27px; letter-spacing: -.04em; }
.catalog-client-summary span { margin-top: 4px; color: #667983; font-size: 10.5px; font-weight: 700; }

.catalog-client-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid #e8edef;
  background: #fbfcfc;
}

.catalog-client-filters > span {
  margin-right: 4px;
  color: #60737d;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.catalog-client-table td { min-width: 0; vertical-align: middle; }
.catalog-client-table td:nth-child(5) { min-width: 260px; }

.catalog-index {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: #eff8f6;
  color: #18776f;
  font-size: 10px;
  font-weight: 800;
}

.catalog-content-name { display: flex; flex-direction: column; gap: 4px; }
.catalog-content-name strong { color: #20343e; font-size: 11.5px; }
.catalog-content-name span { max-width: 430px; color: #758790; font-size: 10px; line-height: 1.45; }
.catalog-duration { color: #405a64; font-size: 10.5px; white-space: nowrap; }

@media (max-width: 850px) {
  .catalog-client-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-client-filters { align-items: flex-start; }
  .catalog-client-filters > span { width: 100%; }
}

/* Chế độ TEST / PRODUCTION */
.study-mode-btn {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #f3c77a;
  background: #fff7e8;
  color: #8a5300;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: default;
}
.study-mode-btn.is-production { border-color: #a7ddd3; background: #eaf8f4; color: #087b72; }
.study-mode-btn:disabled { opacity: .6; cursor: wait; }
.study-mode-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.study-mode-banner {
  margin: 10px 0 0;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #f3c77a;
  background: #fff7e8;
  color: #6b4200;
  font-size: 13px;
}
.study-mode-banner[hidden] { display: none; }
.study-mode-banner-mobile { display: none; }

/* Hộp thoại dùng chung (thay alert/confirm/prompt của trình duyệt) */
.ui-dialog-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 23, 42, .42); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .16s ease;
}
.ui-dialog-backdrop.is-open { opacity: 1; }
.ui-dialog {
  width: min(460px, 100%);
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  padding: 22px 22px 18px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif; color: #0f172a;
  transform: translateY(8px) scale(.98); transition: transform .16s ease;
}
.ui-dialog-backdrop.is-open .ui-dialog { transform: none; }
.ui-dialog__head { display: flex; gap: 14px; align-items: flex-start; }
.ui-dialog__icon {
  flex: 0 0 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; background: #e6f4f2; color: #087b72;
}
.ui-dialog--danger .ui-dialog__icon, .ui-dialog--error .ui-dialog__icon { background: #fdecec; color: #b42318; }
.ui-dialog__title { margin: 2px 0 4px; font-size: 17px; font-weight: 800; }
.ui-dialog__message { margin: 0; font-size: 13.5px; line-height: 1.55; color: #475569; }
.ui-dialog__points { margin: 14px 0 0 50px; padding: 0; font-size: 13px; line-height: 1.6; color: #334155; }
.ui-dialog__points li { margin-bottom: 4px; }
.ui-dialog__field { display: grid; gap: 6px; margin: 16px 0 0 50px; font-size: 12.5px; font-weight: 600; color: #475569; }
.ui-dialog__input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid #cbd5e1;
  font: 600 14px 'JetBrains Mono', monospace; letter-spacing: .06em; color: #0f172a;
}
.ui-dialog__input:focus { outline: none; border-color: #087b72; box-shadow: 0 0 0 3px rgba(8, 123, 114, .15); }
.ui-dialog--danger .ui-dialog__input:focus { border-color: #b42318; box-shadow: 0 0 0 3px rgba(180, 35, 24, .12); }
.ui-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.ui-dialog__btn {
  min-height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: 700 13px 'Plus Jakarta Sans', system-ui, sans-serif; cursor: pointer;
}
.ui-dialog__btn--ghost { background: #fff; border-color: #dce4e9; color: #324454; }
.ui-dialog__btn--ghost:hover { background: #f6f8fa; }
.ui-dialog__btn--primary { background: #087b72; color: #fff; }
.ui-dialog__btn--primary:hover { background: #06675f; }
.ui-dialog__btn--danger { background: #b42318; color: #fff; }
.ui-dialog__btn--danger:hover { background: #912018; }
.ui-dialog__btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 520px) {
  .ui-dialog__points, .ui-dialog__field { margin-left: 0; }
  .ui-dialog__actions { flex-direction: column-reverse; }
  .ui-dialog__btn { width: 100%; }
}

/* Customer-facing responsive polish. Keep the report comfortable on tablets
   and phones without exposing implementation-oriented controls or labels. */
body { overflow-x: hidden; }

#modal-video-filename { display: none; }
.video-playback-meta { justify-content: flex-end; }
.study-mode-btn { white-space: nowrap; }
.format-badge { line-height: 1.25; text-align: center; }

@media (max-width: 850px) {
  .app-layout {
    width: 100%;
    padding: 10px;
    gap: 10px;
  }

  .top-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    margin-left: 0;
  }

  .header-actions .action-btn,
  .header-actions .study-mode-btn {
    justify-content: center;
    min-width: 0;
  }

  .study-mode-banner {
    margin-top: 0;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.55;
  }

  .control-strip {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 4px;
  }

  .tabs-nav {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
  }

  .filter-controls {
    display: flex;
    width: 100%;
    padding: 0;
  }

  .filter-controls .search-wrap { width: 100%; }

  .sapphire-hero { padding: 22px 20px; }
  .sapphire-section { padding: 16px; }
  .sapphire-table-wrap { overscroll-behavior-inline: contain; }
  .sapphire-table { min-width: 820px; }
  .catalog-client-table { min-width: 760px; }

  .modal-backdrop { padding: 8px; }
  .modal-card,
  #user-modal-backdrop .modal-card {
    width: 100% !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 15px;
  }

  .modal-header {
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }

  .modal-title-group,
  .modal-header > div:first-child { min-width: 0; }
  .modal-title { font-size: 15px; line-height: 1.35; }
  .modal-sub { line-height: 1.45; }
  .modal-body { grid-template-columns: 1fr; padding: 16px; }
  .video-aspect-container { width: min(260px, 100%); max-height: 44vh; margin: 0 auto; }
  #modal-user-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .user-modal-body { padding: 16px !important; }

  .ui-dialog {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }
}

@media (max-width: 520px) {
  .top-nav { gap: 10px; padding: 12px; }
  .brand-text h1 { font-size: 15px; }
  .brand-sub { display: none; }
  .header-actions {
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 8px;
  }
  .study-mode-btn { grid-column: auto; }
  .header-actions .action-btn,
  .header-actions .study-mode-btn {
    min-height: 42px;
    padding: 8px 6px;
    font-size: 11.5px;
  }
  .export-primary { min-width: 44px; }
  .export-primary span { display: inline; }
  .apk-secondary { display: inline-flex; }

  .study-mode-banner { padding: 9px 11px; }
  .study-mode-banner-full { display: none; }
  .study-mode-banner-mobile { display: inline; }

  .tabs-nav { scroll-snap-type: x proximity; }
  .tab-item { scroll-snap-align: start; padding: 8px 11px; }
  .tab-item svg { display: none; }
  .sapphire-hero { padding: 20px 16px; }
  .sapphire-hero h2 { font-size: 24px; }
  .sapphire-kpis,
  .panel-progress-grid,
  .result-kpi-grid,
  .catalog-client-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-client-summary article { min-height: 88px; }
  .sapphire-section-head { flex-direction: column; }
  .section-action { width: 100%; text-align: center; }
  .page-count { align-self: flex-start; }
  .timeline-bar-row { grid-template-columns: 62px minmax(90px, 1fr) 42px; }

  .modal-badge-id { display: none; }
  .modal-header > div:last-child { gap: 4px !important; }
  #modal-export-user-btn { width: 40px; padding: 6px !important; }
  #modal-export-user-btn span { display: none; }
  #modal-user-kpis { grid-template-columns: 1fr !important; }

  .ui-dialog-backdrop { align-items: flex-end; padding: 8px; }
  .ui-dialog {
    width: 100%;
    padding: 18px 16px 14px;
    border-radius: 18px 18px 12px 12px;
  }
  .ui-dialog__head { gap: 10px; }
  .ui-dialog__title { font-size: 16px; }
  .ui-dialog__message,
  .ui-dialog__points { font-size: 12.5px; }
}

@media (max-width: 640px) {
  .respondent-table,
  .catalog-client-table {
    display: block;
    min-width: 0 !important;
    width: 100%;
  }

  .respondent-table thead,
  .catalog-client-table thead { display: none; }

  .respondent-table tbody,
  .catalog-client-table tbody {
    display: grid;
    gap: 12px;
    padding: 12px;
  }

  .respondent-table tbody tr,
  .catalog-client-table tbody tr {
    position: relative;
    border: 1px solid #e0e7eb;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(28, 44, 55, .04);
  }

  .respondent-table td,
  .catalog-client-table td,
  .respondent-table td:first-child,
  .catalog-client-table td:first-child {
    min-width: 0 !important;
    border: 0;
  }

  .respondent-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
  }

  .respondent-table td { padding: 0; }
  .respondent-table td::before,
  .catalog-client-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: #8997a1;
    font: 800 8px var(--font-sans);
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .respondent-table td:nth-child(1) { grid-column: 1; }
  .respondent-table td:nth-child(2) { grid-column: 2 / 4; }
  .respondent-table td:nth-child(3),
  .respondent-table td:nth-child(4),
  .respondent-table td:nth-child(5) {
    padding: 10px;
    border-radius: 11px;
    background: #f6f9fa;
  }
  .respondent-table td:nth-child(6) {
    grid-column: 1 / -1;
    padding-top: 12px;
    border-top: 1px solid #e8edef;
  }
  .respondent-table .round-cell { gap: 5px; }
  .respondent-table .round-cell-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
  .respondent-table .round-video {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .catalog-client-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 15px;
  }
  .catalog-client-table td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid #edf1f3;
  }
  .catalog-client-table td::before { margin: 2px 10px 0 0; }
  .catalog-client-table td:nth-child(5) {
    order: -1;
    display: block;
    padding: 0 42px 13px 0;
    border-top: 0;
  }
  .catalog-client-table td:nth-child(5)::before { display: none; }
  .catalog-client-table td:nth-child(1) {
    position: absolute;
    top: 14px;
    right: 14px;
    display: block;
    width: auto;
    padding: 0;
    border: 0;
  }
  .catalog-client-table td:nth-child(1)::before { display: none; }
  .catalog-client-table .hypothesis-chips {
    min-width: 0;
    max-width: none;
  }
  .catalog-client-table .format-badge { width: fit-content; }

  .sapphire-table-wrap {
    overflow-x: visible;
    background: #f6f8fa;
  }
}

@media (max-width: 380px) {
  .brand-sub { display: none; }
  .header-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-mode-btn { grid-column: 1 / -1; }
  .catalog-client-summary { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
  .respondent-table tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .respondent-table td:nth-child(1) { grid-column: 1; }
  .respondent-table td:nth-child(2) { grid-column: 2; }
  .respondent-table td:nth-child(3),
  .respondent-table td:nth-child(4),
  .respondent-table td:nth-child(5),
  .respondent-table td:nth-child(6) { grid-column: 1 / -1; }
  .respondent-table .round-cell-top {
    align-items: center;
    flex-direction: row;
  }
  .result-kpi-grid { grid-template-columns: 1fr; }
}

/* Bộ lọc phễu: Nhãn hàng -> Loại video -> Video */
.funnel-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid #e0e7eb; border-radius: 14px; background: white; }
.funnel-filter label { display: flex; flex-direction: column; gap: 5px; min-width: 190px; flex: 1 1 190px; }
.funnel-filter label span { color: #087b72; font: 800 9px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
.funnel-filter select { width: 100%; padding: 8px 10px; border: 1px solid #d5dee4; border-radius: 9px; background: #fbfcfd; color: #17212b; font-size: 12px; }
.funnel-filter > i { color: #9aa6ae; font-style: normal; font-size: 18px; padding-bottom: 6px; }
.funnel-reset { padding: 8px 12px; border: 1px solid #d5dee4; border-radius: 9px; background: white; color: #4b5b67; font-size: 11px; font-weight: 700; cursor: pointer; }
.sapphire-section-head.padded { padding: 18px 20px 0; }
.video-result-table td, .scroll-video-table td { vertical-align: top; }
.scroll-video-wrap { margin-top: 14px; }
.scroll-video-table tr.is-target td { background: #fff7ed; }

/* Khoảnh khắc nổi bật: heatmap theo giây, gộp mọi đáp viên của một video */
.moment-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 12px; color: #4b5b67; font-size: 11px; font-weight: 600; }
.moment-legend span { display: inline-flex; align-items: center; gap: 6px; }
.moment-legend i { width: 14px; height: 14px; border-radius: 3px; }
.moment-legend-scale { color: #8c99a2; font-weight: 500; }
.moment-list { display: grid; gap: 14px; }
.report-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 18px; background: #f8fafb; color: #526472; font-size: 12px; border-radius: 12px; }
.report-pagination > span { margin-right: auto; }
.report-pagination label, .report-page-buttons { display: flex; align-items: center; gap: 8px; }
.report-pagination select, .report-pagination button { min-height: 36px; padding: 6px 10px; border: 1px solid #dce5e9; border-radius: 8px; background: white; color: #075f59; font: inherit; }
.report-pagination button { cursor: pointer; }
.report-pagination button:disabled { opacity: .4; cursor: default; }
.report-pagination button:focus-visible, .report-pagination select:focus-visible { outline: 2px solid #0d9488; outline-offset: 2px; }
.report-page-buttons { flex-wrap: wrap; }
@media (max-width: 640px) { .report-page-buttons { width: 100%; justify-content: center; } }
.moment-card { padding: 18px 20px; border: 1px solid #e0e7eb; border-radius: 15px; background: white; }
.moment-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.moment-card-head strong { display: block; color: #17212b; font-size: 14px; }
.moment-card-head span { color: #7b8b97; font-size: 11px; }
.moment-heatmap { display: grid; gap: 5px; }
.moment-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; }
.moment-row > span { color: #4b5b67; font-size: 11px; font-weight: 700; }
.moment-cells { display: grid; grid-template-columns: repeat(var(--secs), minmax(0, 1fr)); gap: 1px; height: 26px; }
.moment-cells i { background: #f1f4f6; border-radius: 2px; }
.moment-ticks { position: relative; height: 14px; }
.moment-ticks b { position: absolute; transform: translateX(-50%); color: #90a0ab; font-size: 9px; font-weight: 600; }
.moment-top { margin-top: 16px; padding-top: 12px; border-top: 1px solid #edf1f3; }
.moment-top ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 0; padding: 0; list-style: none; }
.moment-top li { padding: 10px 12px; border: 1px solid #d1fae5; border-radius: 10px; background: #f0fdf8; }
.moment-top li em { display: block; color: #047857; font-size: 10px; font-style: normal; font-weight: 800; text-transform: uppercase; }
.moment-top li strong { display: block; margin: 3px 0; color: #17212b; font-size: 18px; }
.moment-top li span { color: #5b6b77; font-size: 11px; }
.moment-top p { margin-top: 6px; color: #8c99a2; font-size: 11px; }
@media (max-width: 720px) {
  .moment-row { grid-template-columns: 1fr; gap: 4px; }
  .moment-top ol { grid-template-columns: 1fr; }
}
.scroll-video-wrap { max-height: 560px; overflow: auto; }

.interview-times {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e8edef;
}

.interview-times > div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 6px;
}

.interview-times dt {
  color: #8a99a4;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.interview-times dd {
  color: #405a64;
  font: 600 9px var(--font-mono);
  white-space: nowrap;
}

/* Mobile layout: keep every dashboard section inside the viewport instead of
   letting min-content widths turn the page into a scaled desktop canvas. */
@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-layout,
  .top-nav,
  .control-strip,
  .main-viewport,
  .main-viewport > *,
  .sapphire-hero,
  .sapphire-hero-copy,
  .sapphire-section,
  .sapphire-two-column {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .brand-section,
  .brand-logo,
  .brand-text {
    min-width: 0;
    max-width: 100%;
  }

  .brand-section,
  .brand-logo { width: 100%; }

  .brand-text { flex: 1 1 auto; }

  .app-layout {
    margin: 0;
    padding: 10px;
  }

  .header-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-actions .study-mode-btn {
    grid-column: 1 / -1;
  }

  .header-actions .action-btn,
  .header-actions .study-mode-btn {
    width: 100%;
    max-width: 100%;
  }

  .control-strip {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .control-strip::-webkit-scrollbar { display: none; }

  .tabs-nav {
    width: max-content;
    min-width: max-content;
    max-width: none;
  }

  .sapphire-hero h2 {
    overflow-wrap: anywhere;
    font-size: clamp(22px, 7.2vw, 28px);
  }

  .sapphire-hero p {
    font-size: 13px;
  }

  .sapphire-kpis,
  .panel-progress-grid,
  .result-kpi-grid,
  .catalog-client-summary {
    grid-template-columns: 1fr;
  }

  .sapphire-kpi > span,
  .rewind-summary span,
  .panel-progress-head span {
    font-size: 11px;
  }

  .sapphire-kpi p,
  .sapphire-section-head p,
  .rewind-summary em,
  .panel-progress-card p,
  .panel-progress-foot,
  .flow-step small {
    font-size: 11px;
    line-height: 1.5;
  }

  .sapphire-section-head h2 { font-size: 18px; }

  .sapphire-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rewind-table,
  .video-result-table,
  .scroll-video-table {
    min-width: 680px;
  }

  .funnel-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .funnel-filter label {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  .funnel-filter > i { display: none; }

  .moment-card { padding: 16px; }
  .moment-heatmap { overflow-x: auto; }
  .moment-row { min-width: 560px; }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .header-actions { grid-template-columns: 1fr; }
  .header-actions .study-mode-btn { grid-column: auto; }
}
