/* Rediseño de Login con Patrones de Bolivia y Estándar Verde Petróleo Degradado */
#loginView {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--petrol-950);
  font-family: var(--font-sans);
}
.login-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px;
  background: var(--petrol-grad-hero);
  position: relative;
  overflow: hidden;
  border-right: 1px solid rgba(20, 184, 166, 0.2);
}

/* Patrón Geométrico de Fondo con Siluetas y Cuadrícula de Bolivia */
.bolivia-pattern-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(45, 212, 191, 0.35) 1px, transparent 1px),
    linear-gradient(to right, rgba(20, 184, 166, 0.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 184, 166, 0.09) 1px, transparent 1px);
  background-size: 32px 32px, 64px 64px, 64px 64px;
}

/* Gran Silueta Vectorial Topográfica de Bolivia en el Hero */
.bolivia-watermark-container {
  position: absolute;
  top: 50%;
  right: 0%;
  transform: translateY(-50%);
  width: 580px;
  max-width: 65vw;
  height: 640px;
  max-height: 90vh;
  z-index: 1;
  opacity: 0.95;
  filter: drop-shadow(0 0 40px rgba(15, 118, 110, 0.35));
}
.bolivia-svg-contour {
  width: 100%;
  height: 100%;
}
.bolivia-department-path {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  pointer-events: auto;
}
.bolivia-department-path:hover {
  fill: rgba(45, 212, 191, 0.28);
  stroke: #5eead4;
  stroke-width: 2.2px;
  filter: drop-shadow(0 0 10px rgba(45, 212, 191, 0.75));
}
.bolivia-node-pulse {
  animation: boliviaNodePulse 3s infinite ease-in-out;
}
@keyframes boliviaNodePulse {
  0%, 100% { r: 4px; opacity: 1; }
  50% { r: 8px; opacity: 0.4; }
}

.hero-header { position: relative; z-index: 2; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(20, 184, 166, 0.16);
  border: 1px solid rgba(45, 212, 191, 0.38);
  border-radius: 20px;
  color: #2dd4bf;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(4, 39, 46, 0.3);
}
.hero-title {
  font-size: 38px;
  font-weight: 800;
  color: #ffffff;
  margin: 22px 0 12px;
  line-height: 1.15;
  letter-spacing: -0.5px;
}
.hero-subtitle {
  font-size: 15.5px;
  color: #93c5cd;
  max-width: 480px;
  line-height: 1.55;
}
.hero-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 2;
  margin-top: 36px;
}
.hero-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e0f2f5;
  font-size: 13.5px;
  font-weight: 500;
}
.hero-feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2dd4bf;
  font-size: 16px;
}
.hero-footer {
  position: relative;
  z-index: 2;
  color: #649fa8;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.login-form-wrapper {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: #ffffff;
  flex-shrink: 0;
  border-left: 1px solid var(--border-color);
  position: relative;
}
.login-card { width: 100%; max-width: 360px; }
.login-brand-tag {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-align: center;
  background: var(--petrol-grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-card h2 { margin: 0 0 8px; font-size: 24px; font-weight: 700; color: var(--petrol-900); letter-spacing: -0.3px; }
.login-card p { margin: 0 0 24px; color: var(--slate-500); font-size: 14px; line-height: 1.4; }

/* Password Toggle Wrapper */
.pass-wrapper { position: relative; display: flex; align-items: center; }
.pass-wrapper input { padding-right: 44px; }
.toggle-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  min-height: auto;
  color: var(--slate-400);
}
.toggle-eye:hover { color: var(--slate-900); background: transparent; }

/* Inputs & Form Controls */
input, select {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  font-family: var(--font-sans);
  border-radius: 8px;
  font-size: 14px;
  color: var(--slate-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}
label {
  display: block;
  margin: 12px 0 6px;
  color: var(--slate-600);
  font: 600 11px var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Panel Views */
#homeView { padding: 32px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--paper); width: 100%; height: 100%; box-sizing: border-box; }
#adminView { padding: 32px 24px; overflow-y: auto; background: var(--paper); width: 100%; box-sizing: border-box; }
#seprecView { padding: 32px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--paper); width: 100%; height: 100%; box-sizing: border-box; }
#gacetaView { padding: 32px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--paper); width: 100%; height: 100%; box-sizing: border-box; }

/* Home / Inicio View Styles */
.home-container { width: 100%; max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.home-hero-card {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(13, 61, 71, 0.92) 100%);
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: 16px;
  padding: 32px;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}
.home-hero-content { position: relative; z-index: 2; max-width: 900px; }
.home-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: #2dd4bf;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.home-hero-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1.25;
}
.home-hero-subtitle {
  font-size: 14px;
  color: #94a3b8;
  margin: 0 0 20px 0;
  line-height: 1.5;
}
.home-spotlight-box {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 6px;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  align-items: center;
}
.home-spotlight-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}
.home-spotlight-input::placeholder { color: #94a3b8; }
.home-spotlight-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.home-spotlight-actions-sub {
  display: flex;
  gap: 8px;
  align-items: center;
}
.home-spotlight-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0 18px;
  height: 40px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.home-spotlight-btn:hover {
  background: #0d9488;
  transform: translateY(-1px);
}
.home-spotlight-btn.btn-search-sub-table {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.home-spotlight-btn.btn-search-sub-seprec {
  background: rgba(20, 184, 166, 0.25);
  border: 1px solid rgba(45, 212, 191, 0.45);
}

/* Reglas Responsivas Globales Móvil para Home (< 768px) */
.home-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.home-module-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  text-align: left;
  width: 100%;
  font: inherit;
  min-height: auto;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
}
.home-module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  border-color: var(--primary);
}
.home-module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.home-module-card:hover::before { opacity: 1; }
.home-module-card.card-map::before { background: #06b6d4; }
.home-module-card.card-table::before { background: #3b82f6; }
.home-module-card.card-seprec::before { background: var(--petrol-500); }
.home-module-card.card-gaceta::before { background: #f59e0b; }
.home-module-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.home-module-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(20, 184, 166, 0.1);
  color: var(--primary);
}
.home-module-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--slate-100);
  color: var(--slate-600);
}
.home-module-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0 0 6px 0;
}
.home-module-desc {
  font-size: 13px;
  color: var(--slate-500);
  line-height: 1.5;
  margin: 0 0 16px 0;
}
.home-module-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}
.home-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.home-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  text-align: left;
  width: 100%;
  font: inherit;
  min-height: auto;
}
.home-kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.home-kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.2;
}
.home-kpi-subtext {
  font-size: 12.5px;
  color: var(--slate-500);
  margin-top: 8px;
}

/* Home KML Month-vs-Month Comparison Grid (Vistas Espectaculares) */
.home-comparison-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.home-kml-comparison-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.home-compare-card {
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}
.home-compare-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}
.home-compare-card.card-total {
  background: var(--petrol-subtle);
  border-color: var(--border-color);
}
.home-compare-card.card-aum {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}
.home-compare-card.card-red {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}
.home-compare-card.card-man {
  background: rgba(14, 116, 144, 0.08);
  border-color: rgba(14, 116, 144, 0.25);
}
.home-compare-card.card-delta {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
}
.home-compare-label {
  font-size: 11.5px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.home-compare-val {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 4px;
}
.home-compare-sub {
  font-size: 12px;
  font-weight: 500;
}

/* SEPREC Dedicated View Styles */
.seprec-view-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.seprec-view-hero {
  background: var(--petrol-grad-hero);
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 16px;
  padding: 28px 32px;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(2, 26, 31, 0.35);
  position: relative;
  overflow: hidden;
}
.seprec-view-hero::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -20%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.16) 0%, transparent 70%);
  pointer-events: none;
}
.seprec-view-search-box {
  display: flex;
  background: rgba(4, 39, 46, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(45, 212, 191, 0.32);
  border-radius: 12px;
  padding: 6px;
  gap: 8px;
  margin-top: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}
.seprec-view-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}
.seprec-view-input::placeholder { color: var(--petrol-200); opacity: 0.8; }
.seprec-view-btn {
  background: var(--petrol-grad-primary);
  color: #ffffff;
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 8px;
  padding: 0 24px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
}
.seprec-view-btn:hover {
  background: var(--petrol-grad-hover);
  box-shadow: 0 6px 18px rgba(20, 184, 166, 0.5);
}
.seprec-chip-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.seprec-chip-btn {
  background: rgba(13, 148, 136, 0.2);
  border: 1px solid rgba(45, 212, 191, 0.3);
  color: var(--petrol-100);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seprec-chip-btn:hover {
  background: #ffffff;
  color: var(--petrol-900);
  border-color: #ffffff;
}
.seprec-chip-btn.active, .seprec-type-btn.active {
  background: var(--petrol-400);
  color: var(--petrol-950);
  border-color: var(--petrol-200);
  font-weight: 800;
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.45);
}
.seprec-content-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 20px;
  align-items: start;
}

/* Reglas Responsivas y Optimización Móvil para SEPREC */

.seprec-ficha-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.seprec-ficha-grid > div {
  min-width: 0;
  max-width: 100%;
}

.seprec-company-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}
.seprec-company-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: var(--petrol-400);
}
.seprec-company-card.selected {
  border-color: var(--primary);
  background: rgba(13, 148, 136, 0.05);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.25);
}
.seprec-detail-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 20px;
}

/* Home Executive Top Bar */
.home-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-wrap: wrap;
  gap: 12px;
}
.home-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.home-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Admin Container & Executive Segmented Tabs */
.admin-container { width: 100%; max-width: 1400px; margin: 0 auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.admin-header h2 { margin: 0; font-size: 24px; font-weight: 800; color: var(--slate-900); letter-spacing: -0.3px; }

.admin-tab-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--petrol-subtle);
  border: 1px solid var(--border-color);
  padding: 6px;
  border-radius: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tab-nav::-webkit-scrollbar { display: none; }
.admin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.admin-tab-btn:hover {
  color: var(--slate-900);
  background: rgba(255, 255, 255, 0.65);
}
.admin-tab-btn.active {
  background: var(--card-bg);
  color: var(--primary);
  border-color: var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.admin-tab-pane {
  display: none;
  animation: adminFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.admin-tab-pane.active {
  display: block;
}
@keyframes adminFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-grid { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.admin-col { display: flex; flex-direction: column; gap: 20px; width: 100%; min-width: 0; }
.admin-card { background: var(--card-bg); padding: 24px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); width: 100%; box-sizing: border-box; min-width: 0; }
.admin-card h2 { margin-top: 0; font-size: 18px; font-weight: 700; color: var(--slate-900); border-bottom: 1px solid var(--border-color); padding-bottom: 12px; margin-bottom: 16px; }

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

/* Table View & Toolbar */
#tableView { background: var(--paper); overflow: auto; padding: 28px; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.toolbar .search { display: flex; gap: 10px; min-width: min(460px, 100%); }
.toolbar .search input { max-width: 360px; }
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Metrics Bar (Vista Tabular) */
.metrics {
  display: flex;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 20px 0 24px 0;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow-x: auto;
}
.metric {
  flex: 1;
  padding: 0 24px;
  border-right: 1px solid var(--border-color);
  min-width: 160px;
  background: transparent;
  border-left: none;
}
.metric:last-child { border-right: none; }
.metric b { display: block; font-size: 24px; font-weight: 700; color: var(--slate-900); line-height: 1.2; }
.metric span { font-size: 11px; font-weight: 600; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-top: 2px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  max-height: calc(100vh - 250px);
  border-radius: 10px;
  background: #ffffff;
}
table { border-collapse: collapse; width: 100%; font-family: var(--font-sans); white-space: nowrap; }
th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  z-index: 2;
}
td { padding: 10px 14px; font-size: 12px; font-weight: 500; color: var(--slate-700); border-bottom: 1px solid #f1f5f9; }
tr:hover { background: #f8fafc; transition: background-color 0.15s ease; }

/* Modals & Cards */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(15, 23, 42, 0.6);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.card {
  background: var(--surface);
  padding: 28px;
  width: min(460px, calc(100vw - 32px));
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}
.card-wide { width: min(920px, calc(100vw - 32px)); max-height: 88vh; display: flex; flex-direction: column; }
.card h2 { margin-top: 0; font-size: 20px; font-weight: 700; color: var(--slate-900); border-bottom: 1px solid var(--border-color); padding-bottom: 12px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; font-weight: 600; }
.success { color: var(--success); font-size: 13px; min-height: 18px; margin-top: 6px; font-weight: 600; }

/* Slide-over para SEPREC */
#seprecModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#seprecModal.open {
  display: flex;
  opacity: 1;
}
.seprec-slideover-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 92vw);
  background: #ffffff;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 121;
  display: flex;
  flex-direction: column;
  padding: 24px;
}
#seprecModal.open .seprec-slideover-panel {
  transform: translateX(0);
}

/* Slide-over para Consulta Puntual AJAM (Servicio Independiente) */
#ajamModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 122;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#ajamModal.open {
  display: flex;
  opacity: 1;
}
.ajam-slideover-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(680px, 94vw);
  background: #ffffff;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 123;
  display: flex;
  flex-direction: column;
  padding: 24px;
}
#ajamModal.open .ajam-slideover-panel {
  transform: translateX(0);
}

/* Report Preview Printable Block Container */
.report-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px; background: var(--slate-50); border: 1px solid var(--border-color); border-radius: 8px; margin: 12px 0; }
.report-block { margin-bottom: 20px; background: #ffffff; border: 1px solid var(--border-color); border-radius: 8px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow-x: hidden; }
.report-block-title { background: #1e293b; color: #ffffff; font-weight: 600; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Vista Previa Reporte Consolidado (#reportPreviewModal) */
#reportPreviewModal .report-preview-card {
  width: min(1180px, calc(100vw - 28px));
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 22px;
}
.report-preview-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}
.report-preview-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.report-preview-title-wrap {
  min-width: 0;
  flex: 1;
}
.report-preview-title-wrap h2 {
  margin: 0;
  border: none;
  padding: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}
.report-preview-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--slate-500);
}
.report-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.report-scale-select {
  font-weight: 700;
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--paper, #ffffff);
  color: var(--slate-800);
  cursor: pointer;
  min-width: 152px;
}
.report-modo-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--slate-100);
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.report-modo-label {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--slate-600);
  text-transform: uppercase;
  padding: 0 4px;
  letter-spacing: 0.03em;
}
.report-mode-btn {
  font-weight: 700;
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--paper, #ffffff);
  color: var(--slate-700);
  transition: all 0.16s ease;
  white-space: nowrap;
}
.report-mode-btn.is-active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.report-preview-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
  flex-wrap: wrap;
}
.report-accum-table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
}
#reportPreviewModal .report-accum-table-scroll th {
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  padding: 7px 9px;
  border-bottom: 1px solid #cbd5e1;
}
#reportPreviewModal .report-accum-table-scroll td {
  color: #0f172a;
  font-size: 11.5px;
  padding: 7px 9px;
  border-bottom: 1px solid #e2e8f0;
}
.report-accum-sheet {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #0f172a;
  border-radius: 4px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
  transition: max-width 0.18s ease;
}
.report-accum-sheet.is-vertical {
  max-width: 670px;
}
.report-accum-sheet.is-vertical .report-accum-ficha-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 16px;
}
.report-accum-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 2px solid #0f5f59;
  flex-wrap: wrap;
}
.report-accum-banner-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f5f59;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.report-accum-mode-badge {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 3px 10px;
}
.report-accum-ficha {
  background: #f8fafc;
  border: 1.5px solid #0f172a;
  border-radius: 3px;
  padding: 8px 12px;
  margin-bottom: 10px;
  color: #0f172a;
}
.report-accum-ficha-title {
  font-size: 11px;
  font-weight: 800;
  color: #0f5f59;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 4px;
  margin-bottom: 7px;
}
.report-accum-ficha-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 18px;
  font-size: 11.5px;
  line-height: 1.45;
}
.report-accum-ficha-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.report-accum-ficha-row span {
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.report-accum-ficha-row strong {
  color: #0f172a;
  font-weight: 800;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-accum-map-frame {
  width: 100%;
  border: 2px solid #0f172a;
  background: #ffffff;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.report-accum-ticks-x {
  position: relative;
  height: 22px;
  background: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
}
.report-accum-ticks-top { border-bottom: 1.5px solid #0f172a; }
.report-accum-ticks-bottom { border-top: 1.5px solid #0f172a; }
.report-accum-ticks-x-inner {
  position: relative;
  height: 100%;
  margin: 0 66px;
}
.report-accum-map-mid {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.report-accum-ticks-y {
  position: relative;
  width: 66px;
  flex-shrink: 0;
  background: #ffffff;
  overflow: hidden;
  box-sizing: border-box;
}
.report-accum-ticks-left { border-right: 1.5px solid #0f172a; }
.report-accum-ticks-right { border-left: 1.5px solid #0f172a; }
.report-accum-tick-x {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 9.5px;
  font-weight: 700;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  line-height: 1;
}
.report-accum-tick-y {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 9.5px;
  font-weight: 700;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  line-height: 1;
}
#reportAccumMapWrap {
  position: relative;
  flex: 1;
  min-width: 0;
  aspect-ratio: 16 / 10;
  min-height: 400px;
  max-height: 540px;
  background: #f8fafc;
  overflow: hidden;
}
.report-accum-sheet.is-vertical #reportAccumMapWrap {
  aspect-ratio: 39 / 50;
  min-height: 460px;
  max-height: 680px;
}
#reportAccumMapCanvas {
  width: 100%;
  height: 100%;
  position: relative;
}
.report-accum-north {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 6;
  width: 28px;
  height: 36px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #0f172a;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #0f172a;
}
.report-accum-scale-box {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid #0f172a;
  border-radius: 3px;
  padding: 5px 9px;
  font-size: 9.5px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
}
.report-accum-scale-bar {
  margin: 3px auto 2px auto;
  height: 5px;
  border: 1px solid #0f172a;
  background: repeating-linear-gradient(90deg, #0f172a 0 25%, #ffffff 25% 50%);
}
.report-accum-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 9px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}
.report-accum-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.report-accum-swatch {
  width: 14px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

/* Dynamic desktop height expansion for Gaceta View when active */

/* Responsive Gaceta Cards & Table for Mobile */

/* Gaceta Monitor & Calendario Styles */
@keyframes gacetaPulse {
  0% { transform: scale(0.92); opacity: 0.75; }
  50% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(0.92); opacity: 0.75; }
}
.pulsing-dot {
  animation: gacetaPulse 1.5s infinite ease-in-out;
}
.cal-card-item {
  background: var(--paper);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s ease;
}
.cal-card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}
.cal-card-item.is-proxima {
  border: 2px solid #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}
.cal-card-item.is-publicada {
  border-left: 3px solid #16a34a;
}
html.dark-mode .cal-card-item,
html.dark-mode .cal-card-item.is-proxima,


/* ==========================================================================
   GESTOR JERÁRQUICO DE PERMISOS POR ROLES (ESTÁNDAR DOCS)
   ========================================================================== */
.roles-manager-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.roles-manager-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--petrol-subtle, #f0fdfa);
  border: 1px solid var(--border-color, #d1e7e5);
  border-radius: 10px;
  padding: 12px 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.role-selector-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.roles-tree-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.role-module-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #d1e7e5);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.role-module-card:hover {
  border-color: var(--primary, #0d9488);
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.08);
}

.role-module-header {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08) 0%, rgba(20, 184, 166, 0.03) 100%);
  border-bottom: 1px solid var(--border-color, #d1e7e5);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.role-module-header input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary, #0d9488);
}

.role-module-title-wrap {
  flex: 1;
}

.role-module-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--slate-900, #04272e);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-module-desc {
  font-size: 11px;
  color: var(--slate-500, #64748b);
  margin-top: 2px;
}

.role-children-list {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.role-child-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.role-child-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.role-child-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary, #0d9488);
}

.role-child-content {
  flex: 1;
}

.role-child-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-800, #1e293b);
  display: block;
}

.role-child-desc {
  font-size: 10.5px;
  color: var(--slate-500, #64748b);
  display: block;
  margin-top: 1px;
}
