/* ==========================================================================
   Unilever PK - Incident Tracker Design System
   Enterprise Corporate Theme (Light Default / Modern Dark)
   ========================================================================== */

:root {
  /* Core Light Theme (Enterprise Corporate Standard) */
  --bg-app: #f8fafc;
  --bg-sidebar: #00205b;           /* Unilever Classic Deep Navy */
  --bg-sidebar-hover: #0a2d75;
  --bg-sidebar-active: #153e96;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfdfe;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-subtle: #f1f5f9;

  --border-color: #e2e8f0;
  --border-focus: #005a9c;
  --border-subtle: #edf2f7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Unilever Brand Palette */
  --unilever-navy: #00205b;
  --unilever-blue: #005a9c;
  --unilever-accent-blue: #1f75fe;
  --unilever-cyan: #0098db;

  /* Priority & Status Badges (Enterprise Soft Pastels) */
  --p1-bg: #fee2e2;
  --p1-text: #991b1b;
  --p1-border: #fca5a5;

  --p2-bg: #fef3c7;
  --p2-text: #92400e;
  --p2-border: #fcd34d;

  --p3-bg: #dbeafe;
  --p3-text: #1e40af;
  --p3-border: #93c5fd;

  --p4-bg: #f1f5f9;
  --p4-text: #475569;
  --p4-border: #cbd5e1;

  --success-bg: #dcfce7;
  --success-text: #166534;
  --success-border: #86efac;

  --purple-bg: #f3e8ff;
  --purple-text: #6b21a8;
  --purple-border: #d8b4fe;

  /* Dimensions */
  --sidebar-width: 275px;
  --sidebar-collapsed-width: 68px;
  --header-height: 64px;
  --border-radius-sm: 6px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-pill: 9999px;

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

  --transition-fast: 0.15s ease-in-out;
  --transition-smooth: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --bg-app: #0b0f19;
  --bg-sidebar: #060911;
  --bg-sidebar-hover: #111827;
  --bg-sidebar-active: #1f2937;
  --bg-card: #111827;
  --bg-card-hover: #162032;
  --bg-elevated: #1f2937;
  --bg-input: #111827;
  --bg-subtle: #1a2234;

  --border-color: #27354a;
  --border-focus: #3b82f6;
  --border-subtle: #1e293b;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --p1-bg: rgba(239, 68, 68, 0.2);
  --p1-text: #fca5a5;
  --p1-border: rgba(239, 68, 68, 0.4);

  --p2-bg: rgba(245, 158, 11, 0.2);
  --p2-text: #fcd34d;
  --p2-border: rgba(245, 158, 11, 0.4);

  --p3-bg: rgba(59, 130, 246, 0.2);
  --p3-text: #93c5fd;
  --p3-border: rgba(59, 130, 246, 0.4);

  --p4-bg: rgba(100, 116, 139, 0.2);
  --p4-text: #cbd5e1;
  --p4-border: rgba(100, 116, 139, 0.4);

  --success-bg: rgba(34, 197, 94, 0.2);
  --success-text: #86efac;
  --success-border: rgba(34, 197, 94, 0.4);

  --purple-bg: rgba(168, 85, 247, 0.2);
  --purple-text: #d8b4fe;
  --purple-border: rgba(168, 85, 247, 0.4);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* App Layout Grid */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   1. Sidebar Navigation (Supports Full & Collapsed Vector-Only Rail Mode)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width var(--transition-smooth);
  overflow: hidden;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-fast);
}

.brand-logo-icon:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  transform: scale(1.05);
}

.unilever-svg-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.brand-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
  overflow: visible;
  transition: opacity var(--transition-fast);
}

.brand-info .brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  letter-spacing: -0.2px;
  margin: 0;
}

.brand-info .brand-title span {
  color: #60a5fa;
  font-weight: 800;
  margin-left: 1px;
}

.brand-info .brand-subtitle {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: #93c5fd;
  margin-top: 2px;
  line-height: 1.2;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #93c5fd;
  padding: 14px 10px 6px 10px;
  margin: 4px 0 2px 0;
  display: block;
  white-space: nowrap;
  line-height: 1.4;
  overflow: visible;
  transition: opacity var(--transition-fast);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: #cbd5e1;
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), padding var(--transition-fast);
  text-align: left;
  width: 100%;
  white-space: nowrap;
  position: relative;
}

.nav-item i {
  width: 18px;
  height: 18px;
  color: #94a3b8;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-fast);
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-item:hover i {
  color: #ffffff;
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: #ffffff;
  font-weight: 600;
}

.nav-item.active i {
  color: #60a5fa;
}

.badge-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--border-radius-pill);
}

.nav-item.active .badge-count {
  background: #2563eb;
  color: #ffffff;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.data-status-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.status-meta {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 2px;
  white-space: nowrap;
}

.status-last-sync {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
}

/* ==========================================================================
   Collapsed Sidebar State (Vector Icons Rail Only)
   ========================================================================== */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .brand-badge {
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .brand-info,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .badge-count,
.sidebar.collapsed .sidebar-footer {
  display: none !important;
}

.sidebar.collapsed .nav-section-label {
  height: 1px;
  padding: 0;
  margin: 10px 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  gap: 0;
  border-radius: var(--border-radius-sm);
}

.sidebar.collapsed .nav-item i {
  width: 20px;
  height: 20px;
  margin: 0;
}

.sidebar.collapsed .nav-item:hover i {
  transform: scale(1.15);
}

/* ==========================================================================
   2. Main Wrapper & Header (With 3-Bars Button)
   ========================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

.top-header {
  height: var(--header-height);
  padding: 0 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  z-index: 30;
  box-shadow: var(--shadow-xs);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* 3 Bars Toggle Button */
.sidebar-toggle-btn {
  display: flex !important;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: #e2e8f0;
  color: var(--unilever-blue);
}

.page-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-title-area h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.view-tag-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--border-radius-pill);
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.btn i {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: #005a9c;
  color: #ffffff;
  border-color: #004a82;
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
  background: #004a82;
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

/* Firebase Cloud Sync Button & Status Dots */
.firebase-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.firebase-sync-btn:hover {
  background: var(--bg-subtle);
  border-color: #38bdf8;
}

.sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.sync-status-dot.status-connected {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse-green 2s infinite;
}

.sync-status-dot.status-syncing {
  background: #00a2ff;
  box-shadow: 0 0 0 2px rgba(0, 162, 255, 0.3);
  animation: pulse-blue 1s infinite;
}

.sync-status-dot.status-error {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.sync-status-dot.status-offline {
  background: #64748b;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-blue {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 162, 255, 0.6); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 162, 255, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 162, 255, 0); }
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.icon-btn i {
  width: 16px;
  height: 16px;
}

.active-filter-badge {
  background: #2563eb;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

/* ==========================================================================
   3. Collapsible Filter Panel
   ========================================================================== */
.filters-panel {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-smooth);
}

.filters-panel.collapsed {
  display: none;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.filter-icon-box {
  width: 30px;
  height: 30px;
  border-radius: var(--border-radius-sm);
  background: #dbeafe;
  color: #1e40af;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-icon-box i {
  width: 16px;
  height: 16px;
}

.filter-title-wrap h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.filter-actions-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
}

.form-select, .form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-select:focus, .form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(0, 90, 156, 0.15);
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.filter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.chips-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chip-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--border-radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.chip-btn.active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
  font-weight: 600;
}

/* ==========================================================================
   4. Main Scrollable Container & Views
   ========================================================================== */
.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* ==========================================================================
   5. Executive KPI Metric Cards
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-grid.four-col {
  grid-template-columns: repeat(4, 1fr);
}

.kpi-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color var(--transition-fast);
}

.kpi-card:hover {
  border-color: #cbd5e1;
}

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

.kpi-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.kpi-icon-wrap {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon-wrap i {
  width: 16px;
  height: 16px;
}

.icon-neutral { background: var(--bg-subtle); color: var(--text-secondary); }
.icon-blue { background: #dbeafe; color: #1e40af; }
.icon-green { background: #dcfce7; color: #166534; }
.icon-red { background: #fee2e2; color: #991b1b; }
.icon-amber { background: #fef3c7; color: #92400e; }
.icon-purple { background: #f3e8ff; color: #6b21a8; }
.icon-indigo { background: #e0e7ff; color: #3730a3; }

.kpi-body {
  display: flex;
  flex-direction: column;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  font-family: var(--font-sans);
}

.kpi-value-sm {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.text-danger { color: #dc2626 !important; font-weight: 600; }
.text-amber { color: #d97706 !important; font-weight: 600; }
.text-success { color: #16a34a !important; font-weight: 600; }

/* ==========================================================================
   5.1 Most Recurring Issue Highlight Card
   ========================================================================== */
.most-recurring-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid #9333ea;
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  gap: 20px;
}

.mrec-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.mrec-badge-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f3e8ff;
  color: #6b21a8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mrec-badge-icon i {
  width: 22px;
  height: 22px;
}

.mrec-details {
  min-width: 0;
}

.mrec-tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.mrec-service-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--border-radius-pill);
}

.mrec-prb-pill {
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--border-radius-pill);
}

.mrec-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mrec-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.mrec-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.mrec-count-box {
  text-align: right;
}

.mrec-count-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: #9333ea;
  font-family: var(--font-sans);
  line-height: 1;
  display: block;
}

.mrec-count-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

/* ==========================================================================
   6. Chart Cards & Layouts
   ========================================================================== */
.chart-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 20px;
}

.chart-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.chart-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}

.hero-chart-card {
  background: var(--bg-card);
}

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

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

.chart-count-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.chart-title-lg {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

.chart-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.select-service-filter {
  min-width: 150px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
}

.chart-header {
  margin-bottom: 12px;
}

.chart-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-container {
  position: relative;
  flex: 1;
  min-height: 250px;
  max-height: 320px;
  width: 100%;
}

/* ==========================================================================
   6.1 Incident Week-Wise Trend Hero Section & Matrix Table
   ========================================================================== */
.weekly-trend-hero {
  border-top: 3px solid var(--unilever-blue);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.week-trend-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.week-trend-controls .control-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.week-trend-controls select {
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.week-trend-controls select:focus {
  border-color: var(--unilever-blue);
}

.chart-mode-toggle {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 2px;
  gap: 2px;
}

.btn-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-mode-toggle i {
  width: 13px;
  height: 13px;
}

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

.btn-mode-toggle.active {
  background: var(--bg-card);
  color: var(--unilever-blue);
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .btn-mode-toggle.active {
  background: var(--bg-elevated);
  color: #38bdf8;
}

/* Weekly KPI Strip */
.week-trend-kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
}

.week-kpi-item {
  display: flex;
  flex-direction: column;
}

.week-kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.week-kpi-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.week-kpi-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.week-kpi-momentum-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* WoW Momentum Badges */
.wow-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--border-radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.wow-badge-up {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.wow-badge-down {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.wow-badge-neutral {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .wow-badge-up {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

[data-theme="dark"] .wow-badge-down {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

/* Interactive Trend Point Callout / Inspector Banner */
.trend-click-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(0, 162, 255, 0.12), rgba(255, 119, 0, 0.12));
  border: 1px solid rgba(0, 162, 255, 0.35);
  border-radius: var(--border-radius-sm);
  padding: 10px 16px;
  margin-bottom: 14px;
  animation: fadeIn 0.2s ease-in-out;
}

[data-theme="dark"] .trend-click-banner {
  background: linear-gradient(135deg, rgba(0, 162, 255, 0.18), rgba(255, 119, 0, 0.18));
  border-color: rgba(0, 162, 255, 0.45);
}

.trend-click-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tcb-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--unilever-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tcb-icon i {
  width: 16px;
  height: 16px;
}

.tcb-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tcb-service-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid #00a2ff;
  color: #00a2ff;
  background: rgba(0, 162, 255, 0.1);
}

.tcb-point-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.tcb-value-badge {
  font-size: 0.82rem;
  color: var(--text-primary);
}

.tcb-value-badge strong {
  font-size: 0.92rem;
  color: var(--unilever-blue);
}

[data-theme="dark"] .tcb-value-badge strong {
  color: #38bdf8;
}

.tcb-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  margin-bottom: 0;
}

.trend-click-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Weekly Table & Matrix */
.week-trend-table-wrapper {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  transition: all var(--transition-smooth);
}

.week-table-header {
  margin-bottom: 12px;
  gap: 12px;
}

.week-table-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.week-table-subtitle {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.week-table-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.week-table-search-box i {
  position: absolute;
  left: 8px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.week-table-search-box input {
  padding: 5px 10px 5px 28px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.76rem;
  width: 200px;
  outline: none;
}

.week-table-search-box input:focus {
  border-color: var(--unilever-blue);
}

.week-matrix-scroll {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
}

.week-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.week-matrix-table th {
  position: sticky;
  top: 0;
  background: var(--bg-subtle);
  z-index: 2;
  box-shadow: 0 1px 0 var(--border-color);
  padding: 9px 12px;
}

.week-matrix-table td {
  padding: 8px 12px;
  vertical-align: middle;
}

.week-tag-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(0, 90, 156, 0.1);
  color: var(--unilever-blue);
  border: 1px solid rgba(0, 90, 156, 0.25);
}

[data-theme="dark"] .week-tag-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.week-inflow-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-inflow-num {
  font-weight: 700;
  min-width: 24px;
}

.week-mini-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
  max-width: 80px;
}

.week-mini-bar-fill {
  height: 100%;
  background: #005a9c;
  border-radius: 3px;
}

.week-res-pill-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-res-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
  max-width: 70px;
}

.week-res-bar-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 3px;
}

.week-drill-btn {
  padding: 4px 9px;
  font-size: 0.72rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.week-drill-btn:hover {
  background: var(--unilever-blue);
  color: #fff;
  border-color: var(--unilever-blue);
}

@media (max-width: 1024px) {
  .week-trend-kpi-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .week-trend-kpi-bar {
    grid-template-columns: 1fr;
  }
  .week-trend-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   7. Enterprise Data Tables
   ========================================================================== */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 20px;
}

.table-card-header, .table-toolbar {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.table-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.table-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.table-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: var(--border-radius-sm);
  min-width: 300px;
}

.table-search-box i {
  color: var(--text-muted);
  width: 15px;
  height: 15px;
}

.table-search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.8rem;
  outline: none;
  width: 100%;
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.form-select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 6px;
  border-radius: var(--border-radius-sm);
  font-size: 0.78rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.data-table th[data-sort]:hover {
  color: var(--unilever-blue);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--border-radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-p1 { background: var(--p1-bg); color: var(--p1-text); border: 1px solid var(--p1-border); }
.badge-p2 { background: var(--p2-bg); color: var(--p2-text); border: 1px solid var(--p2-border); }
.badge-p3 { background: var(--p3-bg); color: var(--p3-text); border: 1px solid var(--p3-border); }
.badge-p4 { background: var(--p4-bg); color: var(--p4-text); border: 1px solid var(--p4-border); }

.badge-state-new { background: #e0f2fe; color: #0369a1; }
.badge-state-assigned { background: #ede9fe; color: #6d28d9; }
.badge-state-in-progress { background: #fef3c7; color: #92400e; }
.badge-state-resolved { background: var(--success-bg); color: var(--success-text); }
.badge-state-closed { background: #f1f5f9; color: #475569; }

.badge-recurring-yes { background: var(--purple-bg); color: var(--purple-text); border: 1px solid var(--purple-border); }
.badge-recurring-no { background: var(--bg-subtle); color: var(--text-muted); }
.badge-prb { background: #dbeafe; color: #1e40af; font-family: var(--font-mono); font-size: 0.75rem; }

.ticket-link {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #005a9c;
  text-decoration: none;
  cursor: pointer;
}

.ticket-link:hover {
  text-decoration: underline;
}

.table-pagination-footer {
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.pagination-info {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-numbers {
  display: flex;
  gap: 4px;
}

.page-num-btn {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.page-num-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.page-num-btn.active {
  background: #005a9c;
  color: #ffffff;
}

/* ==========================================================================
   8. Upload View & Management
   ========================================================================== */
.upload-container {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.upload-intro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
}

.upload-intro-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-intro-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: #005a9c;
  background: rgba(0, 90, 156, 0.05);
}

.drop-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.drop-icon-box i {
  width: 24px;
  height: 24px;
}

.drop-zone-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.drop-zone-content p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.upload-options-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px;
}

.upload-options-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radio-card:hover {
  border-color: #005a9c;
}

.radio-card.active {
  border-color: #005a9c;
  background: rgba(0, 90, 156, 0.08);
}

.radio-content strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.radio-content span {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.schema-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px;
}

.schema-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.schema-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.schema-header p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.schema-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.schema-tag {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.schema-tag.pk-tag {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1e40af;
  font-weight: 600;
}

.danger-card {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: var(--border-radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.danger-card h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: #c53030;
}

.danger-card p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.danger-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   9. Blueprint View
   ========================================================================== */
.blueprint-container {
  max-width: 1050px;
  margin: 0 auto;
}

.blueprint-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.blueprint-hero h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.blueprint-hero p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.blueprint-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px;
}

.bp-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.bp-icon-wrap i {
  width: 16px;
  height: 16px;
}

.blueprint-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.blueprint-card p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.bp-list {
  padding-left: 18px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.bp-list code {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #005a9c;
}

.code-block-bp {
  background: #0f172a;
  border-radius: var(--border-radius-sm);
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #e2e8f0;
  line-height: 1.5;
}

/* Resolution Themes Grid */
.resolution-themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

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

.theme-card h5 {
  font-size: 0.82rem;
  font-weight: 600;
  color: #005a9c;
  margin-bottom: 4px;
}

.theme-card p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.theme-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ==========================================================================
   10. Modals & Slide-Over Drawer
   ========================================================================== */
.drawer-overlay, .modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.drawer-overlay.active, .modal-overlay.active {
  display: flex;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 500px;
  max-width: 90vw;
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-title-area h3 {
  font-size: 1.05rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.drawer-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.drawer-field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.drawer-field {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: var(--border-radius-sm);
}

.drawer-field .field-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
}

.drawer-field .field-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.drawer-full-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
}

.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Modal Box */
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: 90vw;
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title-area h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.modal-body {
  padding: 18px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 260px;
}

.toast.toast-success { border-left: 3px solid #16a34a; }
.toast.toast-error { border-left: 3px solid #dc2626; }
.toast.toast-info { border-left: 3px solid #005a9c; }

/* Responsive Rules */
@media (max-width: 1024px) {
  .chart-grid.three-col, .kpi-grid.four-col, .kpi-grid.three-col {
    grid-template-columns: repeat(2, 1fr);
  }
  .blueprint-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    transition: left var(--transition-smooth);
  }
  .sidebar.mobile-open {
    left: 0;
  }
  .chart-grid.two-col, .kpi-grid {
    grid-template-columns: 1fr;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
}
