/* ==========================================================================
   Enfoque Intelligence 360 — sistema de diseño
   Tema oscuro por defecto (fiel al prototipo OC04G) y tema claro (html.light)
   Prefijo de clases: ei-
   ========================================================================== */

:root {
  --bg: #081522;
  --bg-2: #0b1b2b;
  --panel: #102338;
  --panel-2: #142b42;
  --card-a: #132b41;
  --card-b: #0d2033;
  --line: #254159;
  --line-2: #355671;
  --ink: #edf5fb;
  --ink-2: #c7d8e7;
  --muted: #94acc1;
  --red: #e51b47;
  --red-2: #c8103a;
  --teal: #32d2bf;
  --cyan: #22d3ee;
  --blue: #6caaff;
  --purple: #a78bfa;
  --green: #34d399;
  --gold: #f4c36a;
  --orange: #fb923c;
  --pink: #f472b6;
  --input-bg: #0a1c2d;
  --input-line: #31506b;
  --btn-bg: #183850;
  --btn-line: #355671;
  --th-bg: #1b354d;
  --row-hover: #17324a;
  --nav-ink: #adc2d3;
  --nav-active: #1b3853;
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 252px;
  --font: Inter, "Segoe UI", system-ui, Arial, sans-serif;
  color-scheme: dark;
}

html.light {
  --bg: #f3f6fb;
  --bg-2: #e9f0f8;
  --panel: #ffffff;
  --panel-2: #eef4fa;
  --card-a: #ffffff;
  --card-b: #f6f9fd;
  --line: #d3deea;
  --line-2: #b9ccdd;
  --ink: #112a3e;
  --ink-2: #23435d;
  --muted: #526d82;
  --teal: #087d76;
  --cyan: #0e7490;
  --blue: #2769a7;
  --purple: #6d28d9;
  --green: #047857;
  --gold: #92620b;
  --orange: #c2410c;
  --pink: #be185d;
  --input-bg: #ffffff;
  --input-line: #bacbdc;
  --btn-bg: #e3edf7;
  --btn-line: #b9ccdd;
  --th-bg: #e3edf7;
  --row-hover: #eef4fa;
  --nav-ink: #23435d;
  --nav-active: #d0e0f1;
  --shadow: 0 8px 24px rgba(17, 42, 62, .08);
  color-scheme: light;
}

/* ---------- Base ---------- */
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); }
a:hover { color: var(--cyan); }
::selection { background: rgba(50, 210, 191, .35); }
.text-muted, .ei-muted { color: var(--muted) !important; }
.text-teal { color: var(--teal) !important; }
.text-red { color: var(--red) !important; }
.text-gold { color: var(--gold) !important; }
.text-green { color: var(--green) !important; }
.text-blue { color: var(--blue) !important; }
.fw-800 { font-weight: 800 !important; }
.small-2 { font-size: 11px; }
hr { border-color: var(--line); opacity: 1; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Estructura ---------- */
.ei-app { min-height: 100vh; }
.ei-sidebar {
  width: var(--sidebar-w);
  position: fixed;
  inset: 0 auto 0 0;
  background: #0b1b2b;
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  overflow-y: auto;
  z-index: 1030;
  display: flex;
  flex-direction: column;
}
html.light .ei-sidebar { background: #e9f0f8; }
.ei-brand { background: #fff; border-radius: 10px; padding: 9px; margin: 0 5px 18px; display: block; }
.ei-brand img { width: 100%; display: block; }
.ei-eyebrow {
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  font-weight: 700;
}
.ei-sidebar .ei-eyebrow { padding: 0 12px 10px; }
.ei-nav { display: flex; flex-direction: column; gap: 2px; }
.ei-nav-link {
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--nav-ink);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-decoration: none;
  border-left: 3px solid transparent;
  line-height: 1.25;
}
.ei-nav-link i { font-style: normal; width: 16px; text-align: center; opacity: .9; flex: 0 0 16px; }
.ei-nav-link:hover { background: var(--nav-active); color: #fff; }
html.light .ei-nav-link:hover { color: #102b44; }
.ei-nav-link.active { background: var(--nav-active); color: #fff; border-left-color: var(--red); font-weight: 600; }
html.light .ei-nav-link.active { color: #102b44; }
.ei-sidebar-foot { margin-top: auto; padding: 14px 10px 0; font-size: 11px; color: var(--muted); }

.ei-main { margin-left: var(--sidebar-w); padding: 22px 28px 40px; min-width: 0; }
.ei-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ei-title { font-size: 28px; font-weight: 800; margin: 4px 0 4px; letter-spacing: -.6px; display: flex; align-items: center; gap: 10px; }
.ei-title .ei-title-icon { color: var(--teal); font-size: 22px; }
.ei-subtitle { color: var(--muted); margin: 0 0 10px; font-size: 13.5px; }
.ei-session { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ei-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--btn-bg); border: 1px solid var(--btn-line); color: var(--ink);
  border-radius: 8px; padding: 7px 11px; font-size: 13px;
}
.ei-top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.ei-mobile-head { display: none; }

/* ---------- Botones ---------- */
.btn-ei, .btn-ei-primary, .btn-ei-teal, .btn-ei-success, .btn-ei-purple, .btn-ei-danger, .btn-ei-ghost, .btn-ei-gold {
  --bs-btn-padding-y: .5rem;
  --bs-btn-padding-x: .8rem;
  --bs-btn-font-size: 13px;
  --bs-btn-border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap;
}
.btn-ei { background: var(--btn-bg); border: 1px solid var(--btn-line); color: var(--ink); }
.btn-ei:hover, .btn-ei:focus { background: #21486a; border-color: #4a7395; color: #fff; }
html.light .btn-ei:hover { background: #d4e3f2; color: #102b44; }
.btn-ei.active { background: var(--teal); border-color: var(--teal); color: #04212a; }
.btn-ei-primary { background: var(--red); border: 1px solid var(--red); color: #fff; }
.btn-ei-primary:hover, .btn-ei-primary:focus { background: var(--red-2); border-color: var(--red-2); color: #fff; }
.btn-ei-teal { background: linear-gradient(135deg, #2ee6d0, #18b9c9); border: 1px solid #2bd6c9; color: #04212a; }
.btn-ei-teal:hover { filter: brightness(1.08); color: #04212a; }
.btn-ei-success { background: #0d6b4f; border: 1px solid #12a37a; color: #fff; }
.btn-ei-success:hover { background: #0f7f5e; color: #fff; }
.btn-ei-purple { background: #6d3fd6; border: 1px solid #8b5cf6; color: #fff; }
.btn-ei-purple:hover { background: #7c4ddf; color: #fff; }
.btn-ei-gold { background: #8a6410; border: 1px solid #c9952b; color: #fff; }
.btn-ei-gold:hover { background: #a1761a; color: #fff; }
.btn-ei-danger { background: rgba(229, 27, 71, .14); border: 1px solid rgba(229, 27, 71, .55); color: #ff8aa4; }
.btn-ei-danger:hover { background: var(--red); color: #fff; }
html.light .btn-ei-danger { color: #b3123a; border-color: rgba(229, 27, 71, .6); }
html.light .btn-ei-danger:hover { color: #fff; }
.btn-ei-ghost { background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-ei-ghost:hover { background: var(--btn-bg); color: var(--ink); }
.btn-ei-sm { --bs-btn-padding-y: .28rem; --bs-btn-padding-x: .55rem; --bs-btn-font-size: 12px; }
.btn-ei-icon { width: 34px; height: 34px; justify-content: center; padding: 0 !important; }
.btn-ei-icon.btn-ei-sm { width: 28px; height: 28px; }
.btn-group-ei { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Paneles / tarjetas ---------- */
.ei-panel {
  background: linear-gradient(155deg, var(--card-a), var(--card-b));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.ei-panel + .ei-panel { margin-top: 16px; }
.ei-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ei-panel-title { font-size: 16px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; }
.ei-panel-title::before { content: "◆"; color: var(--cyan); font-size: 12px; }
.ei-panel-title.no-mark::before { display: none; }
.ei-panel-sub { color: var(--muted); font-size: 12.5px; margin: 3px 0 0; }
.ei-panel-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ei-section { margin-top: 16px; }
.ei-grid { display: grid; gap: 16px; }
.ei-grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ei-grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ei-grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ei-grid-21 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.ei-grid-12 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr); }

/* ---------- Barra de filtros ---------- */
.ei-filters {
  background: linear-gradient(155deg, var(--card-a), var(--card-b));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.ei-filter { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1 1 140px; max-width: 240px; }
.ei-filter label, .ei-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: none; letter-spacing: .2px; }
.ei-filter.wide { max-width: 360px; flex-basis: 220px; }
/* Mensaje de validación creado por site.js (validadorBasico) junto a un campo sin contenedor propio: oculto mientras está vacío
   para no agregar filas ni espacio en grillas. */
.ei-msg-campo { display: block; }
.ei-msg-campo:empty { display: none; }
.ei-filters-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }

/* ---------- Formularios ---------- */
.form-control, .form-select {
  background-color: var(--input-bg);
  border: 1px solid var(--input-line);
  color: var(--ink);
  border-radius: 8px;
  font-size: 13px;
  padding: .45rem .65rem;
}
.form-select { padding-right: 2rem; }
.form-control:focus, .form-select:focus {
  background-color: var(--input-bg);
  color: var(--ink);
  border-color: var(--teal);
  box-shadow: 0 0 0 .18rem rgba(50, 210, 191, .22);
}
.form-control::placeholder { color: #6f8aa1; }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--panel-2); color: var(--muted); opacity: 1; }
.form-select-sm, .form-control-sm { font-size: 12px; padding: .3rem .5rem; }
.form-label { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.form-check-input { background-color: var(--input-bg); border-color: var(--input-line); }
.form-check-input:checked { background-color: var(--teal); border-color: var(--teal); }
.form-text { color: var(--muted); font-size: 11.5px; }
.field-validation-error, .text-danger { color: #ff7b98 !important; font-size: 12px; }
.input-validation-error { border-color: var(--red) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; color: #ff7b98; font-size: 12.5px; }
html.light .field-validation-error, html.light .text-danger { color: #b3123a !important; }
html.light .validation-summary-errors ul { color: #b3123a; }
.ei-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.ei-form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ei-form-grid .span-2 { grid-column: span 2; }
.ei-form-grid .span-all { grid-column: 1 / -1; }
.ei-form-section { grid-column: 1 / -1; font-size: 12px; font-weight: 800; color: var(--teal); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.ei-computed { background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: .45rem .65rem; font-weight: 700; }

/* ---------- KPIs ---------- */
.ei-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ei-kpi {
  --tone: var(--teal);
  position: relative;
  display: flex; gap: 12px; align-items: center;
  background: linear-gradient(155deg, color-mix(in srgb, var(--tone) 13%, var(--card-a)), var(--card-b));
  border: 1px solid color-mix(in srgb, var(--tone) 45%, var(--line));
  border-radius: var(--radius);
  padding: 14px 14px;
  min-height: 88px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
a.ei-kpi:hover { color: var(--ink); border-color: var(--tone); transform: translateY(-1px); }
.ei-kpi-icon {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; font-size: 19px;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent);
}
.ei-kpi-body { min-width: 0; flex: 1; }
.ei-kpi-label { font-size: 12px; font-weight: 700; color: var(--ink-2); line-height: 1.2; }
.ei-kpi-value { font-size: clamp(17px, 1.55vw, 24px); font-weight: 800; letter-spacing: -.5px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ei-kpi-sub { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.25; }
.ei-kpi-bar { height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--tone) 18%, transparent); margin-top: 6px; overflow: hidden; }
.ei-kpi-bar > span { display: block; height: 100%; background: var(--tone); border-radius: 4px; }
.ei-kpi.compact { min-height: 64px; padding: 10px 12px; }
.ei-kpi.compact .ei-kpi-value { font-size: 20px; }
[data-tone="teal"] { --tone: var(--teal); }
[data-tone="cyan"] { --tone: var(--cyan); }
[data-tone="blue"] { --tone: var(--blue); }
[data-tone="purple"] { --tone: var(--purple); }
[data-tone="green"] { --tone: var(--green); }
[data-tone="gold"] { --tone: var(--gold); }
[data-tone="orange"] { --tone: var(--orange); }
[data-tone="red"] { --tone: var(--red); }
[data-tone="pink"] { --tone: var(--pink); }
[data-tone="muted"] { --tone: var(--muted); }

/* Mini indicadores (resúmenes dentro de paneles) */
.ei-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.ei-stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ei-stat-value { font-size: 20px; font-weight: 800; }
.ei-stat-label { font-size: 11.5px; color: var(--muted); }

/* ---------- Pestañas ---------- */
.ei-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.ei-tab {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  border-radius: 9px; padding: 8px 13px; font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.ei-tab:hover { background: var(--btn-bg); color: var(--ink); }
.ei-tab.active { background: linear-gradient(135deg, #0f5d6e, #0b4a5a); border-color: var(--cyan); color: #fff; }
html.light .ei-tab.active { background: #0e7490; color: #fff; }
.ei-tabs.red .ei-tab.active { background: var(--red); border-color: var(--red); }
.ei-tabs-bar { display: flex; flex-wrap: nowrap; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; overflow-y: hidden; margin-bottom: 14px; scrollbar-width: thin; }
.ei-tabs-bar .ei-tab { border: 0; border-right: 1px solid var(--line); border-radius: 0; flex: 1 0 auto; justify-content: center; white-space: nowrap; font-size: 12px; padding: 8px 9px; }
.ei-tabs-bar .ei-tab:last-child { border-right: 0; }
.ei-tabs-bar .ei-tab.active { box-shadow: inset 0 -2px 0 var(--cyan); }

/* ---------- Tablas ---------- */
.ei-table-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--line); max-width: 100%; }
.ei-table-wrap.tall { max-height: 620px; }
.ei-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; color: var(--ink); margin: 0; }
.ei-table th {
  background: var(--th-bg); color: var(--ink-2); text-align: left; position: sticky; top: 0; z-index: 1;
  padding: 10px 11px; border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap; font-size: 12px;
}
.ei-table th[data-sort] { cursor: pointer; user-select: none; }
.ei-table th[data-sort]::after { content: " ⇅"; color: var(--muted); font-size: 10px; }
.ei-table th.sort-asc::after { content: " ▲"; color: var(--teal); }
.ei-table th.sort-desc::after { content: " ▼"; color: var(--teal); }
.ei-table td { padding: 9px 11px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); vertical-align: middle; }
.ei-table tbody tr:hover td { background: var(--row-hover); }
.ei-table tfoot td { font-weight: 800; background: var(--panel-2); position: sticky; bottom: 0; }
.ei-table .num, .ei-table td.num, .ei-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ei-table .center { text-align: center; }
.ei-table .nowrap { white-space: nowrap; }
.ei-table .wrap { white-space: normal; min-width: 220px; }
.ei-table .actions { white-space: nowrap; text-align: right; }
.ei-table .strong { font-weight: 700; }
.ei-table-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ei-search { position: relative; min-width: 220px; }
.ei-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.ei-search input { padding-left: 30px; }
@media (max-width: 750px) { .ei-search { min-width: 0; flex: 1 1 100%; } }
.ei-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.ei-pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.ei-pager button { min-width: 30px; }

/* Filas tipo tarjeta (Proyectos, Ofertas) */
.ei-rows { display: flex; flex-direction: column; gap: 8px; }
.ei-row-card { display: grid; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.ei-row-card:hover { border-color: var(--line-2); }
.ei-avatar { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--tone, #1d6fa5); flex: 0 0 34px; font-size: 13px; }

/* ---------- Pills / estados ---------- */
.ei-pill {
  --tone: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  color: color-mix(in srgb, var(--tone) 85%, #fff);
  background: color-mix(in srgb, var(--tone) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent);
}
html.light .ei-pill { color: color-mix(in srgb, var(--tone) 80%, #000); }
.ei-pill.solid { background: var(--tone); color: #06202a; border-color: var(--tone); }
.ei-pill-success { --tone: var(--green); }
.ei-pill-warning { --tone: var(--gold); }
.ei-pill-danger { --tone: var(--red); }
.ei-pill-info { --tone: var(--blue); }
.ei-pill-teal { --tone: var(--teal); }
.ei-pill-purple { --tone: var(--purple); }
.ei-pill-orange { --tone: var(--orange); }
.ei-pill-muted { --tone: var(--muted); }
.ei-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--tone, var(--teal)); flex: 0 0 9px; }

/* ---------- Progreso ---------- */
.ei-progress { --tone: var(--teal); height: 7px; border-radius: 6px; background: color-mix(in srgb, var(--line) 85%, transparent); overflow: hidden; min-width: 60px; }
.ei-progress > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 70%, #fff 0%), var(--tone)); }
.ei-progress.lg { height: 14px; border-radius: 8px; }
.ei-progress-row { display: grid; grid-template-columns: minmax(90px, 1.1fr) minmax(80px, 2fr) auto; gap: 10px; align-items: center; font-size: 12.5px; padding: 5px 0; }
.ei-progress-row .val { font-weight: 800; text-align: right; min-width: 40px; }

/* ---------- Leyendas y gráficos ---------- */
.ei-chart { position: relative; height: 280px; width: 100%; }
.ei-chart.sm { height: 200px; }
.ei-chart.lg { height: 340px; }
.ei-chart.xl { height: 420px; }
.ei-donut-wrap { display: grid; grid-template-columns: minmax(130px, 230px) minmax(0, 1fr); gap: 16px; align-items: center; }
.ei-panel { container-type: inline-size; }
@container (max-width: 430px) {
  .ei-donut-wrap { grid-template-columns: minmax(0, 1fr); }
  .ei-donut-wrap .ei-chart { height: 200px; }
}
.ei-donut-wrap .ei-chart { height: 230px; }
.ei-legend { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.ei-legend-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.ei-legend-item .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ei-legend-item .val { font-weight: 800; }
.ei-chart-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.ei-chart-center strong { font-size: 20px; display: block; }
.ei-chart-center span { font-size: 11px; color: var(--muted); }

/* Embudo */
.ei-funnel { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.ei-funnel-step {
  --w: 100%;
  width: var(--w); min-width: 42%;
  background: linear-gradient(90deg, #1e6fd9, #2ab7e8);
  color: #fff; border-radius: 8px; padding: 9px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px;
  clip-path: polygon(0 0, 100% 0, 97% 100%, 3% 100%);
}
.ei-funnel-step strong { font-size: 16px; }
.ei-funnel-step small { opacity: .85; display: block; font-size: 10.5px; }

/* ---------- Notas, alertas y vacíos ---------- */
.ei-note {
  border-left: 3px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 9%, transparent);
  padding: 9px 12px; border-radius: 0 8px 8px 0; font-size: 12.5px; color: var(--ink-2); margin: 12px 0 0;
}
.ei-note.info { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 9%, transparent); }
.ei-note.danger { border-color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }
.ei-note.success { border-color: var(--green); background: color-mix(in srgb, var(--green) 9%, transparent); }
.ei-alert-list { display: flex; flex-direction: column; gap: 8px; }
.ei-alert-item { display: flex; gap: 10px; align-items: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }
.ei-alert-item i { font-size: 16px; color: var(--tone, var(--gold)); }
.ei-empty { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 13px; }
.ei-empty i { font-size: 28px; display: block; margin-bottom: 6px; opacity: .7; }
.ei-badge-count { background: var(--red); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 800; }

/* ---------- Modales (Bootstrap) ---------- */
.modal-content { background: #12293d; border: 1px solid #3a5a71; border-radius: 15px; color: var(--ink); }
html.light .modal-content { background: #fff; border-color: #cedbe7; }
.modal-header { border-bottom: 1px solid var(--line); padding: 14px 18px; }
.modal-footer { border-top: 1px solid var(--line); padding: 12px 18px; gap: 8px; }
.modal-title { font-weight: 800; font-size: 17px; }
.modal-body { padding: 16px 18px; }
.btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
html.light .btn-close { filter: none; }
.modal-backdrop.show { opacity: .78; background: #020a11; }
/* Confirmación abierta sobre otro modal: queda por encima y oscurece el modal de abajo. */
#eiConfirmModal { z-index: 1065; }
.modal-backdrop.show + .modal-backdrop.show { z-index: 1060; }

/* ---------- Toasts ---------- */
.ei-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.ei-toast {
  --tone: var(--teal);
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--tone);
  color: var(--ink); border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow); font-size: 13px;
  animation: ei-in .2s ease-out;
}
@keyframes ei-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Celebración de cierres logrados ---------- */
.ei-celebracion { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: rgba(2, 10, 17, .55); animation: ei-in .25s ease-out; pointer-events: none; }
.ei-celebracion.salida { opacity: 0; transition: opacity .45s; }
.ei-celebracion-card { background: linear-gradient(160deg, #10324a, #0b2133); border: 1px solid var(--teal); border-radius: 20px; padding: 26px 34px; text-align: center; box-shadow: 0 0 60px rgba(50, 210, 191, .35); display: flex; flex-direction: column; gap: 6px; color: #fff; }
.ei-celebracion-card .emoji { font-size: 44px; line-height: 1; }
.ei-celebracion-card strong { font-size: 24px; font-weight: 900; }
.ei-celebracion-card span { color: #bfe9f0; }
.ei-confeti { position: absolute; inset: 0; overflow: hidden; }
.ei-confeti i { position: absolute; top: -12px; width: 9px; height: 15px; border-radius: 2px; animation: ei-caer 2.2s linear forwards; opacity: .95; }
@keyframes ei-caer { to { top: 105%; transform: rotate(720deg); } }

/* ---------- Gantt / Kanban (base compartida) ---------- */
.ei-gantt { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.ei-gantt-row { display: grid; grid-template-columns: 260px 1fr; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); min-height: 34px; }
.ei-gantt-label { padding: 7px 10px; font-size: 12px; border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.ei-gantt-track { position: relative; }
.ei-gantt-bar { position: absolute; top: 7px; height: 20px; border-radius: 6px; background: var(--tone, var(--teal)); font-size: 10.5px; color: #04212a; padding: 2px 6px; white-space: nowrap; overflow: hidden; font-weight: 700; }
.ei-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.ei-kanban-col { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 200px; }
.ei-kanban-col h4 { font-size: 13px; font-weight: 800; display: flex; justify-content: space-between; margin: 0 0 8px; }
.ei-kanban-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; font-size: 12.5px; cursor: grab; }
.ei-kanban-card.dragging { opacity: .5; }
.ei-kanban-col.drop-target { outline: 2px dashed var(--teal); outline-offset: -4px; }

/* ---------- Portal de acceso ---------- */
.ei-portal-body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 25% 65%, #08445a 0%, #061827 65%); color: #eaf6ff; overflow-x: hidden; }
.ei-portal { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 3vw; padding: clamp(20px, 4vw, 70px); align-items: center; position: relative; isolation: isolate; }
.ei-portal::before { content: ""; position: fixed; left: 0; bottom: 0; width: 61%; height: 17vh; background: url(../img/portal-wave.webp) left bottom / 100% 100% no-repeat; -webkit-mask-image: linear-gradient(to top, #000 62%, transparent); mask-image: linear-gradient(to top, #000 62%, transparent); pointer-events: none; z-index: -1; }
.ei-portal-brand { position: relative; min-height: 520px; display: flex; flex-direction: column; justify-content: center; isolation: isolate; }
.ei-portal-brand .logo { width: clamp(170px, 19vw, 290px); background: #fff; padding: 6px; border-radius: 4px; }
.ei-portal-visual { position: absolute; z-index: -1; right: -1%; bottom: 0; width: 64%; height: 55%; background: url(../img/portal-visual.webp) right bottom / contain no-repeat; }
.ei-portal-globe { position: absolute; z-index: -2; right: 0; top: -8%; width: 42%; height: 70%; background: url(../img/portal-globe.webp) center / contain no-repeat; opacity: .9; }
.ei-portal-kicker { font-size: clamp(11px, 1.1vw, 16px); letter-spacing: 1.5px; color: #00dde5; margin: 20px 0 6px; text-transform: uppercase; }
.ei-portal-kicker::after { content: ""; display: block; width: 54px; height: 3px; background: #00dde5; margin-top: 10px; }
.ei-portal-name { font-size: clamp(34px, 4.4vw, 64px); font-weight: 900; font-style: italic; line-height: 1.02; margin: 14px 0 18px; letter-spacing: -1px; }
.ei-portal-name span { color: #22e3ee; }
.ei-portal-claim { border-left: 4px solid var(--red); padding-left: 14px; font-size: clamp(17px, 1.7vw, 25px); font-weight: 800; margin-bottom: 20px; }
.ei-portal-claim em { color: #22e3ee; }
.ei-portal-feature { display: flex; gap: 12px; align-items: center; margin: 10px 0; font-size: 14px; }
.ei-portal-feature i { width: 34px; height: 34px; border: 1px solid #2c5b74; border-radius: 8px; display: grid; place-items: center; color: #9fe8f3; background: #0a2436; }
.ei-portal-card { background: linear-gradient(160deg, rgba(14, 43, 64, .92), rgba(6, 24, 39, .94)); border: 1px solid rgba(48, 196, 214, .45); border-radius: 22px; padding: clamp(22px, 2.6vw, 38px); box-shadow: 0 0 40px rgba(0, 221, 229, .12), var(--shadow); backdrop-filter: blur(4px); max-width: 520px; width: 100%; justify-self: end; }
.ei-portal-card .shield { width: 48px; height: 48px; margin: 0 auto 8px; display: grid; place-items: center; color: #1fd6e0; font-size: 30px; }
.ei-portal-card h1 { font-size: clamp(22px, 2vw, 28px); font-weight: 800; text-align: center; margin: 4px 0 6px; }
.ei-portal-card .lead { text-align: center; color: #a9c3d6; font-size: 14px; margin-bottom: 18px; }
.ei-portal-card .form-control { background: rgba(5, 21, 34, .75); border-color: #2a4d66; color: #eaf6ff; padding: .7rem .8rem; }
.ei-portal-card .form-label { color: #d6e7f3; font-weight: 600; }
.ei-portal-card .btn-login { width: 100%; padding: .8rem; font-size: 15px; font-weight: 800; background: linear-gradient(180deg, #ef2152, #c50f3b); border: 0; color: #fff; border-radius: 10px; justify-content: center; }
.ei-portal-card .btn-request { width: 100%; padding: .75rem; font-size: 15px; font-weight: 800; background: transparent; border: 1px solid #2ac0cf; color: #e7fbff; border-radius: 10px; justify-content: center; }
.ei-portal-card .btn-request:hover { background: rgba(42, 192, 207, .12); color: #fff; }
.ei-portal-card .pwd { position: relative; }
.ei-portal-card .pwd button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: #22d3ee; }
.ei-portal-card .foot { font-size: 12px; color: #8fb1c6; margin-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .ei-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ei-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .ei-grid-21, .ei-grid-12, .ei-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .ei-sidebar { display: none; }
  .ei-main { margin-left: 0; padding: 14px; }
  .ei-mobile-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
  .ei-mobile-head img { height: 34px; background: #fff; border-radius: 6px; padding: 3px; }
  .ei-grid-3, .ei-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .ei-donut-wrap { grid-template-columns: minmax(0, 1fr); }
  .ei-form-grid, .ei-form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .ei-form-grid .span-2 { grid-column: auto; }
  .ei-portal { grid-template-columns: minmax(0, 1fr); }
  .ei-portal-brand { min-height: 0; }
  .ei-portal-visual, .ei-portal-globe { display: none; }
  .ei-portal-card { justify-self: stretch; }
}
@media print {
  .ei-sidebar, .ei-top-actions, .ei-filters, .ei-session { display: none !important; }
  .ei-main { margin: 0; }
  body { background: #fff; color: #111; }
}
