/* ── Google Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&family=Manrope:wght@400;500;600;700;800&display=swap');

/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Samatva Intelligence Design System */
  --navy:         #090d12;
  --navy-light:   #0f1419;
  --navy-mid:     #1a2535;
  --surface-high: #223040;
  --surface-bright: #2a3a50;

  --accent:       #c6c6ca;
  --accent-dim:   #b8b8bc;
  --accent-hover: #d4d4d8;

  --text:         #dde6f5;
  --text-muted:   #a2acba;
  --bg:           #1e2d40;   /* content area — much lighter */
  --card-bg:      #263347;   /* cards/tables — clearly visible mid-tone */
  --border:       rgba(80, 100, 120, 0.45);
  --border-subtle: rgba(80, 100, 120, 0.28);

  /* Status colours — 4-level traffic-light: green → yellow → orange → red */
  --dark-red:    #ff5c5c;           /* >2 SD  — pure red, critical        */
  --red:         #ff9a3c;           /* >1 SD  — orange, flagged (caution) */
  --yellow:      #ffd54f;           /* 0.5–1 SD — amber, borderline       */
  --green:       #81c784;           /* at/above avg — green               */
  --dark-red-bg: rgba(255, 80, 80,  0.18);
  --red-bg:      rgba(255,154, 60,  0.18);
  --yellow-bg:   rgba(255, 213, 79, 0.15);
  --green-bg:    rgba(129, 199, 132, 0.13);

  /* Glass / overlay tones (used in hardcoded rgba across components) */
  --header-bg:         rgba(9, 13, 18, 0.85);
  --header-border:     rgba(63, 73, 85, 0.3);
  --header-shadow:     rgba(0,0,0,0.3);
  --auth-card-bg:      rgba(22, 29, 38, 0.7);
  --auth-card-border:  rgba(63, 73, 85, 0.2);
  --auth-card-shadow:  rgba(0,0,0,0.5);
  --auth-glow:         rgba(198, 198, 202, 0.04);
  --loading-bg:        rgba(11, 14, 18, 0.88);
  --spinner-track:     rgba(198, 198, 202, 0.12);
  --row-even:          rgba(255,255,255,0.025);
  --row-hover:         rgba(255,255,255,0.05);
  --avatar-bg:         rgba(173, 198, 255, 0.12);
  --avatar-border:     rgba(173, 198, 255, 0.15);
  --avatar-color:      #adc6ff;
  --chip-bg:           rgba(255,255,255,0.04);
  --chip-border:       rgba(255,255,255,0.1);
  --ghost-hover-bg:    rgba(198, 198, 202, 0.07);
  --ghost-border:      rgba(63, 73, 85, 0.45);
  --secondary-bg:      rgba(173, 198, 255, 0.08);
  --secondary-color:   #adc6ff;
  --secondary-border:  rgba(173, 198, 255, 0.22);
  --secondary-hover-bg:rgba(173, 198, 255, 0.14);
  --scrollbar-thumb:   rgba(63, 73, 85, 0.5);
  --scrollbar-hover:   rgba(198, 198, 202, 0.25);

  /* Elevation system */
  --shadow-sm:    none;
  --shadow-md:    none;
  --shadow-lg:    none;
  --shadow-card:  none;
}

/* ── Light Theme ─────────────────────────────────────────────────── */
[data-theme="light"] {
  --navy:         #f8f9fc;
  --navy-light:   #f1f3f8;
  --navy-mid:     #e8ecf4;
  --surface-high: #e2e7f0;
  --surface-bright: #dce1ec;

  --accent:       #3a3f4a;
  --accent-dim:   #4a4f5a;
  --accent-hover: #2a2f3a;

  --text:         #1a1f2e;
  --text-muted:   #6b7280;
  --bg:           #f4f6fb;
  --card-bg:      #ffffff;
  --border:       rgba(0, 0, 0, 0.1);
  --border-subtle: rgba(0, 0, 0, 0.06);

  --dark-red:    #dc2626;
  --red:         #ea580c;
  --yellow:      #ca8a04;
  --green:       #16a34a;
  --dark-red-bg: rgba(220, 38, 38, 0.08);
  --red-bg:      rgba(234, 88, 12, 0.08);
  --yellow-bg:   rgba(202, 138, 4, 0.08);
  --green-bg:    rgba(22, 163, 74, 0.08);

  --header-bg:         rgba(255, 255, 255, 0.92);
  --header-border:     rgba(0, 0, 0, 0.08);
  --header-shadow:     rgba(0,0,0,0.06);
  --auth-card-bg:      rgba(255, 255, 255, 0.95);
  --auth-card-border:  rgba(0, 0, 0, 0.08);
  --auth-card-shadow:  rgba(0,0,0,0.1);
  --auth-glow:         rgba(100, 120, 200, 0.06);
  --loading-bg:        rgba(255, 255, 255, 0.92);
  --spinner-track:     rgba(0, 0, 0, 0.08);
  --row-even:          rgba(0,0,0,0.02);
  --row-hover:         rgba(0,0,0,0.04);
  --avatar-bg:         rgba(59, 130, 246, 0.08);
  --avatar-border:     rgba(59, 130, 246, 0.15);
  --avatar-color:      #3b82f6;
  --chip-bg:           rgba(0,0,0,0.03);
  --chip-border:       rgba(0,0,0,0.08);
  --ghost-hover-bg:    rgba(0, 0, 0, 0.04);
  --ghost-border:      rgba(0, 0, 0, 0.12);
  --secondary-bg:      rgba(59, 130, 246, 0.06);
  --secondary-color:   #3b82f6;
  --secondary-border:  rgba(59, 130, 246, 0.2);
  --secondary-hover-bg:rgba(59, 130, 246, 0.1);
  --scrollbar-thumb:   rgba(0, 0, 0, 0.15);
  --scrollbar-hover:   rgba(0, 0, 0, 0.25);

  /* Elevation system — light mode depth via shadows */
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:    0 2px 4px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:    0 4px 8px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.08);
  --shadow-card:  0 1px 3px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.06);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Auth Screen ──────────────────────────────────────────────────── */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: '';
  position: absolute;
  top: -15%;
  left: -15%;
  width: 55%;
  height: 55%;
  background: var(--auth-glow);
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
}

.auth-screen::after {
  content: '';
  position: absolute;
  bottom: -15%;
  right: -15%;
  width: 55%;
  height: 55%;
  background: var(--auth-glow);
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
}

.auth-card {
  background: var(--auth-card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--auth-card-border);
  border-radius: 12px;
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px var(--auth-card-shadow);
  position: relative;
  z-index: 1;
}

.auth-logo { font-size: 48px; margin-bottom: 16px; }

.auth-card h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 12px;
}

.auth-card p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

#google-signin-btn {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-note {
  font-size: 11px;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ── App Layout ───────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.hidden { display: none !important; }

/* ── Header ───────────────────────────────────────────────────────── */
.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--text);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 8px 32px var(--header-shadow);
}

.header-left { display: flex; align-items: center; gap: 10px; }
.header-icon { font-size: 20px; }
.header-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

.header-right { display: flex; align-items: center; gap: 12px; }
.last-refreshed {
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  color: rgba(162, 172, 186, 0.55);
}
.user-name {
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Tab Navigation ───────────────────────────────────────────────── */
.tab-nav {
  background: var(--navy-light);
  display: flex;
  gap: 2px;
  padding: 0 16px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 14px 18px;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

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

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Content Area ─────────────────────────────────────────────────── */
.tab-content {
  padding: 24px;
  flex: 1;
}

/* ── Section Header ───────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

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

.controls label {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.controls select,
.controls input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-high);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.controls select:focus,
.controls input[type="date"]:focus { border-color: var(--accent); }

.controls select option { background: var(--surface-high); color: var(--text); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 4px;
  padding: 7px 14px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s;
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--secondary-color);
  border: 1px solid var(--secondary-border);
}
.btn-secondary:hover {
  background: var(--secondary-hover-bg);
  border-color: var(--secondary-border);
  color: var(--secondary-color);
  filter: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--ghost-border);
}
.btn-ghost:hover { background: var(--ghost-hover-bg); color: var(--text); }

.supervisor-toggle-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--ghost-border);
  font-size: 12px;
}
.supervisor-toggle-btn:hover { background: var(--ghost-hover-bg); color: var(--text); }
.supervisor-toggle-btn.active {
  background: rgba(52, 168, 83, 0.12);
  color: #4caf69;
  border-color: rgba(52, 168, 83, 0.4);
  font-weight: 600;
}
.supervisor-toggle-btn.active:hover { background: rgba(52, 168, 83, 0.2); }

.tier-mode-btn {
  font-size: 12px;
  background: rgba(251, 146, 60, 0.1);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.3);
}
.tier-mode-btn:hover { background: rgba(251, 146, 60, 0.18); }
.tier-mode-btn.experience {
  background: rgba(192, 132, 252, 0.1);
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.3);
}
.tier-mode-btn.experience:hover { background: rgba(192, 132, 252, 0.18); }
.tier-mode-btn.dd-tier-off {
  background: rgba(150,150,150,0.08);
  color: #888;
  border-color: rgba(150,150,150,0.25);
}
.tier-mode-btn.dd-tier-off:hover { background: rgba(150,150,150,0.15); }

/* Complaint Category chart mode toggle */
.compl-cat-mode-toggle {
  display: flex;
  gap: 4px;
}
.compl-cat-mode-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(251, 146, 60, 0.3);
  background: rgba(251, 146, 60, 0.08);
  color: #fb923c;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.compl-cat-mode-btn:hover { background: rgba(251, 146, 60, 0.18); }
.compl-cat-mode-btn.active {
  background: rgba(251, 146, 60, 0.22);
  border-color: rgba(251, 146, 60, 0.6);
  font-weight: 600;
}

.dd-tier-divider td {
  padding: 10px 12px 6px !important;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.dd-tier-pip {
  display: inline-block;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Loading Overlay ──────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--loading-bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--spinner-track);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Chart Grid ───────────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
}

.chart-card h3 {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.chart-card canvas { max-height: 260px; }

/* ── Summary Cards ────────────────────────────────────────────────── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.summary-card:hover {
  border-color: rgba(198, 198, 202, 0.18);
  background: var(--navy-mid);
}

.summary-card .card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.summary-card .card-label {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 6px;
}

.summary-card.flagged .card-value { color: var(--red); }
.summary-card.serial .card-value  { color: var(--dark-red); }

/* ── Tables ───────────────────────────────────────────────────────── */
.table-section { margin-top: 12px; }

.table-section h3 {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--surface-high);
  color: var(--text-muted);
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  text-align: left;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  touch-action: manipulation;
}

.table-header-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.table-header-label {
  min-width: 0;
}

.table-sort-marker {
  color: var(--text);
  opacity: 0.75;
  font-size: 10px;
  letter-spacing: 0;
}

.table-filter-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.table-filter-btn:hover,
.table-filter-btn:focus-visible,
.table-filter-btn.active {
  background: rgba(173, 198, 255, 0.12);
  border-color: rgba(173, 198, 255, 0.28);
  color: #adc6ff;
  outline: none;
}

.table-filter-popover {
  position: fixed;
  z-index: 12000;
  width: 260px;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(0,0,0,0.46);
}

.table-filter-title {
  margin-bottom: 9px;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.35;
}

.table-filter-select,
.table-filter-input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-high);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}

.table-filter-select {
  padding: 0 9px;
  margin-bottom: 8px;
}

.table-filter-input {
  padding: 0 10px;
}

.table-filter-input:focus,
.table-filter-select:focus {
  border-color: rgba(173, 198, 255, 0.45);
  outline: none;
}

.table-filter-between {
  margin-top: 8px;
}

.table-filter-between.hidden {
  display: none;
}

.table-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.table-filter-clear,
.table-filter-apply {
  height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.table-filter-clear {
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
}

.table-filter-apply {
  border: 1px solid rgba(173, 198, 255, 0.36);
  background: rgba(173, 198, 255, 0.14);
  color: #adc6ff;
}

.table-filter-clear:hover,
.table-filter-clear:focus-visible,
.table-filter-apply:hover,
.table-filter-apply:focus-visible {
  border-color: rgba(173, 198, 255, 0.45);
  outline: none;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  color: var(--text);
}

.data-table tr:nth-child(even) td { background: var(--row-even); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--row-hover); }

/* ── Conditional Formatting Classes ──────────────────────────────── */
/* >2 SD — critical: red bg + left accent bar + bold */
.cell-dark-red {
  background: var(--dark-red-bg) !important;
  color: var(--dark-red);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--dark-red);
}
/* >1 SD — flagged: orange (clearly different hue from red) */
.cell-red {
  background: var(--red-bg) !important;
  color: var(--red);
  font-weight: 600;
}
.cell-yellow { background: var(--yellow-bg) !important; color: var(--yellow); }
.cell-green  { background: var(--green-bg)  !important; color: var(--green);  }

/* Row-level highlight for daily flags */
tr.row-flagged td { background: var(--red-bg) !important; }
tr.row-serial td  { background: var(--dark-red-bg) !important; }
tr.incentive-zero td { opacity: 0.45; }

/* ── Legend ───────────────────────────────────────────────────────── */
.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.badge { font-size: 16px; line-height: 1; }
.badge-dark-red { color: var(--dark-red); }
.badge-red      { color: var(--red); }
.badge-yellow   { color: var(--yellow); }
.badge-green    { color: var(--green); }

/* ── Deep Dive Sections ───────────────────────────────────────────── */
.flow-section {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}

.flow-section-header {
  background: var(--surface-high);
  color: var(--text-muted);
  padding: 11px 20px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Captain Profile ──────────────────────────────────────────────── */

/* Hero card — captain identity + quick stats */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-color);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-hero-info { flex: 1; min-width: 140px; }

.profile-hero-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.profile-hero-id {
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.profile-hero-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.profile-stat { text-align: center; }

.profile-stat-value {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.profile-stat-label {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Metric sparkline cards */
.profile-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 4px;
}

.profile-metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 18px;
  transition: border-color 0.2s;
}

.profile-metric-card:hover {
  border-color: rgba(173, 198, 255, 0.2);
}

.profile-metric-card h4 {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Profile: captain selection bar + chips */
.profile-captain-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
}

.profile-captain-bar select {
  background: var(--surface-high);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  cursor: pointer;
}

.profile-captain-bar select:focus { border-color: rgba(173, 198, 255, 0.45); }
.profile-captain-bar select option { background: var(--surface-high); color: var(--text); }

.profile-captain-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-captain-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 20px;
  padding: 4px 8px 4px 8px;
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.profile-captain-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-captain-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0 0 2px;
  line-height: 1;
  font-size: 15px;
  display: flex;
  align-items: center;
}

.profile-captain-chip-remove:hover { color: #ff6b6b; }

/* Profile: multi-captain hero row (auto-fit for 1–6 captains) */
.profile-heroes-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.profile-heroes-row .profile-hero { margin-bottom: 0; }

/* ── Config Panel ─────────────────────────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.config-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 22px;
  transition: border-color 0.2s;
}

.config-card:hover { border-color: rgba(173, 198, 255, 0.18); }

.config-card-wide { grid-column: 1 / -1; }

.config-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.config-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.config-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  margin: 0;
}

.config-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.config-code {
  display: block;
  background: var(--surface-high);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  word-break: break-all;
  border: 1px solid var(--border);
  color: #adc6ff;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.config-detail-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.config-detail-row:last-child { border-bottom: none; }

.config-detail-value {
  font-size: 13px;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.config-row input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 14px;
  width: 80px;
  font-family: 'Manrope', sans-serif;
  background: var(--surface-high);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.config-row input:focus { border-color: rgba(173, 198, 255, 0.45); }

.config-hint {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.7;
  margin: 0;
}

.config-flow-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(173, 198, 255, 0.08);
  color: #adc6ff;
}

.config-table th { font-size: 10px; }
.config-table td { font-size: 12px; }

/* ── Excluded Captains card ───────────────────────────────────────── */
.config-excl-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.config-excl-input-row input[type="text"] {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: 'Manrope', sans-serif;
  background: var(--surface-high);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  text-transform: uppercase;
}

.config-excl-input-row input[type="text"]::placeholder { text-transform: none; }
.config-excl-input-row input[type="text"]:focus { border-color: rgba(173, 198, 255, 0.45); }

.config-excl-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.config-excl-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(192, 132, 252, 0.1);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.25);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.config-excl-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: opacity 0.15s;
}
.config-excl-tag-remove:hover { opacity: 1; }

/* ── Slab editor ──────────────────────────────────────────────────── */
.config-month-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.config-month-row input[type="month"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Manrope', sans-serif;
  background: var(--surface-high);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.config-month-row input[type="month"]:focus { border-color: rgba(173, 198, 255, 0.45); }

.slab-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.slab-editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.slab-editor-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.slab-editor-table td {
  padding: 4px 4px;
}

.slab-time,
.slab-amount {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: 'Manrope', sans-serif;
  background: var(--surface-high);
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.slab-time   { width: 80px; font-family: 'SF Mono', 'Fira Code', monospace; }
.slab-amount { width: 80px; }
.slab-time:focus,
.slab-amount:focus { border-color: rgba(173, 198, 255, 0.45); }

.slab-saved-msg {
  font-size: 12px;
  font-weight: 700;
  color: #4edea3;
  align-self: center;
}

.slab-threshold-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.slab-threshold-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  background: var(--surface-high);
  color: var(--text);
  outline: none;
  width: 72px;
  transition: border-color 0.15s;
}
.slab-threshold-input:focus { border-color: rgba(173, 198, 255, 0.45); }

/* ── Inventory Health ─────────────────────────────────────────────── */

.stat-icon-purple { background: rgba(192, 132, 252, 0.1); color: #c084fc; }

.inv-section { margin-bottom: 28px; }

/* Heatmap grid */
.inv-heatmap-grid {
  display: grid;
  gap: 3px;
}

.inv-heatmap-cell {
  border-radius: 5px;
  padding: 6px 4px;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  min-width: 38px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.inv-heatmap-cell:hover {
  transform: scale(1.12);
  z-index: 1;
  box-shadow: 0 0 12px rgba(78, 222, 163, 0.25);
}

.inv-heatmap-label {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.inv-heatmap-corner { background: transparent; }

/* Ranking list */
.inv-ranking-list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.inv-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-high);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s;
}

.inv-ranking-item:hover { border-color: rgba(78, 222, 163, 0.25); }

.inv-ranking-rank {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
}

.inv-ranking-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(78, 222, 163, 0.1);
  color: #4edea3;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inv-ranking-info { flex: 1; min-width: 0; }

.inv-ranking-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-ranking-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.inv-ranking-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #4edea3;
  white-space: nowrap;
}

.inv-ranking-bar {
  width: 60px;
  height: 5px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.inv-ranking-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #4edea3;
  transition: width 0.4s ease;
}

/* Rack list */
.inv-rack-list {
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.inv-rack-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface-high);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s;
}

.inv-rack-item:hover { border-color: rgba(192, 132, 252, 0.25); }

.inv-rack-rank {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
}

.inv-rack-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #c084fc;
  min-width: 90px;
}

.inv-rack-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  min-width: 30px;
  text-align: right;
}

.inv-rack-bar {
  flex: 1;
  height: 5px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.inv-rack-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #c084fc;
  transition: width 0.4s ease;
}

.inv-rack-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Complaints Deep Dive ─────────────────────────────────────────── */
.stat-icon-orange { background: rgba(251, 146, 60, 0.1); color: #fb923c; }
.stat-icon-amber  { background: rgba(255, 202, 40, 0.1); color: #ffca28; }

.compl-section { margin-bottom: 32px; }

.compl-table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface-high);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.compl-table-toolbar-label {
  flex-shrink: 0;
  padding-top: 5px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.compl-category-filter-chips {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.compl-category-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(173, 198, 255, 0.2);
  border-radius: 7px;
  background: rgba(173, 198, 255, 0.07);
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  white-space: normal;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.compl-category-filter-btn:hover {
  background: rgba(173, 198, 255, 0.12);
  color: var(--text);
}

.compl-category-filter-btn.active {
  background: rgba(173, 198, 255, 0.18);
  border-color: rgba(173, 198, 255, 0.5);
  color: #adc6ff;
}

.compl-category-filter-btn span {
  color: currentColor;
  opacity: 0.68;
  font-size: 10px;
}

.compl-ranking-list {
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.compl-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface-high);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s;
}

.compl-ranking-item:hover { border-color: rgba(255, 107, 107, 0.25); }

.compl-ranking-rank {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
}

.compl-ranking-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  flex-shrink: 0;
}

.compl-ranking-info { flex: 1; min-width: 0; }

.compl-ranking-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compl-ranking-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compl-ranking-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  min-width: 35px;
  text-align: right;
}

.compl-ranking-bar {
  width: 60px;
  height: 5px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.compl-ranking-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #ff6b6b;
  transition: width 0.4s ease;
}

.compl-rate-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
}

.compl-rate-badge.rate-high   { background: rgba(255, 107, 107, 0.15); color: #ff6b6b; }
.compl-rate-badge.rate-medium { background: rgba(255, 202, 40, 0.15);  color: #ffca28; }
.compl-rate-badge.rate-low    { background: rgba(78, 222, 163, 0.15);  color: #4edea3; }

.compl-selected-category {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.compl-selected-category-count {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.compl-drill-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 5px;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}
.compl-drill-btn:hover,
.compl-drill-btn:focus-visible {
  background: rgba(255, 107, 107, 0.12);
  outline: none;
}
.compl-drill-danger,
.compl-drill-danger-text {
  color: #ff6b6b;
  font-weight: 700;
}
.compl-drill-empty {
  display: inline-block;
  padding: 2px 5px;
}

.compl-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(9, 13, 18, 0.72);
  backdrop-filter: blur(6px);
}

.compl-detail-modal {
  width: min(1120px, 100%);
  max-height: min(760px, calc(100vh - 56px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.48);
}

.compl-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.compl-detail-kicker {
  margin: 0 0 5px;
  color: #ff6b6b;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.compl-detail-header h3 {
  margin: 0;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.compl-detail-subtitle {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.compl-detail-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--surface-high);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.compl-detail-close:hover,
.compl-detail-close:focus-visible {
  border-color: rgba(255, 107, 107, 0.45);
  color: #ff6b6b;
  outline: none;
}

.compl-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.compl-detail-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.compl-detail-table-wrapper {
  border: 0;
  border-radius: 0;
  overflow: auto;
}
.compl-detail-table {
  min-width: 940px;
}
.compl-detail-product {
  min-width: 220px;
}
.compl-detail-rca {
  min-width: 220px;
}

.compl-qng-btn {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.compl-qng-btn.active {
  background: rgba(192, 132, 252, 0.15);
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.4);
}
.compl-qng-btn:not(.active) {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
}

/* ── Placeholder Text ─────────────────────────────────────────────── */
.placeholder-text {
  text-align: center;
  color: var(--text-muted);
  padding: 48px;
  font-size: 15px;
}

/* ── Store Overview — Bento Layout ───────────────────────────────── */
.overview-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.overview-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.overview-breadcrumb-active { color: #adc6ff; }

.overview-title {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.period-toggle {
  display: flex;
  background: var(--surface-high);
  padding: 4px;
  border-radius: 8px;
  gap: 2px;
}

.period-btn {
  padding: 7px 18px;
  border-radius: 6px;
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s;
  letter-spacing: 0.04em;
}

.period-btn.active {
  background: var(--surface-bright);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Stat Cards Row */
.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: rgba(173,198,255,0.2); }
.stat-card.filter-active {
  border-color: rgba(173,198,255,0.45);
  background: rgba(173,198,255,0.06);
  box-shadow: 0 0 0 1px rgba(173,198,255,0.2);
}
.stat-card.filter-active:hover { border-color: rgba(173,198,255,0.6); }

/* "filtered" badge shown inside active card label */
.dd-filter-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #adc6ff;
  background: rgba(173,198,255,0.15);
  border: 1px solid rgba(173,198,255,0.3);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon-blue  { background: rgba(173, 198, 255, 0.1); color: #adc6ff; }
.stat-icon-green { background: rgba(78,  222, 163, 0.1); color: #4edea3; }
.stat-icon-teal  { background: rgba(77,  182, 172, 0.1); color: #4db6ac; }
.stat-icon-red   { background: rgba(255, 180, 171, 0.1); color: #ffb4ab; }

/* Ensure SVG icons align correctly in all contexts */
.tab-btn svg,
.stat-icon svg,
.flow-section-header svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.stat-label {
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.bento-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
}

.bento-large { grid-column: span 8; }
.bento-small { grid-column: span 4; }
.bento-half  { grid-column: span 6; }
.bento-full  { grid-column: span 12; }

.bento-card canvas { max-height: 260px; }

.bento-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.bento-card-title {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.bento-card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.bento-chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-dot-blue   { background: #adc6ff; box-shadow: 0 0 6px rgba(173,198,255,0.5); }
.legend-dot-green  { background: #4edea3; box-shadow: 0 0 6px rgba(78,222,163,0.5); }
.legend-dot-teal   { background: #4edea3; box-shadow: 0 0 6px rgba(78,222,163,0.5); }
.legend-dot-purple { background: #c084fc; box-shadow: 0 0 6px rgba(192,132,252,0.5); }

/* ── Captain Deep Dive ─────────────────────────────────────────────── */
.dd-page-header {
  margin-bottom: 18px;
}

.dd-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

/* Unified filter strip — horizontal glass card */
.dd-controls-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dd-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dd-control-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.dd-control-sep {
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0.5;
}

.dd-control-divider {
  width: 1px;
  height: 22px;
  background: var(--border-subtle);
  margin: 0 10px;
  flex-shrink: 0;
}

.dd-controls-strip select,
.dd-controls-strip input[type="date"] {
  background: var(--surface-high);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.dd-controls-strip select:focus,
.dd-controls-strip input[type="date"]:focus {
  border-color: rgba(173, 198, 255, 0.45);
}

/* ── Tier Analysis Redesign ────────────────────────────────────────────── */

.tiers-op-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Tier bento overview grid — 5 equal columns */
.tiers-bento-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.tier-metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 130px;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.tier-card-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.tier-card-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tier-card-value {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.tier-card-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}

.tier-card-sub {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.65;
  margin: 2px 0 4px;
  font-style: italic;
}

.tier-card-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin: 0;
}

.tier-card-hint.inactive {
  font-style: italic;
  opacity: 0.4;
}

.tier-count-clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
  transition: opacity 0.15s;
}
.tier-count-clickable:hover { opacity: 0.75; }

.tier-shift-popover {
  position: absolute;
  z-index: 9999;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 240px;
  max-width: 300px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.tier-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--card-bg);
}
.tier-popover-count {
  background: var(--surface-high);
  color: var(--text);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}
.tier-popover-list {
  list-style: none;
  padding: 4px 0;
  margin: 0;
}
.tier-popover-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
}
.tier-popover-list li:hover { background: var(--surface-high); }
.tier-popover-name {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tier-popover-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
}

/* Flow section headers */
.tiers-flow-section {
  margin-bottom: 24px;
}

.tiers-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tiers-section-pip {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tiers-section-title {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
}

/* Compact tiers table */
.tiers-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 3px;
  font-size: 12px;
  padding: 0 10px 10px;
}

.tiers-table thead tr th {
  padding: 12px 10px 8px;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.tiers-table thead tr th:hover { color: var(--text); }
.tiers-table thead tr th:active { opacity: 0.6; }

.tiers-table tbody tr {
  transition: background 0.12s;
}

.tiers-table tbody tr td {
  padding: 10px 10px;
  background: var(--row-even);
  vertical-align: middle;
}

.tiers-table tbody tr td:first-child { border-radius: 8px 0 0 8px; }
.tiers-table tbody tr td:last-child  { border-radius: 0 8px 8px 0; }
.tiers-table tbody tr:hover td { background: var(--row-hover); }

.tiers-tier-name {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 12px;
}

.tiers-row-empty td {
  opacity: 0.35;
}

.tiers-pct {
  font-size: 10px;
  opacity: 0.6;
  margin-left: 3px;
}

/* Cell color classes for tiers table */
.tiers-cell-best  { color: #4edea3; }
.tiers-cell-worst { color: #ff6b6b; }
.tiers-cell-mid   { color: #ffca28; }
.tiers-cell-muted { opacity: 0.35; }

.tiers-hist-avg {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.65;
}

/* Putting bento */
.tiers-putting-bento {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  align-items: start;
}

.tiers-putting-hero {
  background: rgba(29, 31, 38, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  border-left: 3px solid #4d8eff;
}

.tiers-hero-value {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #adc6ff;
  margin: 6px 0 4px;
}

.tiers-iph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.tier-iph-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
}

.tier-iph-value {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin: 4px 0;
}

.tier-iph-bar-bg {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0 4px;
}

.tier-iph-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

@media (max-width: 1024px) {
  .tiers-bento-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .tiers-bento-grid { grid-template-columns: repeat(2, 1fr); }
  .tiers-putting-bento { grid-template-columns: 1fr; }
}

/* ── Unified Tab Headers / Attendance ─────────────────────────────────── */

.flags-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.flags-fleet-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 4px;
}

.flags-title {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  margin: 0;
}

.flags-date-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 16px;
}

.flags-date-strip input[type="date"],
.flags-date-strip input[type="month"],
.flags-date-strip select {
  background: var(--surface-high);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  cursor: pointer;
}

.flags-date-strip input[type="date"]:focus,
.flags-date-strip input[type="month"]:focus,
.flags-date-strip select:focus {
  border-color: rgba(173, 198, 255, 0.45);
}

/* Thin vertical separator inside the strip */
.strip-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 6px;
  flex-shrink: 0;
}

/* Dash separator between From / To */
.dd-control-sep {
  color: var(--text-muted);
  opacity: 0.5;
  font-size: 13px;
}

/* Bento metrics grid — 3 equal columns */
.flags-bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

/* Individual metric card */
.flags-metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flags-metric-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.flags-metric-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.flags-metric-value {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.flags-metric-value.color-blue  { color: #adc6ff; }
.flags-metric-value.color-red   { color: #ff6b6b; }
.flags-metric-value.color-amber { color: #ffca28; }
.flags-metric-value.color-teal  { color: #4edea3; }

.flags-metric-value.small       { font-size: 28px; }

.flags-metric-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Operational alerts section */
.flags-alerts-section {
  margin-bottom: 24px;
}

.flags-alerts-title {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px 0;
}

/* Captain alert cards */
.flags-alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flags-captain-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background 0.15s;
}

.flags-captain-card:hover {
  background: var(--surface-bright);
}

.flags-captain-card.severity-critical {
  border-left: 3px solid #ff6b6b;
}

.flags-captain-card.severity-flagged {
  border-left: 3px solid #ffca28;
}

.flags-captain-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--avatar-bg);
  border: 1px solid var(--avatar-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--avatar-color);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.flags-captain-avatar.critical {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.flags-captain-body {
  flex: 1;
  min-width: 0;
}

.flags-captain-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.flags-captain-name {
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flags-captain-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.flags-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.flags-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.flags-tag.flow  { background: rgba(173,198,255,0.08); color: #adc6ff; border: 1px solid rgba(173,198,255,0.15); }
.flags-tag.alert { background: rgba(255,107,107,0.1);  color: #ff6b6b; border: 1px solid rgba(255,107,107,0.2); }
.flags-tag.warn  { background: rgba(255,202,40,0.1);   color: #ffca28; border: 1px solid rgba(255,202,40,0.2); }

.flags-score-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.flags-dev-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 700px) {
  .flags-bento-grid { grid-template-columns: 1fr; }
  .flags-metric-value { font-size: 28px; }
  .flags-metric-value.small { font-size: 24px; }
}

.attendance-summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.attendance-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.attendance-hint {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.attendance-table {
  width: 100%;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.attendance-shell {
  display: block;
  width: 100%;
}

.attendance-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--card-bg);
}

.attendance-table th,
.attendance-table td {
  text-align: center;
  padding: 8px 10px;
}

.attendance-table thead th {
  position: sticky;
  top: 56px;
  z-index: 8;
  cursor: pointer;
  height: 58px;
}

.attendance-table tfoot td {
  background: var(--surface-high);
  border-top: 1px solid var(--border);
  font-weight: 800;
  height: 48px;
}

.attendance-table tbody tr {
  height: 74px;
}

.attendance-table tbody td {
  height: 74px;
}

.attendance-id-col,
.attendance-name-col {
  text-align: left !important;
  overflow: hidden;
}

th.attendance-id-col,
td.attendance-id-col {
  width: 128px;
  min-width: 128px;
  max-width: 128px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

th.attendance-name-col,
td.attendance-name-col {
  width: 236px;
  min-width: 236px;
  max-width: 236px;
}

.attendance-date-col {
  width: 132px;
  min-width: 132px;
}

.attendance-date-col span,
.attendance-date-col strong {
  display: block;
}

.attendance-date-col strong {
  color: var(--text);
  font-size: 11px;
  margin-top: 2px;
  letter-spacing: 0;
  text-transform: none;
}

.attendance-status-cell {
  width: 132px;
  min-width: 132px;
  vertical-align: middle;
}

.attendance-cell-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.attendance-select {
  width: 116px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 22px 4px 10px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.attendance-select.status-manual {
  background: var(--surface-high);
  color: var(--text);
  border-color: var(--border);
}

.attendance-select.manual {
  box-shadow: inset 0 0 0 1px rgba(173, 198, 255, 0.35);
}

.attendance-captain-trigger {
  display: block;
  max-width: 160px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.attendance-captain-trigger .captain-name {
  transition: color 0.15s ease;
}

.attendance-captain-trigger .captain-id {
  letter-spacing: 0;
}

.attendance-captain-trigger:hover .captain-name,
.attendance-captain-trigger[aria-expanded="true"] .captain-name {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

.attendance-captain-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.attendance-time-popover {
  position: absolute;
  z-index: 10000;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(0,0,0,0.55);
}

.attendance-time-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-high);
}

.attendance-time-title {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.attendance-time-sub {
  margin-top: 3px;
  color: var(--text-muted);
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.attendance-time-total {
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.attendance-time-rows {
  display: grid;
  gap: 6px;
  padding: 10px 12px 12px;
}

.attendance-time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px 52px;
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}

.attendance-time-row.is-total {
  border-color: rgba(173, 198, 255, 0.28);
  background: rgba(173, 198, 255, 0.08);
}

.attendance-time-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.attendance-time-hours,
.attendance-time-percent {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.attendance-time-row.is-total .attendance-time-hours,
.attendance-time-row.is-total .attendance-time-percent {
  color: var(--accent);
}

.attendance-time-bar {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(173, 198, 255, 0.12);
}

.attendance-time-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #4edea3);
}

.attendance-auto-line {
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.01em;
  opacity: 0.92;
}

.attendance-auto-line.status-full { color: var(--green); }
.attendance-auto-line.status-half { color: #93c5fd; }
.attendance-auto-line.status-off  { color: var(--yellow); }
.attendance-auto-line.status-na   { color: var(--text-muted); }
.attendance-auto-line.status-leave { color: var(--dark-red); }
.attendance-auto-line.status-hours { color: #ffd7b0; }

.attendance-select.status-full {
  background: rgba(129, 199, 132, 0.22);
  color: var(--green);
}

.attendance-select.status-half {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

.attendance-select.status-off {
  background: rgba(255, 213, 79, 0.20);
  color: var(--yellow);
}

.attendance-select.status-na {
  background: rgba(198, 198, 202, 0.16);
  color: var(--text-muted);
}

.attendance-select.status-leave {
  background: rgba(255, 92, 92, 0.16);
  color: var(--dark-red);
}

.attendance-select.status-hours {
  background: rgba(154, 91, 36, 0.55);
  color: #ffd7b0;
}

.attendance-total-label {
  text-align: left !important;
  color: var(--text);
}

.attendance-total-cell {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.attendance-summary-col,
.attendance-summary-head {
  width: 112px;
  min-width: 112px;
  text-align: center !important;
}

.attendance-type-col,
.attendance-type-head,
.attendance-bonus-col,
.attendance-bonus-head {
  width: 132px;
  min-width: 132px;
  text-align: center !important;
}

.attendance-reason-col,
.attendance-reason-head {
  width: 160px;
  min-width: 160px;
  text-align: center !important;
}

.attendance-bonus-ok {
  color: var(--green);
}

.attendance-bonus-blocked {
  color: var(--yellow);
}

.attendance-sort-icon {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0;
  margin-left: 4px;
}

.attendance-sortable:hover {
  color: var(--text);
}

@media (max-width: 1100px) {
  .attendance-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .attendance-summary-grid { grid-template-columns: 1fr; }
  th.attendance-name-col,
  td.attendance-name-col {
    width: 196px;
    min-width: 196px;
    max-width: 196px;
  }
  .attendance-date-col,
  .attendance-status-cell {
    width: 122px;
    min-width: 122px;
  }
  .attendance-select {
    width: 106px;
    font-size: 11px;
  }
}

/* Captain avatar initials */
.captain-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--avatar-bg);
  border: 1px solid var(--avatar-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: var(--avatar-color);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.captain-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captain-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  letter-spacing: -0.1px;
}

.captain-id {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Score badges */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.score-badge-ok {
  background: rgba(78, 222, 163, 0.1);
  border: 1px solid rgba(78, 222, 163, 0.25);
  color: #4edea3;
}

.score-badge-warn {
  background: rgba(255, 213, 79, 0.1);
  border: 1px solid rgba(255, 213, 79, 0.25);
  color: #ffd54f;
}

.score-badge-critical {
  background: rgba(238, 125, 119, 0.12);
  border: 1px solid rgba(238, 125, 119, 0.3);
  color: #ee7d77;
}

/* Status badges */
.status-badge {
  padding: 3px 9px;
  border-radius: 4px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-ok         { background: rgba(78, 222, 163, 0.1);  color: #4edea3; }
.status-warn       { background: rgba(255, 213, 79, 0.1);  color: #ffd54f; }
.status-borderline { background: rgba(255, 213, 79, 0.12); color: #ffd54f; }
.status-flagged    { background: rgba(238, 125, 119, 0.1); color: #ee7d77; }
.status-critical   { background: rgba(255, 100, 100, 0.12); color: #ff6b6b; }

/* DD spaced-row table */
.dd-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  font-size: 13px;
  padding: 0 12px 12px;
}

.dd-table th {
  background: transparent;
  color: var(--text-muted);
  padding: 10px 12px;
  text-align: left;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.dd-table th:hover { color: var(--text); }
.dd-table th:active { opacity: 0.6; }

.dd-table td {
  padding: 10px 12px;
  background: var(--row-even);
  white-space: nowrap;
  color: var(--text);
  border: none;
  transition: background 0.15s;
}

.dd-table td:first-child { border-radius: 8px 0 0 8px; }
.dd-table td:last-child  { border-radius: 0 8px 8px 0; }

.dd-table tr:hover td { background: var(--row-hover); }

/* Flag overrides for dd-table */
.dd-table .cell-dark-red {
  background: var(--dark-red-bg) !important;
  color: var(--dark-red);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--dark-red);
}
.dd-table .cell-red    { background: var(--red-bg)    !important; color: var(--red);    font-weight: 600; }
.dd-table .cell-yellow { background: var(--yellow-bg) !important; color: var(--yellow); }
.dd-table .cell-green  { background: var(--green-bg)  !important; color: var(--green);  }

/* Flow section header */
.flow-section-header {
  background: var(--surface-high);
  color: var(--text-muted);
  padding: 14px 20px;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ── Theme Toggle ────────────────────────────────────────────────── */
.theme-toggle-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--ghost-border);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.theme-toggle-btn:hover {
  background: var(--ghost-hover-bg);
  color: var(--text);
}

/* Dark mode: show sun (switch to light), hide moon */
.theme-icon-sun  { display: inline-block; }
.theme-icon-moon { display: none; }

/* Light mode: show moon (switch to dark), hide sun */
[data-theme="light"] .theme-icon-sun  { display: none; }
[data-theme="light"] .theme-icon-moon { display: inline-block; }

/* Smooth theme transition */
body,
.app-header,
.tab-nav,
.tab-content,
.auth-screen,
.auth-card,
.loading-overlay,
.stat-card,
.bento-card,
.chart-card,
.summary-card,
.flow-section,
.flow-section-header,
.profile-hero,
.profile-metric-card,
.config-card,
.flags-captain-card,
.flags-metric-card,
.attendance-shell,
.attendance-select,
.attendance-captain-trigger,
.attendance-time-popover,
.attendance-time-row,
.attendance-time-bar,
.attendance-table th,
.attendance-table td,
.tier-metric-card,
.dd-controls-strip,
.profile-captain-bar,
.flags-date-strip,
.inv-ranking-item,
.inv-rack-item,
.compl-ranking-item,
.compl-table-toolbar,
.compl-category-filter-btn,
.compl-drill-btn,
.compl-detail-modal,
.compl-detail-close,
.table-filter-btn,
.table-filter-popover,
.tier-shift-popover,
.data-table th,
.data-table td {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ─── Light Mode — Elite Design Overrides ──────────────────────── */

/* Card elevation — shadows create depth hierarchy on white */
[data-theme="light"] .stat-card,
[data-theme="light"] .bento-card,
[data-theme="light"] .chart-card,
[data-theme="light"] .summary-card,
[data-theme="light"] .profile-hero,
[data-theme="light"] .profile-metric-card,
[data-theme="light"] .config-card,
[data-theme="light"] .flags-metric-card,
[data-theme="light"] .attendance-shell,
[data-theme="light"] .tier-metric-card,
[data-theme="light"] .tier-iph-card,
[data-theme="light"] .flow-section,
[data-theme="light"] .inv-ranking-item,
[data-theme="light"] .inv-rack-item,
[data-theme="light"] .compl-ranking-item {
  box-shadow: var(--shadow-card);
  border-color: transparent;
}

[data-theme="light"] .compl-table-toolbar {
  background: #ffffff;
  border-color: rgba(0,0,0,0.06);
}

[data-theme="light"] .compl-category-filter-btn {
  background: rgba(59, 130, 246, 0.04);
  border-color: rgba(59, 130, 246, 0.14);
  color: #64748b;
}

[data-theme="light"] .compl-category-filter-btn:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #1e293b;
}

[data-theme="light"] .compl-category-filter-btn.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: #2563eb;
}

[data-theme="light"] .stat-card:hover,
[data-theme="light"] .bento-card:hover,
[data-theme="light"] .summary-card:hover,
[data-theme="light"] .profile-metric-card:hover,
[data-theme="light"] .config-card:hover,
[data-theme="light"] .inv-ranking-item:hover,
[data-theme="light"] .inv-rack-item:hover,
[data-theme="light"] .compl-ranking-item:hover {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

/* Header — frosted white glass */
[data-theme="light"] .app-header {
  box-shadow: 0 1px 0 var(--header-border), 0 4px 16px rgba(0,0,0,0.04);
}

/* Tab navigation — crisp active indicator */
[data-theme="light"] .tab-nav {
  background: #ffffff;
  border-bottom-color: rgba(0,0,0,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
[data-theme="light"] .tab-btn.active {
  color: #1e40af;
  border-bottom-color: #3b82f6;
}
[data-theme="light"] .tab-btn:hover {
  color: #1a1f2e;
}

/* Flags captain cards — subtle elevation with left accent */
[data-theme="light"] .flags-captain-card {
  box-shadow: var(--shadow-sm);
  border-color: transparent;
}
[data-theme="light"] .flags-captain-card:hover {
  box-shadow: var(--shadow-md);
}
[data-theme="light"] .flags-captain-card.severity-critical { border-left: 3px solid #dc2626; }
[data-theme="light"] .flags-captain-card.severity-flagged  { border-left: 3px solid #ca8a04; }

/* Control strips — subtle inset feel */
[data-theme="light"] .dd-controls-strip,
[data-theme="light"] .flags-date-strip,
[data-theme="light"] .profile-captain-bar {
  background: #f8f9fc;
  border-color: rgba(0,0,0,0.06);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}

/* Flow section headers — lighter, more refined */
[data-theme="light"] .flow-section-header {
  background: #f1f5f9;
  border-bottom-color: rgba(0,0,0,0.06);
  color: #475569;
}

/* Table refinements */
[data-theme="light"] .data-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .dd-table th {
  color: #475569;
}
[data-theme="light"] .table-wrapper {
  box-shadow: var(--shadow-sm);
  border-color: transparent;
}
[data-theme="light"] .table-filter-btn:hover,
[data-theme="light"] .table-filter-btn:focus-visible,
[data-theme="light"] .table-filter-btn.active {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.22);
  color: #3b82f6;
}
[data-theme="light"] .table-filter-popover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .table-filter-select,
[data-theme="light"] .table-filter-input {
  background: #f8fafc;
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .table-filter-apply {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.24);
  color: #2563eb;
}
[data-theme="light"] .tiers-table thead tr th {
  color: #475569;
  border-bottom-color: rgba(0,0,0,0.08);
}

/* Tier popover */
[data-theme="light"] .tier-shift-popover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .compl-detail-backdrop {
  background: rgba(15, 23, 42, 0.32);
}

[data-theme="light"] .compl-detail-modal {
  box-shadow: var(--shadow-lg);
  border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .compl-detail-summary span {
  background: rgba(15,23,42,0.04);
}

[data-theme="light"] .attendance-time-popover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .attendance-time-row {
  background: rgba(15,23,42,0.02);
}

[data-theme="light"] .attendance-time-row.is-total {
  background: rgba(37,99,235,0.07);
}

[data-theme="light"] .attendance-time-bar {
  background: rgba(37,99,235,0.12);
}

/* Period toggle pill */
[data-theme="light"] .period-toggle {
  background: #f1f5f9;
}
[data-theme="light"] .period-btn.active {
  background: #ffffff;
  color: #1a1f2e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Form controls */
[data-theme="light"] .controls select,
[data-theme="light"] .controls input[type="date"],
[data-theme="light"] .dd-controls-strip select,
[data-theme="light"] .dd-controls-strip input[type="date"],
[data-theme="light"] .flags-date-strip select,
[data-theme="light"] .flags-date-strip input[type="date"],
[data-theme="light"] .flags-date-strip input[type="month"],
[data-theme="light"] .profile-captain-bar select {
  background: #ffffff;
  border-color: rgba(0,0,0,0.12);
  color: #1a1f2e;
}
[data-theme="light"] .controls select:focus,
[data-theme="light"] .controls input[type="date"]:focus,
[data-theme="light"] .dd-controls-strip select:focus,
[data-theme="light"] .dd-controls-strip input[type="date"]:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* Overview breadcrumb active */
[data-theme="light"] .overview-breadcrumb-active { color: #3b82f6; }

/* Stat icons — refined with tinted backgrounds */
[data-theme="light"] .stat-icon-blue  { background: rgba(59, 130, 246, 0.08); color: #3b82f6; }
[data-theme="light"] .stat-icon-green { background: rgba(22, 163, 74, 0.08);  color: #16a34a; }
[data-theme="light"] .stat-icon-teal  { background: rgba(13, 148, 136, 0.08); color: #0d9488; }
[data-theme="light"] .stat-icon-red   { background: rgba(220, 38, 38, 0.08);  color: #dc2626; }
[data-theme="light"] .stat-icon-purple { background: rgba(124, 58, 237, 0.08); color: #7c3aed; }
[data-theme="light"] .stat-icon-orange { background: rgba(234, 88, 12, 0.08); color: #ea580c; }
[data-theme="light"] .stat-icon-amber  { background: rgba(202, 138, 4, 0.08); color: #ca8a04; }

/* Legend dots — solid, no glow */
[data-theme="light"] .legend-dot-blue   { background: #3b82f6; box-shadow: none; }
[data-theme="light"] .legend-dot-green  { background: #16a34a; box-shadow: none; }
[data-theme="light"] .legend-dot-teal   { background: #0d9488; box-shadow: none; }
[data-theme="light"] .legend-dot-purple { background: #7c3aed; box-shadow: none; }

/* Score badges */
[data-theme="light"] .score-badge-ok {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.2);
  color: #16a34a;
}
[data-theme="light"] .score-badge-warn {
  background: rgba(202, 138, 4, 0.08);
  border-color: rgba(202, 138, 4, 0.2);
  color: #ca8a04;
}
[data-theme="light"] .score-badge-critical {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.2);
  color: #dc2626;
}

/* Status badges */
[data-theme="light"] .status-ok         { background: rgba(22, 163, 74, 0.08);  color: #16a34a; }
[data-theme="light"] .status-flagged    { background: rgba(220, 38, 38, 0.06);  color: #dc2626; }
[data-theme="light"] .status-critical   { background: rgba(220, 38, 38, 0.08);  color: #b91c1c; }
[data-theme="light"] .status-warn       { background: rgba(202, 138, 4, 0.08);  color: #ca8a04; }
[data-theme="light"] .status-borderline { background: rgba(202, 138, 4, 0.1);   color: #b45309; }

/* Flags section */
[data-theme="light"] .flags-metric-value.color-blue  { color: #3b82f6; }
[data-theme="light"] .flags-metric-value.color-red   { color: #dc2626; }
[data-theme="light"] .flags-metric-value.color-amber { color: #ca8a04; }
[data-theme="light"] .flags-metric-value.color-teal  { color: #0d9488; }

[data-theme="light"] .flags-tag.flow  { background: rgba(59,130,246,0.06); color: #3b82f6; border-color: rgba(59,130,246,0.15); }
[data-theme="light"] .flags-tag.alert { background: rgba(220,38,38,0.06);  color: #dc2626; border-color: rgba(220,38,38,0.15); }
[data-theme="light"] .flags-tag.warn  { background: rgba(202,138,4,0.06);  color: #ca8a04; border-color: rgba(202,138,4,0.15); }

[data-theme="light"] .flags-captain-avatar.critical {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}

[data-theme="light"] td.attendance-id-col,
[data-theme="light"] td.attendance-name-col {
  background: #ffffff;
}

[data-theme="light"] .attendance-id-col,
[data-theme="light"] .attendance-name-col,
[data-theme="light"] .attendance-table tfoot td {
  background: #f8fafc;
}

[data-theme="light"] .attendance-select.status-full {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

[data-theme="light"] .attendance-select.status-half {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

[data-theme="light"] .attendance-select.status-off {
  background: rgba(202, 138, 4, 0.14);
  color: #a16207;
}

[data-theme="light"] .attendance-select.status-na {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
}

[data-theme="light"] .attendance-select.status-leave {
  background: rgba(220, 38, 38, 0.10);
  color: #b91c1c;
}

[data-theme="light"] .attendance-select.status-hours {
  background: rgba(146, 64, 14, 0.14);
  color: #92400e;
}

/* Deep Dive filter badge */
[data-theme="light"] .dd-filter-badge {
  color: #3b82f6;
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.2);
}

[data-theme="light"] .stat-card.filter-active {
  border-color: rgba(59,130,246,0.35) !important;
  background: rgba(59,130,246,0.04);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.15), var(--shadow-card);
}

/* Toggle buttons */
[data-theme="light"] .supervisor-toggle-btn.active {
  background: rgba(22, 163, 74, 0.08);
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.3);
}

[data-theme="light"] .tier-mode-btn {
  background: rgba(234, 88, 12, 0.06);
  color: #ea580c;
  border-color: rgba(234, 88, 12, 0.2);
}
[data-theme="light"] .tier-mode-btn.experience {
  background: rgba(124, 58, 237, 0.06);
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.2);
}
[data-theme="light"] .tier-mode-btn.dd-tier-off {
  background: rgba(0,0,0,0.03);
  color: #9ca3af;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .compl-cat-mode-btn {
  background: rgba(234, 88, 12, 0.05);
  color: #ea580c;
  border-color: rgba(234, 88, 12, 0.2);
}
[data-theme="light"] .compl-cat-mode-btn:hover { background: rgba(234, 88, 12, 0.1); }
[data-theme="light"] .compl-cat-mode-btn.active {
  background: rgba(234, 88, 12, 0.15);
  border-color: rgba(234, 88, 12, 0.5);
}

/* Tier Analysis */
[data-theme="light"] .tiers-putting-hero {
  background: rgba(59, 130, 246, 0.03);
  border-color: rgba(59, 130, 246, 0.1);
  border-left-color: #3b82f6;
}
[data-theme="light"] .tiers-hero-value { color: #3b82f6; }
[data-theme="light"] .tiers-cell-best  { color: #16a34a; }
[data-theme="light"] .tiers-cell-worst { color: #dc2626; }
[data-theme="light"] .tiers-cell-mid   { color: #ca8a04; }

/* Config panel */
[data-theme="light"] .config-code {
  background: #f8fafc;
  color: #3b82f6;
  border-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .config-flow-tag {
  background: rgba(59, 130, 246, 0.06);
  color: #3b82f6;
}

/* Inventory Health */
[data-theme="light"] .inv-ranking-avatar { background: rgba(22, 163, 74, 0.08); color: #16a34a; }
[data-theme="light"] .inv-rack-code      { color: #7c3aed; }
[data-theme="light"] .inv-ranking-value  { color: #16a34a; }
[data-theme="light"] .inv-ranking-bar-fill  { background: #16a34a; }
[data-theme="light"] .inv-rack-bar-fill     { background: #7c3aed; }
[data-theme="light"] .compl-ranking-bar-fill { background: #dc2626; }

/* Complaints */
[data-theme="light"] .compl-rate-badge.rate-high   { background: rgba(220, 38, 38, 0.08); color: #dc2626; }
[data-theme="light"] .compl-rate-badge.rate-medium { background: rgba(202, 138, 4, 0.08);  color: #ca8a04; }
[data-theme="light"] .compl-rate-badge.rate-low    { background: rgba(22, 163, 74, 0.08);  color: #16a34a; }

/* Heatmap cells — softer on white */
[data-theme="light"] .inv-heatmap-cell:hover {
  box-shadow: 0 0 8px rgba(0,0,0,0.12);
}

/* Section headers — Tier/Inventory/Complaints pips */
[data-theme="light"] .tiers-section-title { color: #334155; }

/* DD tier divider rows */
[data-theme="light"] .dd-tier-divider td {
  background: #f8fafc;
  border-bottom-color: rgba(0,0,0,0.06);
}

/* QNG toggle */
[data-theme="light"] .compl-qng-btn.active {
  background: rgba(124,58,237,0.06);
  color: #7c3aed;
  border-color: rgba(124,58,237,0.25);
}
[data-theme="light"] .compl-qng-btn:not(.active) {
  background: rgba(220,38,38,0.05);
  color: #dc2626;
  border-color: rgba(220,38,38,0.2);
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Header */
  .app-header { padding: 0 12px; height: 52px; }
  .header-title { font-size: 14px; }
  .header-subtitle { display: none; }
  .last-refreshed { display: none; }
  .user-name { font-size: 12px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-right { gap: 8px; }

  /* Tab nav */
  .tab-nav { padding: 0 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 12px 12px; font-size: 9px; }

  /* Content */
  .tab-content { padding: 12px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-header h2 { font-size: 17px; }

  /* Date strip wraps on mobile */
  .flags-date-strip { flex-wrap: wrap; }

  /* Controls */
  .controls { flex-direction: column; align-items: flex-start; width: 100%; }
  .controls select,
  .controls input[type="date"] { width: 100%; font-size: 15px; padding: 9px 10px; }
  .controls .btn { width: 100%; text-align: center; padding: 9px; }

  /* Charts */
  .chart-grid { grid-template-columns: 1fr; gap: 12px; }
  .chart-card { padding: 14px; }
  .chart-card canvas { max-height: 200px; }

  /* Bento grid — stack on mobile */
  .bento-grid { grid-template-columns: 1fr; gap: 12px; }
  .bento-large, .bento-small, .bento-half, .bento-full { grid-column: span 1; }
  .bento-card { padding: 16px; }
  .bento-card-header { flex-direction: column; gap: 8px; }
  .stat-cards-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 16px; }
  .stat-value { font-size: 20px; }
  .overview-title { font-size: 22px; }

  /* Summary cards — 2 columns on mobile */
  .summary-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .summary-card { padding: 14px 10px; }
  .summary-card .card-value { font-size: 26px; }

  /* Tables */
  .table-wrapper { -webkit-overflow-scrolling: touch; }
  .compl-table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .compl-category-filter-chips { justify-content: flex-start; }
  .compl-category-filter-btn { max-width: 100%; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .data-table th { min-height: 44px; padding: 10px 12px; }
  .data-table th:active { opacity: 0.6; }
  .dd-table th { min-height: 44px; }
  .tiers-table thead tr th { min-height: 44px; }

  /* Profile metric grid */
  .profile-metric-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Config */
  .config-grid { grid-template-columns: 1fr; }
  .config-card-wide { grid-column: auto; }

  /* Inventory Health */
  .inv-heatmap-grid { overflow-x: auto; }

  /* Flow sections */
  .flow-section-header { padding: 10px 14px; font-size: 9px; }

  /* Key Metrics */
  .km-score-row { grid-template-columns: 1fr; }
  .km-grid-2 { grid-template-columns: 1fr; }
  .km-hour-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Key Metrics (SLA Command Center) ───────────────────────────────── */
.km-score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.km-score-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.km-score-card.km-tier-sla2     { border-left-color: #34d399; }
.km-score-card.km-tier-sla1     { border-left-color: #22d3ee; }
.km-score-card.km-tier-baseline { border-left-color: #fbbf24; }
.km-score-card.km-tier-below    { border-left-color: #f87171; }
.km-score-card.km-tier-na       { border-left-color: #6b7280; opacity: 0.92; }
.km-score-card.km-soon { opacity: 0.7; }
.km-score-head { display: flex; justify-content: space-between; align-items: center; }
.km-score-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.km-score-badge {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--text-muted);
  white-space: nowrap;
}
.km-tier-sla2 .km-score-badge     { background: rgba(52,211,153,0.16); color: #34d399; }
.km-tier-sla1 .km-score-badge     { background: rgba(34,211,238,0.16); color: #22d3ee; }
.km-tier-baseline .km-score-badge { background: rgba(251,191,36,0.16); color: #fbbf24; }
.km-tier-below .km-score-badge    { background: rgba(248,113,113,0.16); color: #f87171; }
.km-score-value { font-size: 2.4rem; font-weight: 800; line-height: 1.1; margin: 8px 0 2px; color: var(--text); }
.km-score-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.km-score-foot { font-size: 0.72rem; color: var(--text); margin-top: 10px; opacity: 0.85; }

/* Three-tier ladder on each scorecard */
.km-ladder { display: flex; gap: 6px; margin-top: 12px; }
.km-ladder-step {
  flex: 1; display: flex; flex-direction: column; gap: 1px; align-items: center;
  padding: 5px 4px; border-radius: 7px; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
}
.km-ladder-step.km-ladder-hit { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.4); }
.km-ladder-lbl { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.km-ladder-hit .km-ladder-lbl { color: #34d399; }
.km-ladder-val { font-size: 0.78rem; font-weight: 700; color: var(--text); }

/* Config: SLA target table */
.sla-target-table th:not(:first-child), .sla-target-table td:not(:first-child) { text-align: center; }
.sla-target-table .slab-threshold-input { width: 90px; }

.km-section { margin-bottom: 28px; }
.km-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.km-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px 18px;
}
.km-card-muted { background: transparent; border-style: dashed; }
.km-block-title { font-size: 0.82rem; font-weight: 700; color: var(--text); margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.km-target-line { font-size: 0.66rem; font-weight: 500; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.km-table-block { margin-top: 18px; }
.km-help { font-size: 0.72rem; color: var(--text-muted); line-height: 1.55; margin: 6px 0 0; }

/* Cycle trend bars */
.km-trend-block { margin-bottom: 6px; }
.km-trend-row { display: flex; gap: 10px; align-items: flex-end; }
.km-trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.km-trend-bar-wrap { height: 90px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.km-trend-bar { width: 60%; min-height: 2px; border-radius: 4px 4px 0 0; transition: height 0.3s; }
.km-trend-pct { font-size: 0.7rem; font-weight: 700; color: var(--text); }
.km-trend-lbl { font-size: 0.62rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.km-trend-active .km-trend-pct { color: #60a5fa; }
.km-trend-active .km-trend-lbl { color: #60a5fa; font-weight: 700; }

/* Hourly breakdown — refined cards */
.km-hour-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.km-hour-legend { display: flex; gap: 14px; font-size: 0.66rem; color: var(--text-muted); }
.km-hour-legend span { display: inline-flex; align-items: center; gap: 5px; }
.km-hour-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.km-hour-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.km-hour-card {
  position: relative; border-radius: 12px; padding: 12px 13px 11px;
  background: color-mix(in srgb, var(--km-accent) 9%, var(--card-bg));
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--km-accent);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.km-hour-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.28); }
.km-hour-empty { background: var(--card-bg); border-left-color: var(--border); opacity: 0.55; }
.km-hour-top { display: flex; align-items: center; justify-content: space-between; }
.km-hour-time { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em; color: var(--text-muted); }
.km-hour-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--km-accent); }
.km-hour-pct { font-size: 1.7rem; font-weight: 800; line-height: 1.1; margin: 4px 0 10px; color: var(--km-accent); }
.km-hour-pct-unit { font-size: 0.85rem; font-weight: 700; opacity: 0.7; margin-left: 1px; }
.km-hour-empty-note { font-size: 0.66rem; color: var(--text-muted); }

.km-hour-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.km-hour-stat {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  padding: 5px 7px; border-radius: 7px; background: rgba(255,255,255,0.04);
  border: 1px solid transparent; text-align: left;
}
.km-hour-stat .v { font-size: 0.84rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.km-hour-stat .l { font-size: 0.56rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-muted); }
button.km-hour-stat { cursor: pointer; font-family: inherit; transition: background 0.12s, border-color 0.12s; }
button.km-hour-click:not(.km-hour-disabled):hover { background: rgba(96,165,250,0.16); border-color: rgba(96,165,250,0.5); }
button.km-hour-click:not(.km-hour-disabled) .v { color: #60a5fa; }
button.km-hour-disabled { cursor: default; opacity: 0.6; }

/* Clickable breached-orders count in the picker table */
.km-breach-btn {
  background: rgba(248,113,113,0.14); color: #f87171; border: 1px solid rgba(248,113,113,0.4);
  border-radius: 6px; padding: 1px 9px; font-size: 0.78rem; font-weight: 700; cursor: pointer;
  font-family: inherit;
}
.km-breach-btn:hover { background: rgba(248,113,113,0.26); }

/* Stage / band bars */
.km-stage-row { display: grid; grid-template-columns: 110px 1fr 80px; align-items: center; gap: 10px; margin-bottom: 8px; }
.km-stage-lbl { font-size: 0.74rem; color: var(--text-muted); }
.km-stage-track { height: 10px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.km-stage-fill { height: 100%; background: #60a5fa; border-radius: 999px; min-width: 2px; }
.km-stage-val { font-size: 0.74rem; font-weight: 600; color: var(--text); text-align: right; }

/* Complaint split */
.km-split-bar { display: flex; height: 18px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,0.06); }
.km-split-seg { height: 100%; }
.km-split-legend { display: flex; gap: 18px; margin-top: 10px; font-size: 0.72rem; color: var(--text-muted); }
.km-split-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* Config: category checklist */
.km-cat-checklist { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.km-cat-check { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--text); cursor: pointer; }
.km-cat-check input { accent-color: #60a5fa; }

/* ── Key Metrics: delta chips ───────────────────────────────────────── */
.km-delta-chip {
  display: inline-block; vertical-align: middle; margin-left: 8px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.km-delta-good { background: rgba(52,211,153,0.16);  color: #34d399; }
.km-delta-bad  { background: rgba(248,113,113,0.16); color: #f87171; }
.km-delta-flat { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ── Key Metrics: Yesterday strip ───────────────────────────────────── */
.km-yday-strip {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--card-bg); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 12px 18px; margin-bottom: 20px;
}
.km-yday-label { display: flex; flex-direction: column; gap: 1px; min-width: 76px; }
.km-yday-kicker { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); opacity: 0.8; }
.km-yday-date { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.km-yday-stats { display: flex; gap: 26px; flex-wrap: wrap; flex: 1; }
.km-yday-stat { display: flex; flex-direction: column; gap: 2px; }
.km-yday-stat .v { font-size: 1.02rem; font-weight: 800; color: var(--text); line-height: 1.15; white-space: nowrap; }
.km-yday-stat .l { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.km-yday-btn { flex-shrink: 0; }

/* ── Key Metrics: cycle pace ────────────────────────────────────────── */
.km-pace-card { margin-bottom: 20px; }
.km-pace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.km-pace-head { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.km-pace-proj { font-size: 0.8rem; color: var(--text); margin-bottom: 10px; }
.km-pace-proj strong { font-size: 1.05rem; font-weight: 800; }
.km-pace-tier {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 10px; border-radius: 8px; margin-bottom: 5px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border-subtle);
}
.km-pace-tier-lbl { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.km-pace-tier-lbl i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.km-pace-tier-req { font-size: 0.74rem; font-weight: 700; color: var(--text); text-align: right; }
.km-pace-locked { background: rgba(52,211,153,0.08); border-color: rgba(52,211,153,0.3); }
.km-pace-locked .km-pace-tier-req { color: #34d399; }
.km-pace-lost { opacity: 0.6; }
.km-pace-lost .km-pace-tier-req { color: #f87171; }

/* ── Key Metrics: trend charts ──────────────────────────────────────── */
.km-chart-wrap { position: relative; height: 240px; }

/* ── Store Overview: SLA band ───────────────────────────────────────── */
.ov-sla-band { margin-bottom: 24px; }
.ov-sla-band-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ov-sla-band-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); }
.ov-sla-band-hint { font-size: 0.68rem; color: var(--text-muted); }
.ov-sla-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ov-sla-card {
  font-family: inherit; text-align: left; cursor: pointer;
  background: var(--card-bg); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.ov-sla-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.25); }
.ov-sla-card.km-tier-sla2     { border-left-color: #34d399; }
.ov-sla-card.km-tier-sla1     { border-left-color: #22d3ee; }
.ov-sla-card.km-tier-baseline { border-left-color: #fbbf24; }
.ov-sla-card.km-tier-below    { border-left-color: #f87171; }
.ov-sla-card.km-tier-na       { border-left-color: #6b7280; }
.ov-sla-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ov-sla-title { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.ov-sla-value { font-size: 1.8rem; font-weight: 800; line-height: 1.15; margin: 4px 0 2px; }
.ov-sla-foot { font-size: 0.7rem; color: var(--text-muted); }
.ov-sla-yday { font-size: 0.7rem; color: var(--text); margin-top: 8px; opacity: 0.9; }

/* ── Error toast (replaces alert) ───────────────────────────────────── */
.error-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 20000; display: flex; align-items: center; gap: 14px;
  max-width: min(520px, calc(100vw - 32px));
  background: var(--card-bg); color: var(--text);
  border: 1px solid rgba(248,113,113,0.55); border-left: 4px solid #f87171;
  border-radius: 10px; padding: 12px 16px; font-size: 13px; line-height: 1.45;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.error-toast button {
  background: none; border: none; color: var(--text-muted); font-size: 18px;
  cursor: pointer; line-height: 1; padding: 2px;
}
.error-toast button:hover { color: var(--text); }

/* ── Cached-data freshness banner (cache-first startup) ─────────────── */
.stale-banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 20000;
  max-width: min(460px, calc(100vw - 32px));
  background: var(--card-bg); color: var(--text-muted);
  border: 1px solid rgba(96,165,250,0.45); border-left: 4px solid #60a5fa;
  border-radius: 10px; padding: 8px 14px; font-size: 12px; line-height: 1.4;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}

/* ── Morning Briefing (Phase 1) ─────────────────────────────────────── */
.ov-sla-pace { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.ov-sla-pace strong { color: var(--text); }

.stat-body { flex: 1; min-width: 0; }
.stat-value .km-delta-chip { vertical-align: middle; margin-left: 6px; }
.stat-spark { display: block; width: 100%; max-width: 130px; height: 26px; margin-top: 6px; }

.ov-charts-header { display: flex; justify-content: flex-end; margin: 4px 0 12px; }
.ov-charts-wrap.hidden { display: none; }

.ov-exceptions {
  background: var(--card-bg); border: 1px solid rgba(63,73,85,0.4);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 18px;
}
.ov-exc-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); margin-bottom: 10px; font-weight: 600;
}
.ov-exc-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-radius: 8px;
  padding: 8px 10px; margin: 0 0 4px; cursor: pointer; text-align: left;
  color: var(--text); font-size: 13px; line-height: 1.45; font-family: inherit;
}
.ov-exc-row:hover { background: rgba(128,128,128,0.10); }
.ov-exc-pip { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ov-exc-crit .ov-exc-pip { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.6); }
.ov-exc-warn .ov-exc-pip { background: #f59e0b; }
.ov-exc-info .ov-exc-pip { background: #60a5fa; }
.ov-exc-text { flex: 1; min-width: 0; }
.ov-exc-go { color: var(--text-muted); font-size: 16px; flex-shrink: 0; }
.ov-exc-clear { color: var(--text-muted); font-size: 13px; padding: 4px 2px; }

@media (max-width: 768px) {
  .ov-exc-row { padding: 10px 8px; }
  .stat-spark { max-width: 100%; }
  .ov-charts-header { justify-content: stretch; }
  .ov-charts-header .btn { width: 100%; }
}

/* ── Coaching list + Captain 360 (Phase 2) ──────────────────────────── */
.dd-coach-card {
  background: var(--card-bg); border: 1px solid rgba(245,158,11,0.35);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 18px;
}
.dd-coach-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.dd-coach-sub { font-size: 11px; color: var(--text-muted); }
.dd-coach-row { display: flex; gap: 12px; padding: 10px 4px; border-top: 1px solid rgba(128,128,128,0.12); }
.dd-coach-row:first-of-type { border-top: none; }
.dd-coach-rank {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: rgba(245,158,11,0.15); color: #f59e0b;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-top: 2px;
}
.dd-coach-main { flex: 1; min-width: 0; }
.dd-coach-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dd-coach-name {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text); font-size: 14px; font-weight: 600; font-family: inherit;
  text-decoration: underline; text-decoration-color: rgba(128,128,128,0.4);
  text-underline-offset: 3px;
}
.dd-coach-name:hover { text-decoration-color: currentColor; }
.dd-coach-score {
  font-size: 11px; font-weight: 700; color: #ff5c5c;
  background: rgba(255,92,92,0.12); border-radius: 6px; padding: 2px 7px;
}
.dd-coach-trend { font-size: 11px; font-weight: 600; }
.dd-trend-worse { color: #ff5c5c; }
.dd-trend-better { color: #4edea3; }
.dd-trend-flat { color: var(--text-muted); }
.dd-coach-reasons { margin: 6px 0 0 0; padding-left: 18px; }
.dd-coach-reasons li { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.dd-coach-clear { color: var(--text-muted); font-size: 13px; padding: 4px 2px; }

.captain-cell-link { cursor: pointer; border-radius: 8px; }
.captain-cell-link:hover .captain-name { text-decoration: underline; text-underline-offset: 3px; }

.p360-section {
  background: var(--card-bg); border: 1px solid rgba(96,165,250,0.3);
  border-radius: 12px; padding: 14px 16px; margin: 0 0 18px;
}
.p360-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 10px; }
.p360-card { background: rgba(128,128,128,0.06); border-radius: 10px; padding: 10px 12px; }
.p360-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 600; }
.p360-value { font-size: 22px; font-weight: 700; margin: 4px 0 2px; }
.p360-sub { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }
.p360-flags { margin-top: 12px; font-size: 12.5px; }
.p360-flags ul { margin: 6px 0 0; padding-left: 18px; }
.p360-flags li { color: var(--text-muted); line-height: 1.5; }

@media (max-width: 768px) {
  .p360-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Incentive nudges (Phase 3) ─────────────────────────────────────── */
.inc-nudge-card {
  background: var(--card-bg); border: 1px solid rgba(78,222,163,0.35);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
}
.inc-nudge-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 4px; border-top: 1px solid rgba(128,128,128,0.12);
  font-size: 13px;
}
.inc-nudge-row:first-of-type { border-top: none; }
.inc-nudge-text { flex: 1; min-width: 200px; color: var(--text-muted); line-height: 1.5; }
.inc-nudge-gain {
  font-weight: 700; color: #4edea3; font-size: 12.5px;
  background: rgba(78,222,163,0.12); border-radius: 6px; padding: 2px 8px;
}

/* ── Polish: sticky headers inside scrollable modal tables ──────────── */
.compl-detail-table-wrapper thead th { position: sticky; top: 0; z-index: 2; }

/* ── Responsive: new Key Metrics / Overview components ──────────────── */
@media (max-width: 768px) {
  .km-pace-grid { grid-template-columns: 1fr; }
  .ov-sla-grid { grid-template-columns: 1fr; gap: 10px; }
  .km-yday-strip { align-items: flex-start; gap: 12px; }
  .km-yday-stats { gap: 16px; }
  .km-yday-btn { width: 100%; }
  .km-chart-wrap { height: 210px; }

  /* Modals go full-screen on phones */
  .compl-detail-backdrop { padding: 0; }
  .compl-detail-modal { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; }

  /* Touch-friendlier date strips */
  .flags-date-strip { padding: 10px 12px; width: 100%; }
  .flags-date-strip input[type="date"],
  .flags-date-strip input[type="month"],
  .flags-date-strip select { font-size: 15px; padding: 8px 10px; }
  .strip-divider { display: none; }
}

@media (max-width: 480px) {
  .km-hour-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-cards-row { grid-template-columns: 1fr 1fr; }
  .km-score-value { font-size: 1.9rem; }
  .flags-title { font-size: 22px; }
  .tab-content { padding: 10px; }
  .header-right .btn { padding: 5px 8px; font-size: 10px; }
}
