/* ============================================================
   SIGRIE v2.0 — Hoja de estilos principal
   UGEL 01 El Porvenir — La Libertad 2026
   ============================================================ */
:root {
  --primary: #0c3b6e; --primary-light: #1558a0; --primary-dark: #082d53;
  --accent: #e84e1b; --warning: #f59e0b; --success: #059669;
  --danger: #dc2626; --orange: #ea580c;
  --surface: #fff; --surface-1: #f8f9fa; --surface-2: #f1f3f5;
  --border: #e2e8f0; --border-strong: #cbd5e1;
  --text: #0f172a; --text-2: #475569; --text-3: #94a3b8;
  --nav-h: 60px; --sidebar-w: 260px;
  --radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--surface-2); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-1); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
/* TOPNAV */
.topnav { position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); background: var(--primary); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 20px; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; text-decoration: none; color: #fff; }
.logo-badge { background: var(--accent); font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 4px; letter-spacing: .8px; }
.nav-pill { font-size: 11px; background: rgba(255,255,255,.12); padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; animation: pulse 1.5s infinite; flex-shrink: 0; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(1.3)} }
.alert-count { background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.nav-user { font-size: 12px; background: rgba(255,255,255,.12); padding: 5px 12px; border-radius: 20px; white-space: nowrap; }
.nav-logout { font-size: 12px; color: rgba(255,255,255,.7); padding: 5px 10px; border-radius: 6px; transition: background .15s; cursor: pointer; text-decoration: none; }
.nav-logout:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
/* SIDEBAR */
.sidebar { position: fixed; top: var(--nav-h); left: 0; bottom: 0; width: var(--sidebar-w); background: var(--primary); overflow-y: auto; z-index: 90; padding: 8px 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent; }
.sb-section { padding: 14px 16px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: rgba(255,255,255,.35); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: rgba(255,255,255,.72); cursor: pointer; transition: all .15s; border-left: 3px solid transparent; font-size: 13px; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--accent); }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.sb-info { padding: 14px 16px; margin-top: 12px; border-top: 1px solid rgba(255,255,255,.1); font-size: 11px; color: rgba(255,255,255,.45); line-height: 1.7; }
/* MAIN */
.main { margin-left: var(--sidebar-w); margin-top: var(--nav-h); padding: 20px; min-height: calc(100vh - var(--nav-h)); }
/* PAGE HEADER */
.page-header { margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
/* BUTTONS */
.btn { padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border-strong); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--text); text-decoration: none; }
.btn:hover { background: var(--surface-1); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
/* CARDS */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.card-title { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }
/* KPI GRID */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }
/* ALERT BANNER */
.alert-banner { background: linear-gradient(135deg, #7f1d1d, #991b1b); color: #fff; border-radius: var(--radius); padding: 14px 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 16px; }
.ab-icon { font-size: 28px; flex-shrink: 0; }
.ab-text { flex: 1; }
.ab-title { font-weight: 700; font-size: 15px; }
.ab-desc { font-size: 12px; opacity: .85; margin-top: 3px; line-height: 1.6; }
.ab-pill { background: rgba(255,255,255,.15); padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; text-align: center; }
/* GRIDS */
.split-panel { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .split-panel { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
/* TABLES */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); border-bottom: 2px solid var(--border); background: var(--surface-1); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.data-table tr:hover td { background: var(--surface-1); }
.data-table tr:last-child td { border-bottom: none; }
/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.b-red { background: #fee2e2; color: #991b1b; }
.b-orange { background: #ffedd5; color: #9a3412; }
.b-green { background: #dcfce7; color: #166534; }
.b-blue { background: #dbeafe; color: #1e40af; }
.b-gray { background: var(--surface-2); color: var(--text-2); }
.b-yellow { background: #fef3c7; color: #92400e; }
.b-purple { background: #f3e8ff; color: #7e22ce; }
/* STATUS DOT */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot-red { background: var(--danger); animation: pulse 1.5s infinite; }
.dot-orange { background: var(--orange); }
.dot-green { background: var(--success); }
.dot-gray { background: var(--text-3); }
/* PROGRESS */
.progress { background: var(--surface-2); border-radius: 4px; height: 6px; overflow: hidden; margin-top: 4px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
/* FORM */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-label small { font-weight: 400; color: var(--text-3); display: block; margin-top: 2px; font-size: 11px; }
.form-control { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border-strong); border-radius: 7px; font-size: 13px; color: var(--text); background: var(--surface); transition: border-color .15s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(12,59,110,.1); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; cursor: pointer; }
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-opt { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; padding: 8px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; flex: 1; min-width: 120px; transition: all .15s; }
.radio-opt:hover { border-color: var(--primary); }
.radio-opt input { accent-color: var(--primary); width: 15px; height: 15px; flex-shrink: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
textarea.form-control { resize: vertical; min-height: 80px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
/* SCORE */
.score-box { background: var(--surface-1); border: 2px solid var(--border); border-radius: 12px; padding: 20px; text-align: center; margin: 12px 0; transition: all .3s; }
.score-big { font-size: 52px; font-weight: 800; line-height: 1; transition: color .3s; }
.score-bar { height: 10px; border-radius: 5px; background: var(--surface-2); margin: 12px 0; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 5px; transition: width .5s ease, background .5s ease; }
.score-lbl { font-size: 14px; font-weight: 700; margin-top: 6px; transition: color .3s; }
/* ALERT ITEMS */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.al-item { display: flex; gap: 12px; padding: 12px; border-radius: 8px; border: 1px solid; }
.al-crit { background: #fef2f2; border-color: #fecaca; }
.al-high { background: #fff7ed; border-color: #fed7aa; }
.al-med { background: #fffbeb; border-color: #fde68a; }
.al-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.al-body { flex: 1; }
.al-title { font-size: 13px; font-weight: 600; }
.al-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.al-meta { font-size: 11px; color: var(--text-3); margin-top: 4px; }
/* CHECKLIST */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.chk-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid; }
.chk-done { background: #f0fdf4; border-color: #bbf7d0; }
.chk-pend { background: #fffbeb; border-color: #fde68a; }
.chk-crit { background: #fef2f2; border-color: #fecaca; }
.chk-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.chk-body { flex: 1; font-size: 13px; }
.chk-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
/* TIMELINE */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-dot { position: absolute; left: -22px; top: 3px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--surface); }
.tl-time { font-size: 11px; color: var(--text-3); }
.tl-title { font-size: 13px; font-weight: 600; margin-top: 2px; }
.tl-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }
/* TABS */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; gap: 0; }
.tab { padding: 10px 18px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; text-decoration: none; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
/* MODAL */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 90%; max-width: 700px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-hdr { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.close-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-3); border-radius: 4px; padding: 2px 6px; }
.close-btn:hover { background: var(--surface-2); }
/* MAP */
#mapa-leaflet { height: 480px; border-radius: var(--radius); border: 1px solid var(--border); }
.leaflet-popup-content { font-size: 13px; line-height: 1.6; min-width: 200px; }
.popup-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.popup-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; margin-bottom: 6px; }
/* SEARCH */
.search-wrap { position: relative; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 50; max-height: 280px; overflow-y: auto; display: none; }
.sr-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.sr-item:hover { background: var(--surface-1); }
.sr-item:last-child { border: none; }
.sr-name { font-size: 13px; font-weight: 600; }
.sr-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
/* SELECTED IIEE */
.iiee-sel { background: #f0fdf4; border: 2px solid #6ee7b7; border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.iiee-sel-name { font-size: 15px; font-weight: 700; color: #065f46; }
.iiee-sel-meta { font-size: 12px; color: #047857; margin-top: 4px; line-height: 1.7; }
/* TOAST */
.toast { position: fixed; bottom: 24px; right: 24px; background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 13px; z-index: 300; transform: translateY(60px); opacity: 0; transition: all .3s; box-shadow: 0 4px 20px rgba(0,0,0,.3); max-width: 340px; }
.toast.show { transform: translateY(0); opacity: 1; }
/* FLUJO */
.flujo-step { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.flujo-num { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.flujo-body { flex: 1; }
.flujo-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.flujo-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.flujo-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); color: var(--text-2); font-size: 11px; padding: 2px 8px; border-radius: 12px; margin-top: 6px; }
/* LOGI */
.logi-item { margin-bottom: 12px; }
.logi-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
/* ENFEN */
.enfen-box { background: #fff7ed; border: 1px solid #fb923c; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.enfen-title { font-size: 12px; font-weight: 700; color: #9a3412; margin-bottom: 4px; }
.enfen-text { font-size: 12px; color: #7c2d12; line-height: 1.6; }
/* PAGINACION */
.paginacion { display: flex; gap: 4px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pag-btn { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; background: #fff; cursor: pointer; color: var(--text); text-decoration: none; }
.pag-btn:hover { background: var(--surface-1); text-decoration: none; }
.pag-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
/* FILTROS */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtro-chip { padding: 5px 14px; border-radius: 20px; border: 1.5px solid var(--border); font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; background: #fff; color: var(--text-2); }
.filtro-chip:hover { border-color: var(--primary); color: var(--primary); }
.filtro-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topnav { padding: 0 12px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
