:root {
  color-scheme: light;
  --ink: #16201d;
  --muted: #64706c;
  --line: #dfe5e2;
  --surface: #ffffff;
  --soft: #f4f7f5;
  --green: #176b57;
  --green-dark: #0f4d3e;
  --mint: #dff1e9;
  --yellow: #f3c969;
  --red: #b43b42;
  --sidebar: #13241f;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--soft); color: var(--ink); font-size: 15px; }
a { color: var(--green); text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; max-height: 100vh; padding: 24px 18px; background: var(--sidebar); color: #fff; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #58a68f; border-radius: 8px; background: #1d5949; color: #fff; font-size: 13px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 20px; }
.brand small { margin-top: 2px; color: #a9c4bb; font-size: 12px; }
.main-nav { display: grid; gap: 4px; margin-top: 36px; padding-bottom: 16px; }
.main-nav a { padding: 10px 12px; border-radius: 6px; color: #bed0ca; font-weight: 600; }
.main-nav a:hover, .main-nav a.active { background: #244139; color: #fff; }
.logout-form { margin-top: auto; padding-top: 10px; }
.text-button { border: 0; background: transparent; color: #b9cbc5; cursor: pointer; padding: 10px 12px; }
.text-button:hover { color: #fff; }

.main-content { min-width: 0; padding: 28px 34px 52px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.topbar h1 { margin: 2px 0 0; font-size: 28px; line-height: 1.2; letter-spacing: 0; }
.environment, .eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.status-chip, .badge, .record-count { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status-chip { padding: 7px 10px; border: 1px solid #cdd9d5; border-radius: 6px; background: #fff; color: #43524d; font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #28a377; }

.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; margin-bottom: 28px; }
.metrics-grid.compact { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.metric { min-height: 112px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font-size: 30px; line-height: 1; }

.content-section { margin-top: 18px; border-top: 1px solid var(--line); background: var(--surface); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; }
.section-heading h2, .action-row h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: 0; }
.table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid #e8ecea; text-align: left; vertical-align: middle; }
th { background: #f7f9f8; color: #51605b; font-size: 12px; font-weight: 700; white-space: nowrap; }
tbody tr:hover { background: #f9fbfa; }
.empty-state { padding: 34px; color: var(--muted); text-align: center; }
.record-count { color: var(--muted); font-size: 13px; }
.badge { padding: 4px 8px; border-radius: 5px; background: #edf1ef; color: #52605c; font-size: 12px; font-weight: 700; }
.badge.activa, .badge.activo { background: var(--mint); color: #17634f; }
.badge.prueba { background: #fff0c9; color: #775612; }
.badge.suspendida { background: #f8dfe1; color: #8e2e34; }

.filter-band { padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); }
.filter-form { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(240px, 2fr) auto; gap: 14px; align-items: end; }
.prenomina-filter { grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 1fr) minmax(160px, 1fr) auto; }
.location-filter { grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(130px, auto); }
.page-subtitle { margin: -16px 0 24px; color: var(--muted); }
.location-metrics { margin-top: 18px; }
label { display: grid; gap: 7px; color: #46534f; font-size: 12px; font-weight: 700; }
input, select, textarea { min-width: 0; padding: 0 11px; border: 1px solid #cbd5d1; border-radius: 6px; background: #fff; color: var(--ink); }
input, select { height: 42px; }
textarea { min-height: 120px; padding: 10px 11px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid #89b8aa; outline-offset: 1px; border-color: var(--green); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 15px; border-radius: 6px; font-weight: 700; cursor: pointer; }
.primary-button { border: 1px solid var(--green); background: var(--green); color: #fff; }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { border: 1px solid #b9c9c3; background: #fff; color: var(--green-dark); }
.secondary-button:hover { background: #f0f5f3; }

.action-list { border: 1px solid var(--line); background: #fff; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid var(--line); }
.action-row:last-child { border-bottom: 0; }
.action-row p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.muted-row { background: #f8faf9; }
.alert { margin: 16px 0; padding: 12px 14px; border-radius: 6px; }
.alert.error { border: 1px solid #efc8cb; background: #fff1f2; color: var(--red); }
.muted { color: var(--muted); line-height: 1.55; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eaf0ed; }
.auth-panel { width: min(420px, 100%); padding: 30px; border: 1px solid #ccd7d3; border-radius: 8px; background: #fff; box-shadow: 0 12px 34px rgba(20, 43, 35, .1); }
.auth-brand { color: var(--ink); margin-bottom: 34px; }
.auth-brand small { color: var(--muted); }
.auth-panel h1 { margin: 0 0 24px; font-size: 24px; letter-spacing: 0; }
.stack-form { display: grid; gap: 14px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; max-height: none; padding: 15px 18px; flex-direction: row; align-items: center; gap: 20px; overflow-x: auto; overflow-y: visible; }
  .main-nav { display: flex; margin: 0; gap: 2px; }
  .main-nav a { white-space: nowrap; }
  .logout-form { margin: 0 0 0 auto; }
  .main-content { padding: 24px 20px 44px; }
  .metrics-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}

@media (max-width: 680px) {
  .sidebar { align-items: flex-start; flex-wrap: wrap; }
  .brand { width: 100%; }
  .main-nav { width: 100%; overflow-x: auto; }
  .logout-form { position: absolute; top: 18px; right: 12px; }
  .main-content { padding: 20px 12px 36px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 24px; }
  .metrics-grid, .metrics-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 96px; padding: 14px; }
  .metric strong { font-size: 26px; }
  .filter-form, .prenomina-filter { grid-template-columns: 1fr; }
  .section-heading, .action-row { align-items: flex-start; flex-direction: column; }
  .section-heading .secondary-button, .action-row .primary-button { width: 100%; }
  th, td { padding: 11px 12px; }
}
.badge.state-trabajando { background: var(--mint); color: #17634f; }
.badge.state-descanso { background: #fff0c9; color: #775612; }
.badge.state-cerrada { background: #edf1ef; color: #52605c; }
.badge.state-sin_entrada, .badge.state-sin_telegram, .badge.alerta { background: #f8dfe1; color: #8e2e34; }
.badge.geocerca-dentro { background: var(--mint); color: #17634f; }
.badge.geocerca-fuera { background: #f8dfe1; color: #8e2e34; }
.badge.geocerca-sin_geocerca { background: #edf1ef; color: #52605c; }
.badge.geocerca-sin_coordenadas { background: #fff0c9; color: #775612; }
.badge.location-status-respondida,
.badge.location-geofence-dentro_zona { background: var(--mint); color: #17634f; }
.badge.location-status-pendiente { background: #fff0c9; color: #775612; }
.badge.location-status-sin_telegram,
.badge.location-geofence-sin_geocerca { background: #edf1ef; color: #52605c; }
.badge.location-status-error_envio,
.badge.location-geofence-fuera_zona { background: #f8dfe1; color: #8e2e34; }
.badge.rp-status-abierto { background: #fff0c9; color: #775612; }
.badge.rp-status-en_investigacion { background: #e0f2fe; color: #075985; }
.badge.rp-status-cerrado { background: var(--mint); color: #17634f; }

.form-panel { padding: 22px; border-top: 1px solid var(--line); }
.grid-form { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; align-items: end; }
.grid-form .form-actions { display: flex; align-items: end; }
.grid-form .form-actions .primary-button { width: 100%; }
.form-hint { margin: 0; color: var(--muted); font-size: 14px; }
.full-row { grid-column: 1 / -1; }
.compact-form { grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; }
.alert.success { border: 1px solid #b7dfd0; background: #eefaf5; color: #17634f; }
.secondary-button.small { min-height: 32px; padding: 0 10px; font-size: 12px; text-decoration: none; }
.primary-button.small { min-height: 32px; padding: 0 10px; font-size: 12px; text-decoration: none; }
.badge.modo-observacion { background: #fff0c9; color: #775612; }
.badge.modo-bloqueo_futuro { background: #f8dfe1; color: #8e2e34; }
.badge.inactiva { background: #edf1ef; color: #52605c; }
.readonly-summary { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 10px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.readonly-summary p { margin: 0; color: var(--muted); }
.readonly-summary strong { color: var(--ink); }

@media (max-width: 980px) {
  .grid-form, .compact-form, .readonly-summary, .rp-filter-form { grid-template-columns: 1fr; }
}
.heading-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.inline-form button { font-family: inherit; }
.photo-link { display: inline-flex; margin-top: 4px; font-weight: 700; color: var(--green-dark); text-decoration: none; }
.photo-link:hover { text-decoration: underline; }

/* Dashboard ejecutivo */
.executive-metrics .metric strong {
  font-size: 2rem;
}
.content-grid.two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 1rem;
  align-items: start;
}
.compact-table table th,
.compact-table table td {
  padding: 0.65rem 0.75rem;
}
.badge.priority-alta {
  background: #fee2e2;
  color: #991b1b;
}
.badge.priority-media {
  background: #fef3c7;
  color: #92400e;
}
.badge.priority-baja {
  background: #e0f2fe;
  color: #075985;
}
.executive-list {
  display: grid;
  gap: 0.75rem;
}
.executive-list h3 {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  color: #334155;
}
.list-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem;
  background: #f8fafc;
}
.list-card strong {
  display: block;
  color: #0f172a;
}
.list-card span {
  display: block;
  color: #64748b;
  font-size: 0.88rem;
  margin-top: 0.25rem;
}
.empty-state {
  color: #64748b;
  margin: 0;
}
@media (max-width: 980px) {
  .content-grid.two-columns {
    grid-template-columns: 1fr;
  }
}
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.secondary-button.danger { border-color: #efc8cb; color: #8e2e34; }
.secondary-button.danger:hover { background: #fff1f2; }
.user-form .form-actions { justify-content: flex-start; }
.user-form .form-actions .primary-button { max-width: 320px; }
.upload-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}
.upload-form label {
  font-weight: 700;
  color: var(--ink);
}
.upload-form input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.compact-section { margin-bottom: 14px; }
@media (max-width: 980px) {
  .upload-form { grid-template-columns: 1fr; }
}


/* TurnoGo Loading Overlay */
body.is-loading {
  cursor: wait;
}
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(19, 36, 31, .72);
  backdrop-filter: blur(3px);
}
.loading-overlay.active {
  display: grid;
}
.loading-card {
  width: min(460px, 100%);
  padding: 30px 28px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  text-align: center;
}
.loading-spinner {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border: 5px solid #dfeee8;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: turnogo-spin .9s linear infinite;
}
.loading-card h2 {
  margin: 0 0 10px;
  font-size: 21px;
  line-height: 1.25;
}
.loading-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.loading-steps {
  margin: 18px 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--green-dark);
  list-style: none;
  font-weight: 800;
}
.loading-note {
  font-weight: 700;
}
.loading-warning {
  margin-top: 10px !important;
  color: var(--red) !important;
  font-weight: 800;
}
.primary-button:disabled,
.secondary-button.disabled {
  opacity: .7;
  cursor: wait;
  pointer-events: none;
}
@keyframes turnogo-spin {
  to { transform: rotate(360deg); }
}

.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px 16px; min-width: 0; padding: 12px; border: 1px solid #cbd5d1; border-radius: 6px; }
.checkbox-group legend { padding: 0 6px; color: #46534f; font-size: 12px; font-weight: 700; }
.checkbox-group label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 700; color: #46534f; }
.checkbox-group input { width: 16px; height: 16px; min-width: 16px; padding: 0; }
.checkbox-line {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  color: #46534f;
  font-size: 13px;
}
.checkbox-line input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
}

/* TurnoGo Design System Sprint 1 */
:root {
  --tg-navy: #071B3D;
  --tg-green: #00D084;
  --tg-green-700: #007F5F;
  --tg-blue: #2E90FA;
  --tg-bg: #F7F9FC;
  --tg-surface: #FFFFFF;
  --tg-border: #DCE3EC;
  --tg-muted: #667085;
  --tg-danger: #E5484D;
  --tg-warning: #F5A524;
  --tg-success: #16A34A;
  --tg-sidebar: #061A17;
  --tg-sidebar-2: #0B2A25;
  --tg-radius-sm: 8px;
  --tg-radius-md: 12px;
  --tg-radius-lg: 16px;
  --tg-radius-xl: 20px;
  --tg-shadow-sm: 0 1px 2px rgba(7, 27, 61, .06);
  --tg-shadow-md: 0 8px 24px rgba(7, 27, 61, .08);
  --tg-shadow-lg: 0 20px 60px rgba(7, 27, 61, .12);
  --tg-duration-fast: 120ms;
  --tg-duration-normal: 220ms;
  --tg-ease: cubic-bezier(.2, .8, .2, 1);

  --ink: #111827;
  --muted: var(--tg-muted);
  --line: var(--tg-border);
  --surface: var(--tg-surface);
  --soft: var(--tg-bg);
  --green: var(--tg-green-700);
  --green-dark: #055B49;
  --mint: #E6F9F1;
  --red: var(--tg-danger);
  --sidebar: var(--tg-sidebar);
}

body {
  background:
    linear-gradient(180deg, rgba(247, 249, 252, .96), rgba(247, 249, 252, .98)),
    url("assets/turnogo/backgrounds/grid-background.png");
  color: var(--ink);
  font-size: 14px;
}

.app-shell {
  grid-template-columns: 286px minmax(0, 1fr);
  background: transparent;
}

.sidebar {
  padding: 22px 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 208, 132, .18), transparent 34%),
    linear-gradient(180deg, var(--tg-sidebar), var(--tg-sidebar-2));
  box-shadow: 18px 0 42px rgba(7, 27, 61, .16);
  gap: 16px;
  transition: width var(--tg-duration-normal) var(--tg-ease), padding var(--tg-duration-normal) var(--tg-ease);
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 999px; }

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.brand { min-width: 0; }
.brand-logo { display: block; }
.brand-logo-full { width: 152px; max-width: 100%; height: auto; }
.brand-logo-icon { display: none; width: 36px; height: 36px; }

.sidebar-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--tg-duration-normal) var(--tg-ease), transform var(--tg-duration-normal) var(--tg-ease);
}
.sidebar-toggle:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.sidebar-toggle span,
.sidebar-toggle span::before,
.sidebar-toggle span::after {
  display: block;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #D7FFF0;
  content: "";
}
.sidebar-toggle span::before { transform: translateY(-5px); }
.sidebar-toggle span::after { transform: translateY(3px); }

.sidebar-context,
.sidebar-user-card {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--tg-radius-md);
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.sidebar-context { padding: 12px 13px; color: #D8E7E2; }
.sidebar-product-context { background: rgba(0, 208, 132, .08); }
.context-label { display: block; margin-bottom: 4px; color: rgba(216, 231, 226, .68); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-context strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.main-nav { gap: 14px; margin-top: 2px; padding: 2px 0 8px; }
.nav-group { display: grid; gap: 4px; padding: 0 0 14px; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.nav-product-switcher { padding-bottom: 10px; }
.nav-group:last-child { border-bottom: 0; }
.main-nav a,
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--tg-radius-sm);
  color: rgba(232, 248, 242, .76);
  font-weight: 750;
  transition: background var(--tg-duration-normal) var(--tg-ease), color var(--tg-duration-normal) var(--tg-ease), transform var(--tg-duration-normal) var(--tg-ease);
}
.nav-link::before,
.logout-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-color: currentColor;
  content: "";
  -webkit-mask: var(--nav-icon) center / contain no-repeat;
  mask: var(--nav-icon) center / contain no-repeat;
}
.nav-dashboard { --nav-icon: url("assets/turnogo/icons/dashboard.svg"); }
.nav-productos { --nav-icon: url("assets/turnogo/icons/dashboard.svg"); }
.nav-ejecutivo { --nav-icon: url("assets/turnogo/icons/ejecutivo.svg"); }
.nav-empresas { --nav-icon: url("assets/turnogo/icons/empresas.svg"); }
.nav-owner { --nav-icon: url("assets/turnogo/icons/empresas.svg"); }
.nav-usuarios { --nav-icon: url("assets/turnogo/icons/usuarios.svg"); }
.nav-catalogos { --nav-icon: url("assets/turnogo/icons/empresas.svg"); }
.nav-equipos { --nav-icon: url("assets/turnogo/icons/equipos.svg"); }
.nav-operacion { --nav-icon: url("assets/turnogo/icons/operacion.svg"); }
.nav-evidencias { --nav-icon: url("assets/turnogo/icons/evidencias.svg"); }
.nav-rp { --nav-icon: url("assets/turnogo/icons/operacion.svg"); }
.nav-ubicacion { --nav-icon: url("assets/turnogo/icons/ubicacion-equipo.svg"); }
.nav-mapa { --nav-icon: url("assets/turnogo/icons/ubicacion-equipo.svg"); }
.nav-geocercas { --nav-icon: url("assets/turnogo/icons/geocercas.svg"); }
.nav-horarios { --nav-icon: url("assets/turnogo/icons/horarios.svg"); }
.nav-exportaciones { --nav-icon: url("assets/turnogo/icons/exportaciones.svg"); }
.nav-prenomina { --nav-icon: url("assets/turnogo/icons/prenomina.svg"); }
.logout-icon { --nav-icon: url("assets/turnogo/icons/cerrar-sesion.svg"); }

.main-nav a:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; transform: translateX(2px); }
.main-nav a.active {
  background: linear-gradient(135deg, rgba(0, 208, 132, .22), rgba(46, 144, 250, .12));
  color: #FFFFFF;
  box-shadow: inset 3px 0 0 var(--tg-green), 0 10px 26px rgba(0, 208, 132, .08);
}

.sidebar-user-card { display: flex; align-items: center; gap: 10px; padding: 12px; margin-top: auto; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #E6FFF5; color: #056044; font-size: 12px; font-weight: 900; }
.user-meta { min-width: 0; display: grid; gap: 2px; }
.user-meta strong, .user-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { color: #FFFFFF; font-size: 13px; }
.user-meta small { color: rgba(232, 248, 242, .64); font-size: 11px; }
.logout-form { margin-top: 0; padding-top: 0; }
.logout-button { width: 100%; display: flex; align-items: center; gap: 10px; color: rgba(232, 248, 242, .74); border-radius: var(--tg-radius-sm); }
.logout-button:hover { background: rgba(255, 255, 255, .08); }

.main-content { padding: 30px clamp(22px, 3.2vw, 46px) 56px; }
.topbar {
  min-height: 86px;
  padding: 0 0 22px;
  border-bottom: 1px solid rgba(220, 227, 236, .9);
  margin-bottom: 28px;
}
.breadcrumb { margin: 0 0 8px; color: var(--tg-muted); font-size: 12px; font-weight: 700; }
.topbar h1 { margin-top: 4px; font-size: clamp(28px, 3vw, 38px); font-weight: 850; color: #061A17; }
.environment, .eyebrow { color: var(--tg-green-700); letter-spacing: .12em; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.topbar-company, .topbar-user, .topbar-updated, .status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--tg-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  color: #344054;
  box-shadow: var(--tg-shadow-sm);
  font-size: 12px;
  font-weight: 750;
}
.topbar-updated { color: var(--tg-muted); font-weight: 650; }
.status-chip { gap: 8px; }
.status-dot { background: var(--tg-green); box-shadow: 0 0 0 4px rgba(0, 208, 132, .12); }

.metrics-grid { gap: 16px; }
.metric,
.content-section,
.filter-band,
.action-list,
.auth-panel,
.readonly-summary {
  border: 1px solid rgba(220, 227, 236, .9);
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--tg-shadow-sm);
}
.metric {
  min-height: 128px;
  padding: 20px;
  overflow: hidden;
  position: relative;
  transition: transform var(--tg-duration-normal) var(--tg-ease), box-shadow var(--tg-duration-normal) var(--tg-ease), border-color var(--tg-duration-normal) var(--tg-ease);
}
.metric::after {
  position: absolute;
  right: -26px;
  top: -30px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(0, 208, 132, .11);
  content: "";
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--tg-shadow-md); border-color: rgba(0, 208, 132, .24); }
.metric span { color: var(--tg-muted); font-weight: 750; }
.metric strong { color: #071B3D; font-size: 34px; font-weight: 900; }
.content-section { overflow: hidden; border-top: 1px solid rgba(220, 227, 236, .9); }
.section-heading { padding: 22px 24px; }
.section-heading h2, .action-row h2 { font-size: 20px; font-weight: 850; color: #061A17; }

.table-wrap { border-top-color: rgba(220, 227, 236, .9); }
table { background: #FFFFFF; }
th { background: #F8FAFC; color: #475467; font-size: 12px; letter-spacing: .02em; }
td { color: #1D2939; }
th, td { border-bottom-color: #EEF2F6; }
tbody tr { transition: background var(--tg-duration-fast) var(--tg-ease); }
tbody tr:hover { background: #F9FCFB; }

.primary-button, .secondary-button, .text-button {
  border-radius: var(--tg-radius-sm);
  transition: transform var(--tg-duration-normal) var(--tg-ease), box-shadow var(--tg-duration-normal) var(--tg-ease), background var(--tg-duration-normal) var(--tg-ease), border-color var(--tg-duration-normal) var(--tg-ease);
}
.primary-button {
  min-height: 44px;
  border-color: var(--tg-green-700);
  background: linear-gradient(135deg, var(--tg-green-700), #009A6E);
  box-shadow: 0 10px 20px rgba(0, 127, 95, .14);
}
.primary-button:hover { background: linear-gradient(135deg, #056044, var(--tg-green-700)); transform: translateY(-1px); box-shadow: 0 14px 28px rgba(0, 127, 95, .18); }
.secondary-button {
  min-height: 44px;
  border-color: var(--tg-border);
  color: #07513F;
  box-shadow: var(--tg-shadow-sm);
}
.secondary-button:hover { transform: translateY(-1px); border-color: rgba(0, 127, 95, .25); background: #F6FFFB; }
.secondary-button.danger { color: var(--tg-danger); border-color: #F4C7CA; }
.secondary-button.danger:hover { background: #FFF5F5; }

input, select, textarea {
  min-height: 44px;
  border-color: var(--tg-border);
  border-radius: var(--tg-radius-sm);
  background: #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(7, 27, 61, .02);
  transition: border-color var(--tg-duration-normal) var(--tg-ease), box-shadow var(--tg-duration-normal) var(--tg-ease), background var(--tg-duration-normal) var(--tg-ease);
}
textarea { padding: 10px 11px; }
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--tg-green-700);
  box-shadow: 0 0 0 4px rgba(0, 208, 132, .14);
}
label { color: #344054; }

.badge {
  border-radius: 999px;
  padding: 5px 9px;
  background: #F2F4F7;
  color: #475467;
  font-size: 11px;
  letter-spacing: .01em;
}
.badge.activa, .badge.activo, .badge.aprobada, .badge.aprobada_rh, .badge.state-trabajando, .badge.geocerca-dentro, .badge.location-status-respondida, .badge.location-geofence-dentro_zona {
  background: #E8F8EF;
  color: #087443;
}
.badge.prueba, .badge.pendiente, .badge.state-descanso, .badge.location-status-pendiente, .badge.geocerca-sin_coordenadas {
  background: #FFF4D6;
  color: #8A5D00;
}
.badge.suspendida, .badge.inactiva, .badge.rechazada, .badge.error, .badge.state-sin_entrada, .badge.state-sin_telegram, .badge.alerta, .badge.geocerca-fuera, .badge.location-status-error_envio, .badge.location-geofence-fuera_zona {
  background: #FFECEE;
  color: #B4232B;
}
.badge.geocerca-sin_geocerca, .badge.location-status-sin_telegram, .badge.location-geofence-sin_geocerca, .badge.state-cerrada {
  background: #EEF2F6;
  color: #475467;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 36px 24px;
  color: var(--tg-muted);
  font-weight: 700;
}
.empty-state::before {
  width: 74px;
  height: 74px;
  background: url("assets/turnogo/empty/sin-resultados.svg") center / contain no-repeat;
  opacity: .9;
  content: "";
}
td.empty-state::before { display: block; }

.loading-overlay { background: rgba(7, 27, 61, .64); backdrop-filter: blur(8px); }
.loading-card { border-radius: var(--tg-radius-xl); box-shadow: var(--tg-shadow-lg); }
.loading-spinner {
  border: 0;
  background: url("assets/turnogo/loaders/spinner.svg") center / contain no-repeat;
  animation: turnogo-spin .9s linear infinite;
}
.loading-steps { border-radius: var(--tg-radius-md); }

.auth-page {
  background:
    linear-gradient(135deg, rgba(247, 249, 252, .90), rgba(231, 252, 242, .92)),
    url("assets/turnogo/backgrounds/dashboard-light.png") center / cover no-repeat;
}
.auth-panel {
  width: min(448px, 100%);
  padding: 36px;
  box-shadow: var(--tg-shadow-lg);
}
.auth-brand-block { display: grid; gap: 10px; margin-bottom: 28px; }
.auth-logo { width: 172px; height: auto; }
.auth-kicker { color: var(--tg-green-700); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.auth-copy { margin: -12px 0 24px; color: var(--tg-muted); line-height: 1.5; }
.auth-panel h1 { font-size: 28px; font-weight: 900; color: #061A17; }
.stack-form small { color: var(--tg-muted); font-size: 12px; line-height: 1.45; }
.grid-form small { display: block; margin-top: 6px; color: var(--tg-muted); font-size: 12px; line-height: 1.45; }
.content-breadcrumb { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px; color: var(--tg-muted); font-size: 13px; font-weight: 700; }
.content-breadcrumb a { color: var(--tg-green-700); text-decoration: none; }
.content-breadcrumb a:hover { text-decoration: underline; }
.context-note { max-width: 850px; margin: 12px 0 0; padding: 11px 13px; border-left: 3px solid var(--tg-green); border-radius: 0 var(--tg-radius-sm) var(--tg-radius-sm) 0; background: #F2FBF7; color: #344054; line-height: 1.5; }
.catalog-grid .kpi-card { align-content: start; min-height: 170px; }
.catalog-card-link small { color: var(--tg-muted); font-size: 13px; font-weight: 600; line-height: 1.45; }
.advanced-options { padding: 14px; border: 1px solid var(--tg-border); border-radius: var(--tg-radius-sm); background: #F8FAFC; }
.advanced-options summary { cursor: pointer; color: #344054; font-weight: 800; }
.advanced-options[open] summary { margin-bottom: 14px; }
.advanced-options label { display: grid; gap: 6px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.service-product-card { margin: 0; padding: 18px; border: 1px solid var(--tg-border); border-radius: var(--tg-radius-md); }
.service-product-card legend { padding: 0 8px; color: #061A17; font-size: 18px; font-weight: 850; }
.service-module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.service-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--tg-border); border-radius: var(--tg-radius-sm); background: #fff; }
.service-check input { min-height: auto; margin-top: 3px; }
.service-check span { display: grid; gap: 3px; }
.service-check small { color: var(--tg-muted); font-size: 12px; }

body.sidebar-collapsed .app-shell { grid-template-columns: 86px minmax(0, 1fr); }
body.sidebar-collapsed .sidebar { padding-inline: 14px; }
body.sidebar-collapsed .brand-logo-full,
body.sidebar-collapsed .sidebar-context,
body.sidebar-collapsed .nav-link span,
body.sidebar-collapsed .user-meta,
body.sidebar-collapsed .logout-button span:not(.logout-icon) { display: none; }
body.sidebar-collapsed .brand-logo-icon { display: block; }
body.sidebar-collapsed .sidebar-brand-row { justify-content: center; flex-direction: column; }
body.sidebar-collapsed .nav-link,
body.sidebar-collapsed .logout-button { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-user-card { justify-content: center; padding: 10px; }
body.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }

@media (max-width: 980px) {
  .app-shell, body.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; width: 100%; height: auto; max-height: none; padding: 14px 16px; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: visible; }
  .sidebar-brand-row { min-width: 200px; }
  .brand-logo-full { width: 130px; }
  body.sidebar-collapsed .brand-logo-full { display: block; }
  body.sidebar-collapsed .brand-logo-icon { display: none; }
  body.sidebar-collapsed .nav-link span { display: inline; }
  .sidebar-context, .sidebar-user-card { display: none; }
  .main-nav { display: flex; flex: 1; gap: 8px; margin: 0; padding: 0; }
  .nav-group { display: flex; gap: 8px; padding: 0; border-bottom: 0; }
  .main-nav a { white-space: nowrap; }
  .logout-form { margin-left: 0; }
  .logout-button span:not(.logout-icon) { display: none; }
  .topbar { align-items: flex-start; gap: 16px; }
}

@media (max-width: 680px) {
  .sidebar { align-items: center; flex-wrap: nowrap; }
  .sidebar-brand-row { min-width: 160px; }
  .sidebar-toggle { display: none; }
  .main-content { padding: 20px 14px 36px; }
  .topbar { flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .topbar-updated { display: none; }
}

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

/* TurnoGo Design System Sprint 1.1 polish */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.topbar-actions > * { flex: 0 0 auto; }
.topbar-company { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-link::after {
  position: absolute;
  left: 7px;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 999px;
  background: var(--tg-green);
  transform: translateY(-50%);
  transition: height var(--tg-duration-normal) var(--tg-ease);
  content: "";
}
.nav-link.active::after { height: 22px; }
.nav-link:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.button:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(46, 144, 250, .34);
  outline-offset: 2px;
}

.button,
button:not(.sidebar-toggle):not(.text-button):not(.primary-button):not(.secondary-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--tg-green-700);
  border-radius: var(--tg-radius-sm);
  background: linear-gradient(135deg, var(--tg-green-700), #009A6E);
  color: #FFFFFF;
  box-shadow: 0 10px 20px rgba(0, 127, 95, .14);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--tg-duration-normal) var(--tg-ease), box-shadow var(--tg-duration-normal) var(--tg-ease), background var(--tg-duration-normal) var(--tg-ease), border-color var(--tg-duration-normal) var(--tg-ease);
}
.button:hover,
button:not(.sidebar-toggle):not(.text-button):not(.primary-button):not(.secondary-button):hover {
  background: linear-gradient(135deg, #056044, var(--tg-green-700));
  box-shadow: 0 14px 28px rgba(0, 127, 95, .18);
  transform: translateY(-1px);
}
.button.secondary,
button.secondary {
  border-color: var(--tg-border) !important;
  background: #FFFFFF !important;
  color: #07513F !important;
  box-shadow: var(--tg-shadow-sm) !important;
}
.button.secondary:hover,
button.secondary:hover { background: #F6FFFB !important; border-color: rgba(0, 127, 95, .25) !important; }
.button:disabled,
button:disabled,
.primary-button:disabled,
.secondary-button:disabled { opacity: .62; cursor: not-allowed; transform: none; box-shadow: none; }

.card,
.table-card,
.kpi-card {
  border: 1px solid rgba(220, 227, 236, .9);
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--tg-shadow-sm);
}
.card { margin-top: 18px; overflow: hidden; }
.table-card { overflow-x: auto; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(220, 227, 236, .9);
}
.section-header h2 { margin: 3px 0 0; color: #061A17; font-size: 20px; font-weight: 850; }
.section-header p:not(.section-kicker) { margin: 8px 0 0; color: var(--tg-muted); }
.section-kicker { margin: 0; color: var(--tg-green-700); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.actions-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.actions-row.compact { gap: 6px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; padding: 20px 24px 24px; }
.kpi-card { min-height: 104px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi-card span { color: var(--tg-muted); font-size: 13px; font-weight: 750; }
.kpi-card strong { color: var(--tg-navy); font-size: 28px; font-weight: 900; }
.status-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 5px 9px; border-radius: 999px; background: #EEF2F6; color: #475467; font-size: 11px; font-weight: 850; }

.filter-band { margin-bottom: 18px; }
.filter-form { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.filter-form .primary-button { align-self: end; min-width: 150px; }
.prenomina-filter .primary-button { min-width: 180px; }
.upload-form { border-radius: 0 0 var(--tg-radius-lg) var(--tg-radius-lg); }
.checkbox-group { border-color: var(--tg-border); border-radius: var(--tg-radius-md); background: #FFFFFF; }
.checkbox-group label { min-height: 32px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--tg-green-700); }

.empty-state { text-wrap: balance; }
td.empty-state {
  display: table-cell;
  min-height: 0;
  padding: 42px 24px;
  text-align: center;
  vertical-align: middle;
}
td.empty-state::before { display: block; margin: 0 auto 12px; }
p.empty-state { border-top: 1px solid rgba(220, 227, 236, .9); }

.record-count { color: var(--tg-muted); font-weight: 750; }
.photo-link { color: #07513F; }
.muted { color: var(--tg-muted); }
.alert { border-radius: var(--tg-radius-md); font-weight: 700; }

@media (max-width: 1024px) {
  .main-content { padding-inline: 24px; }
  .topbar { flex-direction: column; }
  .topbar-actions { justify-content: flex-start; width: 100%; }
  .topbar-company { max-width: min(100%, 360px); }
  .metrics-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .topbar h1 { font-size: 30px; }
  .topbar-actions { gap: 8px; }
  .topbar-company, .topbar-user, .topbar-updated, .status-chip { min-height: 34px; padding: 7px 10px; }
  .section-header, .section-heading { flex-direction: column; align-items: flex-start; }
  .actions-row, .heading-actions { width: 100%; justify-content: flex-start; }
  .actions-row .button, .heading-actions .secondary-button { flex: 1 1 180px; }
  .filter-form, .prenomina-filter, .location-filter { grid-template-columns: 1fr; }
  .filter-form .primary-button, .prenomina-filter .primary-button, .filter-form .secondary-button { width: 100%; }
  .form-actions { width: 100%; }
  .form-actions .primary-button, .form-actions .secondary-button { flex: 1 1 190px; text-align: center; }
  .service-module-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 18px; }
}

@media (max-width: 430px) {
  .main-content { padding-inline: 12px; }
  .metrics-grid, .metrics-grid.compact, .kpi-grid { grid-template-columns: 1fr; }
  .topbar-company, .topbar-user, .status-chip { max-width: 100%; }
  th, td { padding: 10px 11px; }
}

/* Mapa operativo */
.map-filter-form {
  grid-template-columns: minmax(220px, 420px) minmax(150px, auto);
}

.map-shell {
  position: relative;
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.map-toolbar,
.map-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(220, 227, 236, .9);
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--tg-shadow-sm);
}

.map-toolbar h2 { margin: 3px 0 0; font-size: 20px; }
.map-layer-toggles { display: flex; gap: 12px; flex-wrap: wrap; }
.map-layer-toggles label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  min-height: 34px;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--tg-border);
  border-radius: 999px;
  background: #FFFFFF;
  color: #344541;
}

.map-operational-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(220, 227, 236, .9);
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--tg-shadow-sm);
}
.map-operational-filters label {
  display: grid;
  gap: 7px;
  color: #344541;
  font-size: 12px;
  font-weight: 850;
}
.map-operational-filters input,
.map-operational-filters select {
  min-height: 40px;
}
.map-filter-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  grid-column: 1 / -1;
}
.map-results-count {
  color: var(--tg-muted);
  font-size: 13px;
  font-weight: 800;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.map-layout.has-detail {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}

.map-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 620px;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid rgba(220, 227, 236, .9);
  border-radius: var(--tg-radius-lg);
  background: #EAF1EE;
  box-shadow: var(--tg-shadow-sm);
}

.operational-map {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  z-index: 1;
}

.map-shell [hidden] {
  display: none !important;
}

.leaflet-container img,
.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
}

.map-loading,
.map-empty,
.map-error {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(320px, calc(100% - 32px));
  padding: 18px;
  border: 1px solid rgba(220, 227, 236, .9);
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--tg-shadow-md);
  color: #344541;
  text-align: center;
  transform: translate(-50%, -50%);
}

.map-error { color: var(--tg-red); }

.map-detail-panel {
  min-height: 620px;
  padding: 18px;
  border: 1px solid rgba(220, 227, 236, .9);
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--tg-shadow-sm);
}

.map-detail-close { display: flex; margin-left: auto; }
.map-detail-empty { display: grid; gap: 6px; color: var(--tg-muted); }
.map-detail-empty strong { color: #061A17; }

.map-person {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(220, 227, 236, .9);
}
.map-avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #E6FFF5, #DCEBFF);
  color: #07513F;
  font-weight: 900;
}
.map-person h2 {
  margin: 3px 0;
  color: #061A17;
  font-size: 18px;
  line-height: 1.18;
}
.map-person p:last-child { margin: 0; color: var(--tg-muted); }
.map-detail-list {
  display: grid;
  gap: 0;
  margin: 16px 0;
}
.map-detail-list div {
  display: grid;
  grid-template-columns: minmax(110px, .72fr) minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(220, 227, 236, .72);
}
.map-detail-list dt {
  color: var(--tg-muted);
  font-size: 12px;
  font-weight: 850;
}
.map-detail-list dd { margin: 0; color: #1D2B27; font-weight: 700; }
.map-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-legend {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #344541;
  font-size: 13px;
  font-weight: 750;
}

.map-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #98A2B3;
  box-shadow: 0 0 0 4px rgba(152, 162, 179, .15);
}
.map-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #007F5F;
  background: rgba(0, 168, 107, .1);
}
.map-ring.state-geofence-block { border-color: #DC2626; background: rgba(220, 38, 38, .1); }
.map-cluster-sample {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #00A86B, #007F5F);
  color: #FFFFFF;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}
.map-dot.state-trabajando { background: #16A34A; box-shadow: 0 0 0 4px rgba(22, 163, 74, .15); }
.map-dot.state-descanso { background: #D97706; box-shadow: 0 0 0 4px rgba(217, 119, 6, .16); }
.map-dot.state-cerrada { background: #475467; box-shadow: 0 0 0 4px rgba(71, 84, 103, .14); }
.map-dot.state-fuera { background: #DC2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, .14); }
.map-dot.state-sin { background: #667085; box-shadow: 0 0 0 4px rgba(102, 112, 133, .14); }

.map-marker {
  display: grid;
  place-items: center;
  width: 28px !important;
  height: 28px !important;
  border-radius: 999px;
  background: #FFFFFF;
  border: 2px solid #FFFFFF;
  box-shadow: 0 8px 18px rgba(7, 27, 61, .2);
}
.map-marker span {
  width: 16px;
  height: 16px;
  border-radius: inherit;
  background: #667085;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .58);
}
.map-marker,
.map-detail-panel,
.map-operational-filters,
.map-legend-item,
.marker-cluster {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.map-marker:hover,
.marker-cluster:hover {
  transform: translateY(-1px);
}
.map-marker-trabajando span { background: #16A34A; }
.map-marker-descanso span,
.map-marker-en_descanso span { background: #D97706; }
.map-marker-cerrada span,
.map-marker-jornada_finalizada span { background: #475467; }
.map-marker-fuera_de_geocerca span { background: #DC2626; }
.map-marker-sin_ubicacion span,
.map-marker-sin_telegram span,
.map-marker-sin_entrada span { background: #667085; }

.marker-cluster,
.marker-cluster div {
  border-radius: 999px;
}
.marker-cluster {
  background: rgba(0, 168, 107, .18);
  box-shadow: 0 10px 22px rgba(7, 27, 61, .18);
}
.marker-cluster div {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #00A86B, #007F5F);
  color: #FFFFFF;
  font-weight: 900;
}
.marker-cluster span {
  line-height: 1;
}

@media (max-width: 1024px) {
  .map-layout,
  .map-layout.has-detail { grid-template-columns: 1fr; }
  .map-detail-panel { min-height: 220px; }
}

@media (max-width: 768px) {
  .map-filter-form,
  .map-operational-filters { grid-template-columns: 1fr; }
  .map-filter-actions { align-items: stretch; flex-direction: column; }
  .map-filter-actions .secondary-button { width: 100%; }
  .map-toolbar { align-items: flex-start; flex-direction: column; }
  .map-stage { height: 520px; min-height: 520px; }
}

@media (max-width: 430px) {
  .map-stage { height: 480px; min-height: 480px; }
  .map-layer-toggles label { width: 100%; justify-content: center; }
  .map-detail-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 1000;
    max-height: min(76vh, 620px);
    overflow-y: auto;
  }
  .map-detail-list div { grid-template-columns: 1fr; gap: 3px; }
}

.product-launcher {
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--tg-ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 208, 132, .14), transparent 30%),
    radial-gradient(circle at 86% 16%, rgba(46, 144, 250, .10), transparent 28%),
    linear-gradient(135deg, #F7FAFC 0%, #EEF7F4 52%, #F8FBFF 100%);
  overflow-x: hidden;
}
.product-launcher::before {
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 208, 132, .08), transparent 24%),
    radial-gradient(circle at 80% 60%, rgba(7, 27, 61, .06), transparent 26%);
  content: "";
  opacity: .72;
  animation: productMeshDrift 18s ease-in-out infinite alternate;
}
.product-launcher-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 64px;
}
.product-launcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(44px, 7vw, 78px);
  animation: productFadeUp .54s var(--tg-ease) both;
}
.product-launcher-brand img {
  display: block;
  width: clamp(148px, 16vw, 178px);
  height: auto;
}
.product-launcher-hero {
  max-width: 720px;
  margin-bottom: clamp(28px, 4vw, 42px);
  animation: productFadeUp .6s var(--tg-ease) .06s both;
}
.product-platform-label {
  margin: 0 0 12px;
  color: var(--tg-green-700);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.product-launcher-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}
.product-launcher-question {
  margin: 0 0 22px;
  color: var(--tg-muted);
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 650;
}
.product-company-context {
  display: inline-grid;
  gap: 3px;
  min-width: min(100%, 250px);
  padding: 10px 13px;
  border: 1px solid rgba(7, 27, 61, .08);
  border-radius: 18px;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--tg-shadow-sm);
}
.product-company-context span {
  color: var(--tg-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.product-company-context strong {
  overflow: hidden;
  color: #0B2A24;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  align-items: stretch;
}
.product-card {
  position: relative;
  display: flex;
  min-height: 296px;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  padding: 26px;
  overflow: hidden;
  color: var(--tg-ink);
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .78));
  border: 1px solid rgba(7, 27, 61, .08);
  border-radius: 26px;
  box-shadow: 0 22px 52px rgba(7, 27, 61, .09);
  isolation: isolate;
  opacity: 0;
  transform: translateY(16px) scale(.985);
  animation: productCardEnter .58s var(--tg-ease) both;
  transition: transform .2s var(--tg-ease), box-shadow .2s var(--tg-ease), border-color .2s var(--tg-ease), background .2s var(--tg-ease);
}
.product-card:nth-child(1) { animation-delay: .10s; }
.product-card:nth-child(2) { animation-delay: .16s; }
.product-card:nth-child(3) { animation-delay: .22s; }
.product-card:nth-child(4) { animation-delay: .28s; }
.product-card::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 78% 14%, rgba(0, 208, 132, .14), transparent 32%);
  content: "";
  opacity: .68;
  transition: opacity .2s var(--tg-ease);
}
.product-card:hover,
.product-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(0, 168, 107, .42);
  box-shadow: 0 30px 68px rgba(7, 27, 61, .14);
  outline: none;
}
.product-card:focus-visible {
  box-shadow: 0 0 0 4px rgba(0, 208, 132, .22), 0 24px 54px rgba(7, 27, 61, .13);
}
.product-card:active {
  transform: translateY(-3px) scale(.99);
}
.product-card:hover::before,
.product-card:focus-visible::before {
  opacity: 1;
}
.product-card-emblem {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border-radius: 28px;
  background: rgba(255, 255, 255, .76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 12px 32px rgba(7, 27, 61, .08);
  transform: translate3d(0, 0, 0);
  animation: productEmblemFloat 6.8s ease-in-out infinite alternate;
  transition: transform .2s var(--tg-ease);
}
.product-card:nth-child(2) .product-card-emblem { animation-delay: .7s; }
.product-card:nth-child(3) .product-card-emblem { animation-delay: 1.3s; }
.product-card:nth-child(4) .product-card-emblem { animation-delay: 1.9s; }
.product-card-emblem img {
  display: block;
  width: min(88px, 76%);
  max-width: 100%;
  height: auto;
}
.product-card:hover .product-card-emblem,
.product-card:focus-visible .product-card-emblem {
  transform: translateY(-4px);
}
.product-card-content {
  display: grid;
  gap: 8px;
}
.product-card-content strong {
  font-size: 25px;
  line-height: 1.15;
}
.product-card-content small {
  max-width: 285px;
  color: var(--tg-muted);
  font-size: 14.5px;
  line-height: 1.45;
}
.product-card-arrow {
  position: absolute;
  right: 24px;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #064E3B;
  background: rgba(0, 208, 132, .13);
  font-size: 18px;
  font-weight: 900;
  transition: transform .2s var(--tg-ease), background .2s var(--tg-ease);
}
.product-card:hover .product-card-arrow,
.product-card:focus-visible .product-card-arrow {
  transform: translateX(6px);
  background: rgba(0, 208, 132, .22);
}

@keyframes productFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes productCardEnter {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes productEmblemFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}
@keyframes productMeshDrift {
  from { transform: translate3d(-8px, -6px, 0) scale(1); }
  to { transform: translate3d(10px, 8px, 0) scale(1.02); }
}

@media (max-width: 620px) {
  .product-launcher-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 22px;
  }
  .product-launcher-header {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 42px;
  }
  .product-launcher-logout,
  .product-launcher-logout .secondary-button { width: 100%; }
  .product-grid { grid-template-columns: 1fr; }
  .product-card {
    min-height: 248px;
    padding: 22px;
  }
  .product-card-emblem {
    width: 92px;
    height: 92px;
  }
}

@media (min-width: 621px) and (max-width: 980px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .product-launcher::before,
  .product-launcher-header,
  .product-launcher-hero,
  .product-card,
  .product-card-emblem {
    animation: none;
  }
  .product-card {
    opacity: 1;
    transform: none;
    transition-duration: .01ms;
  }
}
