/* ============================================================
   LAYOUT FIX - Premium Override CSS
   ISO 9001 SGC - QMSPM Ecosystem
   v2.0 - Stunning Dark Theme with Glassmorphism
   ============================================================ */

/* ===========================================
   1. RESET & BASE
   =========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: #0F0D12;
  color: #e5e7eb;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===========================================
   2. LOGIN SCREEN
   =========================================== */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0F0D12 0%, #1a1625 40%, #0a1628 100%);
}
.login-overlay::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(14,116,144,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(14,116,144,0.05) 0%, transparent 50%);
  pointer-events: none;
}
.login-card {
  background: rgba(28, 24, 36, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(14, 116, 144, 0.2);
  border-radius: 20px;
  padding: 48px 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.5), 0 0 60px rgba(14,116,144,0.06);
  position: relative;
}
.login-logo { text-align: center; margin-bottom: 12px; }
.login-logo-icon { font-size: 48px; filter: drop-shadow(0 0 16px rgba(14,116,144,0.5)); }
.login-title { text-align: center; font-size: 24px; font-weight: 700; color: #f1f5f9; margin-bottom: 4px; }
.login-subtitle { text-align: center; font-size: 12px; color: #22d3ee; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 32px; font-weight: 600; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label {
  display: block; font-size: 11px; font-weight: 700; color: #64748b;
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px;
}
.login-form input {
  width: 100%; padding: 13px 16px;
  background: rgba(15, 13, 18, 0.9);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; color: #e5e7eb; font-size: 14px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.login-form input:focus {
  outline: none;
  border-color: #0e7490;
  box-shadow: 0 0 0 3px rgba(14,116,144,0.2), 0 0 20px rgba(14,116,144,0.08);
}
.login-error { color: #f87171; font-size: 13px; min-height: 20px; text-align: center; margin-bottom: 4px; }
.login-form .btn-primary, .login-form .btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #0e7490, #0891b2);
  border: none; border-radius: 10px; color: white;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all 0.25s; letter-spacing: 0.3px;
  box-shadow: 0 4px 15px rgba(14,116,144,0.3);
}
.login-form .btn-primary:hover, .login-form .btn:hover {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(14,116,144,0.4);
}
.login-footer { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; font-size: 12px; color: #475569; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; display: inline-block; box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.connection-dot.ok { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }

/* ===========================================
   3. APP CONTAINER
   =========================================== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #0F0D12;
}

/* ===========================================
   4. SIDEBAR
   =========================================== */
.sidebar {
  width: 260px; min-width: 260px;
  background: linear-gradient(180deg, #0e0c14 0%, #0a0910 100%);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  transition: width 0.3s ease, min-width 0.3s ease;
  z-index: 100;
  position: relative;
}
.sidebar::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, rgba(14,116,144,0.2) 0%, rgba(14,116,144,0.05) 50%, rgba(14,116,144,0.1) 100%);
  pointer-events: none;
}
.sidebar::-webkit-scrollbar { width: 0; }
.sidebar:hover::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }

.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-version,
.sidebar.collapsed .nav-section-header { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-icon { margin-right: 0; font-size: 18px; }

.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-logo-icon {
  font-size: 28px; color: #0e7490;
  filter: drop-shadow(0 0 8px rgba(14,116,144,0.4));
}
.sidebar-brand {
  font-size: 16px; font-weight: 800; color: #f1f5f9;
  white-space: nowrap; letter-spacing: -0.3px;
}
.sidebar-version { font-size: 10px; color: #475569; margin-left: auto; }

.sidebar-nav {
  flex: 1; padding: 14px 10px;
  display: flex; flex-direction: column; gap: 2px;
}

.nav-section-header {
  font-size: 10px; font-weight: 800; color: #3f4a5c;
  text-transform: uppercase; letter-spacing: 2px;
  padding: 20px 14px 8px; margin-top: 4px;
  user-select: none;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 10px;
  color: #7a8599; font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  border-left: 3px solid transparent;
  margin-left: 2px;
  position: relative;
}
.nav-item:hover {
  background: rgba(14,116,144,0.07);
  color: #c9d1dc;
  border-left-color: rgba(14,116,144,0.3);
}
.nav-item.active {
  background: rgba(14,116,144,0.12);
  color: #22d3ee;
  border-left-color: #0e7490;
  font-weight: 600;
}
.nav-item.active .nav-icon { color: #22d3ee; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; opacity: 0.7; transition: opacity 0.2s; }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-spacer { flex: 1; }
.nav-item-bottom { margin-top: auto; }

/* ===========================================
   5. MAIN WRAPPER
   =========================================== */
.main-wrapper {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: linear-gradient(160deg, #0F0D12 0%, #151320 40%, #0F0D12 100%);
}

/* ===========================================
   6. HEADER
   =========================================== */
.app-header {
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  height: 60px; min-height: 60px;
  background: rgba(14, 12, 20, 0.75);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 50;
  position: relative;
}
.app-header::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(14,116,144,0.2) 30%, rgba(14,116,144,0.2) 70%, transparent 100%);
  pointer-events: none;
}
.btn-icon {
  background: none; border: none; color: #64748b; cursor: pointer;
  font-size: 18px; padding: 8px 10px; border-radius: 8px;
  transition: all 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.sidebar-toggle { display: none; }
.header-title {
  font-size: 18px; font-weight: 700; color: #f1f5f9;
  flex: 1; letter-spacing: -0.3px;
}
.header-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.header-empresa select, .form-select-sm {
  background: rgba(15,13,18,0.9);
  border: 1px solid rgba(255,255,255,0.08);
  color: #c9d1dc; padding: 7px 30px 7px 12px;
  border-radius: 8px; font-size: 13px;
  appearance: auto; cursor: pointer; max-width: 220px;
  transition: border-color 0.2s;
}
.header-empresa select:focus, .form-select-sm:focus {
  border-color: #0e7490;
  outline: none;
  box-shadow: 0 0 0 2px rgba(14,116,144,0.15);
}
.header-notifications { position: relative; }
.header-notifications .badge {
  position: absolute; top: -2px; right: -2px;
  font-size: 10px; min-width: 18px; height: 18px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; font-weight: 700;
  box-shadow: 0 2px 8px rgba(239,68,68,0.4);
}
.header-user {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; position: relative;
  padding: 5px 10px; border-radius: 10px;
  transition: background 0.2s;
}
.header-user:hover { background: rgba(255,255,255,0.04); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #0e7490, #06b6d4);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  box-shadow: 0 0 0 2px rgba(14,116,144,0.3);
}
.user-name { font-size: 13px; color: #94a3b8; font-weight: 500; }
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: rgba(28, 24, 40, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; min-width: 200px; padding: 6px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.5);
  z-index: 200;
  animation: fadeIn 0.15s ease;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; color: #94a3b8; text-decoration: none;
  border-radius: 8px; font-size: 13px; transition: all 0.15s;
}
.dropdown-item:hover { background: rgba(14,116,144,0.1); color: #e2e8f0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ===========================================
   7. MAIN CONTENT AREA
   =========================================== */
.main-content {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 28px;
  background: transparent;
  scroll-behavior: smooth;
}

/* ===========================================
   8. CONTENT SECTIONS & ANIMATIONS
   =========================================== */
.content-section { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===========================================
   9. KPI GRID - Premium Cards
   =========================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-card {
  background: rgba(28, 24, 36, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: all 0.25s ease;
  border-left: 4px solid rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 60%);
  pointer-events: none;
}
.kpi-card:hover {
  background: rgba(28, 24, 36, 0.85);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.08);
}

.kpi-danger  { border-left-color: #ef4444; }
.kpi-warning { border-left-color: #f59e0b; }
.kpi-info    { border-left-color: #3b82f6; }
.kpi-success { border-left-color: #10b981; }
.kpi-teal    { border-left-color: #0e7490; }
.kpi-purple  { border-left-color: #8b5cf6; }

.kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: rgba(14,116,144,0.12);
  color: #22d3ee;
}
.kpi-danger .kpi-icon  { background: rgba(239,68,68,0.12); color: #f87171; }
.kpi-warning .kpi-icon { background: rgba(245,158,11,0.12); color: #fbbf24; }
.kpi-info .kpi-icon    { background: rgba(59,130,246,0.12); color: #60a5fa; }
.kpi-success .kpi-icon { background: rgba(16,185,129,0.12); color: #34d399; }
.kpi-teal .kpi-icon    { background: rgba(14,116,144,0.12); color: #22d3ee; }
.kpi-purple .kpi-icon  { background: rgba(139,92,246,0.12); color: #a78bfa; }

.kpi-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-value {
  font-size: 24px; font-weight: 800; color: #f1f5f9;
  line-height: 1.1; letter-spacing: -0.5px;
}
.kpi-label {
  font-size: 10px; color: #64748b; text-transform: uppercase;
  letter-spacing: 0.5px; margin-top: 2px; font-weight: 600;
  word-wrap: break-word; line-height: 1.3;
  text-align: center;
}
.kpi-body { display: flex; flex-direction: column; min-width: 0; align-items: center; }
.kpi-card { flex-direction: column; text-align: center; gap: 8px; }

/* ===========================================
   10. CARDS - Glassmorphism
   =========================================== */
.card {
  background: rgba(28, 24, 36, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 0;
  margin-bottom: 20px;
  transition: all 0.25s ease;
  overflow: hidden;
}
.card:hover {
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 15px; font-weight: 700; color: #f1f5f9;
  letter-spacing: -0.2px;
}
.card-header .card-subtitle,
.card-header small {
  font-size: 12px; color: #64748b; font-weight: 500; letter-spacing: 0;
}
.card-body { padding: 22px; }

/* ===========================================
   11. CHART GRID
   =========================================== */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.chart-card {
  background: rgba(28, 24, 36, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 22px;
  transition: all 0.25s ease;
}
.chart-card:hover {
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.chart-card h4 {
  font-size: 14px; font-weight: 700; color: #c9d1dc;
  margin-bottom: 4px; letter-spacing: -0.2px;
}
.chart-card .chart-subtitle,
.chart-card h4 + p,
.chart-card h4 + small {
  font-size: 12px; color: #475569; margin-bottom: 16px; display: block;
}
.chart-card canvas { width: 100% !important; max-height: 260px; }

/* ===========================================
   12. TABLES - Premium Styling
   =========================================== */
.table-wrapper, .table-responsive {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(28, 24, 36, 0.4);
}
table, .table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(14,116,144,0.06);
  white-space: nowrap;
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: #cbd5e1;
  transition: background 0.15s;
}
tbody tr:nth-child(odd) td { background: rgba(255,255,255,0.01); }
tbody tr:hover td { background: rgba(14,116,144,0.06); }
tbody tr:last-child td { border-bottom: none; }

/* ===========================================
   13. BUTTONS - Gradient & Lift
   =========================================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
  position: relative;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #0e7490, #0891b2);
  color: white;
  box-shadow: 0 2px 10px rgba(14,116,144,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14,116,144,0.4);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  box-shadow: 0 2px 10px rgba(5,150,105,0.25);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(5,150,105,0.35); }

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  box-shadow: 0 2px 10px rgba(220,38,38,0.25);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(220,38,38,0.35); }

.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: white;
  box-shadow: 0 2px 10px rgba(217,119,6,0.25);
}
.btn-warning:hover { transform: translateY(-2px); }

.btn-outline {
  background: transparent; color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-outline:hover {
  border-color: #0e7490; color: #22d3ee;
  background: rgba(14,116,144,0.06);
}
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; color: #94a3b8; border: none; }
.btn-ghost:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }

/* ===========================================
   14. BADGES
   =========================================== */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
  background: rgba(100,116,139,0.12); color: #94a3b8;
  letter-spacing: 0.3px;
}
.badge-success { background: rgba(5,150,105,0.15); color: #34d399; }
.badge-danger  { background: rgba(220,38,38,0.15); color: #f87171; }
.badge-warning { background: rgba(217,119,6,0.15); color: #fbbf24; }
.badge-info    { background: rgba(14,116,144,0.15); color: #22d3ee; }
.badge-purple  { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* ===========================================
   15. FORMS & INPUTS
   =========================================== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 11px; font-weight: 700; color: #64748b;
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px;
}
.form-control, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%; padding: 10px 14px;
  background: rgba(15,13,18,0.85);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; color: #e2e8f0; font-size: 13px;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  font-family: inherit;
}
.form-control:hover, select:hover, textarea:hover { border-color: rgba(255,255,255,0.12); }
.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: #0e7490;
  box-shadow: 0 0 0 3px rgba(14,116,144,0.15), 0 0 20px rgba(14,116,144,0.06);
  background: rgba(15,13,18,0.95);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
select { cursor: pointer; }
input::placeholder, textarea::placeholder { color: #3f4a5c; }

.form-row, .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-help { font-size: 12px; color: #475569; margin-top: 4px; }
.form-error { font-size: 12px; color: #f87171; margin-top: 4px; }

/* Checkbox & Radio custom */
input[type="checkbox"], input[type="radio"] {
  width: 18px; height: 18px; padding: 0;
  accent-color: #0e7490;
}

/* ===========================================
   16. TABS
   =========================================== */
.tab-nav {
  display: flex; gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-nav::-webkit-scrollbar { height: 0; }
.tab-btn {
  padding: 12px 20px; font-size: 13px; font-weight: 600;
  color: #64748b; background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
  position: relative;
}
.tab-btn:hover { color: #94a3b8; }
.tab-btn.active {
  color: #22d3ee;
  border-bottom-color: #0e7490;
}
.tab-pane { display: none; animation: fadeIn 0.3s ease; }
.tab-pane.active { display: block; }

/* ===========================================
   17. MODALS - Glassmorphism + Animation
   =========================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal-box {
  background: rgba(28, 24, 40, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  width: 100%; max-width: 600px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 60px rgba(14,116,144,0.04);
  animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1060px; }
.modal-sm { max-width: 420px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-title { font-size: 18px; font-weight: 800; color: #f1f5f9; letter-spacing: -0.3px; }
.modal-close {
  background: rgba(255,255,255,0.04); border: none; color: #64748b;
  font-size: 20px; cursor: pointer; padding: 6px 10px; border-radius: 8px;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: #e2e8f0; }
.modal-body { padding: 26px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 18px 26px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ===========================================
   18. TOASTS - Slide from bottom-right
   =========================================== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 99999; display: flex; flex-direction: column-reverse; gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 16px 22px; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  color: white; min-width: 300px; max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: toastSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; align-items: center; gap: 12px;
  pointer-events: all;
  border: 1px solid rgba(255,255,255,0.1);
}
@keyframes toastSlide {
  from { opacity: 0; transform: translateX(40px) translateY(10px); }
  to { opacity: 1; transform: translateX(0) translateY(0); }
}
.toast-success { background: linear-gradient(135deg, #059669, #10b981); }
.toast-error   { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.toast-info    { background: linear-gradient(135deg, #0e7490, #0891b2); }

/* ===========================================
   19. SECTION HEADER
   =========================================== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}
.section-title {
  font-size: 24px; font-weight: 800; color: #f1f5f9;
  letter-spacing: -0.5px;
}
.section-subtitle {
  font-size: 13px; color: #64748b; margin-top: 2px;
}

/* ===========================================
   20. FILTER BAR
   =========================================== */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 14px 18px;
  background: rgba(28, 24, 36, 0.4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
}
.filter-bar select, .filter-bar input {
  background: rgba(15,13,18,0.9);
  border: 1px solid rgba(255,255,255,0.07);
  color: #e2e8f0; padding: 8px 14px;
  border-radius: 8px; font-size: 13px;
  transition: border-color 0.2s;
}
.filter-bar select:focus, .filter-bar input:focus {
  border-color: #0e7490;
  outline: none;
}
.filter-bar .btn { flex-shrink: 0; }

/* ===========================================
   21. EMPTY STATE
   =========================================== */
.empty-state {
  text-align: center; padding: 72px 20px;
  color: #3f4a5c;
}
.empty-state-icon {
  font-size: 56px; opacity: 0.25; margin-bottom: 16px;
  filter: grayscale(0.5);
}
.empty-state-text { font-size: 15px; color: #475569; }
.empty-state-action { margin-top: 20px; }

/* ===========================================
   22. PROCESS MAP - Swimlanes
   =========================================== */
.process-map {
  display: flex; flex-direction: column; gap: 2px;
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 24px;
}
.swimlane {
  display: flex; min-height: 80px;
}
.swimlane-header {
  width: 160px; min-width: 160px;
  display: flex; align-items: center; justify-content: center;
  padding: 14px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: white;
}
.swimlane-header.sl-direction    { background: rgba(14,116,144,0.7); }
.swimlane-header.sl-core         { background: rgba(59,130,246,0.6); }
.swimlane-header.sl-support      { background: rgba(139,92,246,0.5); }
.swimlane-header.sl-measurement  { background: rgba(245,158,11,0.6); }
.swimlane-body {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 16px; background: rgba(28,24,36,0.4);
  overflow-x: auto;
}
.process-step {
  background: rgba(28,24,36,0.8);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 10px 16px;
  font-size: 12px; color: #cbd5e1; white-space: nowrap;
  transition: all 0.2s;
}
.process-step:hover {
  background: rgba(14,116,144,0.1);
  border-color: rgba(14,116,144,0.3);
}
.process-arrow { color: #3f4a5c; font-size: 18px; flex-shrink: 0; }

/* ===========================================
   23. RISK MATRIX - 5x5 Grid
   =========================================== */
.risk-matrix {
  display: grid;
  grid-template-columns: auto repeat(5, 1fr);
  grid-template-rows: auto repeat(5, 1fr);
  gap: 3px;
  max-width: 600px;
  margin: 0 auto 24px;
}
.risk-matrix-cell {
  display: flex; align-items: center; justify-content: center;
  min-height: 56px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: rgba(0,0,0,0.7);
  transition: all 0.2s; cursor: default;
}
.risk-matrix-cell:hover { transform: scale(1.05); z-index: 1; }
.risk-matrix-header {
  font-size: 10px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
}
.risk-low       { background: rgba(34,197,94,0.6); }
.risk-moderate  { background: rgba(250,204,21,0.6); color: rgba(0,0,0,0.7); }
.risk-high      { background: rgba(249,115,22,0.6); }
.risk-extreme   { background: rgba(239,68,68,0.7); color: white; }
.risk-very-low  { background: rgba(34,197,94,0.35); }

/* ===========================================
   24. DOFA QUADRANT (SWOT)
   =========================================== */
.dofa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 24px;
}
.dofa-quadrant {
  padding: 0;
  min-height: 160px;
}
.dofa-header {
  padding: 12px 18px;
  font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px;
  color: white;
}
.dofa-header.dofa-f { background: rgba(16,185,129,0.7); }   /* Fortalezas */
.dofa-header.dofa-d { background: rgba(239,68,68,0.6); }    /* Debilidades */
.dofa-header.dofa-o { background: rgba(59,130,246,0.6); }   /* Oportunidades */
.dofa-header.dofa-a { background: rgba(249,115,22,0.6); }   /* Amenazas */
.dofa-body {
  padding: 16px 18px;
  background: rgba(28,24,36,0.5);
  font-size: 13px; color: #cbd5e1;
  min-height: 100px;
}
.dofa-body ul { list-style: none; padding: 0; }
.dofa-body li {
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 13px;
}
.dofa-body li:last-child { border-bottom: none; }

/* ===========================================
   25. PDCA CYCLE
   =========================================== */
.pdca-cycle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  width: 320px; height: 320px;
  margin: 20px auto;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(14,116,144,0.1);
}
.pdca-quadrant {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
  color: white; cursor: default;
  transition: all 0.25s;
}
.pdca-quadrant:hover { filter: brightness(1.15); }
.pdca-quadrant span { font-size: 11px; font-weight: 600; margin-top: 4px; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; }
.pdca-plan  { background: linear-gradient(135deg, #3b82f6, #2563eb); border-radius: 50% 0 0 0; }
.pdca-do    { background: linear-gradient(135deg, #10b981, #059669); border-radius: 0 50% 0 0; }
.pdca-check { background: linear-gradient(135deg, #f59e0b, #d97706); border-radius: 0 0 0 50%; }
.pdca-act   { background: linear-gradient(135deg, #ef4444, #dc2626); border-radius: 0 0 50% 0; }

/* ===========================================
   26. WORKFLOW STEPS - Horizontal
   =========================================== */
.workflow-steps {
  display: flex; align-items: center; gap: 0;
  overflow-x: auto; padding: 16px 0;
  margin-bottom: 24px;
}
.workflow-step {
  display: flex; flex-direction: column; align-items: center;
  min-width: 120px; padding: 12px 16px;
  position: relative;
}
.workflow-step-number {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(28,24,36,0.8);
  border: 2px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #64748b;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.workflow-step.active .workflow-step-number {
  background: linear-gradient(135deg, #0e7490, #0891b2);
  border-color: #0e7490;
  color: white;
  box-shadow: 0 0 15px rgba(14,116,144,0.4);
}
.workflow-step.completed .workflow-step-number {
  background: rgba(16,185,129,0.2);
  border-color: #10b981;
  color: #34d399;
}
.workflow-step-label {
  font-size: 11px; color: #64748b; text-align: center;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.workflow-step.active .workflow-step-label { color: #22d3ee; }
.workflow-step.completed .workflow-step-label { color: #34d399; }
.workflow-connector {
  flex: 0 0 40px; height: 2px;
  background: rgba(255,255,255,0.06);
  align-self: center;
  margin-bottom: 20px;
}
.workflow-connector.active { background: linear-gradient(90deg, #0e7490, #22d3ee); }
.workflow-connector.completed { background: #10b981; }

/* ===========================================
   27. TIMELINE
   =========================================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: rgba(255,255,255,0.06);
}
.timeline-item {
  position: relative; margin-bottom: 24px;
  padding-left: 20px;
}
.timeline-item::before {
  content: ''; position: absolute; left: -24px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(14,116,144,0.3); border: 2px solid #0e7490;
}
.timeline-date { font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.timeline-content { font-size: 13px; color: #cbd5e1; margin-top: 4px; }

/* ===========================================
   28. STATUS INDICATORS
   =========================================== */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}
.status-dot.active { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.inactive { background: #64748b; }
.status-dot.warning { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.status-dot.danger { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.4); }

/* Progress bars */
.progress-bar-wrapper {
  width: 100%; height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #0e7490, #22d3ee);
  transition: width 0.5s ease;
}
.progress-bar-fill.success { background: linear-gradient(90deg, #059669, #34d399); }
.progress-bar-fill.warning { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress-bar-fill.danger  { background: linear-gradient(90deg, #dc2626, #f87171); }

/* ===========================================
   29. LOADING STATES
   =========================================== */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: 8px;
}
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(14,116,144,0.2);
  border-top-color: #0e7490;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================================
   30. SCROLLBAR - Thin & Subtle
   =========================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}

/* ===========================================
   31. ACTIVITY TABLE
   =========================================== */
.activity-table { margin-top: 8px; }
.activity-table th, .activity-table td { padding: 9px 16px; }

/* ===========================================
   32. TOOLBAR INLINE
   =========================================== */
.toolbar-inline {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.toolbar-inline .btn { margin: 0; }

/* ===========================================
   33. PAGINATION
   =========================================== */
.pagination {
  display: flex; align-items: center; gap: 4px;
  justify-content: center; padding: 16px 0;
}
.page-btn {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid rgba(255,255,255,0.06);
  background: transparent; color: #94a3b8;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.page-btn:hover { border-color: #0e7490; color: #22d3ee; }
.page-btn.active {
  background: rgba(14,116,144,0.15); border-color: #0e7490; color: #22d3ee;
}

/* ===========================================
   34. TAGS & CHIPS
   =========================================== */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  background: rgba(14,116,144,0.1); color: #22d3ee;
  border: 1px solid rgba(14,116,144,0.15);
}
.tag-remove {
  background: none; border: none; color: inherit;
  cursor: pointer; font-size: 14px; padding: 0 2px;
  opacity: 0.6; transition: opacity 0.15s;
}
.tag-remove:hover { opacity: 1; }

/* ===========================================
   35. TOOLTIPS
   =========================================== */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 6px 12px; border-radius: 8px;
  background: rgba(28,24,40,0.95); color: #e2e8f0;
  font-size: 12px; font-weight: 500;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  z-index: 1000;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ===========================================
   36. ACCORDION / COLLAPSIBLE
   =========================================== */
.accordion-item {
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px; margin-bottom: 6px;
  overflow: hidden;
}
.accordion-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; cursor: pointer;
  background: rgba(28,24,36,0.4);
  font-size: 14px; font-weight: 600; color: #c9d1dc;
  transition: background 0.2s;
}
.accordion-header:hover { background: rgba(28,24,36,0.6); }
.accordion-body { padding: 0 18px 16px; }

/* ===========================================
   37. STAT COMPARISON CARDS
   =========================================== */
.stat-trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.stat-trend.up { color: #34d399; }
.stat-trend.down { color: #f87171; }
.stat-trend.neutral { color: #64748b; }

/* ===========================================
   38. DOCUMENT VIEWER
   =========================================== */
.doc-viewer {
  background: rgba(28,24,36,0.5);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 24px; min-height: 200px;
}
.doc-viewer h1, .doc-viewer h2, .doc-viewer h3 { color: #f1f5f9; margin-bottom: 12px; }
.doc-viewer p { color: #cbd5e1; line-height: 1.7; margin-bottom: 12px; }

/* ===========================================
   39. AUDIT TRAIL
   =========================================== */
.audit-entry {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.audit-entry:last-child { border-bottom: none; }
.audit-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14,116,144,0.1); color: #22d3ee;
  font-size: 14px; flex-shrink: 0;
}
.audit-details { flex: 1; }
.audit-action { font-size: 13px; color: #cbd5e1; font-weight: 500; }
.audit-meta { font-size: 11px; color: #475569; margin-top: 2px; }

/* ===========================================
   40. ALERT BANNERS
   =========================================== */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px; border-radius: 12px;
  margin-bottom: 16px; font-size: 13px;
  border: 1px solid transparent;
}
.alert-info {
  background: rgba(14,116,144,0.08); border-color: rgba(14,116,144,0.2);
  color: #67e8f9;
}
.alert-success {
  background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.2);
  color: #6ee7b7;
}
.alert-warning {
  background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2);
  color: #fcd34d;
}
.alert-danger {
  background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.2);
  color: #fca5a5;
}
.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ===========================================
   41. FILE UPLOAD ZONE
   =========================================== */
.upload-zone {
  border: 2px dashed rgba(255,255,255,0.08);
  border-radius: 14px; padding: 40px;
  text-align: center; color: #475569;
  transition: all 0.25s; cursor: pointer;
}
.upload-zone:hover {
  border-color: rgba(14,116,144,0.3);
  background: rgba(14,116,144,0.04);
}
.upload-zone.dragover {
  border-color: #0e7490;
  background: rgba(14,116,144,0.08);
}

/* ===========================================
   42. UTILITY CLASSES
   =========================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #64748b; }
.text-teal { color: #22d3ee; }
.text-success { color: #34d399; }
.text-danger { color: #f87171; }
.text-warning { color: #fbbf24; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; letter-spacing: 0.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }

.w-full { width: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }

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

/* ===========================================
   43. RESPONSIVE
   =========================================== */
@media (max-width: 1200px) {
  .chart-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: -270px; top: 0; bottom: 0;
    z-index: 200; transition: left 0.3s ease;
    box-shadow: none;
  }
  .sidebar.sidebar-open {
    left: 0;
    box-shadow: 20px 0 60px rgba(0,0,0,0.5);
  }
  /* Overlay oscuro cuando sidebar abierto en mobile */
  .sidebar.sidebar-open + .main-wrapper::before {
    content: '';
    position: fixed; inset: 0; z-index: 150;
    background: rgba(0,0,0,0.5);
  }
  .sidebar-toggle { display: flex !important; }
  .main-content { padding: 16px; }
  .app-header { padding: 0 12px; height: 52px; min-height: 52px; }
  .header-title { font-size: 15px; }
  .header-empresa { max-width: 140px; }
  .header-empresa select { font-size: 11px; padding: 5px 8px; max-width: 130px; }
  .user-name { display: none; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .kpi-card { padding: 10px 10px; gap: 8px; border-radius: 10px; }
  .kpi-icon { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
  .kpi-value { font-size: 18px; }
  .kpi-label { font-size: 8px; letter-spacing: 0.3px; }
  .chart-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .dofa-grid { grid-template-columns: 1fr; }
  .pdca-cycle { width: 200px; height: 200px; }
  .section-title { font-size: 18px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .modal-box { margin: 8px; border-radius: 14px; max-height: 95vh; }
  .modal-lg, .modal-xl { max-width: calc(100vw - 16px); }
  .filter-bar { flex-direction: column; align-items: stretch; padding: 10px 12px; gap: 8px; }
  .filter-bar select, .filter-bar input { width: 100%; }
  .workflow-steps { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .tab-nav { gap: 0; }
  .tab-btn { padding: 8px 12px; font-size: 12px; }
  table { font-size: 12px; display: block; overflow-x: auto; white-space: nowrap; }
  thead th, tbody td { padding: 8px 10px; }
  .card-header { padding: 12px 14px; font-size: 14px; }
  .card-body { padding: 14px; }
  .btn { padding: 7px 12px; font-size: 12px; }
  .process-map-lane { flex-direction: column; }
  .risk-matrix { font-size: 10px; }
  .risk-matrix td { padding: 6px 4px; min-width: 45px; }
}

/* --- TABLET (481-768) --- */
@media (min-width: 481px) and (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .dofa-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- PHONE SMALL (max 480px) --- */
@media (max-width: 480px) {
  .main-content { padding: 10px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .kpi-card { padding: 8px; gap: 6px; }
  .kpi-icon { width: 26px; height: 26px; font-size: 11px; }
  .kpi-value { font-size: 16px; }
  .kpi-label { font-size: 7px; }
  .app-header { height: 48px; min-height: 48px; }
  .header-title { font-size: 14px; }
  .header-notifications { display: none; }
  .tab-btn { padding: 6px 8px; font-size: 11px; }
  .modal-box { margin: 4px; border-radius: 12px; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .filter-bar { padding: 8px; }
  .section-title { font-size: 16px; }
  .chart-card { padding: 12px; }
  .chart-card h4 { font-size: 12px; }
  .dofa-grid { grid-template-columns: 1fr; }
  /* Floating action button for mobile */
  .btn-fab {
    position: fixed; bottom: 20px; right: 20px;
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, #0e7490, #0891b2);
    color: white; font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(14,116,144,0.4);
    z-index: 100; border: none; cursor: pointer;
  }
}

/* --- LANDSCAPE PHONE --- */
@media (max-height: 500px) and (orientation: landscape) {
  .app-header { height: 44px; min-height: 44px; }
  .main-content { padding: 8px 12px; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
  .kpi-card { padding: 6px 8px; }
  .kpi-value { font-size: 16px; }
  .login-card { padding: 20px 24px; }
  .login-title { font-size: 18px; }
}

/* --- Touch improvements --- */
@media (hover: none) and (pointer: coarse) {
  .nav-item { padding: 12px 14px; min-height: 44px; }
  .btn { min-height: 44px; }
  .tab-btn { min-height: 44px; }
  .form-control, select, textarea { min-height: 44px; font-size: 16px; }
  .dropdown-item { min-height: 44px; display: flex; align-items: center; }
  tbody td { padding: 12px 14px; }
}

/* ===========================================
   44. PRINT STYLES
   =========================================== */
@media print {
  *, *::before, *::after {
    background: white !important;
    color: #1a1a1a !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-color: #ddd !important;
  }
  body { font-size: 12pt; line-height: 1.4; }
  .sidebar, .app-header, .sidebar-toggle,
  .toast-container, .modal-overlay, .btn,
  .filter-bar { display: none !important; }
  .main-wrapper { display: block; }
  .main-content {
    padding: 0; overflow: visible;
    background: white !important;
  }
  .app-container { display: block; height: auto; overflow: visible; }
  .card, .chart-card, .kpi-card {
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
  }
  .kpi-grid { flex-wrap: wrap; }
  .kpi-card { border-left-width: 4px !important; }
  table { border-collapse: collapse; }
  th, td { border: 1px solid #ddd !important; padding: 6px 10px; }
  thead th { background: #f0f0f0 !important; font-weight: 700; }
  a { text-decoration: none; }
  .section-title { font-size: 18pt; }
  @page { margin: 1.5cm; }
}

/* ===========================================
   45. SELECTION & FOCUS GLOBAL
   =========================================== */
::selection {
  background: rgba(14,116,144,0.3);
  color: #f1f5f9;
}
:focus-visible {
  outline: 2px solid rgba(14,116,144,0.5);
  outline-offset: 2px;
  border-radius: 4px;
}
a { color: #22d3ee; text-decoration: none; transition: color 0.15s; }
a:hover { color: #67e8f9; }

/* ===========================================
   46. RADIAL AMBIENT GLOW (Subtle BG effect)
   =========================================== */
.main-content::before {
  content: '';
  position: fixed; top: -20%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(14,116,144,0.03) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
.main-content > * { position: relative; z-index: 1; }
