/* =========================================================
   VEHICLE AI · SISTEMA VISUAL GLOBAL
   Etapa 2 del rediseño. Este archivo solo define apariencia:
   no contiene lógica y no afecta a las páginas que no lo cargan.

   Índice
   1. Variables (colores, tipografía, medidas)
   2. Base
   3. Botones
   4. Tarjetas, badges y alertas
   5. Formularios
   6. Tablas
   7. KPIs, progreso, pestañas, línea de tiempo, acordeón
   8. Estructura de la aplicación (sidebar y barra superior)
   9. Pantalla de login
   10. Responsive
   ========================================================= */


/* =========================================================
   1. VARIABLES
   ========================================================= */

:root {

  /* Fondos */
  --bg: #F5F8FC;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;

  /* Identidad */
  --celeste: #22B8CF;
  --celeste-hover: #1AA6BC;
  --celeste-claro: #E6F7FB;
  --azul: #168AAD;
  --azul-oscuro: #183B56;

  /* Texto */
  --text: #1F2937;
  --text-2: #64748B;
  --text-link: #0F6F8C;   /* celeste/azul oscurecido para texto: contraste AA */

  /* Bordes */
  --border: #DCE5EE;

  /* Estados (color de relleno / indicador) */
  --ok: #22C55E;
  --ok-bg: #EAF8EF;
  --ok-text: #15803D;

  --warn: #F59E0B;
  --warn-bg: #FFF7E6;
  --warn-text: #B45309;

  --danger: #EF4444;
  --danger-bg: #FDECEC;
  --danger-text: #B91C1C;

  --info: #22B8CF;
  --info-bg: #E6F7FB;
  --info-text: #0F6F8C;

  --neutral: #94A3B8;
  --neutral-bg: #F1F5F9;
  --neutral-text: #475569;

  /* Tipografía */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Forma */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(24, 59, 86, .06);
  --shadow-hover: 0 4px 14px rgba(24, 59, 86, .08);

  /* Medidas de la estructura */
  --sidebar-w: 264px;
  --topbar-h: 64px;
}


/* =========================================================
   2. BASE
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--azul-oscuro);
  line-height: 1.2;
}

h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

p { margin: 0; }

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

/* Etiqueta pequeña en mayúsculas (títulos de KPI, campos, etc.) */
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* Anillo de foco visible para quien navega con teclado */
:focus-visible {
  outline: 2px solid var(--celeste);
  outline-offset: 2px;
}

/* Iconos (sprite en _iconos.html, estilo Lucide) */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* =========================================================
   3. BOTONES
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }

/* Principal: celeste de identidad con texto azul oscuro (contraste AA) */
.btn-primary {
  background: var(--celeste);
  color: var(--azul-oscuro);
}
.btn-primary:hover { background: var(--celeste-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--azul-oscuro);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); border-color: #C5D3E0; }

.btn-ghost {
  background: transparent;
  color: var(--text-link);
}
.btn-ghost:hover { background: var(--celeste-claro); }

.btn-danger {
  background: var(--surface);
  color: var(--danger-text);
  border-color: #F5C2C2;
}
.btn-danger:hover { background: var(--danger-bg); }

.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }

.btn[disabled], .btn.is-disabled {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}


/* =========================================================
   4. TARJETAS, BADGES Y ALERTAS
   ========================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card--flat { box-shadow: none; }
.card--soft { background: var(--surface-2); box-shadow: none; }

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

/* Badge de estado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge--sin-punto::before { display: none; }

.badge-ok      { background: var(--ok-bg);      color: var(--ok-text); }
.badge-warn    { background: var(--warn-bg);    color: var(--warn-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.badge-info    { background: var(--info-bg);    color: var(--info-text); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-text); }

/* Alertas / mensajes (flash) */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.alert-warn   { background: var(--warn-bg);   color: var(--warn-text);   border-color: #F6D9A0; }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border-color: #F5C2C2; }
.alert-ok     { background: var(--ok-bg);     color: var(--ok-text);     border-color: #BFE6CB; }
.alert-info   { background: var(--info-bg);   color: var(--info-text);   border-color: #B5E3EC; }


/* =========================================================
   5. FORMULARIOS
   ========================================================= */

.field { margin-bottom: 16px; }

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--azul-oscuro);
}

.field__hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-2);
}

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input--mono { font-family: var(--font-mono); font-size: 14px; }

.textarea { min-height: 96px; resize: vertical; }

.input::placeholder, .textarea::placeholder { color: #94A3B8; }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--celeste);
  box-shadow: 0 0 0 3px rgba(34, 184, 207, .18);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
.form-grid .full { grid-column: 1 / -1; }


/* =========================================================
   6. TABLAS
   ========================================================= */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }


/* =========================================================
   7. KPIs, PROGRESO, PESTAÑAS, LÍNEA DE TIEMPO, ACORDEÓN
   ========================================================= */

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

.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
  overflow: hidden;
}

/* Barra fina de color en el borde superior: indica el estado */
.kpi::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--kpi-color, var(--celeste));
}

.kpi--ok      { --kpi-color: var(--ok);      --kpi-bg: var(--ok-bg);      --kpi-text: var(--ok-text); }
.kpi--warn    { --kpi-color: var(--warn);    --kpi-bg: var(--warn-bg);    --kpi-text: var(--warn-text); }
.kpi--danger  { --kpi-color: var(--danger);  --kpi-bg: var(--danger-bg);  --kpi-text: var(--danger-text); }
.kpi--info    { --kpi-color: var(--celeste); --kpi-bg: var(--info-bg);    --kpi-text: var(--info-text); }
.kpi--neutral { --kpi-color: var(--neutral); --kpi-bg: var(--neutral-bg); --kpi-text: var(--neutral-text); }

.kpi__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi__titulo {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
}

.kpi__icono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--kpi-bg, var(--info-bg));
  color: var(--kpi-text, var(--info-text));
}

.kpi__valor {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--azul-oscuro);
}

.kpi__detalle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.kpi__detalle .punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--kpi-color, var(--celeste));
}

/* Barra de progreso */
.progress {
  height: 8px;
  background: var(--neutral-bg);
  border-radius: 999px;
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--ok);
  border-radius: 999px;
}
.progress__bar--warn   { background: var(--warn); }
.progress__bar--danger { background: var(--danger); }
.progress__bar--info   { background: var(--celeste); }

/* Pestañas / filtros */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--azul-oscuro); border-color: #C5D3E0; }
.tab.is-active {
  color: var(--text-link);
  background: var(--celeste-claro);
  border-color: #B5E3EC;
  font-weight: 600;
}

/* Línea de tiempo */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 4px;
}

.timeline__item {
  position: relative;
  padding: 0 0 18px 24px;
  border-left: 2px solid var(--border);
  margin-left: 5px;
}
.timeline__item:last-child { border-left-color: transparent; padding-bottom: 0; }

.timeline__item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--celeste);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline__item--ok::before     { background: var(--ok); }
.timeline__item--warn::before   { background: var(--warn); }
.timeline__item--danger::before { background: var(--danger); }

.timeline__fecha { font-size: 12px; font-weight: 600; color: var(--text-2); }
.timeline__texto { font-size: 14px; color: var(--text); }

/* Acordeón (filas expandibles) */
.acordeon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.acordeon + .acordeon { margin-top: 10px; }

.acordeon__cab {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  font-family: var(--font);
  font-size: 15px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
}
.acordeon__cab:hover { background: var(--surface-2); }
.acordeon__titulo { flex: 1; min-width: 0; }
.acordeon__flecha { transition: transform .2s ease; color: var(--text-2); }
.acordeon.is-open .acordeon__flecha { transform: rotate(180deg); }

.acordeon__cuerpo { padding: 4px 18px 16px; border-top: 1px solid var(--border); }
.acordeon__cuerpo[hidden] { display: none; }


/* =========================================================
   8. ESTRUCTURA DE LA APLICACIÓN
   Sidebar blanca a la izquierda + barra superior + contenido
   ========================================================= */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 10px 20px;
  color: inherit;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo__marca {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--azul-oscuro);
  background: var(--celeste);
  border-radius: 10px;
}

.logo__nombre { display: block; font-size: 17px; font-weight: 700; color: var(--azul-oscuro); line-height: 1.2; }
.logo__lema   { display: block; font-size: 12px; color: var(--text-2); line-height: 1.3; }

/* Navegación */
.nav { display: flex; flex-direction: column; gap: 2px; }

.nav__titulo {
  padding: 14px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94A3B8;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); color: var(--azul-oscuro); text-decoration: none; }

/* Elemento activo: fondo celeste muy claro + indicador lateral */
.nav-item.is-active {
  background: var(--celeste-claro);
  color: var(--text-link);
  font-weight: 600;
}
.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--celeste);
  border-radius: 0 3px 3px 0;
}

.nav-item.is-disabled { cursor: default; color: #94A3B8; }
.nav-item.is-disabled:hover { background: transparent; color: #94A3B8; }

.nav-item__tag {
  margin-left: auto;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--neutral-text);
  background: var(--neutral-bg);
  border-radius: 999px;
}

.nav-item__flecha { margin-left: auto; transition: transform .2s ease; }
.nav-grupo.is-open > .nav-item .nav-item__flecha { transform: rotate(180deg); }

.nav-sub { display: none; flex-direction: column; gap: 1px; padding: 2px 0 4px 22px; margin-left: 20px; border-left: 1px solid var(--border); }
.nav-grupo.is-open > .nav-sub { display: flex; }

.nav-sub .nav-item { min-height: 36px; font-size: 13.5px; padding-left: 12px; }

/* Parte inferior de la sidebar: usuario / empresa / salir */
.sidebar__pie {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.usuario-caja {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 10px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-link);
  background: var(--celeste-claro);
  border: 1px solid #B5E3EC;
  border-radius: 50%;
}

.usuario-caja__nombre  { font-size: 14px; font-weight: 600; color: var(--azul-oscuro); line-height: 1.25; overflow-wrap: anywhere; }
.usuario-caja__empresa { font-size: 12px; color: var(--text-2); line-height: 1.25; overflow-wrap: anywhere; }

/* Columna principal */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__izq, .topbar__der { display: flex; align-items: center; gap: 12px; min-width: 0; }

.topbar__titulo {
  font-size: 18px;
  font-weight: 600;
  color: var(--azul-oscuro);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--azul-oscuro); }
.icon-btn[disabled] { opacity: .5; cursor: not-allowed; }

.menu-btn { display: none; }

/* Menú de usuario (barra superior) */
.menu-usuario { position: relative; }

.menu-usuario__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}
.menu-usuario__btn:hover { background: var(--surface-2); }
.menu-usuario__nombre { font-size: 14px; font-weight: 500; }

.menu-usuario__lista {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(24, 59, 86, .12);
}
.menu-usuario__lista[hidden] { display: none; }

.menu-usuario__lista a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  font-size: 14px;
  color: var(--text);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.menu-usuario__lista a:hover { background: var(--surface-2); }

/* Contenido */
.content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head__sub { margin-top: 4px; color: var(--text-2); }

.seccion { margin-top: 32px; }
.seccion__cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* Fondo oscuro tras la sidebar en móvil */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(24, 59, 86, .35);
}


/* =========================================================
   9. PANTALLA DE LOGIN
   Escritorio: dos áreas (presentación + tarjeta de acceso)
   ========================================================= */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.auth__lado {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 56px;
  background: linear-gradient(160deg, var(--celeste-claro) 0%, var(--bg) 75%);
  border-right: 1px solid var(--border);
}

.auth__lado .logo { padding: 0; }

.auth__mensaje { max-width: 480px; padding: 32px 0; }

.auth__mensaje h2 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--azul-oscuro);
}
.auth__mensaje h2 span { color: var(--azul); }

.auth__mensaje p { margin-top: 16px; font-size: 16px; color: var(--text-2); max-width: 420px; }

.auth__ilustracion { width: 100%; max-width: 460px; margin-top: 28px; height: auto; }

.auth__legal { font-size: 12px; color: var(--text-2); }

.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth__tarjeta {
  width: 100%;
  max-width: 420px;
  padding: 32px 30px 28px;
}

.auth__tarjeta h1 { font-size: 26px; }
.auth__tarjeta .auth__sub { margin: 6px 0 24px; font-size: 14px; color: var(--text-2); }


/* =========================================================
   10. RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {

  /* La sidebar pasa a ser un menú lateral desplegable */
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(86vw, 300px);
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: none;
  }

  body.menu-abierto .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(24, 59, 86, .25); }
  body.menu-abierto .sidebar-backdrop { display: block; }
  body.menu-abierto { overflow: hidden; }

  .menu-btn { display: inline-flex; }

  .topbar { padding: 0 14px; }
  .content { padding: 20px 14px 32px; }
  .menu-usuario__nombre { display: none; }

  /* Login: una sola columna; el lado de presentación se compacta */
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__lado { padding: 20px 20px 18px; border-right: none; border-bottom: 1px solid var(--border); }
  .auth__mensaje { padding: 16px 0 0; }
  .auth__mensaje h2 { font-size: 20px; }
  .auth__mensaje p, .auth__ilustracion, .auth__legal { display: none; }
  .auth__panel { align-items: flex-start; padding: 24px 16px 40px; }
  .auth__tarjeta { padding: 24px 20px 22px; }
}

@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi__valor { font-size: 28px; }
  .topbar .btn-primary .btn__texto { display: none; }  /* solo el icono + en pantallas muy chicas */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}