/* ============================================================
   styles.css — Vidas en Movimiento
   Diseño: Minimalist Modern · UI/UX Pro Max
   Fuentes: Plus Jakarta Sans (display) + Inter (body)
   ============================================================ */

/* ─── DESIGN TOKENS ──────────────────────────────────────── */
:root {
  /* Brand */
  --color-sidebar:      #0D1B36;
  --color-sidebar-dark: #081022;
  --color-sidebar-hover:#162447;
  --color-sidebar-act:  #1E3163;
  --color-accent:       #E8612A;
  --color-accent-dark:  #C94E1A;
  --color-accent-soft:  #FEF0E9;
  --color-accent-mid:   #FDDDD0;

  /* Superficies */
  --color-bg:       #F4F6F9;
  --color-bg-alt:   #EEF1F6;
  --color-surface:  #FFFFFF;
  --color-surface-2:#F9FAFB;

  /* Bordes */
  --color-border:        #E4E7EC;
  --color-border-subtle: #F2F4F7;

  /* Texto */
  --color-text:       #101828;
  --color-text-muted: #475467;
  --color-text-light: #98A2B3;

  /* Semánticos */
  --color-success:      #12B76A;
  --color-success-soft: #D1FADF;
  --color-warning:      #F79009;
  --color-warning-soft: #FEF0C7;
  --color-error:        #F04438;
  --color-error-soft:   #FEE4E2;
  --color-info:         #2E90FA;
  --color-info-soft:    #D1E9FF;
  --color-purple:       #7F56D9;
  --color-purple-soft:  #E9D7FE;
  --color-teal:         #0D9488;
  --color-teal-soft:    #CCFBF1;

  /* Layout */
  --sidebar-w:    252px;
  --sidebar-mini: 68px;
  --header-h:     62px;

  /* Radios */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Sombras — muy minimalistas */
  --shadow-xs: 0 1px 2px rgba(16,24,40,0.05);
  --shadow-sm: 0 1px 3px rgba(16,24,40,0.08), 0 1px 2px rgba(16,24,40,0.04);
  --shadow-md: 0 4px 12px -2px rgba(16,24,40,0.08), 0 2px 4px -2px rgba(16,24,40,0.04);
  --shadow-lg: 0 12px 32px -4px rgba(16,24,40,0.12), 0 4px 8px -2px rgba(16,24,40,0.06);

  /* Transición */
  --transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ─── RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fuente display para headings */
h1, h2, h3, h4, h5,
.page-title, .card-title, .kpi-value,
.sidebar-brand .brand-text h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* Focus visibles — accesibilidad */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
#app-shell { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--color-sidebar);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  overflow: hidden;
}

#sidebar.collapsed { width: var(--sidebar-mini); }

/* Logo */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: var(--header-h);
  flex-shrink: 0;
}

.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--color-accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  box-shadow: 0 0 0 4px rgba(232,97,42,0.2);
}

.sidebar-brand .brand-text { overflow: hidden; transition: var(--transition); }
.sidebar-brand .brand-text h1 {
  font-size: 13.5px; font-weight: 700;
  color: #fff; line-height: 1.2; white-space: nowrap;
  letter-spacing: -0.01em;
}
.sidebar-brand .brand-text span {
  font-size: 10px; color: rgba(255,255,255,0.38);
  white-space: nowrap; font-weight: 400; letter-spacing: 0.02em;
}
#sidebar.collapsed .brand-text { opacity: 0; width: 0; }

/* Nav scroll */
.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 10px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* Etiquetas de grupo */
.nav-group-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  padding: 14px 20px 4px;
  white-space: nowrap; overflow: hidden;
  font-family: 'Inter', sans-serif;
}
#sidebar.collapsed .nav-group-label { opacity: 0; }

/* Header de grupo (colapsable) */
.nav-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  color: rgba(255,255,255,0.65);
  font-size: 12.5px; font-weight: 600;
  border-radius: var(--radius-sm);
  margin: 0 8px;
  cursor: pointer;
  transition: var(--transition);
  gap: 10px;
  user-select: none;
}
.nav-group-header:hover { background: var(--color-sidebar-hover); color: rgba(255,255,255,0.9); }
.nav-group-header .group-icon {
  font-size: 16px; flex-shrink: 0;
  width: 22px; display: flex; align-items: center; justify-content: center;
  opacity: 0.7;
}
.nav-group-header:hover .group-icon { opacity: 1; }
.nav-group-header .group-name { flex: 1; white-space: nowrap; overflow: hidden; }
.nav-group-header .group-arrow { font-size: 10px; transition: transform 0.2s; flex-shrink: 0; opacity: 0.5; }
.nav-group-header.open .group-arrow { transform: rotate(90deg); }
#sidebar.collapsed .nav-group-header .group-name,
#sidebar.collapsed .nav-group-header .group-arrow { opacity: 0; width: 0; overflow: hidden; }

/* Sub-items */
.nav-sub-items { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.nav-sub-items.open { max-height: 700px; }

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6.5px 12px 6.5px 38px;
  color: rgba(255,255,255,0.45);
  font-size: 12px; font-weight: 400;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--color-sidebar-hover); color: rgba(255,255,255,0.85); }
.nav-item.active {
  background: var(--color-accent);
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(232,97,42,0.3);
}
.nav-item .nav-dot {
  width: 4px; height: 4px;
  border-radius: 50%; background: currentColor;
  flex-shrink: 0; opacity: 0.5;
}
.nav-item.active .nav-dot { opacity: 1; width: 6px; height: 6px; }
#sidebar.collapsed .nav-item .nav-item-text { opacity: 0; width: 0; }

/* Footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition);
}
.sidebar-user:hover { background: var(--color-sidebar-hover); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-info { overflow: hidden; transition: var(--transition); }
.user-info .user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .user-org  { font-size: 10px; color: rgba(255,255,255,0.35); white-space: nowrap; }
#sidebar.collapsed .user-info { opacity: 0; width: 0; }

/* Botón colapso */
#sidebar-toggle {
  position: absolute; top: 20px; right: -12px;
  width: 24px; height: 24px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: var(--transition); z-index: 101;
  font-size: 10px; color: var(--color-text-muted);
}
#sidebar-toggle:hover { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* ─── MAIN WRAPPER ───────────────────────────────────────── */
#main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.2s cubic-bezier(0.4,0,0.2,1);
}
#main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-mini); }

/* ─── HEADER ─────────────────────────────────────────────── */
#top-header {
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 90;
}

#hamburger-btn {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  color: var(--color-text-muted); transition: var(--transition); flex-shrink: 0;
}
#hamburger-btn:hover { background: var(--color-bg); color: var(--color-text); }

.header-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--color-text-muted); flex: 1;
  font-family: 'Inter', sans-serif;
}
.breadcrumb-sep { color: var(--color-border); }
.breadcrumb-current { font-weight: 600; color: var(--color-text); }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.header-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  color: var(--color-text-muted); transition: var(--transition); position: relative;
}
.header-btn:hover { background: var(--color-bg); color: var(--color-text); }
.header-notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; background: var(--color-error);
  border-radius: 50%; border: 1.5px solid var(--color-surface);
}
.header-divider { width: 1px; height: 22px; background: var(--color-border); }

.header-user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 100px;
  border: 1.5px solid var(--color-border);
  cursor: pointer; transition: var(--transition); font-size: 12.5px;
}
.header-user-pill:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.header-user-pill .pill-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-accent);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.header-user-pill .pill-name { font-weight: 600; color: var(--color-text); }
.header-user-pill .pill-role { color: var(--color-text-light); font-size: 11px; }

/* ─── PAGE CONTENT ───────────────────────────────────────── */
#page-content {
  flex: 1; padding: 28px 28px 40px;
  max-width: 1440px; width: 100%;
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-title {
  font-size: 21px; font-weight: 700; color: var(--color-text);
  line-height: 1.25; letter-spacing: -0.02em;
}
.page-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 3px; line-height: 1.5; }
.page-actions  { display: flex; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 22px;
  transition: var(--transition);
}
.card-sm { padding: 16px; border-radius: var(--radius-md); }
.card-lg { padding: 30px; }
.card:hover { border-color: #D0D5DD; }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px;
}
.card-title {
  font-size: 13.5px; font-weight: 700; color: var(--color-text);
  letter-spacing: -0.01em;
}
.card-subtitle { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

/* ─── KPI CARDS — minimalistas, impactantes ──────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 22px 24px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--kpi-color, var(--color-accent));
  opacity: 0;
  transition: var(--transition);
}
.kpi-card:hover { border-color: #D0D5DD; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card:hover::before { opacity: 1; }

.kpi-body  { flex: 1; }
.kpi-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--color-text-muted);
  margin-bottom: 8px; font-family: 'Inter', sans-serif;
}
.kpi-value {
  font-size: 34px; font-weight: 800; color: var(--color-text);
  line-height: 1; letter-spacing: -0.03em;
}
.kpi-sub {
  font-size: 11.5px; color: var(--color-text-muted);
  margin-top: 6px; display: flex; align-items: center; gap: 5px;
}
.kpi-delta-up   { color: var(--color-success); font-weight: 600; }
.kpi-delta-down { color: var(--color-error); font-weight: 600; }

.kpi-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.kpi-icon.orange  { background: var(--color-accent-soft);   color: var(--color-accent); }
.kpi-icon.blue    { background: var(--color-info-soft);     color: var(--color-info); }
.kpi-icon.green   { background: var(--color-success-soft);  color: var(--color-success); }
.kpi-icon.yellow  { background: var(--color-warning-soft);  color: var(--color-warning); }
.kpi-icon.purple  { background: var(--color-purple-soft);   color: var(--color-purple); }
.kpi-icon.red     { background: var(--color-error-soft);    color: var(--color-error); }
.kpi-icon.teal    { background: var(--color-teal-soft);     color: var(--color-teal); }

/* ─── BOTONES ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  border: 1.5px solid transparent;
  letter-spacing: 0;
  font-family: 'Inter', sans-serif;
  min-height: 38px;
}
.btn-sm  { padding: 6px 13px; font-size: 12px; min-height: 32px; border-radius: var(--radius-sm); }
.btn-lg  { padding: 12px 24px; font-size: 14px; min-height: 44px; }
.btn-icon { width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 30px; height: 30px; border-radius: 6px; }

.btn-primary {
  background: var(--color-accent); color: #fff; border-color: var(--color-accent);
}
.btn-primary:hover {
  background: var(--color-accent-dark); border-color: var(--color-accent-dark);
  box-shadow: 0 2px 10px rgba(232,97,42,0.3);
}

.btn-secondary {
  background: var(--color-surface); color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-bg); color: var(--color-text); border-color: #C4CAD4; }

.btn-dark {
  background: var(--color-sidebar); color: #fff; border-color: var(--color-sidebar);
}
.btn-dark:hover { background: var(--color-sidebar-dark); }

.btn-ghost  { color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }

.btn-danger  { background: var(--color-error-soft);   color: var(--color-error);   border-color: #FECDCA; }
.btn-danger:hover  { background: var(--color-error);   color: #fff; }
.btn-success { background: var(--color-success-soft);  color: var(--color-success); border-color: #A6F4C5; }
.btn-success:hover { background: var(--color-success); color: #fff; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 100px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.badge-orange { background: var(--color-accent-soft);   color: var(--color-accent); }
.badge-blue   { background: var(--color-info-soft);     color: #1570EF; }
.badge-green  { background: var(--color-success-soft);  color: #067647; }
.badge-yellow { background: var(--color-warning-soft);  color: #B54708; }
.badge-purple { background: var(--color-purple-soft);   color: #6941C6; }
.badge-red    { background: var(--color-error-soft);    color: #B42318; }
.badge-gray   { background: var(--color-bg-alt);        color: var(--color-text-muted); }
.badge-teal   { background: var(--color-teal-soft);     color: var(--color-teal); }

/* Estado */
.badge-en_transito { background: #FEF0C7; color: #B54708; }
.badge-atendido    { background: var(--color-info-soft); color: #1570EF; }
.badge-derivado    { background: var(--color-purple-soft); color: #6941C6; }
.badge-ubicado     { background: var(--color-success-soft); color: #067647; }
.badge-archivado   { background: var(--color-bg-alt); color: var(--color-text-muted); }

/* ─── TABLA ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

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

thead th {
  padding: 12px 18px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--color-surface-2); }

.td-name   { font-weight: 600; }
.td-muted  { color: var(--color-text-muted); font-size: 12px; }
.td-actions{ display: flex; gap: 4px; align-items: center; }

/* ─── FORMULARIOS ────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--color-text-muted); letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: 'Inter', sans-serif;
}
.form-label .required { color: var(--color-error); margin-left: 2px; }

.form-input, .form-select, .form-textarea, .form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13.5px; color: var(--color-text);
  background: var(--color-surface);
  transition: var(--transition);
  outline: none; appearance: none;
  font-family: 'Inter', sans-serif;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--color-text-light); }
.form-input:hover, .form-select:hover, .form-control:hover { border-color: #C4CAD4; }
.form-input:focus, .form-select:focus, .form-textarea:focus, .form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(232,97,42,0.1);
}

.form-select, .form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2398A2B3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.form-textarea { min-height: 90px; resize: vertical; }
.form-hint  { font-size: 11.5px; color: var(--color-text-muted); margin-top: 5px; }
.form-error { font-size: 11.5px; color: var(--color-error); margin-top: 5px; }

.form-row   { display: grid; gap: 18px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* Inputs compactos para tablas dinámicas (grupo de viaje) */
.form-input-sm, .form-select-sm {
  width: 100%; box-sizing: border-box;
  padding: 7px 10px; border: 1.5px solid var(--color-border);
  border-radius: 7px; font-size: 12.5px; font-family: inherit;
  background: #fff; color: var(--color-text); outline: none;
  transition: border-color .15s;
}
.form-input-sm:focus, .form-select-sm:focus { border-color: var(--color-accent); }

/* Tabla grupo de viaje */
.grupo-viaje-table { width: 100%; border-collapse: collapse; }
.grupo-viaje-table th {
  font-size: 10.5px; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 0 6px 10px; text-align: left;
}
.grupo-viaje-table td { padding: 5px 6px; vertical-align: middle; }
.grupo-viaje-table tr { border-bottom: 1px solid var(--color-border-subtle); }
.grupo-viaje-table tr:last-child { border-bottom: none; }

/* Toggle switch boolean */
.toggle-wrapper { display: flex; align-items: center; gap: 10px; }
.toggle-switch {
  position: relative; width: 40px; height: 22px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--color-border); border-radius: 22px;
  transition: .2s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

.form-section { padding: 22px 0; border-bottom: 1px solid var(--color-border-subtle); margin-bottom: 4px; }
.form-section:last-child { border-bottom: none; }
.form-section-title {
  font-size: 12px; font-weight: 700; color: var(--color-text-muted);
  margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
  text-transform: uppercase; letter-spacing: 0.07em;
  font-family: 'Inter', sans-serif;
}
.form-section-title::before {
  content: ''; display: inline-block; width: 5px; height: 18px;
  border-radius: 3px; flex-shrink: 0; background: var(--color-border-subtle);
}
.form-section-title::after { content: ''; flex: 1; height: 2px; border-radius: 1px; background: var(--color-border-subtle); }

/* Section accent colors */
.fst-migrante   { color: #2563EB; }
.fst-migrante::before   { background: #3B82F6; }
.fst-migrante::after    { background: linear-gradient(90deg,#BFDBFE,transparent); }

.fst-entrevista { color: #0F766E; }
.fst-entrevista::before { background: #0D9488; }
.fst-entrevista::after  { background: linear-gradient(90deg,#99F6E4,transparent); }

.fst-adulto     { color: #6D28D9; }
.fst-adulto::before     { background: #7C3AED; }
.fst-adulto::after      { background: linear-gradient(90deg,#DDD6FE,transparent); }

.fst-nino       { color: #B45309; }
.fst-nino::before       { background: #F59E0B; }
.fst-nino::after        { background: linear-gradient(90deg,#FDE68A,transparent); }

.fst-rec        { color: #065F46; }
.fst-rec::before        { background: #10B981; }
.fst-rec::after         { background: linear-gradient(90deg,#A7F3D0,transparent); }

/* Checkbox pills */
.multi-check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.multi-check-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px; border: 1.5px solid var(--color-border);
  border-radius: 100px; cursor: pointer;
  font-size: 12px; font-weight: 500; transition: var(--transition); user-select: none;
}
.multi-check-item:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.multi-check-item.selected { border-color: var(--color-accent); background: var(--color-accent); color: #fff; }
.multi-check-item input { display: none; }

/* ─── MODALES ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,0.5);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s; backdrop-filter: blur(4px);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--color-surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
  transform: translateY(16px) scale(0.97); transition: transform 0.2s;
  border: 1px solid var(--color-border);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.modal-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--color-text-muted); transition: var(--transition); font-size: 16px;
}
.modal-close:hover { background: var(--color-bg); color: var(--color-text); }

.modal-body   { padding: 22px 26px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 26px; border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}

/* ─── TOASTS ─────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--color-sidebar);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500; max-width: 340px;
  animation: toastIn 0.25s cubic-bezier(0.4,0,0.2,1) both;
  pointer-events: all; color: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.08);
}
.toast.exiting { animation: toastOut 0.22s ease both; }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg  { flex: 1; }
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error   { border-left: 3px solid var(--color-error); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.info    { border-left: 3px solid var(--color-info); }

@keyframes toastIn  { from { opacity:0; transform:translateX(24px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(24px); } }

/* ─── SKELETON ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #F2F4F7 25%, #E8EBF0 50%, #F2F4F7 75%);
  background-size: 400% 100%; animation: shimmer 1.6s infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text   { height: 13px; margin-bottom: 8px; }
.skeleton-title  { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { background: var(--color-surface); border-radius: var(--radius-lg); border: 1px solid var(--color-border); padding: 22px; }

/* ─── BÚSQUEDA Y FILTROS ─────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md); transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(232,97,42,0.1); }
.search-bar input { border: none; outline: none; background: transparent; font-size: 13.5px; color: var(--color-text); flex: 1; }
.search-bar input::placeholder { color: var(--color-text-light); }
.search-icon { color: var(--color-text-light); flex-shrink: 0; }

.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-select {
  padding: 7px 34px 7px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md); font-size: 12.5px; color: var(--color-text);
  background: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2398A2B3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  outline: none; cursor: pointer; appearance: none; transition: var(--transition);
}
.filter-select:focus { border-color: var(--color-accent); }

/* ─── TIMELINE ───────────────────────────────────────────── */
.timeline { position: relative; }
.timeline-item { display: flex; gap: 16px; position: relative; padding-bottom: 26px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-left { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 36px; }
.timeline-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-info-soft); border: 2px solid var(--color-info);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  flex-shrink: 0; z-index: 1; position: relative;
}
.timeline-line { width: 2px; flex: 1; background: var(--color-border); margin-top: 4px; margin-bottom: -4px; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-content { flex: 1; padding-bottom: 4px; }
.timeline-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.timeline-title { font-size: 13px; font-weight: 600; }
.timeline-date  { font-size: 11px; color: var(--color-text-muted); flex-shrink: 0; }
.timeline-org   { font-size: 12px; color: var(--color-text-muted); margin-bottom: 6px; }
.timeline-obs   { font-size: 12px; color: var(--color-text-muted); font-style: italic; }
.timeline-servicios { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

/* ─── TABS ───────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 2px; border-bottom: 1.5px solid var(--color-border);
  margin-bottom: 22px; overflow-x: auto;
}
.tab-item {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--color-text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -1.5px; cursor: pointer; white-space: nowrap; transition: var(--transition);
}
.tab-item:hover { color: var(--color-text); }
.tab-item.active { color: var(--color-accent); border-bottom-color: var(--color-accent); font-weight: 700; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── PAGINADOR ──────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-top: 1px solid var(--color-border);
  font-size: 12px; color: var(--color-text-muted);
}
.pagination-pages { display: flex; gap: 4px; align-items: center; }
.page-btn {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500;
  transition: var(--transition); color: var(--color-text-muted);
}
.page-btn:hover { background: var(--color-bg); color: var(--color-text); }
.page-btn.active { background: var(--color-accent); color: #fff; }
.page-btn:disabled { opacity: 0.35; pointer-events: none; }

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 70px 20px; color: var(--color-text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 14px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--color-text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 360px; margin: 0 auto 18px; line-height: 1.6; }

/* ─── WIZARD ─────────────────────────────────────────────── */
.wizard-steps { display: flex; align-items: center; gap: 0; margin-bottom: 30px; overflow-x: auto; }
.wizard-step  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.wizard-step-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--color-bg); border: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--color-text-muted); transition: var(--transition);
}
.wizard-step.active .wizard-step-num { background: var(--color-accent); border-color: var(--color-accent); color: #fff; box-shadow: 0 0 0 4px rgba(232,97,42,0.15); }
.wizard-step.done  .wizard-step-num  { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.wizard-step-label { font-size: 12px; font-weight: 500; color: var(--color-text-muted); white-space: nowrap; }
.wizard-step.active .wizard-step-label { color: var(--color-text); font-weight: 700; }
.wizard-step.done  .wizard-step-label  { color: var(--color-success); }
.wizard-connector { flex: 1; min-width: 24px; height: 1.5px; background: var(--color-border); margin: 0 8px; }
.wizard-connector.done { background: var(--color-success); }

/* ─── MAPA ───────────────────────────────────────────────── */
#map-container, .leaflet-map {
  height: 480px; border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--color-border);
}

/* ─── GRÁFICAS ───────────────────────────────────────────── */
.chart-container {
  background: var(--color-surface); border-radius: var(--radius-lg);
  border: 1px solid var(--color-border); padding: 22px;
}
.chart-wrapper    { position: relative; height: 240px; }
.chart-wrapper-lg { height: 320px; }

/* ─── GRIDS ──────────────────────────────────────────────── */
.grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ─── PROGRESS ───────────────────────────────────────────── */
.progress-bar-wrap { background: var(--color-bg-alt); border-radius: 10px; height: 5px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 10px; background: var(--color-accent); transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.progress-bar-fill.green  { background: var(--color-success); }
.progress-bar-fill.blue   { background: var(--color-info); }
.progress-bar-fill.purple { background: var(--color-purple); }
.progress-bar-fill.teal   { background: var(--color-teal); }

/* ─── AVATARES ───────────────────────────────────────────── */
.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; text-transform: uppercase;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 42px; height: 42px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 72px; height: 72px; font-size: 26px; }
.avatar-accent { background: var(--color-accent-soft); color: var(--color-accent); }
.avatar-blue   { background: var(--color-info-soft);   color: var(--color-info); }
.avatar-green  { background: var(--color-success-soft);color: var(--color-success); }
.avatar-purple { background: var(--color-purple-soft); color: var(--color-purple); }

/* ─── PERFIL MIGRANTE ────────────────────────────────────── */
.profile-header {
  display: flex; align-items: flex-start; gap: 22px; padding: 28px;
  background: var(--color-sidebar);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; color: #fff;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
}
.profile-status-dot { position: absolute; bottom: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--color-sidebar); }
.profile-info h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.01em; }
.profile-info .profile-id { font-size: 11px; opacity: 0.45; margin-bottom: 8px; font-family: monospace; }
.profile-info .profile-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-tag {
  padding: 2px 9px; border-radius: 100px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18);
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.85);
}

/* ─── LOADING ────────────────────────────────────────────── */
#app-loading {
  position: fixed; inset: 0; background: var(--color-surface);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px;
  z-index: 1000; transition: opacity 0.4s;
}
#app-loading.hidden { opacity: 0; pointer-events: none; }
.loading-logo {
  width: 56px; height: 56px; background: var(--color-accent);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  animation: pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(232,97,42,0.3);
}
.loading-dots { display: flex; gap: 7px; }
.loading-dot {
  width: 8px; height: 8px; background: var(--color-accent); border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse  { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

/* ─── OVERLAY MÓVIL ──────────────────────────────────────── */
#sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(16,24,40,0.55); z-index:99; backdrop-filter:blur(3px); }
#sidebar-overlay.open { display:block; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1280px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-1-2, .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 252px; }
  #sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  #sidebar.mobile-open { transform: translateX(0); }
  #sidebar-toggle { display: none; }
  #main-wrapper { margin-left: 0 !important; }
  #hamburger-btn { display: flex; }
  #page-content { padding: 18px 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .grupo-viaje-table { display: block; overflow-x: auto; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .kpi-value { font-size: 26px; }
  .grid-4 { grid-template-columns: 1fr; }
  #top-header { padding: 0 14px; }
  .header-user-pill .pill-role { display: none; }
  #page-content { padding: 14px 12px; }
}

/* ─── MOTION ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── UTILIDADES ─────────────────────────────────────────── */
.text-muted   { color: var(--color-text-muted); }
.text-light   { color: var(--color-text-light); }
.text-accent  { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-error   { color: var(--color-error); }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.fw-600   { font-weight: 600; }
.fw-700   { font-weight: 700; }
.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }  .mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex  { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4  { gap: 4px; }  .gap-8  { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.w-full { width: 100%; }
