/* ======================================================
   Mone! · Estilos
   Basado en el diseño "Mone! – diseño escritorio y móvil":
   fondo crema, verde bosque, acento lima,
   títulos en Bricolage Grotesque y texto en Inter.
====================================================== */

@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #F5F3EC;
  --ink: #13231C;
  --green: #0E3B2C;
  --lime: #CDEB5F;
  --lime-soft: #E9F5C4;
  --muted: #5B6660;
  --line: #E7E4D9;
  --line-soft: #EEEBE1;
  --sand: #F0EDE3;
  --field: #E1DED2;
  --on-dark: #F5F3EC;
  --on-dark-muted: #B9C9BF;
  --danger: #B42318;
  --radius-card: 24px;
  --radius-control: 14px;
  --font-display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--green); }
a:hover { color: var(--ink); }

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 12px;
}

h1 {
  font-weight: 800;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: -0.03em;
}

h2 { font-weight: 700; font-size: 24px; }
h3 { font-weight: 700; font-size: 19px; }

p { margin: 0 0 10px; }

@keyframes up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(205, 235, 95, .8); }
  100% { box-shadow: 0 0 0 14px rgba(205, 235, 95, 0); }
}

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


/* ---------- Botones ---------- */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--lime);
  color: var(--green);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .2s, color .2s;
}

.button:hover,
button:hover { background: #C0E04A; color: var(--green); }

.button:active,
button:active { transform: scale(.97); }

.button-secondary,
button.button-secondary {
  background: var(--ink);
  color: var(--on-dark);
}

.button-secondary:hover,
button.button-secondary:hover { background: var(--green); color: var(--on-dark); }

.button-danger,
button.button-danger {
  background: #FFFFFF;
  color: var(--danger);
  border: 1px solid #F1C9C4;
}

.button-danger:hover,
button.button-danger:hover { background: #FDF1EF; color: var(--danger); }

.button:disabled,
button:disabled {
  opacity: .55;
  cursor: default;
  transform: none;
}

.actions,
.trip-actions,
.access-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}


/* ---------- Formularios ---------- */

form { display: grid; gap: 16px; }

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--field);
  border-radius: var(--radius-control);
  background: #FFFFFF;
  color: var(--ink);
  font: 500 16px var(--font-body);
}

textarea { padding: 12px 16px; }

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

input[readonly] { background: var(--sand); }

input[type="radio"],
input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  padding: 0;
  accent-color: var(--green);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 8px;
}

legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* Opciones de radio (conductor / pasajero): en fila y fáciles de tocar */
label:has(> input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field);
  border-radius: var(--radius-control);
  background: #FFFFFF;
  font-weight: 600;
  cursor: pointer;
}

label:has(> input[type="radio"]:checked) {
  border-color: var(--green);
  background: var(--lime-soft);
}


/* ---------- Mensajes ---------- */

.message:empty { display: none; }

.message { margin-top: 16px; }

.success-message {
  background: var(--lime-soft);
  color: var(--green);
  border-radius: 18px;
  padding: 18px 20px;
}

.success-message h2,
.success-message h3 { color: var(--green); }

.error-message {
  background: #FDF1EF;
  color: var(--danger);
  border-radius: var(--radius-control);
  padding: 12px 16px;
  font-weight: 500;
}

.section-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-description,
.meta { color: var(--muted); }

.empty-state {
  background: var(--sand);
  border-radius: 18px;
  padding: 20px;
  color: var(--muted);
}

.empty-state h2 { color: var(--ink); }


/* ---------- Cabecera de páginas públicas ---------- */

.dashboard-header {
  background: var(--bg);
  padding: 18px clamp(16px, 3vw, 44px);
}

.navbar {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo::before {
  content: "M";
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--lime);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.back-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius-control);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover { background: var(--sand); }


/* ---------- Contenedor y tarjetas ---------- */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.container > * { animation: up .6s cubic-bezier(.2, .7, .2, 1) both; }
.container > *:nth-child(2) { animation-delay: .06s; }
.container > *:nth-child(3) { animation-delay: .12s; }
.container > *:nth-child(4) { animation-delay: .18s; }

.form-card,
.impact-card,
.worker-day-card,
.worker-requests-card,
.worker-profile-card,
.access-section,
.centers-section,
.card,
.dashboard-welcome + section:not(.dashboard-stats) {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(20px, 2.4vw, 28px);
}

.form-card { max-width: 680px; width: 100%; }

.dashboard-welcome {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-welcome p { color: var(--muted); margin: 0; }


/* ---------- Cifras ---------- */

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  background: var(--lime);
  color: var(--green);
  border-radius: var(--radius-card);
  padding: clamp(18px, 2.4vw, 24px);
}

.stat-card {
  background: rgba(255, 255, 255, .5);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 2px;
}

.stat-card span { font-size: 13px; font-weight: 500; }

.stat-card strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Secciones de impacto: tarjeta blanca; sus cifras van en el bloque lima */
.impact-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(20px, 2.4vw, 28px);
}

.impact-card .dashboard-stats { margin: 16px 0 4px; }


/* ---------- Tarjetas de listas ---------- */

.match-card,
.trip-card,
.request-card,
.worker-card,
.center-card,
.shift-card,
.meeting-point-card,
.profile-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  margin: 0 0 14px;
  transition: transform .25s ease, box-shadow .25s ease;
}

.match-card:hover,
.trip-card:hover,
.request-card:hover,
.profile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(19, 35, 28, .08);
}

/* Dentro de una tarjeta blanca, las tarjetas hijas van con borde suave */
.worker-requests-card .request-card,
.centers-section .center-card {
  border-color: var(--line-soft);
}

.match-header,
.trip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.match-header h2 { margin: 0 0 4px; overflow-wrap: anywhere; }

.match-header p,
.match-details p,
.trip-details p,
.request-card p,
.worker-card p,
.center-card p,
.shift-card p,
.meeting-point-card p { margin: 4px 0; color: var(--muted); }

.match-details strong,
.trip-details strong { color: var(--ink); }

.match-details,
.trip-details { margin: 14px 0; }

.compatibility,
.trip-role,
.worker-mode {
  flex-shrink: 0;
  max-width: 45%;
  text-align: center;
  background: var(--lime-soft);
  color: var(--green);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
}

.match-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.match-reason {
  background: var(--sand);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

.worker-card,
.center-card,
.shift-card,
.meeting-point-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.center-card h3,
.shift-card h3,
.worker-card h3 { margin-bottom: 4px; }

.center-actions { flex-shrink: 0; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.section-header h2 { margin: 0; }

#centersList { display: grid; gap: 12px; }


/* ---------- Perfil ---------- */

.profile-data p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.profile-data p:last-child { border-bottom: 0; }
.profile-data strong { font-weight: 600; color: var(--muted); }


/* ---------- Inicio ---------- */

.hero {
  background: var(--green);
  color: var(--on-dark);
  padding: 24px clamp(16px, 3vw, 44px) clamp(48px, 8vw, 96px);
}

.hero .navbar { color: var(--on-dark-muted); }
.hero .logo { color: var(--on-dark); }
.hero .logo::before { animation: pulse 1.8s ease-out infinite; }

.hero-content {
  max-width: 1100px;
  margin: clamp(40px, 8vw, 90px) auto 0;
}

.hero-content h1 {
  font-size: clamp(38px, 6vw, 72px);
  max-width: 860px;
  color: var(--on-dark);
}

.hero-content p {
  max-width: 620px;
  font-size: 18px;
  color: var(--on-dark-muted);
  margin-bottom: 24px;
}

.profile-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  background: var(--bg);
}

.profile-card p { color: var(--muted); }

.profile-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(20px, 3vw, 44px) 40px;
  color: var(--muted);
  font-size: 14px;
}


/* ======================================================
   MENÚ DE LA APP (lo crea js/layout.js)
   Lateral en escritorio, barra inferior en el móvil.
====================================================== */

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

body.has-shell > .dashboard-header,
body.has-shell > footer { display: none; }

body.has-shell > .container,
body.has-shell > main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  margin: 0;
}

body.has-shell > main > * { max-width: 1100px; }

.app-side {
  flex: 0 0 248px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--green);
  color: var(--on-dark);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.app-side .logo { color: var(--on-dark); padding: 0 10px; text-decoration: none; }
.app-side .logo::before { animation: pulse 1.8s ease-out infinite; }

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-nav a,
.app-side-footer a,
.app-side-footer button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--on-dark);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s;
}

.app-nav a:hover,
.app-side-footer a:hover,
.app-side-footer button:hover { background: rgba(255, 255, 255, .08); color: var(--on-dark); }

.app-nav a[aria-current="page"] {
  background: var(--lime);
  color: var(--green);
  font-weight: 700;
}

.app-nav svg,
.app-bottom svg,
.app-side-footer svg { flex: none; }

.app-side-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-side-card {
  background: rgba(255, 255, 255, .07);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-side-card span:first-child {
  font-size: 12px;
  color: var(--on-dark-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.app-side-card span:last-child { font-weight: 600; }

.app-side-footer button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
}

.app-bottom { display: none; }
.app-mobile-top { display: none; }

@media (max-width: 760px) {
  body.has-shell { display: block; }

  .app-side { display: none; }

  .app-bottom {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 10;
    gap: 4px;
    padding: 8px;
    background: var(--green);
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(14, 59, 44, .3);
  }

  .app-bottom a {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0;
    border-radius: 14px;
    color: var(--on-dark);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
  }

  .app-bottom a[aria-current="page"] {
    background: var(--lime);
    color: var(--green);
    font-weight: 700;
  }

  body.has-shell > main { padding-bottom: 110px; }

  /* En el móvil, salir va arriba a la derecha */
  .app-mobile-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: -8px;
  }
}


/* ---------- Ajustes para pantallas estrechas ---------- */

@media (max-width: 650px) {
  .worker-card,
  .center-card,
  .shift-card,
  .meeting-point-card,
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .center-actions .button,
  .actions .button,
  .actions button,
  .trip-actions .button,
  .trip-actions button { flex: 1 1 auto; }

  .profile-data p { flex-direction: column; gap: 2px; }
}


/* ======================================================
   PANTALLAS NUEVAS
   Detalle del viaje, mensajes, ajustes, impacto,
   empleados, rutas y CAE.
====================================================== */

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head h1 { margin: 0; }
.page-head .meta { margin: 0 0 6px; font-size: 14px; }

.page-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.page-grid > .col-main { flex: 3 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.page-grid > .col-side { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

.dark-card {
  background: var(--green);
  color: var(--on-dark);
  border-radius: var(--radius-card);
  padding: clamp(20px, 2.4vw, 28px);
}

.dark-card h2, .dark-card h3 { color: var(--on-dark); }
.dark-card p { color: var(--on-dark-muted); }

.note-card {
  background: var(--lime-soft);
  color: var(--green);
  border-radius: var(--radius-card);
  padding: clamp(20px, 2.4vw, 24px);
}

.note-card h2, .note-card h3 { color: var(--green); }

.placeholder {
  background: var(--sand);
  border-radius: 8px;
  padding: 0 6px;
  font-weight: 700;
}

/* ---------- Avatares con iniciales ---------- */

.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  background: var(--sand);
  color: var(--ink);
}

.avatar.is-me { background: var(--lime); color: var(--green); }
.avatar.tone-1 { background: #FFD9C2; color: #7A2E0B; }
.avatar.tone-2 { background: #D6E6FF; color: #163A6B; }
.avatar.tone-3 { background: #F4D6F0; color: #5A1E52; }
.avatar.tone-4 { background: var(--lime-soft); color: var(--green); }

.avatar-row { display: flex; }
.avatar-row .avatar { border: 3px solid #FFFFFF; margin-left: -10px; }
.avatar-row .avatar:first-child { margin-left: 0; }
.avatar.is-free { background: transparent; border: 2px dashed var(--field); }

.person { display: flex; align-items: center; gap: 12px; }
.person p { margin: 0; color: var(--muted); font-size: 14px; }
.person strong { display: block; }

/* ---------- Mapa y paradas del viaje ---------- */

.route-map {
  width: 100%;
  height: auto;
  display: block;
  background: #EEF0E4;
  border-radius: 18px;
}

.route-map .dash { animation: dash 1.4s linear infinite; }

@keyframes dash { to { stroke-dashoffset: -36; } }

.timeline { list-style: none; margin: 16px 0 0; padding: 0; }

.timeline li { display: flex; gap: 14px; align-items: flex-start; }

.timeline time {
  width: 52px;
  flex: none;
  padding-top: 2px;
  font-family: var(--font-display);
  font-weight: 700;
}

.timeline .dot {
  width: 12px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline .dot::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  border: 3px solid var(--green);
  box-sizing: border-box;
}

.timeline .dot::after {
  content: "";
  width: 2px;
  height: 38px;
  background: #DCD8CA;
}

.timeline li:last-child .dot::after { display: none; }
.timeline li.is-me .dot::before { background: var(--lime); animation: pulse 1.8s ease-out infinite; }
.timeline li.is-end .dot::before { background: var(--green); }

.timeline .stop { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; }
.timeline .stop strong { font-weight: 600; }
.timeline .stop span { font-size: 14px; color: var(--muted); }

.facts { display: grid; gap: 0; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; text-align: right; }

/* ---------- Chat ---------- */

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 2px;
}

.chat-msg {
  align-self: flex-start;
  max-width: 82%;
  background: var(--sand);
  color: var(--ink);
  border-radius: 18px 18px 18px 6px;
  padding: 10px 14px;
  overflow-wrap: anywhere;
}

.chat-msg small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }

.chat-msg.mine {
  align-self: flex-end;
  background: var(--ink);
  color: var(--on-dark);
  border-radius: 18px 18px 6px 18px;
}

.chat-msg.mine small { color: var(--on-dark-muted); }

.chat-form { display: flex; gap: 10px; margin-top: 12px; }
.chat-form input { flex: 1 1 auto; }
.chat-form button { flex: none; }

.chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 0;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  min-height: 520px;
}

.conv-list { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 4px; }

.conv-list button {
  width: 100%;
  min-height: 64px;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  text-align: left;
  border-radius: 16px;
}

.conv-list button:hover { background: var(--sand); }
.conv-list button[aria-current="true"] { background: var(--sand); }
.conv-list .conv-text { min-width: 0; display: flex; flex-direction: column; }
.conv-list .conv-text strong { font-weight: 700; }
.conv-list .conv-text span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.conv-pane { display: flex; flex-direction: column; padding: 20px; min-width: 0; }
.conv-pane .chat { flex: 1 1 auto; max-height: none; min-height: 300px; }
.conv-pane header { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.conv-pane header p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Interruptores, chips y selector ---------- */

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.toggle-row:last-child { border-bottom: 0; }
.toggle-row strong { display: block; font-weight: 600; color: var(--ink); }
.toggle-row > span:first-child > span { display: block; font-size: 14px; color: var(--muted); }
.toggle-row .person p { font-size: 14px; }

button.switch {
  flex: none;
  width: 52px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  background: #D6D2C4;
  position: relative;
  justify-content: flex-start;
}

button.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform .2s ease;
}

button.switch[aria-checked="true"] { background: var(--green); }
button.switch[aria-checked="true"]::after { transform: translateX(20px); }
button.switch:hover { background: #C9C4B4; }
button.switch[aria-checked="true"]:hover { background: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1px solid var(--field);
  color: var(--ink);
  font-weight: 600;
}

.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

.choice-grid button {
  min-height: 64px;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 10px 14px;
  background: #FFFFFF;
  border: 1px solid var(--field);
  color: var(--ink);
  text-align: left;
}

.choice-grid button span { font-size: 13px; font-weight: 500; color: var(--muted); }
.choice-grid button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.choice-grid button[aria-pressed="true"] span { color: var(--on-dark-muted); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

.save-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.save-bar .message { margin: 0; }

/* ---------- Tabla (empleados, expedientes) ---------- */

.table-wrap { overflow-x: auto; }

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

.data-table th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.data-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  background: var(--lime-soft);
  color: var(--green);
  white-space: nowrap;
}

.pill.is-warn { background: #FFE6D2; color: #7A2E0B; }
.pill.is-dark { background: var(--ink); color: var(--on-dark); }
.pill.is-muted { background: var(--sand); color: var(--muted); }

.data-table select { min-height: 38px; width: auto; padding: 0 10px; font-size: 14px; }

@media (max-width: 650px) {
  .data-table.stack thead { display: none; }
  .data-table.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .data-table.stack td { padding: 0; border: 0; }
  .data-table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; }
  .data-table.stack .num { text-align: left; }
}

/* ---------- Gráficos sencillos ---------- */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding-top: 10px;
}

.bars .bar {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.bars .bar b { font-weight: 700; }

.bars .bar i {
  display: block;
  width: 100%;
  max-width: 64px;
  border-radius: 12px 12px 4px 4px;
  background: var(--lime);
  transform-origin: bottom;
  animation: grow .7s cubic-bezier(.2, .7, .2, 1) both;
}

.bars .bar.is-current i { background: var(--green); }
.bars .bar span { color: var(--muted); }

@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.progress { height: 10px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.dark-card .progress { background: rgba(255, 255, 255, .15); }
.dark-card .progress > i { background: var(--lime); }

.prize { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.prize:last-child { border-bottom: 0; }
.prize div { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }

.big-number {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 64px);
  letter-spacing: -0.03em;
  line-height: 1;
}

/* ---------- Rutas ---------- */

.towns {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #EEF0E4;
  border-radius: 18px;
  min-height: 220px;
}

.town { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }

.town b {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green);
  color: var(--lime);
  font-family: var(--font-display);
  font-weight: 800;
}

.town.is-center b { background: var(--lime); color: var(--green); border: 4px solid var(--green); }

.route-row { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.route-row:last-child { border-bottom: 0; }
.route-row > div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.route-row span { color: var(--muted); font-size: 14px; }

/* ---------- CAE ---------- */

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

.steps li {
  background: var(--bg);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.steps li.is-done { background: var(--lime-soft); }
.steps li.is-now { background: var(--ink); color: var(--on-dark); }
.steps li.is-now p { color: var(--on-dark-muted); }
.steps li p { margin: 0; color: var(--muted); font-size: 14px; }
.steps li strong { font-size: 17px; }

.steps .step-n {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--lime);
  color: var(--green);
  font-weight: 800;
}

.steps li:not(.is-done):not(.is-now) .step-n { background: #FFFFFF; }
.steps .step-state { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.share-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.share-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--bg); border-radius: 14px; font-weight: 600; }

@media (max-width: 760px) {
  .chat-layout { grid-template-columns: 1fr; min-height: 0; }
  .conv-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-layout.is-reading .conv-list { display: none; }
  .chat-layout:not(.is-reading) .conv-pane { display: none; }
  .conv-pane .chat { min-height: 260px; max-height: 55vh; }
}

.only-mobile { display: none; }
@media (max-width: 760px) { .only-mobile { display: inline-flex; } }

.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;
}

[hidden] { display: none !important; }
.prize div span:last-child { white-space: nowrap; }
.placeholder { color: var(--ink); }
.dark-card .placeholder { background: rgba(255, 255, 255, .16); color: var(--lime); }
.dark-card .facts div { border-color: rgba(255, 255, 255, .14); }
.facts dd { white-space: nowrap; }
@media (max-width: 650px) { .section-header > * { flex-basis: auto !important; } }
