/* =========================================================
   Cultura Organizacional — sistema visual
   Paleta y ritmo tomados de la plantilla original.
   ========================================================= */

:root {
  --navy: #12294D;
  --blue: #2E75B6;
  --red: #E5484D;
  --yellow: #F0A93B;
  --green: #27AE60;
  --purple: #8E6FCE;
  --gray: #8A93A6;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --border: #E4E8EF;
  --text-dark: #1F2937;
  --text-muted: #6B7280;

  --radius-sm: 7px;
  --radius: 12px;
  --radius-lg: 14px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  --sidebar-w: 210px;
  --bottom-nav-h: 62px;

  --font: Arial, Helvetica, "Segoe UI", system-ui, sans-serif;

  --z-drawer: 60;
  --z-modal: 80;
  --z-toast: 90;

  --shadow-card: 0 1px 2px rgba(18, 41, 77, 0.04);
  --shadow-pop: 0 12px 32px rgba(18, 41, 77, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-dark);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font-family: inherit; }

a { color: var(--blue); }

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

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------
   Layout
   --------------------------------------------------------- */

.shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
}

.main {
  flex: 1;
  min-width: 0;
  padding: var(--space-5);
  background: var(--bg);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------
   Sidebar (escritorio) / Drawer (móvil)
   --------------------------------------------------------- */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--navy);
  padding: var(--space-5) 14px;
  padding-top: calc(var(--space-5) + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  color: #C9D6EA;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 26px;
  padding: 0 var(--space-1);
}
.sidebar__brand svg { width: 22px; height: 22px; flex-shrink: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  min-height: 44px;
  border-radius: 9px;
  background: transparent;
  color: #C9D6EA;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: var(--space-1);
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item:active { background: rgba(255, 255, 255, 0.14); }
.nav-item.is-active { background: var(--blue); color: #fff; }

.sidebar__spacer { flex: 1; }

.sidebar__purpose {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 14px;
  color: #C9D6EA;
}
.sidebar__purpose-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}
.sidebar__purpose-text { font-size: 11.5px; line-height: 1.5; }

.sidebar__user {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px;
  line-height: 1.5;
}
.sidebar__user strong { color: #fff; display: block; font-size: 12.5px; }

.btn-logout {
  margin-top: var(--space-2);
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #C9D6EA;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-logout:hover { background: rgba(229, 72, 77, 0.18); color: #fff; border-color: rgba(229, 72, 77, 0.5); }
.btn-logout svg { width: 16px; height: 16px; }

/* Barra superior móvil */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  gap: var(--space-3);
  background: var(--navy);
  color: #fff;
  padding: 10px var(--space-4);
  padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar__title { font-size: 14.5px; font-weight: 800; }
.icon-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.16); }
.icon-btn svg { width: 22px; height: 22px; }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: calc(var(--z-drawer) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.scrim.is-open { opacity: 1; pointer-events: auto; }

/* Navegación inferior (móvil) */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: #fff;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(18, 41, 77, 0.06);
}
.bottom-nav__list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav__item {
  border: none;
  background: none;
  cursor: pointer;
  min-height: var(--bottom-nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  padding: 6px 2px;
}
.bottom-nav__item svg { width: 20px; height: 20px; }
.bottom-nav__item.is-active { color: var(--blue); }
.bottom-nav__item:active { background: rgba(46, 117, 182, 0.08); }

/* ---------------------------------------------------------
   Encabezado y filtros
   --------------------------------------------------------- */

.page-header {
  background: var(--bg);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
}
.page-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.3px;
  line-height: 1.25;
  margin: 0;
}
.page-subtitle {
  font-size: 14px;
  color: var(--blue);
  margin-top: var(--space-1);
}
.page-subtitle .heart { color: var(--red); }
.page-header__actions { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.page-header__buttons { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.stamp { font-size: 11px; color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 160ms ease, color 160ms ease, transform 120ms ease;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: #2764a0; }
.btn--ghost { background: #fff; color: var(--navy); border-color: var(--border); }
.btn--ghost:hover { background: #F0F4F9; }
.btn--danger { background: var(--red); color: #fff; }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn__spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(39, 174, 96, 0.12);
  color: var(--green);
  border: 1px solid rgba(39, 174, 96, 0.35);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
}
.role-chip svg { width: 14px; height: 14px; }
.role-chip--lider { background: rgba(46, 117, 182, 0.1); color: var(--blue); border-color: rgba(46, 117, 182, 0.3); }

.filters {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: flex-end;
}
.field-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  display: block;
}
.select, .input, .textarea {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
  color: var(--text-dark);
  min-height: 44px;
  width: 100%;
}
.textarea { min-height: 66px; resize: vertical; line-height: 1.45; }
.select:hover, .input:hover { border-color: #cfd6e2; }
.filters .filter { min-width: 160px; flex: 1 1 160px; }

/* ---------------------------------------------------------
   Tarjetas, KPI y gráficos
   --------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}
.card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
}
.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.card__meta { font-size: 12px; color: var(--text-muted); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-card);
}
.kpi__label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.3;
}
.kpi__value {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.grid { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
.grid--3 { grid-template-columns: 1.1fr 1.1fr 0.9fr; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--analisis { grid-template-columns: 1.3fr 0.7fr; }
.grid--calendario { grid-template-columns: 1.6fr 0.9fr; }
.grid--pilares { grid-template-columns: repeat(4, 1fr); gap: 14px; }

.chart-box { position: relative; height: 220px; }
.chart-box--gauge { height: 150px; width: 150px; }

.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-card .card__title { align-self: flex-start; margin-bottom: 6px; }
.gauge-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.gauge-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
}

.pilar {
  display: flex;
  gap: 10px;
}
.pilar__count {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.pilar__name { font-size: 12.5px; font-weight: 700; color: var(--text-dark); line-height: 1.3; }
.pilar__desc { font-size: 11px; color: var(--text-muted); line-height: 1.35; }

.stat-strip { display: flex; gap: var(--space-3); margin-bottom: 14px; flex-wrap: wrap; }
.stat-strip__item { flex: 1 1 140px; border-radius: 10px; padding: 12px; }
.stat-strip__label { font-size: 11px; color: var(--text-muted); }
.stat-strip__value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

.stats-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
.stats-3 > div { background: var(--bg); border-radius: 10px; padding: 14px; }

.rank-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.rank-row__value { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

.big-number { font-size: 32px; font-weight: 800; color: var(--blue); }
.muted { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* ---------------------------------------------------------
   Tablas
   --------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  padding: var(--space-2);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px var(--space-2);
  font-size: 12.5px;
  border-bottom: 1px solid #F1F4F8;
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FAFBFD; }
.table .cell-muted { color: var(--text-muted); font-size: 12px; }
.table .cell-clip { max-width: 240px; }
.table .cell-nowrap { white-space: nowrap; }
.table .cell-num { font-variant-numeric: tabular-nums; }
.table .is-late { color: var(--red); font-weight: 700; }
.empty-row {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.link-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 6px;
  min-height: 40px;
  border-radius: 6px;
}
.link-btn--edit { color: var(--blue); }
.link-btn--edit:hover { background: rgba(46, 117, 182, 0.08); }
.link-btn--del { color: var(--red); }
.link-btn--del:hover { background: rgba(229, 72, 77, 0.08); }

.table-note { font-size: 11px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }

/* ---------------------------------------------------------
   Calendario
   --------------------------------------------------------- */

.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}
.cal-head__label { font-size: 14px; font-weight: 700; color: var(--navy); }
.cal-nav {
  min-width: 44px; min-height: 44px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
}
.cal-nav svg { width: 18px; height: 18px; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekdays { margin-bottom: 6px; }
.cal-weekday { font-size: 11px; color: var(--text-muted); text-align: center; font-weight: 700; }
.cal-day {
  min-height: 74px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}
.cal-day--empty { border: none; background: transparent; min-height: 40px; }
.cal-day--today { background: rgba(46, 117, 182, 0.07); border-color: rgba(46, 117, 182, 0.4); }
.cal-day__num { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.cal-day--today .cal-day__num { font-weight: 800; color: var(--blue); }
.cal-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 3px;
  display: inline-block;
}
.cal-more { font-size: 10px; color: var(--text-muted); }

/* ---------------------------------------------------------
   Modal
   --------------------------------------------------------- */

.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px var(--space-4);
  z-index: var(--z-modal);
  overflow: auto;
  animation: fade-in 180ms ease-out;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 640px;
  width: 100%;
  box-shadow: var(--shadow-pop);
  animation: modal-in 220ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}
.modal__title { font-size: 16px; font-weight: 800; color: var(--navy); }
.modal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.modal__full { grid-column: 1 / -1; margin-top: 10px; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.confidencial {
  grid-column: 1 / -1;
  margin-top: 14px;
  padding: var(--space-3);
  background: #F7F0FF;
  border: 1px dashed var(--purple);
  border-radius: 10px;
}
.confidencial__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: var(--space-2);
}
.confidencial__title svg { width: 14px; height: 14px; }

.form-error {
  color: var(--red);
  font-size: 12.5px;
  margin: 6px 0 0;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.form-error svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.input.has-error, .textarea.has-error, .select.has-error { border-color: var(--red); }

/* ---------------------------------------------------------
   Toast / offline
   --------------------------------------------------------- */

.toast-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 200ms ease-out;
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast--error { background: var(--red); }
.toast--ok { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.offline-bar {
  display: none;
  background: var(--yellow);
  color: #4a3200;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px var(--space-4);
  text-align: center;
}
body.is-offline .offline-bar { display: block; }

.install-cta {
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(46, 117, 182, 0.1);
  border: 1px solid rgba(46, 117, 182, 0.3);
  border-radius: 10px;
  padding: 10px var(--space-3);
  margin-bottom: var(--space-3);
  font-size: 12.5px;
  color: var(--navy);
}
.install-cta.is-visible { display: flex; }

.skeleton {
  background: linear-gradient(90deg, #EDF1F6 25%, #F6F8FB 37%, #EDF1F6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------------------------------
   Autenticación
   --------------------------------------------------------- */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth__brand {
  background: var(--navy);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-4);
}
.auth__brand-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
.auth__brand-logo svg { width: 26px; height: 26px; }
.auth__brand h1 { font-size: 28px; line-height: 1.25; margin: 0; letter-spacing: 0.3px; }
.auth__brand p { color: #C9D6EA; font-size: 14px; line-height: 1.6; max-width: 42ch; margin: 0; }
.auth__pilares { display: grid; gap: 10px; margin-top: var(--space-4); }
.auth__pilar { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #C9D6EA; }
.auth__pilar span { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px var(--space-5);
  background: var(--bg);
}
.auth__card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: min(420px, 100%);
  box-shadow: var(--shadow-card);
}
.auth__card h2 { font-size: 20px; color: var(--navy); margin: 0 0 6px; }
.auth__card .muted { margin-bottom: var(--space-5); }
.form-row { margin-bottom: var(--space-4); }
.form-row label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 48px; }
.password-toggle {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  min-width: 40px; min-height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.password-toggle svg { width: 18px; height: 18px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--blue); }

.alert {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  margin-bottom: var(--space-4);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert--error { background: rgba(229, 72, 77, 0.1); color: #9c2c30; border: 1px solid rgba(229, 72, 77, 0.3); }
.alert--ok { background: rgba(39, 174, 96, 0.1); color: #1c6b3c; border: 1px solid rgba(39, 174, 96, 0.3); }

/* ---------------------------------------------------------
   Usuarios (admin)
   --------------------------------------------------------- */

.users-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
}
.tag--admin { background: rgba(142, 111, 206, 0.14); color: var(--purple); }
.tag--lider { background: rgba(46, 117, 182, 0.12); color: var(--blue); }
.tag--off { background: rgba(138, 147, 166, 0.16); color: var(--gray); }
.tag--on { background: rgba(39, 174, 96, 0.14); color: var(--green); }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 1279px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid--3 { grid-template-columns: 1fr 1fr; }
  .grid--pilares { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 264px;
    max-width: 82vw;
    z-index: var(--z-drawer);
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.2, 0.8, 0.3, 1);
    overflow-y: auto;
  }
  .sidebar.is-open { transform: none; }
  .topbar { display: flex; }
  .main { padding: var(--space-4); }
  .page-header { padding: var(--space-4) 0 0; }
  .page-header__top { flex-direction: column; align-items: stretch; }
  .page-header__actions { text-align: left; align-items: stretch; }
  .page-header__buttons { justify-content: flex-start; }
  .page-title { font-size: 19px; }
  .grid--analisis, .grid--calendario, .grid--2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth__brand { padding: 32px var(--space-5); }
  .auth__brand h1 { font-size: 22px; }
  .users-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .main {
    padding: var(--space-3);
    padding-bottom: calc(var(--bottom-nav-h) + 24px + env(safe-area-inset-bottom));
  }
  .bottom-nav { display: block; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); margin-top: var(--space-3); }
  .kpi { padding: var(--space-3); }
  .kpi__value { font-size: 22px; }
  .grid, .grid--3, .grid--2 { grid-template-columns: 1fr; gap: var(--space-3); }
  .grid--pilares { grid-template-columns: 1fr; }
  .stats-3 { grid-template-columns: 1fr; }
  .chart-box { height: 240px; }
  .filters { gap: var(--space-2); }
  .filters .filter { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .modal-scrim { padding: 0; align-items: stretch; }
  .modal {
    border-radius: 0;
    max-width: none;
    min-height: 100%;
    padding: var(--space-4);
    padding-top: calc(var(--space-4) + env(safe-area-inset-top));
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  }
  .modal__grid { grid-template-columns: 1fr; }
  .modal__foot { position: sticky; bottom: 0; background: #fff; padding-top: var(--space-3); }
  .modal__foot .btn { flex: 1; }

  /* Inputs a 16px: evita el zoom automático de iOS */
  .select, .input, .textarea { font-size: 16px; }

  /* Tablas -> tarjetas apiladas */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
    background: #fff;
  }
  .table tr:hover { background: #fff; }
  .table td {
    border: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    font-size: 13.5px;
    align-items: flex-start;
  }
  .table td::before {
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    flex-shrink: 0;
    padding-top: 2px;
  }
  .table td:empty { display: none; }
  .table td.cell-clip { max-width: none; text-align: right; }
  .table td.cell-actions { justify-content: flex-end; gap: var(--space-2); border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
  .table td.cell-actions::before { content: ""; }
  .table .empty-row { display: block; text-align: center; }
  .table .empty-row::before { content: ""; }

  .cal-day { min-height: 54px; padding: 4px; }
  .cal-day__num { font-size: 11px; }
  .auth__panel { padding: var(--space-4); }
  .auth__card { padding: var(--space-5); border-radius: var(--radius); }
}

@media (max-width: 380px) {
  .bottom-nav__item { font-size: 9.5px; }
  .page-title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .page-header__buttons, .cell-actions, .install-cta { display: none !important; }
  .main { padding: 0; }
  .card { break-inside: avoid; }
}
