/* ==========================================================================
   Design System & Aesthetics - Dashboard REM 20 Hospital Penco Lirquén
   Theme: Light Clinical Executive / Modern Healthcare BI (Reference UI)
   ========================================================================== */

:root {
  /* Background & Surfaces */
  --bg: #f1f5f9;
  --bg-subtle: #f8fafc;
  --surf: #ffffff;
  --surf2: #f8fafc;
  --surf-active: #f1f5f9;
  
  /* Borders & Dividers */
  --brd: #e2e8f0;
  --brd-subtle: #f1f5f9;
  --brd-focus: #94a3b8;
  
  /* Primary & Brand Colors */
  --c-primary: #5b7da8;
  --c-primary-hover: #4a688d;
  --c-primary-light: #eff6ff;
  --c-primary-dark: #334e68;
  
  /* Accent Colors */
  --c-blue: #2563eb;
  --c-cyan: #0284c7;
  --c-teal: #0d9488;
  --c-emerald: #059669;
  --c-amber: #d97706;
  --c-rose: #e11d48;
  --c-purple: #7c3aed;
  
  /* Typography */
  --tx-main: #0f172a;
  --tx-title: #1e293b;
  --tx-body: #334155;
  --mu: #64748b;
  --mu-light: #94a3b8;
  
  /* Radii & Shadows */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-active: 0 4px 12px rgba(91, 125, 168, 0.28);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--tx-body);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   1. Header Bar (Institutional MINSAL / HPL)
   ========================================================================== */
header {
  background: #ffffff;
  border-bottom: 1px solid var(--brd);
  padding: 14px 32px;
  position: relative;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.header-container {
  max-width: 1480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.header-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.header-badge {
  background: var(--c-primary);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(91, 125, 168, 0.2);
}

.header-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-title h1 {
  font-size: clamp(16px, 1.8vw, 21px);
  font-weight: 800;
  color: var(--tx-main);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.header-title p {
  color: var(--mu);
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}

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

.update-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--brd);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mu);
}

.btn-print-top {
  background: #ffffff;
  border: 1px solid var(--brd);
  color: var(--tx-body);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.btn-print-top:hover {
  background: var(--bg-subtle);
  border-color: var(--c-primary);
  color: var(--c-primary-dark);
  transform: translateY(-1px);
}

/* ==========================================================================
   2. Filter Section (Segmented Pill Controls)
   ========================================================================== */
.fbar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--brd);
  box-shadow: var(--shadow-sm);
}

.fbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  max-width: 1480px;
  margin: 0 auto;
  width: 100%;
}

.flbl {
  font-size: 11px;
  font-weight: 800;
  color: var(--tx-body);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
  min-width: 130px;
}

.fbtn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--tx-body);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.fbtn:hover {
  background: var(--bg-subtle);
  border-color: var(--c-primary);
  color: var(--tx-main);
}

.fbtn.active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(91, 125, 168, 0.3);
}

.fselect {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--tx-main);
  border-radius: var(--r-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: border-color 0.15s ease;
  min-width: 260px;
}

.fselect:hover, .fselect:focus {
  border-color: var(--c-primary);
}

/* ==========================================================================
   3. Indicator Tabs Navigation (Top 10 Vertical Cards in 1 Single Row)
   ========================================================================== */
.tabs-nav-wrap {
  background: var(--bg);
  padding: 14px 24px 0 24px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

.tabs-nav {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 8px;
  max-width: 1540px;
  margin: 0 auto;
  align-items: stretch;
  min-width: 1120px;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: var(--tx-body);
  padding: 10px 5px 8px 5px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 114px;
  height: 118px;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  text-align: center;
  overflow: hidden;
}

.tab-icon-kawaii {
  font-size: 22px;
  line-height: 1;
  display: block;
  margin-top: 1px;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.tab-btn:hover .tab-icon-kawaii {
  transform: scale(1.15);
}

.tab-label {
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.24;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #1e293b;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 2px;
  word-break: normal;
  hyphens: none;
}

.tab-def-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: auto;
  flex-shrink: 0;
}

.tab-def-btn {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 99px;
  font-size: 7.5px;
  font-weight: 800;
  color: #475569;
  padding: 2.5px 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.tab-btn:hover {
  background: #ffffff;
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
}

.tab-btn.active {
  background: linear-gradient(180deg, #5b7da8 0%, #4d6f9a 100%);
  border-color: #3f5d83;
  box-shadow: 0 6px 16px rgba(91, 125, 168, 0.35);
  transform: translateY(-2px);
}

.tab-btn.active .tab-label {
  color: #ffffff;
}

.tab-btn.active .tab-def-btn {
  background: #ffffff;
  border-color: transparent;
  color: #334155;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.tab-btn.active .tab-def-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

/* ==========================================================================
   4. Main Content Layout & Header Bar
   ========================================================================== */
main {
  max-width: 1480px;
  margin: 16px auto 40px auto;
  padding: 0 32px;
}

.ind-header {
  background: #ffffff;
  border: 1px solid var(--brd);
  border-left: 5px solid var(--c-primary);
  border-radius: var(--r);
  padding: 12px 20px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.ind-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--tx-main);
  letter-spacing: -0.2px;
}

.ind-meta {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mu);
  background: var(--bg-subtle);
  border: 1px solid var(--brd);
  padding: 4px 12px;
  border-radius: 99px;
}

/* ==========================================================================
   5. KPI Grid Layout & Modern Pastel Cards
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi {
  background: #ffffff;
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 140px;
}

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

/* Main Highlighted KPI Card */
.kpi.highlight {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-md);
  min-width: 220px;
}

.kpi-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--mu);
  margin-bottom: 6px;
  line-height: 1.3;
}

.kpi-val-container {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 6px 0;
}

.kpi-val {
  font-size: 28px;
  font-weight: 900;
  color: var(--c-cyan);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.kpi.highlight .kpi-val {
  color: var(--c-cyan);
  font-size: 30px;
}

.kpi-unit {
  font-size: 14px;
  font-weight: 700;
  color: var(--mu);
}

.kpi-sub {
  font-size: 11px;
  color: var(--mu);
  margin-top: auto;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Pastel Tint Tracer Cards Styles */
.kpi-tint-rose {
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
  border-color: #fecdd3;
}
.kpi-tint-rose .kpi-label { color: #9f1239; }
.kpi-tint-rose .kpi-val { color: #0f172a; }

.kpi-tint-blue {
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  border-color: #bfdbfe;
}
.kpi-tint-blue .kpi-label { color: #1e40af; }
.kpi-tint-blue .kpi-val { color: #0f172a; }

.kpi-tint-emerald {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border-color: #bbf7d0;
}
.kpi-tint-emerald .kpi-label { color: #166534; }
.kpi-tint-emerald .kpi-val { color: #0f172a; }

.kpi-tint-orange {
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  border-color: #fed7aa;
}
.kpi-tint-orange .kpi-label { color: #9a3412; }
.kpi-tint-orange .kpi-val { color: #0f172a; }

.kpi-tint-purple {
  background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%);
  border-color: #e9d5ff;
}
.kpi-tint-purple .kpi-label { color: #6b21a8; }
.kpi-tint-purple .kpi-val { color: #0f172a; }

.kpi-tint-amber {
  background: linear-gradient(180deg, #fefce8 0%, #ffffff 100%);
  border-color: #fef08a;
}
.kpi-tint-amber .kpi-label { color: #854d0e; }
.kpi-tint-amber .kpi-val { color: #0f172a; }

.kpi-tint-teal {
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
  border-color: #99f6e4;
}
.kpi-tint-teal .kpi-label { color: #115e59; }
.kpi-tint-teal .kpi-val { color: #0f172a; }

/* Subtle Bottom Wave Decoration for Tracer Cards */
.tracer-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 28px;
  pointer-events: none;
  opacity: 0.35;
}

.kpi-tracer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-badge-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.kpi-tint-rose .kpi-badge-icon { background: #ffe4e6; color: #e11d48; }
.kpi-tint-blue .kpi-badge-icon { background: #dbeafe; color: #2563eb; }
.kpi-tint-emerald .kpi-badge-icon { background: #dcfce7; color: #16a34a; }
.kpi-tint-orange .kpi-badge-icon { background: #ffedd5; color: #ea580c; }
.kpi-tint-purple .kpi-badge-icon { background: #f3e8ff; color: #9333ea; }
.kpi-tint-amber .kpi-badge-icon { background: #fef3c7; color: #d97706; }
.kpi-tint-teal .kpi-badge-icon { background: #ccfbf1; color: #0d9488; }

/* Featured Contrast Bottom Banner (like in photo) */
.kpi-banner-container {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 6px;
}

.kpi-featured-bottom {
  background: #5b7da8;
  border: 1px solid #4a6b94;
  color: #ffffff;
  border-radius: var(--r-lg);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 12px rgba(91, 125, 168, 0.25);
  min-width: 320px;
}

.kpi-featured-bottom .kpi-label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 10px;
  margin-bottom: 2px;
}

.kpi-featured-bottom .kpi-val {
  color: #ffffff;
  font-size: 26px;
}

.kpi-featured-bottom .kpi-sub {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
}

.kpi-featured-badge {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  color: #ffffff;
  white-space: nowrap;
}

/* Compliance Status Badges */
.kpi-badge.optimo {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.kpi-badge.cumple {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.kpi-badge.fuera-rango {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.kpi-badge.no-cumple, .kpi-badge.sobrecargado {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

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

/* Semaphores */
.sem {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.sem.s-ok { background-color: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.sem.s-warn { background-color: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.sem.s-no { background-color: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.sem.s-na { background-color: #94a3b8; }

/* ==========================================================================
   6. Table & Chart Cards
   ========================================================================== */
.chart-card, .table-card {
  background: #ffffff;
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.table-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--tx-main);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

.table-scroll {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--brd);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
  background: #ffffff;
}

thead tr {
  background: #f8fafc;
  border-bottom: 2px solid var(--brd);
}

th {
  padding: 10px 14px;
  font-weight: 700;
  color: var(--tx-body);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

th.r, td.r {
  text-align: right;
}

td {
  padding: 10px 14px;
  color: var(--tx-body);
  border-bottom: 1px solid var(--brd);
  white-space: nowrap;
}

tbody tr:hover {
  background-color: #f8fafc;
}

tbody tr.highlighted {
  background-color: #eff6ff;
  font-weight: 600;
}

tbody tr.accumulated {
  background-color: #f1f5f9;
  font-weight: 700;
  border-top: 2px solid #cbd5e1;
}

.pct-good { color: #059669; font-weight: 700; }
.pct-warn { color: #d97706; font-weight: 700; }
.pct-bad { color: #e11d48; font-weight: 700; }
.pct-na { color: #64748b; }

/* ==========================================================================
   7. CUDYR & Special Views Specific Styles
   ========================================================================== */
.btn-preset {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--tx-body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-preset:hover {
  background: var(--bg-subtle);
  border-color: var(--c-primary);
}

.btn-preset.active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #ffffff;
  font-weight: 700;
}

.cudyr-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-body);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.cudyr-pill:hover {
  background: var(--bg-subtle);
  border-color: var(--c-primary);
}

.cudyr-pill.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
  font-weight: 700;
}

.cudyr-pill input[type="checkbox"] {
  accent-color: var(--c-primary);
  cursor: pointer;
}

/* Categorization Layout & Matrix (CUDYR) */
.cudyr-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 16px;
  margin-bottom: 24px;
}

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

.cudyr-card {
  background: #ffffff;
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.cudyr-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--tx-title);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--brd);
  padding-bottom: 8px;
}

.cudyr-bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cudyr-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cudyr-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
}

.cudyr-bar-label {
  color: var(--tx-main);
  font-weight: 700;
}

.cudyr-bar-val {
  color: #475569;
  font-weight: 700;
}

.cudyr-bar-bg {
  height: 8px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.cudyr-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.fill-a { background: linear-gradient(90deg, #e11d48, #9333ea); }
.fill-b { background: linear-gradient(90deg, #9333ea, #2563eb); }
.fill-c { background: linear-gradient(90deg, #2563eb, #0284c7); }
.fill-d { background: linear-gradient(90deg, #0284c7, #059669); }

.fill-dep1 { background: #e11d48; }
.fill-dep2 { background: #d97706; }
.fill-dep3 { background: #059669; }

/* Matrix Table Grid */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.matrix-header-cell {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  padding: 6px 4px;
  background: #f8fafc;
  border-radius: var(--r-sm);
  border: 1px solid #e2e8f0;
}

.matrix-cell {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--r-sm);
  padding: 10px 6px;
  text-align: center;
  transition: all 0.2s ease;
}

.matrix-cell:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.matrix-cell-code {
  font-size: 13px;
  font-weight: 900;
  color: #1e293b;
  margin-bottom: 2px;
}

.matrix-cell-val {
  font-size: 15px;
  font-weight: 800;
  color: #0284c7;
}

.matrix-cell-pct {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  margin-top: 1px;
}

/* CUDYR Cross Table */
.cudyr-cross-table {
  width: 100%;
  border-collapse: collapse;
}

.cudyr-cross-table th, .cudyr-cross-table td {
  padding: 8px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--brd);
}

.cudyr-cross-table tbody tr:hover {
  background-color: #f8fafc;
}

/* ==========================================================================
   8. Tooltip System
   ========================================================================== */
#global-tooltip {
  position: fixed;
  display: none;
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 320px;
}

/* ==========================================================================
   9. Responsive & Print Styles
   ========================================================================== */
@media (max-width: 1024px) {
  header, .fbar-wrap, .tabs-nav-wrap, main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .fbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .flbl {
    margin-bottom: 4px;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }
  header, .fbar-wrap, .tabs-nav-wrap, .btn-print-top {
    display: none !important;
  }
  .chart-card, .table-card, .kpi {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }
}
