/* ============================================================
   OSP-OS Dashboard — Unified Dark Glass Design System
   Version: 4.0 | 2026
   ============================================================ */

/* ── 1. Design Tokens ────────────────────────────────────── */
:root {
  /* Background */
  --bg-deep: #0a0f1d;
  --bg-surface: #0f162a;
  --bg-elevated: #151f39;
  --bg-card: rgba(21, 32, 57, 0.45);
  --bg-card-hover: rgba(28, 42, 72, 0.55);
  --bg-input: rgba(15, 22, 42, 0.8);

  /* Glass */
  --glass-blur: 16px;
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.14);

  /* Colors */
  --color-primary: #00bfff;
  --color-primary-dim: rgba(0, 191, 255, 0.15);
  --color-primary-glow: rgba(0, 191, 255, 0.35);
  --color-success: #10b981;
  --color-success-dim: rgba(16, 185, 129, 0.15);
  --color-success-glow: rgba(16, 185, 129, 0.35);
  --color-warning: #f59e0b;
  --color-warning-dim: rgba(245, 158, 11, 0.15);
  --color-warning-glow: rgba(245, 158, 11, 0.35);
  --color-danger: #ef4444;
  --color-danger-dim: rgba(239, 68, 68, 0.15);
  --color-danger-glow: rgba(239, 68, 68, 0.35);
  --color-info: #818cf8;
  --color-info-dim: rgba(129, 140, 248, 0.15);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-link: #38bdf8;

  /* Fonts */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow-primary: 0 0 15px var(--color-primary-glow);
  --shadow-glow-success: 0 0 15px var(--color-success-glow);
  --shadow-glow-warning: 0 0 15px var(--color-warning-glow);
  --shadow-glow-danger: 0 0 15px var(--color-danger-glow);

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --header-height: 64px;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-surface) 50%, #0d1528 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  line-height: 1.6;
}

a { color: var(--text-link); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-primary); }

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.3; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ── 3. Custom Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }

/* ── 3b. Focus Visible — Keyboard Accessibility ─────────── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Menu items — custom focus ring */
.menu-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  background: var(--color-primary-dim);
  color: var(--text-primary);
}

/* Buttons — enhanced focus ring */
.btn:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--color-primary-dim);
}

/* Form controls — already have focus styles, enhance outline */
.form-control:focus-visible,
.role-selector:focus-visible {
  outline: none; /* using box-shadow instead */
}

/* Cards with interactive states */
.saas-perf-card:focus-visible,
.glass-card:focus-visible,
.info-card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* Table rows */
.data-table tbody tr:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  background: rgba(0, 191, 255, 0.08);
}

/* Skip-to-content link — hidden until focused */
.skip-to-content {
  position: absolute;
  left: -999px;
  top: -999px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-to-content:focus {
  left: 12px;
  top: 12px;
}

/* ── 3c. Reduced Motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 4. Typography Utilities ─────────────────────────────── */
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-heading { font-family: var(--font-heading); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fs-sm { font-size: 0.85rem; }
.fs-lg { font-size: 1.15rem; }
.fs-xl { font-size: 1.5rem; }

/* ── 5. Layout ───────────────────────────────────────────── */
.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

.app-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.page-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 40px;
  animation: fadeIn 0.4s ease-out;
}

/* ── 6. Sidebar ──────────────────────────────────────────── */
.app-sidebar {
  background: linear-gradient(180deg, rgba(10,15,29,0.97) 0%, rgba(15,22,42,0.95) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width var(--transition-base), transform var(--transition-base);
}

.sidebar-logo {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.logo-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--color-primary), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.logo-subtext {
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--color-primary-dim);
  color: var(--color-primary);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-menu {
  padding: 12px 0;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 24px;
  margin: 2px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  white-space: nowrap;
}

.menu-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.menu-item:hover {
  background: var(--color-primary-dim);
  color: var(--text-primary);
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(0,191,255,0.15), rgba(129,140,248,0.1));
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.menu-item.active i {
  color: var(--color-primary);
  filter: drop-shadow(0 0 6px var(--color-primary-glow));
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sidebar-toggle:hover { background: var(--color-primary-dim); border-color: var(--color-primary); }

/* ── 7. Header ───────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--header-height);
  border-bottom: 1px solid var(--glass-border);
  background: rgba(10, 15, 29, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  gap: 16px;
}

.header-title-section {
  flex: 1;
  min-width: 0;
}

.header-title-section h2 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-secondary);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.role-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.role-selector-container label { white-space: nowrap; font-weight: 500; }
.role-selector-container i { margin-right: 4px; }

.role-selector {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
  min-width: 200px;
}
.role-selector:focus { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-dim); }
.role-selector option { background: var(--bg-surface); color: var(--text-primary); }

.notification-bell {
  position: relative;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-fast);
}
.notification-bell:hover { background: var(--color-primary-dim); border-color: var(--color-primary); }
.notification-bell i { font-size: 1rem; color: var(--text-secondary); }

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-glow-danger 2s infinite;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #fff;
}

/* ── 8. Glass Card ───────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
  animation: fadeIn 0.5s ease-out;
}

.glass-card:hover {
  border-color: var(--glass-border-hover);
  background: var(--bg-card-hover);
}

.glass-card h3, .glass-card h4 {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.glass-card h3 i, .glass-card h4 i {
  color: var(--color-primary);
  font-size: 1.1rem;
}

/* ── 9. Dashboard Grid ───────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-full { grid-template-columns: 1fr; }

/* ── 10. Info Cards ──────────────────────────────────────── */
.info-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  animation: slideUp 0.4s ease-out both;
}

.info-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
  border-radius: 0 4px 4px 0;
}

.info-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-glow-primary);
}

.info-card.accent-success::before { background: var(--color-success); }
.info-card.accent-success:hover { box-shadow: var(--shadow-glow-success); }
.info-card.accent-warning::before { background: var(--color-warning); }
.info-card.accent-warning:hover { box-shadow: var(--shadow-glow-warning); }
.info-card.accent-danger::before { background: var(--color-danger); }
.info-card.accent-danger:hover { box-shadow: var(--shadow-glow-danger); }

.info-card .card-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}

.info-card .card-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.info-card .card-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ── 11. Data Tables ─────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead th {
  background: rgba(0, 191, 255, 0.06);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

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

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(0, 191, 255, 0.04);
}

.data-table .total-row td {
  font-weight: 700;
  background: rgba(0, 191, 255, 0.08);
  border-top: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.data-table td.text-right, .data-table th.text-right { text-align: right; }
.data-table td.text-center, .data-table th.text-center { text-align: center; }

/* ── 12. Form Controls ───────────────────────────────────── */
.form-control {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-dim);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select.form-control option { background: var(--bg-surface); color: var(--text-primary); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.form-row { display: flex; gap: 16px; align-items: flex-end; }
.form-row .form-group { flex: 1; }

/* ── 13. Input Cells (Excel-style) ───────────────────────── */
.input-cell {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-warning);
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  text-align: right;
  width: 100%;
  outline: none;
  font-family: var(--font-body);
  transition: all var(--transition-fast);
}
.input-cell:focus {
  border-color: var(--color-warning);
  box-shadow: 0 0 0 2px var(--color-warning-dim);
  background: rgba(245, 158, 11, 0.18);
}

/* ── 14. Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), #0ea5e9);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover { box-shadow: var(--shadow-glow-primary); }

.btn-success {
  background: linear-gradient(135deg, var(--color-success), #059669);
  color: #fff;
  border-color: var(--color-success);
}
.btn-success:hover { box-shadow: var(--shadow-glow-success); }

.btn-warning {
  background: linear-gradient(135deg, var(--color-warning), #d97706);
  color: #fff;
  border-color: var(--color-warning);
}
.btn-warning:hover { box-shadow: var(--shadow-glow-warning); }

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), #dc2626);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover { box-shadow: var(--shadow-glow-danger); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--glass-border);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--glass-border-hover); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── 15. Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-primary { background: var(--color-primary-dim); color: var(--color-primary); }
.badge-success { background: var(--color-success-dim); color: var(--color-success); }
.badge-warning { background: var(--color-warning-dim); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-dim); color: var(--color-danger); }
.badge-info { background: var(--color-info-dim); color: var(--color-info); }

.bg-success-subtle { background: var(--color-success-dim); }
.bg-warning-subtle { background: var(--color-warning-dim); }
.bg-danger-subtle { background: var(--color-danger-dim); }
.bg-primary-subtle { background: var(--color-primary-dim); }

/* ── 16. Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  min-width: 420px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content h3 {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}

/* ── 17. Progress Bars ───────────────────────────────────── */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--color-primary), #818cf8);
  transition: width var(--transition-slow);
  position: relative;
}

.progress-bar-fill.success { background: linear-gradient(90deg, var(--color-success), #34d399); }
.progress-bar-fill.warning { background: linear-gradient(90deg, var(--color-warning), #fbbf24); }
.progress-bar-fill.danger { background: linear-gradient(90deg, var(--color-danger), #f87171); }

/* ── 18. Status Indicators ───────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  margin-right: 6px;
  flex-shrink: 0;
}

.status-dot.green { background: var(--color-success); box-shadow: 0 0 8px var(--color-success-glow); }
.status-dot.yellow { background: var(--color-warning); box-shadow: 0 0 8px var(--color-warning-glow); }
.status-dot.red { background: var(--color-danger); box-shadow: 0 0 8px var(--color-danger-glow); }
.status-dot.blue { background: var(--color-primary); box-shadow: 0 0 8px var(--color-primary-glow); }

/* ── 19. Toast Notifications ─────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 450px;
  animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(12px);
  font-size: 0.85rem;
}

.toast.info { border-left: 4px solid var(--color-primary); }
.toast.success { border-left: 4px solid var(--color-success); }
.toast.warning { border-left: 4px solid var(--color-warning); }
.toast.error { border-left: 4px solid var(--color-danger); }

.toast i { font-size: 1.1rem; flex-shrink: 0; }
.toast.info i { color: var(--color-primary); }
.toast.success i { color: var(--color-success); }
.toast.warning i { color: var(--color-warning); }
.toast.error i { color: var(--color-danger); }

.toast-exit { animation: slideOutRight 0.3s ease-in forwards; }

/* ── 20. Loading Skeleton ────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; width: 80%; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 16px; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }

/* ── 21. Directive Board ─────────────────────────────────── */
.directive-board { margin-top: 24px; }

.directive-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition-fast);
}

.directive-item:hover { background: rgba(0,191,255,0.03); }
.directive-item:last-child { border-bottom: none; }

.directive-item .dir-id {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.82rem;
  white-space: nowrap;
}

.directive-item .dir-content { flex: 1; }
.directive-item .dir-recipient { font-weight: 600; color: var(--color-warning); font-size: 0.8rem; margin-bottom: 4px; }
.directive-item .dir-text { font-size: 0.85rem; color: var(--text-primary); margin-bottom: 4px; }
.directive-item .dir-deadline { font-size: 0.75rem; color: var(--text-muted); }

.directive-item.done { opacity: 0.5; }
.directive-item.done .dir-text { text-decoration: line-through; }

/* ── 22. Meeting Container ───────────────────────────────── */
.meeting-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  min-height: 500px;
}

.agenda-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  backdrop-filter: blur(var(--glass-blur));
}

.agenda-sidebar h4 {
  font-size: 0.85rem;
  color: var(--color-primary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.agenda-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.agenda-step:hover { background: var(--color-primary-dim); color: var(--text-primary); }

.agenda-step.active {
  background: linear-gradient(135deg, var(--color-primary-dim), rgba(129,140,248,0.1));
  color: var(--color-primary);
  font-weight: 600;
}

.agenda-step .step-num {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.agenda-step.active .step-num {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

.agenda-step.completed .step-num {
  background: var(--color-success);
  color: #fff;
  border-color: var(--color-success);
}

.meeting-workspace {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(var(--glass-blur));
}

.meeting-timer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.timer-display {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 2px;
}

/* ── 23. L10 Timeline ────────────────────────────────────── */
.l10-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  margin-bottom: 24px;
  position: relative;
}

.l10-timeline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 40px;
  right: 40px;
  height: 2px;
  background: var(--glass-border);
  transform: translateY(-50%);
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  cursor: pointer;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all var(--transition-base);
}

.timeline-step.active .timeline-dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 16px var(--color-primary-glow);
  animation: pulse-glow 2s infinite;
}

.timeline-step.completed .timeline-dot {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.timeline-step .step-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-step.active .step-label { color: var(--color-primary); font-weight: 600; }

/* ── 24. Issue List ──────────────────────────────────────── */
.issue-list { display: flex; flex-direction: column; gap: 8px; }

.issue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.issue-item:hover { background: rgba(0,191,255,0.04); border-color: var(--glass-border); }
.issue-item .issue-priority { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.issue-item .issue-title { flex: 1; font-size: 0.85rem; }
.issue-item .issue-owner { font-size: 0.78rem; color: var(--text-secondary); }
.issue-item.resolved { opacity: 0.5; text-decoration: line-through; }

/* ── 25. Org Tree / Accountability Map ───────────────────── */
.map-canvas-container {
  padding: 24px;
  overflow-x: auto;
}

.org-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.org-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.map-node {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  min-width: 180px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.map-node:hover {
  transform: translateY(-3px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow-primary);
}

.map-node.health-green { border-left: 4px solid var(--color-success); }
.map-node.health-yellow { border-left: 4px solid var(--color-warning); }
.map-node.health-red { border-left: 4px solid var(--color-danger); }

.map-node .node-title { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.map-node .node-name { font-weight: 700; font-size: 0.9rem; margin: 4px 0; color: var(--text-primary); }
.map-node .node-kpi { font-size: 0.78rem; color: var(--text-secondary); }

.map-node.selected {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow-primary);
  background: var(--bg-card-hover);
}

.node-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
  animation: slideUp 0.3s ease-out;
}

/* ── 26. Tab Navigation ──────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
  position: relative;
  bottom: -1px;
}

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

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: var(--color-primary-dim);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-content { display: none; animation: fadeIn 0.3s ease-out; }
.tab-content.active { display: block; }

/* ── 27. Product Cards ───────────────────────────────────── */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-md);
}

.product-card .product-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
}

.product-card .product-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.product-card .product-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.product-card .stat-item .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.product-card .stat-item .stat-value {
  font-weight: 700;
  font-size: 0.95rem;
}

/* ── 28. Progress Ring (CSS Conic Gradient) ───────────────── */
.progress-ring {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.progress-ring::before {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
}

.progress-ring .ring-value {
  position: relative;
  z-index: 1;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.85rem;
}

/* ── 29. Chart Containers ────────────────────────────────── */
.chart-container {
  padding: 16px 0;
}

.css-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding: 16px 0;
}

.chart-bar {
  flex: 1;
  min-width: 30px;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: all var(--transition-base);
  cursor: pointer;
}

.chart-bar:hover { filter: brightness(1.2); }

.chart-bar .bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.chart-bar .bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Horizontal bars */
.h-bar-chart { display: flex; flex-direction: column; gap: 12px; }

.h-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.h-bar-label { width: 120px; font-size: 0.8rem; color: var(--text-secondary); text-align: right; flex-shrink: 0; }

.h-bar-track {
  flex: 1;
  height: 20px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
}

.h-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--color-primary), #818cf8);
  transition: width var(--transition-slow);
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}

/* ── 30. EVM Gauge ───────────────────────────────────────── */
.evm-gauge {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
}

.gauge-ring {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gauge-ring::before {
  content: '';
  position: absolute;
  inset: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
}

.gauge-ring .gauge-value {
  position: relative;
  z-index: 1;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
}

/* ── 31. Collapsible Section ─────────────────────────────── */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 12px 0;
  user-select: none;
}

.collapsible-header .toggle-icon {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}

.collapsible-header.collapsed .toggle-icon { transform: rotate(-90deg); }

.collapsible-body {
  overflow: hidden;
  transition: max-height var(--transition-base), opacity var(--transition-base);
  max-height: 2000px;
  opacity: 1;
}

.collapsible-body.collapsed {
  max-height: 0;
  opacity: 0;
}

/* ── 32. Waterfall Chart ─────────────────────────────────── */
.waterfall-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: 0 8px;
}

.waterfall-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: all var(--transition-fast);
}

.waterfall-bar.positive { background: linear-gradient(180deg, var(--color-success), rgba(16,185,129,0.4)); }
.waterfall-bar.negative { background: linear-gradient(180deg, var(--color-danger), rgba(239,68,68,0.4)); }

/* ── 33. Score / Histogram ───────────────────────────────── */
.histogram {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding: 0 4px;
}

.histogram-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--color-primary), rgba(0,191,255,0.3));
  position: relative;
  transition: all var(--transition-fast);
  min-width: 20px;
}

.histogram-bar:hover { filter: brightness(1.3); }

.histogram-bar .hist-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ── 34. Spacing Utilities ───────────────────────────────── */
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.p-0 { padding: 0; }
.p-16 { padding: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* ── 35. View Header ─────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-header h2 i {
  color: var(--color-primary);
  filter: drop-shadow(0 0 6px var(--color-primary-glow));
}

/* ── 36. Scenario Switcher ───────────────────────────────── */
.scenario-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 6px 8px;
}

.scenario-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.scenario-option.active {
  background: var(--color-primary-dim);
  color: var(--color-primary);
}

.scenario-option input[type="radio"] { display: none; }

/* ── 37. Checkbox / Todo ─────────────────────────────────── */
.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition-fast);
}

.todo-item:hover { background: rgba(0,191,255,0.03); }

.todo-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--glass-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  background: transparent;
  color: transparent;
  font-size: 0.7rem;
}

.todo-checkbox.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.todo-item.done .todo-text { text-decoration: line-through; color: var(--text-muted); }
.todo-item .todo-owner { font-size: 0.78rem; color: var(--text-secondary); margin-left: auto; }
.todo-item .todo-due { font-size: 0.72rem; color: var(--text-muted); }

/* ── 38. Handover Checklist ──────────────────────────────── */
.handover-steps {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.handover-step {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.handover-step.completed {
  background: var(--color-success-dim);
  border-color: var(--color-success);
  color: var(--color-success);
}

.handover-step .step-icon { font-size: 1.2rem; margin-bottom: 6px; display: block; }

/* ── 39. Timeline Log ────────────────────────────────────── */
.timeline-log {
  border-left: 2px solid var(--glass-border);
  padding-left: 20px;
  margin: 16px 0;
}

.timeline-entry {
  position: relative;
  padding-bottom: 16px;
  margin-bottom: 8px;
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  border: 2px solid var(--bg-surface);
}

.timeline-entry .entry-date { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 4px; }
.timeline-entry .entry-source { font-size: 0.78rem; font-weight: 600; color: var(--color-primary); }
.timeline-entry .entry-text { font-size: 0.82rem; color: var(--text-primary); margin-top: 4px; }

/* ── 40. Conic Gradient Pie ──────────────────────────────── */
.pie-chart {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-full);
  position: relative;
  margin: 0 auto;
}

.pie-chart::after {
  content: '';
  position: absolute;
  inset: 40px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.pie-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── 41. Animations ──────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100px); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px var(--color-primary-glow); }
  50% { box-shadow: 0 0 20px var(--color-primary-glow), 0 0 40px rgba(0,191,255,0.15); }
}

@keyframes pulse-glow-danger {
  0%, 100% { box-shadow: 0 0 4px var(--color-danger-glow); }
  50% { box-shadow: 0 0 12px var(--color-danger-glow); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

/* Staggered animation delays */
.info-card:nth-child(1) { animation-delay: 0.05s; }
.info-card:nth-child(2) { animation-delay: 0.1s; }
.info-card:nth-child(3) { animation-delay: 0.15s; }
.info-card:nth-child(4) { animation-delay: 0.2s; }
.info-card:nth-child(5) { animation-delay: 0.25s; }
.info-card:nth-child(6) { animation-delay: 0.3s; }

/* ── 42. Responsive ──────────────────────────────────────── */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .meeting-container { grid-template-columns: 200px 1fr; }
}

@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    z-index: 500;
    box-shadow: var(--shadow-lg);
  }

  .app-sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .page-body { padding: 16px; }
  .app-header { padding: 0 16px; }
  .header-title-section h2 { font-size: 0.78rem; }

  .role-selector-container label { display: none; }
  .role-selector { min-width: 140px; font-size: 0.78rem; }

  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .meeting-container { grid-template-columns: 1fr; }
  .agenda-sidebar { display: none; }

  .l10-timeline { overflow-x: auto; padding: 20px 16px; }
  .org-row { gap: 8px; }
  .map-node { min-width: 140px; padding: 12px; }
}

@media (max-width: 600px) {
  .header-controls { gap: 8px; }
  .user-badge span { display: none; }
  .notification-bell { width: 34px; height: 34px; }
  .view-header { flex-direction: column; align-items: flex-start; }
  .scenario-switch { flex-wrap: wrap; }
  .info-card .card-value { font-size: 1.3rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .modal-content { min-width: auto; margin: 16px; }
  .handover-steps { flex-direction: column; }
}

/* ── 43. Print Styles ────────────────────────────────────── */
@media print {
  .app-sidebar, .sidebar-toggle, .mobile-menu-toggle, .fab-export,
  .header-controls, .toast-container, #aiModal { display: none !important; }
  .app-container { grid-template-columns: 1fr !important; }
  .app-content { margin-left: 0 !important; }
  .page-body { padding: 20px !important; }
  body { background: #fff !important; color: #000 !important; }
  .glass-card, .info-card {
    background: #f5f5f5; border: 1px solid #ddd;
    backdrop-filter: none; break-inside: avoid;
  }
  .data-table thead th { background: #eee; color: #333; }
  * { color-adjust: exact !important; -webkit-print-color-adjust: exact !important; }
}

/* ── 44. SaaS View 0607 — Info Card Extensions ────────── */
.info-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.info-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.info-card-icon {
  font-size: 20px;
  color: var(--color-primary);
}
.info-card-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-main);
}
.info-card-footer {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.info-card.success::before { background: var(--color-success); }
.info-card.warning::before { background: var(--color-warning); }
.info-card.danger::before  { background: var(--color-danger);  }

/* SaaS product card click highlight */
.saas-perf-card {
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.saas-perf-card:hover {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 12px rgba(0, 191, 255, 0.15) !important;
}

/* ── 45. Enhanced Mobile Responsive ──────────────────────── */
@media (max-width: 1024px) {
  .app-sidebar { width: 200px; }
  .app-container { grid-template-columns: 200px 1fr; }
}

@media (max-width: 768px) {
  .app-sidebar {
    position: fixed; left: -260px; z-index: 1000;
    width: var(--sidebar-width);
    transition: left 0.3s;
  }
  .app-sidebar.open { left: 0; }
  .app-content { margin-left: 0 !important; }
  .page-body { padding: 16px !important; }
  .dashboard-grid { grid-template-columns: 1fr !important; }
  .info-card { min-width: unset !important; }
  .app-header { padding: 0 16px; }
  .glass-card { padding: 16px !important; }
}

@media (max-width: 480px) {
  .page-body { padding: 8px !important; }
  .header-title-section h2 { font-size: 0.7rem; }
  .glass-card { padding: 12px !important; border-radius: 8px !important; }
  .info-card .card-value { font-size: 1.2rem; }
  .btn { padding: 6px 12px; font-size: 0.78rem; }
}

/* ── 46. Mobile-First Overrides ─────────────────────────── */
@media (max-width: 768px) {
  /* Prevent horizontal scroll at page level */
  body,
  .app-container,
  .app-content,
  .page-body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  /* Word break for long text */
  h1, h2, h3, h4, p, span, td, th, label {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Force all inline grid layouts to stack */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Tables must scroll horizontally */
  .table-responsive,
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* View headers stack vertically */
  .view-header,
  [style*="display: flex"][style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  /* Header controls - compact */
  .app-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-controls {
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-title-section {
    display: none;
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* Cards full width */
  .glass-card,
  .info-card {
    min-width: unset !important;
    width: 100% !important;
  }

  /* Buttons wrap */
  .btn-group,
  [style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }

  /* Font size adjustments */
  h1 { font-size: 1.3rem !important; }
  h2 { font-size: 1.1rem !important; }
  h3 { font-size: 0.95rem !important; }

  /* Sidebar toggle always visible */
  .sidebar-toggle,
  .mobile-menu-toggle {
    display: flex !important;
  }

  /* Role selector compact */
  .role-selector-container {
    max-width: 160px;
  }

  .role-selector-container label {
    display: none;
  }

  /* User badge compact */
  .user-badge span {
    display: none;
  }

  /* Export buttons hide on mobile */
  .fab-export {
    display: none !important;
  }

  /* Meeting timeline scroll */
  .l10-timeline {
    overflow-x: auto;
    padding-bottom: 16px;
  }

  /* Page body padding */
  .page-body {
    padding: 12px !important;
  }

  /* OKR tree mobile */
  .org-row {
    flex-direction: column;
    align-items: stretch;
  }

  .map-node {
    min-width: unset;
    width: 100%;
  }

  /* Scenario switch compact */
  .scenario-switch {
    flex-wrap: wrap;
    gap: 6px;
  }

  .scenario-option {
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  /* Tab navigation scroll */
  .tab-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

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

  .tab-btn {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 0.78rem;
  }

  /* Notification bell */
  .notification-bell {
    width: 32px;
    height: 32px;
  }

  /* Chatbot floating button smaller */
  .chatbot-floating-btn {
    width: 48px !important;
    height: 48px !important;
    bottom: 16px !important;
    right: 16px !important;
  }
}

@media (max-width: 480px) {
  /* Extra small - even more compact */
  .glass-card {
    padding: 10px !important;
  }

  .info-card .card-value {
    font-size: 1.1rem;
  }

  .badge {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  /* Stack all flex containers */
  [style*="display: flex"][style*="gap: 16px"],
  [style*="display: flex"][style*="gap: 20px"],
  [style*="display: flex"][style*="gap: 24px"] {
    flex-direction: column !important;
  }
}

/* ── 47. Deep Mobile Fixes (≤768px) — Inner Layout Overrides ── */
@media (max-width: 768px) {
  /* Inner card 2-column grids (SaaS cards, EWS alerts) → stack */
  [style*="grid-template-columns: 1.15fr 1fr"],
  [style*="grid-template-columns: 1.5fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns: 200px 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Chart containers — reduce height on mobile */
  [style*="height: 520px"],
  [style*="height: 400px"],
  [style*="height: 350px"] {
    height: 280px !important;
  }

  [style*="height: 280px"] {
    height: 220px !important;
  }

  /* SaaS product cards — remove dashed border-left on stacked layout */
  [style*="border-left: 1px dashed"] {
    border-left: none !important;
    padding-left: 0 !important;
    border-top: 1px dashed var(--glass-border);
    padding-top: 10px;
    margin-top: 8px;
  }

  /* Modal content — full width on mobile */
  .modal-content {
    min-width: unset !important;
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
    margin: 12px !important;
    padding: 16px !important;
    max-height: 85vh !important;
  }

  /* AI Modal inner container */
  [style*="width: 800px"] {
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
  }

  /* Header MBR + Data Entry buttons — shrink */
  #btnExportMBR,
  #btnOpenDataEntry {
    font-size: 11px !important;
    padding: 6px 10px !important;
    margin-right: 4px !important;
  }

  #btnExportMBR span,
  #btnExportMBR .fa-file-powerpoint + span {
    display: none;
  }

  /* Notification bell — smaller on mobile for touch */
  .notification-bell {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  /* Toast container — bottom center on mobile */
  #toastContainer,
  .toast-container {
    right: 8px !important;
    left: 8px !important;
    bottom: 12px !important;
    top: auto !important;
  }

  .toast {
    font-size: 0.8rem !important;
    padding: 10px 14px !important;
  }

  /* Table fonts smaller on mobile */
  .data-table {
    font-size: 0.75rem !important;
  }

  .data-table thead th {
    font-size: 0.68rem !important;
    padding: 8px 6px !important;
    letter-spacing: 0;
  }

  .data-table tbody td {
    padding: 6px !important;
  }

  /* Scenario switcher — stack vertically */
  [style*="KỊCH BẢN EGOV"],
  [name="ceoScenario"] {
    font-size: 12px;
  }

  /* Info card value responsive */
  .info-card-value {
    font-size: 22px !important;
  }

  /* View header H1 */
  [style*="font-size: 24px"][style*="font-weight: 800"] {
    font-size: 16px !important;
  }

  /* Early warning alerts — full width */
  .ews-alert-critical {
    margin-bottom: 8px;
  }

  /* Touch targets — minimum 44px */
  .btn,
  .menu-item,
  button {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 36px;
  }

  /* Sidebar overlay — darken background when open */
  .app-sidebar.open ~ .app-content::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.2s ease-out;
  }
}

/* ── 48. Safe Area + PWA Support ─────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .page-body {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }

  .fab-export,
  .chatbot-floating-btn {
    bottom: calc(24px + env(safe-area-inset-bottom)) !important;
  }

  .toast-container {
    bottom: calc(24px + env(safe-area-inset-bottom)) !important;
  }
}

/* ── 49. Landscape Mobile (≤900px height) ────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .app-header {
    height: 48px;
    padding: 0 12px;
  }

  .page-body {
    padding: 8px 12px !important;
  }

  .glass-card {
    padding: 10px !important;
  }
}

/* ── 50. Skeleton Loading ────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(255, 255, 255, 0.04) 80%
  );
  background-size: 800px 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-label { height: 10px; }
.skeleton-value { height: 20px; }
.skeleton-sub   { height: 10px; }

.skeleton-bar {
  border-radius: 4px 4px 0 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(255, 255, 255, 0.04) 80%
  );
  background-size: 800px 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-card {
  animation: fadeIn 0.4s ease-out both;
}

.skeleton-card::before {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* ── 51. Connection Status Badge ─────────────────────────── */
#connectionStatus {
  display: flex;
  align-items: center;
}

#connectionStatus .conn-status-badge:hover {
  filter: brightness(1.15);
  transform: scale(1.02);
}

