/* =============================================================================
   Vigia Plus — sistema de diseño compartido de la suite (6 apps)
   Este archivo es IDÉNTICO en las 6 apps (Auth, Selección, Contratación,
   Dotaciones, Paz y Salvo, VigiaSupply) — si se toca, replicar el cambio en
   las demás. Lo único que varía por app es static/css/style.css (overrides
   puntuales) y qué opciones del app-switcher/side-nav se pintan en base.html.
   ============================================================================= */

/* ---- fuentes autoalojadas (sin CDN) ---- */
@font-face { font-family:'VP Archivo'; font-weight:800; src:url('../fonts/archivo-extrabold.woff2') format('woff2'); font-display:swap; }
@font-face { font-family:'VP Archivo'; font-weight:700; src:url('../fonts/archivo-bold.woff2') format('woff2'); font-display:swap; }
@font-face { font-family:'VP Plex'; font-weight:400; src:url('../fonts/plexsans-regular.woff2') format('woff2'); font-display:swap; }
@font-face { font-family:'VP Plex'; font-weight:500; src:url('../fonts/plexsans-medium.woff2') format('woff2'); font-display:swap; }
@font-face { font-family:'VP Plex'; font-weight:600; src:url('../fonts/plexsans-semibold.woff2') format('woff2'); font-display:swap; }
@font-face { font-family:'VP Plex Mono'; font-weight:500; src:url('../fonts/plexmono-medium.woff2') format('woff2'); font-display:swap; }
@font-face { font-family:'VP Plex Mono'; font-weight:600; src:url('../fonts/plexmono-semibold.woff2') format('woff2'); font-display:swap; }

/* ---- tokens ---- */
:root {
  color-scheme: light;
  --f-display: 'VP Archivo', 'Arial Black', sans-serif;
  --f-body: 'VP Plex', -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'VP Plex Mono', ui-monospace, 'Cascadia Code', monospace;

  --page: #EFF1F8; --surface: #FFFFFF; --surface-2: #F6F7FC; --surface-3: #ECEEF7;
  --border: #DFE2F0; --border-strong: #C7CCE3;
  --text-1: #12142A; --text-2: #52577A; --text-3: #8A8FB0;

  --brand-900: #1A1F4D; --brand-800: #1E2459; --brand-700: #2B337E; --brand-600: #363F92; --brand-500: #4750A8;
  --brand-100: #E7E8F7; --brand-50: #F2F2FB;
  --accent: #FF8300; --accent-600: #E67300; --accent-100: #FFE9D1;
  /* Texto/iconos "color de marca" sobre una superficie tintada (links,
     botones outline, badge/alert info) -- brand-700 es legible en modo
     claro pero en modo oscuro brand-50/100 tambien se oscurecen, dejando
     texto oscuro sobre fondo oscuro (bug real reportado por Luis
     2026-08-14). Se aclara aparte en los bloques de tema oscuro. */
  --brand-ink: var(--brand-700);

  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;

  --status-good: #0ca30c; --status-good-bg: #e4f6e4;
  --status-warning: #b3790a; --status-warning-bg: #fdf1d9;
  --status-serious: #c25a34; --status-serious-bg: #fbe6dd;
  --status-critical: #d03b3b; --status-critical-bg: #fbe2e2;
  --status-neutral: #5B6079; --status-neutral-bg: #eceefa;

  --shadow-1: 0 1px 2px rgba(18,20,42,.05), 0 1px 1px rgba(18,20,42,.04);
  --shadow-2: 0 10px 24px -10px rgba(23,26,64,.16), 0 3px 8px -3px rgba(23,26,64,.08);
  --shadow-3: 0 20px 45px -14px rgba(23,26,64,.24), 0 6px 14px -6px rgba(23,26,64,.10);
  --ring-brand: 0 0 0 3px rgba(71,80,168,.22);

  --r-lg: 14px; --r-md: 10px; --r-sm: 8px; --r-xs: 6px;

  /* Bootstrap trae sus PROPIAS variables (--bs-*) y muchos componentes
     (.card, .list-group, .dropdown-menu, etc.) las usan directo en vez de
     heredar de body -- si no se remapean aca tambien, esos componentes se
     quedan con el texto/fondo claro de Bootstrap sin importar el tema
     (bug real reportado por Luis 2026-08-14: texto ilegible/fondo blanco
     en modo oscuro). Mismos valores que --text-*/--surface-*/--border de
     arriba, solo que con el nombre que Bootstrap 5.3 espera.
     Referencia RGB para --bs-*-rgb: light --text-1=18,20,42 --page=239,241,248;
     dark --text-1=238,240,250 --page=11,13,30. */
  --bs-body-color: var(--text-1); --bs-body-color-rgb: 18, 20, 42;
  --bs-body-bg: var(--page); --bs-body-bg-rgb: 239, 241, 248;
  --bs-emphasis-color: var(--text-1);
  --bs-secondary-color: var(--text-2); --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-color: var(--text-3); --bs-tertiary-bg: var(--surface-3);
  --bs-border-color: var(--border); --bs-border-color-translucent: var(--border);
  --bs-link-color: var(--brand-700); --bs-link-hover-color: var(--accent-600);
  --bs-heading-color: var(--text-1);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0B0D1E; --surface: #14172E; --surface-2: #191C38; --surface-3: #20244A;
    --border: #2A2E52; --border-strong: #3B4068;
    --text-1: #EEF0FA; --text-2: #ABB0D2; --text-3: #767CA0;
    --brand-100: #262B57; --brand-50: #1C2047; --accent-100: #402A0F;
    --brand-ink: #6B93F0;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --status-good-bg: #10331a; --status-warning-bg: #3a2c0e; --status-serious-bg: #3a2115; --status-critical-bg: #3a1414; --status-neutral-bg: #20244a;
    --shadow-1: 0 1px 2px rgba(0,0,0,.35);
    --shadow-2: 0 10px 26px -10px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.03);
    --shadow-3: 0 24px 50px -16px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.04);
    --bs-body-color: var(--text-1); --bs-body-color-rgb: 238, 240, 250;
    --bs-body-bg: var(--page); --bs-body-bg-rgb: 11, 13, 30;
    --bs-emphasis-color: var(--text-1);
    --bs-secondary-color: var(--text-2); --bs-secondary-bg: var(--surface-2);
    --bs-tertiary-color: var(--text-3); --bs-tertiary-bg: var(--surface-3);
    --bs-border-color: var(--border); --bs-border-color-translucent: var(--border);
    --bs-link-color: var(--brand-500); --bs-link-hover-color: var(--accent);
    --bs-heading-color: var(--text-1);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0B0D1E; --surface: #14172E; --surface-2: #191C38; --surface-3: #20244A;
  --border: #2A2E52; --border-strong: #3B4068;
  --text-1: #EEF0FA; --text-2: #ABB0D2; --text-3: #767CA0;
  --brand-100: #262B57; --brand-50: #1C2047; --accent-100: #402A0F;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
  --status-good-bg: #10331a; --status-warning-bg: #3a2c0e; --status-serious-bg: #3a2115; --status-critical-bg: #3a1414; --status-neutral-bg: #20244a;
  --shadow-1: 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 10px 26px -10px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.03);
  --shadow-3: 0 24px 50px -16px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.04);
  --bs-body-color: var(--text-1); --bs-body-color-rgb: 238, 240, 250;
  --bs-body-bg: var(--page); --bs-body-bg-rgb: 11, 13, 30;
  --bs-emphasis-color: var(--text-1);
  --bs-secondary-color: var(--text-2); --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-color: var(--text-3); --bs-tertiary-bg: var(--surface-3);
  --bs-border-color: var(--border); --bs-border-color-translucent: var(--border);
  --bs-link-color: var(--brand-500); --bs-link-hover-color: var(--accent);
  --bs-heading-color: var(--text-1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #EFF1F8; --surface: #FFFFFF; --surface-2: #F6F7FC; --surface-3: #ECEEF7;
  --border: #DFE2F0; --border-strong: #C7CCE3;
  --text-1: #12142A; --text-2: #52577A; --text-3: #8A8FB0;
  --brand-100: #E7E8F7; --brand-50: #F2F2FB; --accent-100: #FFE9D1;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
  --status-good-bg: #e4f6e4; --status-warning-bg: #fdf1d9; --status-serious-bg: #fbe6dd; --status-critical-bg: #fbe2e2; --status-neutral-bg: #eceefa;
  --shadow-1: 0 1px 2px rgba(18,20,42,.05), 0 1px 1px rgba(18,20,42,.04);
  --shadow-2: 0 10px 24px -10px rgba(23,26,64,.16), 0 3px 8px -3px rgba(23,26,64,.08);
  --shadow-3: 0 20px 45px -14px rgba(23,26,64,.24), 0 6px 14px -6px rgba(23,26,64,.10);
  --bs-body-color: var(--text-1); --bs-body-color-rgb: 18, 20, 42;
  --bs-body-bg: var(--page); --bs-body-bg-rgb: 239, 241, 248;
  --bs-emphasis-color: var(--text-1);
  --bs-secondary-color: var(--text-2); --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-color: var(--text-3); --bs-tertiary-bg: var(--surface-3);
  --bs-border-color: var(--border); --bs-border-color-translucent: var(--border);
  --bs-link-color: var(--brand-700); --bs-link-hover-color: var(--accent-600);
  --bs-heading-color: var(--text-1);
}

/* ---- base ---- */
* { box-sizing: border-box; }
html { background: var(--page); }
body {
  background: var(--page);
  color: var(--text-1);
  font-family: var(--f-body);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, .card-title {
  font-family: var(--f-display) !important;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--text-1);
}
.mono, code, .api-key-reveal { font-family: var(--f-mono) !important; font-variant-numeric: tabular-nums; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { color: var(--accent-600); }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 4px; }

/* ---- shell: sidebar + main (páginas autenticadas) ---- */
.vp-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.vp-sidebar {
  background: linear-gradient(185deg, var(--brand-900), var(--brand-800) 60%, var(--brand-700));
  color: #fff; padding: 18px 14px 20px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
}
.vp-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; border-bottom: 1px solid rgba(255,255,255,.12); text-decoration: none; }
.vp-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-family: var(--f-display); font-weight: 800; font-size: 15px; color: #241200; box-shadow: var(--shadow-2); flex-shrink: 0; }
.vp-brand .txt { line-height: 1.15; white-space: nowrap; }
.vp-brand .txt b { display: block; font-family: var(--f-display); font-weight: 800; font-size: 14.5px; letter-spacing: -.01em; color: #fff; }
.vp-brand .txt span { font-size: 10.5px; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .08em; }

.vp-sidebar-toggle {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: var(--r-xs); margin-left: auto;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.75); cursor: pointer; transition: background .15s ease, color .15s ease;
}
.vp-sidebar-toggle:hover { background: rgba(255,255,255,.16); color: #fff; }
.vp-sidebar-toggle svg { width: 13px; height: 13px; transition: transform .16s ease; }
#vp-sidebar-chevron { font-size: 15px; line-height: 1; color: rgba(255,255,255,.9); transition: transform .16s ease; display: inline-block; }
html[data-sidebar="collapsed"] #vp-sidebar-chevron { transform: rotate(180deg); }

.vp-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.vp-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-xs); color: rgba(255,255,255,.78); text-decoration: none; font-size: 13px; font-weight: 500; transition: background .15s ease, color .15s ease; white-space: nowrap; }
.vp-nav a svg { width: 15px; height: 15px; flex-shrink: 0; }
.vp-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.vp-nav a.is-current { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }

.vp-side-foot { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 10px 8px 2px; border-top: 1px solid rgba(255,255,255,.1); }
.vp-side-foot .av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-500); display: flex; align-items: center; justify-content: center; font-family: var(--f-mono); font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }
.vp-side-foot .who { min-width: 0; flex: 1; }
.vp-side-foot .who b { display: block; font-size: 12px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-side-foot .who span { font-size: 10.5px; color: rgba(255,255,255,.5); }
.vp-side-foot a.logout { color: rgba(255,255,255,.55); flex-shrink: 0; }
.vp-side-foot a.logout:hover { color: #fff; }

.vp-main { background: var(--page); min-width: 0; }
.vp-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 26px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.vp-crumb { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.vp-crumb b { color: var(--text-2); }
.vp-pagetitle { font-size: 21px; margin: 0; }
.vp-topbar-actions { display: flex; align-items: center; gap: 10px; }
.vp-content { padding: 18px 24px 32px; }

/* ---- sidebar colapsado a solo iconos ---- */
html[data-sidebar="collapsed"] .vp-shell { grid-template-columns: 72px 1fr; }
html[data-sidebar="collapsed"] .vp-sidebar { padding-left: 10px; padding-right: 10px; align-items: center; }
html[data-sidebar="collapsed"] .vp-brand { justify-content: center; padding-left: 0; padding-right: 0; }
html[data-sidebar="collapsed"] .vp-brand .txt,
html[data-sidebar="collapsed"] .vp-nav a .lbl,
html[data-sidebar="collapsed"] .vp-side-foot .who,
html[data-sidebar="collapsed"] .vp-sidebar-toggle .lbl { display: none; }
html[data-sidebar="collapsed"] .vp-sidebar-toggle { margin-left: 0; }
html[data-sidebar="collapsed"] .vp-sidebar-toggle svg { transform: rotate(180deg); }
html[data-sidebar="collapsed"] .vp-nav a { justify-content: center; padding: 9px; }
html[data-sidebar="collapsed"] .vp-side-foot { justify-content: center; }

/* ---- theme toggle ---- */
.vp-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  cursor: pointer; transition: background .15s ease;
}
.vp-theme-toggle:hover { background: var(--surface-3); }
.vp-theme-toggle svg { width: 16px; height: 16px; }
#vp-theme-icon { font-size: 16px; line-height: 1; }
/* luna oscura en modo claro, sol amarillo en modo oscuro -- colores propios
   por icono, no currentColor heredado, para que se vean sobre --surface-2
   en ambos temas */
.vp-theme-toggle .i-moon { color: var(--brand-700); }
.vp-theme-toggle .i-sun { color: #FFC53D; }
.vp-theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .vp-theme-toggle .i-moon { display: none; }
  :root:where(:not([data-theme="light"])) .vp-theme-toggle .i-sun { display: block; }
}
:root[data-theme="dark"] .vp-theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .vp-theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .vp-theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .vp-theme-toggle .i-moon { display: block; }

/* toggle used outside the sidebar (e.g. login page, light surface) */
.vp-theme-toggle--onlight { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); box-shadow: var(--shadow-1); }
.vp-theme-toggle--onlight:hover { background: var(--surface-2); color: var(--text-1); }

/* ---- bootstrap component remapping ---- */
.navbar.bg-vp, nav.navbar { display: none; } /* replaced by .vp-shell sidebar */

/* Componentes de Bootstrap que antes se quedaban con el blanco/negro por
   defecto en modo oscuro (dropdown, modal, list-group, tabs, paginacion,
   textos "muted") -- pedido explicito de Luis 2026-08-14: "no deberian
   existir fondo blanco en modo oscuro". */
.dropdown-menu { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2); padding: 6px; }
.dropdown-item { color: var(--text-2); border-radius: var(--r-xs); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text-1); }
.dropdown-divider { border-color: var(--border); }

.modal-content { background: var(--surface); color: var(--text-1); border: 1px solid var(--border); }
.modal-header, .modal-footer { border-color: var(--border); }

.list-group-item { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.list-group-item.active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }

.nav-tabs { border-color: var(--border); }
.nav-tabs .nav-link { color: var(--text-3); border-color: transparent; }
.nav-tabs .nav-link:hover { color: var(--text-1); border-color: var(--border) var(--border) transparent; }
.nav-tabs .nav-link.active { background: var(--surface); color: var(--brand-ink); border-color: var(--border) var(--border) var(--surface); }

.pagination .page-link { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.pagination .page-link:hover { background: var(--surface-2); color: var(--text-1); }
.page-item.active .page-link { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.page-item.disabled .page-link { background: var(--surface-2); color: var(--text-3); }

.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-2); }
.form-check-input { background-color: var(--surface-2); border-color: var(--border-strong); }
.form-text { color: var(--text-3); }
.text-muted, .text-secondary { color: var(--text-3) !important; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
hr { border-color: var(--border); opacity: 1; }

/* Boton "x" de cerrar (alertas/modales): el SVG de Bootstrap es negro fijo,
   invisible sobre un fondo oscuro -- se invierte solo en modo oscuro. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
}
:root[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Icono nativo del selector de fecha (Chrome/Edge): tambien es negro fijo. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) input[type="date"]::-webkit-calendar-picker-indicator,
  :root:where(:not([data-theme="light"])) input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
}
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }

.badge-mode {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 100px;
  background: var(--status-warning-bg); color: var(--status-warning); font-size: 11.5px; font-weight: 600;
  border: 1px solid rgba(179,121,10,.22);
}
.badge-mode i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.btn { font-family: var(--f-body); font-weight: 600; font-size: 13.5px; border-radius: var(--r-sm); transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-700); border-color: var(--brand-700); color: #fff; box-shadow: var(--shadow-1); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-600) !important; border-color: var(--brand-600) !important; box-shadow: var(--shadow-2); }
.btn-accent, .btn-warning { background: var(--accent); border-color: var(--accent); color: #2b1600; box-shadow: var(--shadow-1); }
.btn-accent:hover { background: var(--accent-600); border-color: var(--accent-600); }
/* Botones outline: color propio EN REPOSO (no solo al hover), para que el
   tipo de accion se distinga de un vistazo -- editar=neutral/marca,
   activar=verde, desactivar=ambar, restablecer=indigo, eliminar=rojo. */
.btn-outline-light { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-outline-light:hover { background: var(--surface-2); color: var(--text-1); }

.btn-outline-secondary { background: var(--brand-50); color: var(--brand-ink); border-color: transparent; }
.btn-outline-secondary:hover { background: var(--brand-100); color: var(--brand-ink); }

.btn-outline-primary { background: var(--brand-50); color: var(--brand-ink); border-color: transparent; }
.btn-outline-primary:hover { background: var(--brand-700); color: #fff; }

.btn-outline-success { background: var(--status-good-bg); color: var(--status-good); border-color: transparent; }
.btn-outline-success:hover { background: var(--status-good); color: #fff; }

.btn-outline-warning { background: var(--status-warning-bg); color: var(--status-warning); border-color: transparent; }
.btn-outline-warning:hover { background: var(--status-warning); color: #fff; }

.btn-outline-danger { background: var(--status-critical-bg); color: var(--status-critical); border-color: transparent; }
.btn-outline-danger:hover { background: var(--status-critical); color: #fff; }

.btn-outline-info { background: var(--brand-100); color: var(--brand-ink); border-color: transparent; }
.btn-outline-info:hover { background: var(--brand-ink); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); margin-bottom: 1.1rem; transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover { box-shadow: var(--shadow-2); }
.card-title { font-size: 15px !important; margin-bottom: .7rem; }
.card-body { padding: 1.1rem 1.25rem; }
.card-header, .card-footer { background: var(--surface-2); border-color: var(--border); color: var(--text-1); }

.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-control, .form-select {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  color: var(--text-1); font-family: var(--f-body); font-size: 13.5px; padding: 9px 12px;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.form-control:focus, .form-select:focus { background: var(--surface); border-color: var(--brand-500); box-shadow: var(--ring-brand); color: var(--text-1); }
.form-check-input:checked { background-color: var(--brand-700); border-color: var(--brand-700); }

.table { color: var(--text-2); font-size: 13px; }
.table thead th { color: var(--text-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; background: transparent; border-bottom: 1px solid var(--border) !important; padding: 8px 10px; }
.table td { padding: 11px 10px; border-color: var(--border) !important; vertical-align: middle; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background: var(--surface-2); color: var(--text-2); }
.table-hover > tbody > tr:hover > * { background: var(--brand-50); }

.badge { font-family: var(--f-body); font-weight: 700; font-size: 10.5px; padding: 4px 9px; border-radius: 100px; }
.badge.bg-success { background: var(--status-good-bg) !important; color: var(--status-good) !important; }
.badge.bg-secondary { background: var(--status-neutral-bg) !important; color: var(--status-neutral) !important; }
.badge.bg-danger { background: var(--status-critical-bg) !important; color: var(--status-critical) !important; }
.badge.bg-warning { background: var(--status-warning-bg) !important; color: var(--status-warning) !important; }
.badge.bg-info { background: var(--brand-100) !important; color: var(--brand-ink) !important; }
.badge.bg-primary { background: var(--brand-700) !important; }

.alert { border-radius: var(--r-md); border: 1px solid transparent; font-size: 13.5px; }
.alert-success { background: var(--status-good-bg); color: var(--status-good); }
.alert-danger { background: var(--status-critical-bg); color: var(--status-critical); }
.alert-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.alert-info { background: var(--brand-100); color: var(--brand-ink); }

.api-key-reveal { background: var(--brand-900); color: #fff; padding: 14px 18px; border-radius: var(--r-md); font-size: 13px; word-break: break-all; }

/* ---- dashboard: stat tiles + actividad reciente ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 14px 16px; box-shadow: var(--shadow-1); transition: box-shadow .18s ease, transform .18s ease;
}
.stat-tile:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
/* Iconos de estadistica: circulo SOLIDO de color (no un tinte palido) para
   que el dashboard se sienta vivo/colorido a simple vista -- pedido
   explicito de Luis 2026-08-14. El SVG adentro usa stroke="currentColor"
   sin fill, asi que queda blanco sobre el color solido. */
.stat-icon {
  width: 30px; height: 30px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px; color: #fff; box-shadow: 0 3px 9px -2px rgba(10,12,30,.35);
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.brand { background: var(--brand-700); }
.stat-icon.good { background: var(--status-good); }
.stat-icon.warning { background: var(--status-warning); }
.stat-icon.critical { background: var(--status-critical); }
.stat-icon.accent { background: var(--accent); }
.stat-icon.neutral { background: var(--status-neutral); }
.stat-tile .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; margin-bottom: 6px; }
.stat-tile .stat-value { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 600; color: var(--text-1); line-height: 1; }
.stat-tile .stat-note { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.stat-tile .stat-note.warn { color: var(--status-warning); }
.stat-tile .stat-note.good { color: var(--status-good); }

.panel-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }

.activity-list { display: flex; flex-direction: column; }
.activity-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.activity-row:last-child { border-bottom: none; }
.activity-row .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--status-neutral); }
.activity-row .dot.good { background: var(--status-good); }
.activity-row .dot.bad { background: var(--status-critical); }
.activity-row .who { font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row .meta { color: var(--text-3); font-size: 11.5px; margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.activity-empty { color: var(--text-3); font-size: 13px; padding: 8px 0; }

.mini-table { width: 100%; font-size: 13px; }
.mini-table td { padding: 8px 0; border-bottom: 1px solid var(--border); }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table .num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: var(--text-2); }

/* ---- graficos Chart.js: contenedor de altura fija ----
   Chart.js con maintainAspectRatio:true (su default) calcula su propio alto
   cuadrado a partir del ancho disponible -- en una dona o barra dentro de
   una columna ancha eso da un grafico gigante (bug real: 522x522px, toca
   scrolear mucho, reportado por Luis 2026-08-14). El patron correcto es
   maintainAspectRatio:false en el JS + esta caja con alto fijo en CSS. */
.chart-box { position: relative; height: 190px; }
.chart-box canvas { max-width: 100%; }

/* ---- graficos SVG del dashboard (linea+area, barras) ---- */
.viz-line, .viz-bar { width: 100%; height: auto; overflow: visible; margin-top: 4px; }
.viz-grid { stroke: var(--border); stroke-width: 1; }
.viz-area { fill: var(--brand-100); opacity: .6; }
.viz-line-path { fill: none; stroke: var(--brand-600); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.viz-dot { fill: var(--surface); stroke: var(--brand-600); stroke-width: 2; cursor: default; }
.viz-dot:hover { fill: var(--brand-600); }
.viz-axis-label { font-family: var(--f-mono); font-size: 9px; fill: var(--text-3); text-anchor: middle; }
.viz-bar-rect { transition: opacity .12s ease; cursor: default; }
.viz-bar-rect:hover { opacity: .82; }
.viz-bar-value { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 10px; font-weight: 600; fill: var(--text-2); text-anchor: middle; }

/* ---- login (páginas sin sesión) ---- */
body.pagina-auth {
  background:
    linear-gradient(rgba(11,13,30,.72), rgba(11,13,30,.72)),
    url('../img/login_fondo.jpg') center center / cover no-repeat;
}
:root[data-theme="light"] body.pagina-auth {
  background: linear-gradient(rgba(20,25,70,.55), rgba(20,25,70,.55)), url('../img/login_fondo.jpg') center center / cover no-repeat;
}
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; padding: 24px; }
.login-toggle { position: absolute; top: 20px; right: 20px; }
.login-card { max-width: 400px; width: 100%; border: none; border-radius: 18px; box-shadow: var(--shadow-3); overflow: hidden; background: var(--surface); }
.login-card .login-header { background: linear-gradient(135deg, var(--brand-800) 0%, var(--brand-500) 100%); padding: 2.1rem 2rem 1.4rem; text-align: center; color: #fff; }
.login-card .login-header img { height: 42px; margin-bottom: 12px; background: #fff; padding: 6px 10px; border-radius: 8px; }
.login-card .login-header h5 { color: #fff !important; }
.login-card .login-header p { font-size: .85rem; color: rgba(255,255,255,.75); margin: 6px 0 0; }
.login-card .card-body { padding: 1.9rem 2rem 2.1rem; }
.login-card .btn-primary { width: 100%; }

@media (max-width: 980px) {
  .vp-shell { grid-template-columns: 1fr; }
  .vp-sidebar { position: static; height: auto; }
}
