@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap");

:root {
  --primary: #0f4c8a;
  --primary-dk: #082d54;
  --primary-md: #1a6bbf;
  --primary-lt: #e8f1fb;
  --accent: #f59e0b;
  --accent-lt: #fef3c7;
  --success: #059669;
  --success-lt: #d1fae5;
  --danger: #dc2626;
  --danger-lt: #fee2e2;
  --warning: #d97706;
  --warning-lt: #fef3c7;
  --neutral: #64748b;
  --neutral-lt: #f1f5f9;
  --bg: #f0f4f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-md: #cbd5e1;
  --text: #0f172a;
  --text-md: #334155;
  --text-muted: #64748b;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.14);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "DM Mono", monospace;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background-image: url("../../../assets/img/hero-bg-light.webp");
  font-family: "Titillium Web", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--gray-800);
  line-height: 1.6;
  margin: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(255, 255, 255, 0.774);
  z-index: -1;
  pointer-events: none;
}

/* ─── HEADER ─── */
.app-header {
  background: linear-gradient(130deg, var(--primary-dk) 0%, var(--primary) 55%, var(--primary-md) 100%);
  color: #fff;
  padding: 0 28px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 20px rgba(8, 45, 84, 0.35);
}
.app-header::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
}
.header-brand { display: flex; align-items: center; gap: 14px; }
.header-brand .brand-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.header-brand h1 { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.header-brand p { font-size: 11px; opacity: 0.7; font-weight: 400; margin-top: 1px; }

.header-button {
  display: flex; align-items: center; justify-content: center;
  background-color: #d97706; padding: 8px 16px; border-radius: 25px;
  cursor: pointer; transition: all 0.3s ease; border: none;
  box-shadow: 0 4px 6px rgba(255, 255, 255, 0.301); position: relative; overflow: hidden;
}
.header-button a { color: #fff; text-decoration: none; font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.header-button .material-icons { font-size: 18px; }
.header-button:hover { background-color: #b85e00; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); }

/* ─── LAYOUT ─── */
.container { max-width: 1520px; margin: 0 auto; padding: 22px 24px 50px; }

/* ─── FILTROS ─── */
.filtros-bar {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.filtro-group {
  display: flex; flex-direction: column; gap: 5px;
  min-width: 140px; flex: 1; max-width: 200px;
}
.filtro-group label {
  font-size: 10.5px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.7px;
  display: flex; align-items: center; gap: 5px;
}
.filtro-group label i { font-size: 11px; opacity: 0.8; }
.filtro-group select, .filtro-group input {
  border: 1.5px solid var(--border-md); border-radius: var(--radius-sm);
  padding: 8px 32px 8px 10px; font-size: 13px; font-family: var(--font);
  color: var(--text-md); background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  appearance: none; outline: none; cursor: pointer; transition: var(--transition);
}
.filtro-group select:focus, .filtro-group input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 76, 138, 0.12);
}
.filtros-actions { display: flex; gap: 8px; align-items: flex-end; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm); border: none;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; white-space: nowrap; transition: var(--transition);
}
.btn i { font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(15, 76, 138, 0.3); }
.btn-primary:hover { background: var(--primary-md); box-shadow: 0 4px 14px rgba(15, 76, 138, 0.4); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border-md); }
.btn-ghost:hover { background: var(--neutral-lt); color: var(--text); }

/* ─── TABS ─── */
.tabs-wrap {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 0;
}
.tabs { display: flex; gap: 0; }
.tab-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 20px; background: none; border: none;
  font-size: 13.5px; font-weight: 600; font-family: var(--font);
  color: var(--text-muted); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: var(--transition); white-space: nowrap;
}
.tab-btn i { font-size: 14px; }
.tab-btn:hover:not(.active) { color: var(--text); background: var(--neutral-lt); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; animation: fadeIn 0.25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ─── KPI CARDS ─── */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.kpi-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); display: flex; gap: 14px;
  align-items: center; transition: var(--transition); position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.kpi-card.blue::before { background: var(--primary); }
.kpi-card.green::before { background: var(--success); }
.kpi-card.amber::before { background: var(--accent); }
.kpi-card.red::before { background: var(--danger); }
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.kpi-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.kpi-card.blue .kpi-icon { background: var(--primary-lt); color: var(--primary); }
.kpi-card.green .kpi-icon { background: var(--success-lt); color: var(--success); }
.kpi-card.amber .kpi-icon { background: var(--accent-lt); color: var(--warning); }
.kpi-card.red .kpi-icon { background: var(--danger-lt); color: var(--danger); }
.kpi-value { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.kpi-card.blue .kpi-value { color: var(--primary); }
.kpi-card.green .kpi-value { color: var(--success); }
.kpi-card.amber .kpi-value { color: var(--warning); }
.kpi-card.red .kpi-value { color: var(--danger); }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ─── CHARTS ─── */
.section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--primary);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.section-title i { font-size: 14px; }
.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px; margin-bottom: 22px;
}
.chart-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.chart-card:hover { box-shadow: var(--shadow); }
.chart-card canvas { max-height: 240px; }

/* ─── INDICADORES ─── */
.indicadores-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.indicadores-tabla { display: flex; flex-direction: column; gap: 0; }
.ind-row {
  display: grid; grid-template-columns: 32px 1fr 220px 100px 70px;
  align-items: center; gap: 14px; padding: 10px 12px;
  border-radius: 8px; transition: background 0.15s;
}
.ind-row:hover { background: var(--primary-lt); }
.ind-row + .ind-row { border-top: 1px dashed var(--border); }
.ind-num {
  font-size: 11px; font-weight: 800; color: var(--text-muted);
  font-family: var(--font-mono); text-align: center;
  background: var(--neutral-lt); border-radius: 6px; padding: 3px 0;
}
.ind-label { font-size: 13px; font-weight: 600; color: var(--text-md); line-height: 1.4; }
.ind-bar-wrap { background: #e9eef5; border-radius: 20px; height: 10px; overflow: hidden; }
.ind-bar-fill { height: 100%; border-radius: 20px; transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
.ind-bar-fill.ok { background: linear-gradient(90deg, #059669, #34d399); }
.ind-bar-fill.warning { background: linear-gradient(90deg, #d97706, #fbbf24); }
.ind-bar-fill.danger { background: linear-gradient(90deg, #dc2626, #f87171); }
.ind-counts { display: flex; gap: 6px; justify-content: flex-end; }
.ind-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
}
.ind-pill.si { background: #d1fae5; color: #059669; }
.ind-pill.no { background: #fee2e2; color: #dc2626; }
.ind-pill i { font-size: 9px; }
.ind-pct-wrap { border-radius: 8px; padding: 5px 8px; text-align: center; }
.ind-pct { font-size: 14px; font-weight: 800; font-family: var(--font-mono); display: block; }

/* ─── BADGES ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge i { font-size: 10px; }
.badge-si { background: var(--success-lt); color: var(--success); }
.badge-no { background: var(--danger-lt); color: var(--danger); }
.badge-parcial { background: var(--accent-lt); color: var(--warning); }
.badge-nd { background: var(--neutral-lt); color: var(--neutral); }
.badge-inicio { background: #fee2e2; color: #dc2626; }
.badge-proceso { background: #fef3c7; color: #d97706; }
.badge-logrado { background: #d1fae5; color: #059669; }

/* ─── TABLE ─── */
.table-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px; flex-wrap: wrap;
}
.table-info { font-size: 12.5px; color: var(--text-muted); }
.table-info strong { color: var(--text); font-weight: 700; }
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 1000px; }
thead th {
  background: var(--primary); color: #fff; padding: 11px 14px;
  text-align: left; font-weight: 700; font-size: 11px;
  white-space: nowrap; letter-spacing: 0.3px;
  position: sticky; top: 0; z-index: 5;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}
thead th:last-child { border-right: none; }
thead th i { margin-right: 4px; opacity: 0.8; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-lt); }
tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:nth-child(even):hover { background: var(--primary-lt); }
tbody td { padding: 9px 14px; vertical-align: middle; white-space: nowrap; }
tbody td.td-nombre { white-space: normal; min-width: 180px; max-width: 260px; line-height: 1.4; font-weight: 600; }
tbody td.td-centro { text-align: center; }
.td-cmod { font-family: var(--font-mono); font-size: 11.5px; color: var(--primary); font-weight: 500; }
.td-dist { font-weight: 600; font-size: 12px; color: var(--text-md); }
.td-nivel { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: var(--primary-lt); color: var(--primary); white-space: nowrap; }
.td-pct { font-weight: 700; font-family: var(--font-mono); }
.btn-ficha {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--primary-lt); color: var(--primary);
  border: 1px solid rgba(15, 76, 138, 0.2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition); font-size: 13px;
}
.btn-ficha:hover { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(15, 76, 138, 0.35); transform: scale(1.08); }
.btn-pdf { background: #fef3c7; color: #d97706; border-color: rgba(217,119,6,0.2); }
.btn-pdf:hover { background: #d97706 !important; color: #fff !important; box-shadow: 0 3px 10px rgba(217,119,6,0.35); }

/* ─── PAGINATION ─── */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 4px; margin-top: 16px; flex-wrap: wrap;
}
.page-btn {
  min-width: 34px; height: 34px; padding: 0 6px;
  border: 1.5px solid var(--border-md); border-radius: var(--radius-sm);
  background: #fff; font-size: 12.5px; font-family: var(--font);
  font-weight: 600; cursor: pointer; transition: var(--transition);
  color: var(--text-md); display: flex; align-items: center; justify-content: center;
}
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); background: var(--primary-lt); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── MODAL ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(8, 45, 84, 0.55); z-index: 300;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px); padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%;
  max-width: 820px; max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: modalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); overflow: hidden;
}
@keyframes modalIn {
  from { transform: scale(0.92) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  background: linear-gradient(130deg, var(--primary-dk), var(--primary));
  color: #fff; padding: 18px 22px; display: flex;
  justify-content: space-between; align-items: flex-start; flex-shrink: 0;
}
.modal-header h2 { font-size: 15px; font-weight: 800; line-height: 1.3; color: #fff; }
.modal-header .modal-subtitle {
  font-size: 11px; opacity: 0.7; margin-top: 3px;
  display: flex; align-items: center; gap: 8px;
}
.modal-header .modal-subtitle span { display: flex; align-items: center; gap: 4px; }
.modal-close {
  background: rgba(255, 255, 255, 0.15); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; flex-shrink: 0; margin-left: 12px;
  transition: var(--transition);
}
.modal-close:hover { background: rgba(255, 255, 255, 0.3); }
.modal-body { overflow-y: auto; padding: 22px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--border-md) transparent; }
.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 10px; }

.ficha-seccion { margin-bottom: 22px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ficha-seccion-header {
  background: var(--primary-lt); padding: 10px 16px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.ficha-seccion-header i { font-size: 14px; color: var(--primary); width: 20px; text-align: center; }
.ficha-seccion-header h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--primary); font-weight: 700; }
.ficha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; }
.ficha-item { padding: 10px 16px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.ficha-item:nth-child(even) { border-right: none; }
.ficha-item:last-child, .ficha-item:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.ficha-item.full { grid-column: 1/-1; border-right: none; }
.fi-label { font-size: 10.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.fi-value { font-size: 13px; color: var(--text); font-weight: 500; line-height: 1.45; }

/* ─── SPINNER ─── */
.spinner-wrap { display: flex; justify-content: center; align-items: center; padding: 50px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── EMPTY STATE ─── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; opacity: 0.25; display: block; margin-bottom: 14px; }
.empty-state p { font-size: 15px; }

/* ─── TOAST ─── */
.toast-notification {
  position: fixed; bottom: 24px; right: 24px;
  background: #1f2937; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000; transform: translateX(400px);
  transition: transform 0.3s ease; font-family: var(--font);
}
.toast-notification.show { transform: translateX(0); }
.toast-notification i { font-size: 16px; }
.toast-notification.error { background: #dc2626; }
.toast-notification.success { background: #059669; }
.toast-notification.warning { background: #d97706; }

/* ─── MODAL PDF ─── */
.modal-pdf { max-width: 95%; width: 95%; height: 90vh; }
.modal-pdf .modal-body { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.modal-pdf iframe { width: 100%; height: 100%; border: none; background: #f5f5f5; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .charts-grid { grid-template-columns: 1fr; }
  .ficha-grid { grid-template-columns: 1fr; }
  .filtro-group { max-width: 100%; }
  .tabs-wrap { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 900px) {
  .ind-row { grid-template-columns: 28px 1fr 80px; }
  .ind-bar-wrap, .ind-counts { display: none; }
}
