/* ================================================================
   PALETA METROPOL
   ================================================================ */
:root {
  --m-blue-dark: #072b5a;
  --m-blue: #0056a4;
  --m-blue-soft: #e5edf7;
  --m-blue-soft2: #f0f4ff;
  --m-red: #e30613;
  --m-yellow: #f59e0b;
  --m-gray-bg: #eef2f7;
  --m-gray-panel: #ffffff;
  --m-gray-border: #d1d5db;
  --m-text-main: #111827;
  --m-text-muted: #6b7280;

  /* extras visual */
  --m-shadow-1: 0 10px 22px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(148, 163, 184, 0.3);
  --m-shadow-2: 0 14px 30px rgba(15, 23, 42, 0.20), 0 0 0 1px rgba(148, 163, 184, 0.35);
  --m-radius: 12px;

  /* DTP indicador (parametrizable) */
  --dtp-bad-bg:   #fee2e2;
  --dtp-bad-tx:   #7f1d1d;
  --dtp-mid-bg:   #fef3c7;
  --dtp-mid-tx:   #854d0e;
  --dtp-good-bg:  #dcfce7;
  --dtp-good-tx:  #065f46;
}

/* ================================================================
   RESET BÁSICO
   ================================================================ */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(circle at top left, var(--m-blue-soft2) 0, var(--m-gray-bg) 45%, #e5e7eb 100%);
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--m-text-main);
}

/* ================================================================
   BOTONES BASE
   ================================================================ */
button {
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.08s ease, opacity 0.14s ease;
}

button:focus-visible {
  outline: 2px solid var(--m-yellow);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.35);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ================================================================
   CONTENEDOR GENERAL
   ================================================================ */
.dashboard {
  min-height: 100vh;
  padding: 10px 16px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Panel general tipo "card" */
.panel {
  background: radial-gradient(circle at top left, #ffffff 0, #f9fafb 45%, #ffffff 100%);
  border-radius: var(--m-radius);
  border: 1px solid var(--m-gray-border);
  box-shadow: var(--m-shadow-1);
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  animation: panelIn 180ms ease-out both;
}

/* franja superior de color en cada panel */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--m-blue), transparent);
  opacity: 0.75;
  pointer-events: none;
}

/* contenido real del panel (para no pisar la franja) */
.main-left,
.main-center-top,
.main-center-bottom,
.main-right {
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 0;
}

/* ================================================================
   HEADER GLOBAL
   ================================================================ */
.dashboard-header {
  flex: 0 0 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(90deg, var(--m-blue-dark), var(--m-blue));
  color: #f9fafb;
  border-radius: var(--m-radius);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.4);
}

.dashboard-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(15, 23, 42, 0.4);
  overflow: hidden;
}

.brand-logo img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-app-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-subtitle {
  font-size: 12px;
  color: #e5e7eb;
}

.dashboard-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  gap: 2px;
}

/* ================================================================
   GRID PRINCIPAL (OTRAS VISTAS, no monitor DTP)
   ================================================================ */
.dashboard-main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
}

.main-left {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-center-top {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* panel inferior y derecho no se usan en el monitor DTP */
.main-center-bottom { display: none; }
.main-right { display: none; }

/* ================================================================
   TÍTULOS DE PANEL
   ================================================================ */
.panel-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--m-blue-dark);
  position: relative;
  z-index: 1;
}

.panel-title span.icon { font-size: 16px; }

.panel-title::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--m-blue), transparent);
  margin-left: 8px;
}

/* ================================================================
   PROGRAMACIÓN SEMANAL (TABLA CENTRAL, OTRAS VISTAS)
   ================================================================ */
.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.schedule-week-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
}

.schedule-week-info span:last-child { font-size: 13px; }

.week-nav-btn {
  padding: 4px 12px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  cursor: pointer;
  font-weight: 500;
  color: var(--m-blue-dark);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.week-nav-btn:hover {
  background: var(--m-blue-soft);
  border-color: var(--m-blue);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
}

.schedule-table-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--m-gray-border);
  background: linear-gradient(to bottom, #f9fafb, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 1px 3px rgba(15, 23, 42, 0.1);
  overflow: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 11px;
  background: #ffffff;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(to bottom, var(--m-blue-soft2), #eef2ff);
  color: var(--m-blue-dark);
  padding: 6px 8px;
  border-bottom: 1px solid #cbd5e1;
  border-right: 1px solid #e5e7eb;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

.schedule-table tbody td {
  padding: 5px 6px;
  border-bottom: 1px solid #e5e7eb;
  border-right: 1px solid #f3f4f6;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.schedule-table th:nth-child(1),
.schedule-table td:nth-child(1) { width: 70px; text-align: left; }

.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) { width: 110px; text-align: left; }

.schedule-table th:nth-child(3),
.schedule-table td:nth-child(3) { width: 230px; text-align: left; }

.schedule-table th:nth-child(n+4),
.schedule-table td:nth-child(n+4) {
  width: 80px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.schedule-table tbody tr:nth-child(even) { background: #f9fafb; }
.schedule-table tbody tr:hover { background: #e5edf7; }

.schedule-empty-row td {
  text-align: center !important;
  color: var(--m-text-muted);
  font-style: italic;
}

.schedule-cell-readonly { background: #f9fafb; color: var(--m-text-muted); }
.schedule-cell-editable { background: #ffffff; }

.schedule-input-time {
  width: 100%;
  max-width: 70px;
  padding: 2px 4px;
  font-size: 11px;
  text-align: center;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  box-sizing: border-box;
}

.schedule-input-time:focus {
  outline: none;
  border-color: var(--m-blue);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.schedule-input-time[readonly] {
  border-color: transparent;
  background: transparent;
  color: var(--m-text-muted);
  cursor: default;
}

.schedule-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--m-text-muted);
}

/* ================================================================
   CONDUCTORES (PANEL IZQUIERDO)
   ================================================================ */
.driver-subpanel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.driver-subpanel + .driver-subpanel {
  border-top: 1px dashed var(--m-gray-border);
  padding-top: 8px;
  margin-top: 4px;
}

.driver-subpanel-header {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--m-text-main);
}

.driver-counter {
  background: var(--m-red);
  color: #f9fafb;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.driver-list {
  margin-top: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #9ca3af #e5e7eb;
}

.driver-list::-webkit-scrollbar { width: 8px; }
.driver-list::-webkit-scrollbar-track { background: #e5e7eb; }
.driver-list::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 4px; }

.driver-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 5px 7px;
  margin-bottom: 4px;
  font-size: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.3fr);
  column-gap: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.driver-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
  border-color: rgba(37, 99, 235, 0.35);
}

.driver-main-code { font-weight: 700; }

.driver-main-name {
  font-size: 10px;
  color: var(--m-text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.driver-times {
  font-size: 10px;
  text-align: right;
  color: var(--m-text-muted);
}

.driver-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  font-size: 10px;
  margin-top: 2px;
}
.driver-pill span { font-weight: 600; }

.driver-pill-adelantado { background: #e0f2fe; border-color: #38bdf8; color: #0f172a; }
.driver-pill-en-hora    { background: #dcfce7; border-color: #22c55e; color: #14532d; }
.driver-pill-atrasado   { background: #fee2e2; border-color: #ef4444; color: #7f1d1d; }

.driver-status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 4px;
  border: 1px solid #ffffff;
}
.status-en-ruta { background: #22c55e; }
.status-patio   { background: #ef4444; }
.status-colacion{ background: #eab308; }

/* ================================================================
   PANEL GESTIÓN CONDUCTORES
   ================================================================ */
.driver-subpanel.admin-panel {
  flex: 0 0 auto;
  min-height: auto;
  margin-top: 10px;
  padding: 8px 8px 10px;
  border-radius: 10px;
  background: radial-gradient(circle at top left, #ffffff 0, var(--m-blue-soft2) 60%, #ffffff 100%);
  border: 1px solid rgba(37, 99, 235, 0.45);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(148, 163, 184, 0.3);
}

.driver-subpanel.admin-panel .driver-subpanel-header { margin-bottom: 4px; }

.driver-subpanel.admin-panel .hint-text {
  font-size: 10px;
  font-weight: 400;
  color: var(--m-text-muted);
}

.gestion-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.gestion-btn {
  width: 100%;
  padding: 6px 10px;
  font-size: 11px;
  text-align: left;
  border-radius: 8px;
  border: 1px solid rgba(37, 99, 235, 0.45);
  background: #ffffff;
  cursor: pointer;
  font-weight: 500;
  color: var(--m-blue-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}

.gestion-btn::after {
  content: "›";
  font-size: 11px;
  color: #9ca3af;
}

.gestion-btn:hover {
  background: var(--m-blue-soft);
  border-color: var(--m-blue);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

/* ================================================================
   SERVICIOS (FRANJAS) - Panel derecho en otras vistas
   ================================================================ */
.services-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.services-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--m-text-muted);
}

.services-buttons button {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  cursor: pointer;
  margin-left: 4px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.services-buttons button:hover {
  background: var(--m-blue-soft);
  border-color: var(--m-blue);
}

.slot-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

#slot-next-card { border-color: #fbbf24; }

.slot-current-stats {
  margin-top: 4px;
  font-size: 11px;
  color: var(--m-text-muted);
}

.slot-current-stats span.big-number {
  font-size: 18px;
  font-weight: 700;
  margin-right: 6px;
  color: var(--m-blue-dark);
}

.services-list {
  margin-top: 5px;
  border-top: 1px solid #e5e7eb;
  padding-top: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.services-list::-webkit-scrollbar { width: 8px; }
.services-list::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 4px; }

.service-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 6px;
  margin-bottom: 3px;
  font-size: 10px;
  cursor: pointer;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
  display: flex;
  flex-direction: column;
}

.service-card:hover {
  background: #f3f4ff;
  border-color: var(--m-blue);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

.service-card.selected {
  border-color: var(--m-blue);
  box-shadow: 0 0 0 1px var(--m-blue);
}

.service-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.svc-block-main {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 150px;
}

.svc-line { font-size: 13px; font-weight: 700; }
.svc-hour { font-weight: 700; }

.svc-tag {
  border-radius: 999px;
  padding: 0 7px;
  font-size: 9px;
  min-width: 40px;
  text-align: center;
  font-weight: 600;
}
.svc-tag-exp { background: #dbeafe; border: 1px solid #1d4ed8; color: #1e3a8a; }
.svc-tag-vin { background: #ffedd5; border: 1px solid #ea580c; color: #9a3412; }
.svc-tag-vpa { background: #fef9c3; border: 1px solid #eab308; color: #854d0e; }
.svc-tag-other { background: #e5e7eb; border: 1px solid #6b7280; color: #111827; }

.svc-block-middle {
  flex: 1 1 auto;
  min-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--m-text-muted);
}

.svc-block-actions,
.svc-block-assign {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  min-width: 150px;
  justify-content: flex-end;
  white-space: nowrap;
}

.svc-status-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid transparent;
}

.svc-status-asignado {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.svc-status-pendiente {
  background: #fee2e2;
  border-color: #ef4444;
  color: #7f1d1d;
}

.svc-btn-main {
  padding: 3px 10px;
  font-size: 10px;
  border-radius: 999px;
  border: 1px solid var(--m-blue);
  cursor: pointer;
  font-weight: 600;
  min-width: 68px;
  background: #ffffff;
  color: var(--m-blue-dark);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}

.svc-btn-main:hover { background: var(--m-blue-soft); }

/* ================================================================
   BUSES
   ================================================================ */
.bus-panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 11px;
}

.bus-filter-buttons { display: flex; gap: 4px; }

.bus-filter-buttons button {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  cursor: pointer;
  font-weight: 500;
}

.bus-filter-buttons button.active {
  background: var(--m-blue);
  color: #f9fafb;
  border-color: var(--m-blue-dark);
}

.bus-filter-buttons button:hover { background: var(--m-blue-soft); }

.bus-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.bus-list::-webkit-scrollbar { width: 8px; }
.bus-list::-webkit-scrollbar-track { background: #e5e7eb; }
.bus-list::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 4px; }

.bus-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.bus-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 11px;
  cursor: pointer;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.bus-card:hover {
  background: #f3f4ff;
  border-color: var(--m-blue);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

.bus-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr);
  align-items: center;
  column-gap: 6px;
  margin-bottom: 4px;
}

.bus-label {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.bus-number { font-weight: 700; white-space: nowrap; }

.bus-status-pill-small {
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 10px;
}

.bus-status-disponible   { background:#dcfce7; border-color:#16a34a; color:#166534; }
.bus-status-carga        { background:#fef9c3; border-color:#f59e0b; color:#92400e; }
.bus-status-no_disponible{ background:#e5e7eb; border-color:#6b7280; color:#374151; }
.bus-status-averia       { background:#fee2e2; border-color:#ef4444; color:#b91c1c; }
.bus-status-mantencion   { background:#e0f2fe; border-color:#3b82f6; color:#1e3a8a; }

.bus-timer-row {
  font-size: 10px;
  color: var(--m-text-muted);
  margin-bottom: 3px;
}

.bus-battery {
  position: relative;
  width: 100%;
  max-width: 140px;
  height: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f3f4f6;
  overflow: hidden;
}

.bus-battery-level { height: 100%; border-radius: 4px; }

.bus-battery-text {
  font-size: 10px;
  margin-top: 2px;
  color: var(--m-text-muted);
}

.bus-state-select {
  margin-top: 3px;
  padding: 3px 5px;
  font-size: 10px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f9fafb;
}

/* ================================================================
   MODALES
   ================================================================ */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 40;
  align-items: center;
  justify-content: center;
}
.modal.is-open { display: flex; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  animation: fadeIn 160ms ease-out both;
}

.modal-dialog {
  position: relative;
  z-index: 41;
  background: #ffffff;
  border-radius: var(--m-radius);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(148, 163, 184, 0.4);
  padding: 12px 14px 14px;
  font-size: 13px;
  max-width: 480px;
  width: calc(100% - 56px);
  animation: popIn 180ms ease-out both;
}

.modal-dialog-wide { max-width: 860px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.modal-header h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--m-blue-dark);
}
.modal-subtitle { font-size: 11px; color: var(--m-text-muted); }

.modal-close {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}
.modal-close:hover { color: #111827; }

.modal-body { font-size: 12px; }

.modal-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  column-gap: 32px;
  row-gap: 4px;
}

.modal-detail-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  column-gap: 6px;
  margin-bottom: 3px;
  font-size: 11px;
}
.modal-detail-row .label { color: var(--m-text-muted); }

.modal-section-title {
  font-weight: 600;
  margin: 4px 0 6px 0;
  font-size: 12px;
}

.modal-footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-primary,
.btn-secondary {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn-primary {
  background: var(--m-blue);
  color: #f9fafb;
  border-color: var(--m-blue-dark);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}
.btn-primary:hover {
  background: #0b74d1;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
}

.btn-secondary {
  background: #ffffff;
  color: var(--m-blue-dark);
  border-color: var(--m-blue);
}
.btn-secondary:hover {
  background: var(--m-blue-soft);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.modal .form-row,
.admin-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}
.modal .form-row label,
.admin-form .form-row label { font-weight: 500; }

.modal .form-row input[type="text"],
.modal .form-row input[type="number"],
.modal .form-row input[type="date"],
.modal .form-row input[type="time"],
.modal .form-row select,
.modal .form-row textarea,
.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form input[type="date"],
.admin-form input[type="time"],
.admin-form select,
.admin-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.modal .form-row textarea,
.admin-form textarea {
  resize: vertical;
  min-height: 40px;
  max-height: 90px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
}

.admin-form .form-row-actions {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
  gap: 8px;
}

.admin-form button[type="submit"] {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--m-blue-dark);
  background: linear-gradient(to right, var(--m-blue), #1d4ed8);
  color: #f9fafb;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.admin-form button[type="submit"]:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
}

.small-status { font-size: 10px; color: var(--m-text-muted); }

/* ================================================================
   RESPONSIVE GENERAL
   ================================================================ */
@media (max-width: 1200px) {
  .dashboard-main { grid-template-columns: 300px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .dashboard { padding: 8px; }

  .dashboard-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
  }

  .main-left { grid-column: 1; grid-row: 1; }
  .main-center-top { grid-column: 1; grid-row: 2; }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .dashboard-header-right { align-items: flex-start; }

  .modal-dialog,
  .modal-dialog-wide {
    width: calc(100% - 32px);
    max-width: 100%;
  }
}

/* ================================================================
   MONITOR DTP • TABLA CUMPLIMIENTO + GRÁFICOS (LIMPIO)
   ================================================================ */

/* Ocultar footer global dentro del sinoptic tracker */
.dashboard-footer { display: none !important; }

/* Layout DTP: tabla arriba + gráficos abajo (no forza 100vh, usa scroll normal del navegador) */
.dtp-monitor-layout {
  /* tuning */
  --dtp-rows-visible: 8;
  --dtp-row-h: 32px;
  --dtp-head-h: 44px;

  --dtp-font-base: 14px;
  --dtp-font-table: 13px;
  --dtp-font-title: 15px;

  --dtp-cell-pad-y: 5px;
  --dtp-cell-pad-x: 10px;

  --dtp-chart-h: 280px;

  font-size: var(--dtp-font-base);

  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 12px;
  padding: 10px 16px 16px;
  box-sizing: border-box;
  align-content: start;
}

/* Panel superior (tabla) */
.panel-resumen {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

/* Panel inferior (gráficos) */
.panel-graficos {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 12px;
  min-height: 0;
}

/* Encabezado franja */
.franja-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #d1d5db;
  font-size: var(--dtp-font-title);
}

.franja-header .week-nav-btn,
.franja-header button { justify-self: start; }

.franja-header-titulo {
  text-align: center;
  font-weight: 700;
  color: var(--m-blue-dark);
}

/* Wrapper de tabla: alto controlado (N filas visibles) + scroll interno */
.tabla-cumplimiento-wrapper {
  padding: 8px 10px 12px;
  flex: 0 0 auto;
  min-height: 0;
  max-height: calc(var(--dtp-head-h) + (var(--dtp-rows-visible) * var(--dtp-row-h)));
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: linear-gradient(to bottom, #ffffff, #fbfdff);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #e5e7eb;
}

.tabla-cumplimiento-wrapper::-webkit-scrollbar { width: 10px; height: 10px; }
.tabla-cumplimiento-wrapper::-webkit-scrollbar-track { background: #e5e7eb; border-radius: 10px; }
.tabla-cumplimiento-wrapper::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 10px; }

/* Tabla */
.cumplimiento-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--dtp-font-table);
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
}

.cumplimiento-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: var(--dtp-head-h);
  background: linear-gradient(to bottom, #f3f6ff, #eef2ff);
  color: var(--m-blue-dark);
  font-weight: 700;
  border-bottom: 1px solid #d1d5db;
}

.cumplimiento-table th,
.cumplimiento-table td {
  border: 1px solid #eef2f7;
  padding: var(--dtp-cell-pad-y) var(--dtp-cell-pad-x);
  text-align: center;
  vertical-align: middle;
  line-height: 1.15;
}

.cumplimiento-table tbody td { height: var(--dtp-row-h); }

/* columnas */
.cumplimiento-table th:nth-child(1),
.cumplimiento-table td:nth-child(1) { width: 44%; text-align: left; }

.cumplimiento-table th:nth-child(2),
.cumplimiento-table td:nth-child(2) { width: 22%; }

.cumplimiento-table th:nth-child(3),
.cumplimiento-table td:nth-child(3) { width: 17%; }

.cumplimiento-table th:nth-child(4),
.cumplimiento-table td:nth-child(4) { width: 17%; }

/* Servicio (compacto para respetar altura fija) */
.cumplimiento-servicio {
  text-align: left;
  padding-left: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* numéricas */
.cumplimiento-table td:not(.cumplimiento-servicio) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* zebra + hover (no pisan filas coloreadas porque abajo van con !important) */
.cumplimiento-table tbody tr:nth-child(even) td { background: #fafcff; }
.cumplimiento-table tbody tr:hover td {
  background: #eaf2ff;
  transition: background 120ms ease;
}

/* colores por indicador (fila completa) */
tr.row-rojo td {
  background: var(--dtp-bad-bg) !important;
  color: var(--dtp-bad-tx) !important;
}
tr.row-amarillo td {
  background: var(--dtp-mid-bg) !important;
  color: var(--dtp-mid-tx) !important;
}
tr.row-verde td {
  background: var(--dtp-good-bg) !important;
  color: var(--dtp-good-tx) !important;
}

/* badges inferiores */
.resumen-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 10px 10px;
  font-size: 0.88rem;
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2f7;
  color: #111827;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.badge-leyenda {
  background: #f9fafb;
  border: 1px dashed #d1d5db;
}

.badge-leyenda span.cuadro {
  display: inline-block;
  width: 12px;
  height: 8px;
  margin: 0 3px;
  border-radius: 2px;
  vertical-align: middle;
}
.cuadro.rojo     { background: #fecaca; }
.cuadro.amarillo { background: #fef3c7; }
.cuadro.verde    { background: #bbf7d0; }

/* “pill” de sentido (IDA/VUELTA) */
.svc-dir{
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  margin-left: 8px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
}

/* gráficos */
.panel-grafico {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.panel-grafico-titulo {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--m-blue-dark);
}

.panel-grafico canvas {
  width: 100%;
  height: var(--dtp-chart-h) !important;
  max-height: var(--dtp-chart-h);
}

/* Mensajes dentro de la tabla de cumplimiento */
.tabla-msg-row td {
  text-align: center;
  font-size: 0.92rem;
  padding: 12px 10px;
}
.tabla-msg-warning td { background: #fef9c3; color: #854d0e; }
.tabla-msg-error td   { background: #fee2e2; color: #7f1d1d; }

/* ================================================================
   Drawer lateral de filtros (monitor DTP)
   ================================================================ */
.filter-toggle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 6px 4px;
  border-radius: 0 999px 999px 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.35);

  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  color: var(--m-blue-dark);

  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.filter-toggle:hover {
  transform: translateY(-50%) translateX(1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
}

.filter-toggle.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* contenedor general del drawer */
.filters-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.filters-drawer.is-open {
  pointer-events: auto;
  opacity: 1;
}

/* overlay */
.filters-drawer-overlay {
  flex: 1 1 auto;
  background: rgba(15, 23, 42, 0.55);
}

/* panel físico de filtros */
.filters-drawer-panel {
  flex: 0 0 auto;
  width: min(380px, 100%);
  padding: 14px 10px 14px 4px;
  display: flex;
  align-items: stretch;
}

/* panel interno */
.filters-drawer .panel-filtros {
  width: 100%;
  max-height: 100%;
  overflow: hidden;
}

/* encabezado interno */
.filters-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 6px;
}

.filters-drawer-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--m-blue-dark);
}

.filters-drawer-subtitle {
  font-size: 11px;
  color: var(--m-text-muted);
}

.filters-drawer-close {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}
.filters-drawer-close:hover { color: #111827; }

/* bloque scrolleable */
.filters-drawer .filters-block {
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.filters-block {
  padding: 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* inputs */
.filter-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-row label {
  font-size: 0.82rem;
  color: var(--m-text-muted);
}
.filter-row input,
.filter-row select {
  padding: 6px 8px;
  font-size: 0.92rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--m-text-main);
}
.filter-row input:focus,
.filter-row select:focus {
  outline: none;
  border-color: var(--m-blue);
  box-shadow: 0 0 0 3px rgba(0, 86, 164, 0.15);
}

.filter-row-actions {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  gap: 8px;
}

.filters-block button {
  padding: 7px 12px;
  font-size: 0.86rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--m-blue-dark);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}
.filters-block button:hover {
  background: var(--m-blue-soft);
  border-color: var(--m-blue);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

/* ================================================================
   RESPONSIVE MONITOR DTP
   ================================================================ */
@media (max-width: 1100px) {
  .dtp-monitor-layout { padding: 10px 12px 16px; }
  .panel-graficos { grid-template-columns: 1fr; }
  .dtp-monitor-layout { --dtp-chart-h: 240px; }
  .filters-drawer-panel { width: calc(100% - 24px); padding: 12px 8px; }
  .filters-drawer .filters-block { max-height: calc(100vh - 120px); }
  .filter-toggle { top: auto; bottom: 120px; transform: translateY(0); }
}

@media (max-width: 600px) {
  .dtp-monitor-layout { padding: 8px 8px 12px; gap: 8px; }
  .franja-header { grid-template-columns: 1fr; gap: 6px; font-size: 0.92rem; }
  .dtp-monitor-layout { --dtp-rows-visible: 6; --dtp-chart-h: 200px; }
  .filters-drawer-panel { width: 100%; padding: 10px; }
  .filters-drawer .filters-block { max-height: calc(100vh - 110px); }
}

/* ================================================================
   PO UPLOAD: card más ancho + responsive
   ================================================================ */
.po-upload-page .po-upload-card {
  width: min(1200px, calc(100% - 48px));
  margin: 18px auto;
}

@media (max-width: 700px) {
  .po-upload-page .po-upload-card {
    width: calc(100% - 16px);
    margin: 10px auto;
  }

  .po-upload-page .po-upload-card table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ================================================================
   ANIMACIONES SUTILES
   ================================================================ */
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ================================================================
   PATCH • Responsive + Anti-blur (Drawer filtros)
   Pegar AL FINAL del CSS
   ================================================================ */

/* Mejor legibilidad general (no invasivo) */
html { -webkit-text-size-adjust: 100%; }
body { text-rendering: optimizeLegibility; }

/* ---------- Anti-blur: pestaña lateral y drawer ---------- */

/* Evita blur por transform en hover (pestaña lateral) */
.filter-toggle{
  transform: translate3d(0, -50%, 0);
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  will-change: left, box-shadow;
}
.filter-toggle:hover{
  /* en vez de translateX(1px) -> mueve con left (pixel entero) */
  left: 1px;
  transform: translate3d(0, -50%, 0);
}

/* El panel de filtros no necesita translateZ(0) -> puede suavizar texto */
.filters-drawer .panel,
.filters-drawer .panel-filtros{
  transform: none !important;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Dentro del drawer: evita hover “lift” con transform (principal causa de blur) */
.filters-drawer .filters-block button:hover{
  transform: none;
}

/* Si quieres mantener el efecto “lift” sin blur, usa translate3d:
.filters-drawer .filters-block button:hover{
  transform: translate3d(0, -1px, 0);
}
*/

/* Opcional: hover suave en inputs/select sin transform */
.filters-drawer .filter-row input:hover,
.filters-drawer .filter-row select:hover{
  border-color: rgba(0, 86, 164, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 86, 164, 0.08);
}

/* ---------- Responsive tipografías / espaciados ---------- */

@media (max-width: 1100px){
  .dtp-monitor-layout{
    --dtp-font-base: 13px;
    --dtp-font-table: 12px;
    --dtp-font-title: 14px;

    --dtp-cell-pad-x: 8px;
    --dtp-cell-pad-y: 4px;

    --dtp-row-h: 30px;
    --dtp-head-h: 42px;
    --dtp-chart-h: 240px;
  }
}

@media (max-width: 600px){
  .dtp-monitor-layout{
    --dtp-font-base: 12px;
    --dtp-font-table: 12px;
    --dtp-font-title: 13px;

    --dtp-rows-visible: 6;

    --dtp-cell-pad-x: 8px;
    --dtp-cell-pad-y: 4px;

    --dtp-row-h: 30px;
    --dtp-head-h: 40px;
    --dtp-chart-h: 200px;
  }

  /* Tabla: en pantallas muy chicas, mejor scroll horizontal que aplastar texto */
  .cumplimiento-table{ min-width: 560px; }
  .tabla-cumplimiento-wrapper{
    -webkit-overflow-scrolling: touch;
  }

  /* Drawer: un pelín más compacto y legible */
  .filters-block{ padding: 8px 10px 12px; }
  .filter-row label{ font-size: 12px; }
  .filter-row input,
  .filter-row select{
    font-size: 14px;
    padding: 8px 10px;
  }

  .resumen-badges{ font-size: 0.82rem; }
}

/* ================================================================
   PATCH • Móvil: tabla full-width + títulos con salto + padding final
   Pegar AL FINAL del CSS
   ================================================================ */

@media (max-width: 600px){

  /* 1) Más aire al final de la página (sensación “completa”) */
  .dtp-monitor-layout{
    padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px));
  }
  .panel-graficos{
    margin-bottom: 18px;
  }

  /* 2) Tabla: que NO fuerce scroll horizontal y que calce en pantalla */
  .tabla-cumplimiento-wrapper{
    overflow-x: hidden;            /* evita scroll horizontal */
    padding: 8px 8px 12px;
  }

  .cumplimiento-table{
    min-width: 0 !important;       /* IMPORTANT: quita el min-width del patch anterior */
    width: 100%;
    table-layout: fixed;           /* mantiene columnas estables */
  }

  /* 3) Títulos (thead): permitir salto de línea y mejor legibilidad */
  .cumplimiento-table thead th{
    white-space: normal;           /* wrap */
    overflow-wrap: anywhere;       /* rompe si es necesario */
    word-break: break-word;
    hyphens: auto;

    padding: 6px 6px;
    font-size: 11px;
    line-height: 1.15;
  }

  /* 4) Celdas: más compactas para que entren todos los ítems */
  .cumplimiento-table th,
  .cumplimiento-table td{
    padding: 4px 6px;
    font-size: 11px;
  }

  /* 5) Ajuste de ancho por columna (en %) para que calce todo */
  .cumplimiento-table th:nth-child(1),
  .cumplimiento-table td:nth-child(1){ width: 52%; } /* Servicio */
  .cumplimiento-table th:nth-child(2),
  .cumplimiento-table td:nth-child(2){ width: 18%; }
  .cumplimiento-table th:nth-child(3),
  .cumplimiento-table td:nth-child(3){ width: 15%; }
  .cumplimiento-table th:nth-child(4),
  .cumplimiento-table td:nth-child(4){ width: 15%; }

  /* Mantén el body compacto (para respetar altura de fila) */
  .cumplimiento-servicio{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 8px;
  }
}

/* Ultra chico: un poco más agresivo */
@media (max-width: 420px){
  .cumplimiento-table th,
  .cumplimiento-table td{ font-size: 10.5px; padding: 4px 5px; }

  .cumplimiento-table th:nth-child(1),
  .cumplimiento-table td:nth-child(1){ width: 54%; }
  .cumplimiento-table th:nth-child(2),
  .cumplimiento-table td:nth-child(2){ width: 18%; }
  .cumplimiento-table th:nth-child(3),
  .cumplimiento-table td:nth-child(3){ width: 14%; }
  .cumplimiento-table th:nth-child(4),
  .cumplimiento-table td:nth-child(4){ width: 14%; }
}

/* ================================================================
   PATCH • Móvil: pestaña Filtros + drawer alineado y sin descuadres
   Pegar AL FINAL del CSS
   ================================================================ */

@media (max-width: 600px){

  /* 1) Pestaña -> botón flotante horizontal (evita vertical-rl y blur/descuadre) */
  .filter-toggle{
    writing-mode: horizontal-tb;
    text-orientation: initial;

    left: 12px;
    top: auto;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));

    transform: none;              /* clave: fuera translateY(-50%) */
    border-radius: 999px;

    padding: 10px 12px;
    font-size: 12px;
    letter-spacing: .2px;
    gap: 8px;

    min-height: 40px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
  }

  .filter-toggle:hover{
    left: 12px;                   /* anula el “left:1px” del patch anti-blur */
    transform: none;
  }

  /* si el texto queda largo, asegúralo en una línea */
  .filter-toggle{ white-space: nowrap; }

  /* 2) Drawer panel bien calzado en móvil + safe-area */
  .filters-drawer-panel{
    width: min(420px, calc(100% - 16px));
    padding: 10px 8px;
  }

  .filters-drawer .panel-filtros{
    border-radius: 14px;
  }

  .filters-drawer-header{
    padding: 12px 12px 8px;
    gap: 10px;
  }

  .filters-drawer-title{ font-size: 14px; }
  .filters-drawer-subtitle{ font-size: 12px; }

  .filters-drawer-close{
    font-size: 24px;
    padding: 6px 10px;
    line-height: 1;
  }

  /* 3) Área scrolleable sin que “corte” abajo */
  .filters-drawer .filters-block{
    max-height: calc(100vh - 150px - env(safe-area-inset-bottom, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* Ultra chico: mueve el botón un poquito para que no choque con otros elementos */
@media (max-width: 420px){
  .filter-toggle{
    left: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 9px 11px;
    font-size: 11.5px;
    min-height: 38px;
  }
}

/* ================================================================
   FIX • el botón de filtros NO puede desaparecer en móvil
   (override de is-hidden y posibles display:none)
   ================================================================ */
@media (max-width: 600px){
  .filter-toggle{
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 9999 !important; /* por si queda debajo de algo */
  }

  /* aunque el JS le ponga is-hidden, en móvil lo mostramos igual */
  .filter-toggle.is-hidden{
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

@media (max-width: 600px){
  .filter-toggle.is-hidden{
    opacity: 1 !important;
    pointer-events: auto !important;
    display: inline-flex !important;
  }
}


/* ================================================================
   Indicadores por patio
   ================================================================ */
.panel-indicadores-patios{
  margin-top: 18px;
}

.indicadores-patios-wrapper{
  width: 100%;
  overflow-x: auto;
}

.indicadores-patios-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1280px;
}

.indicadores-patios-table thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: #082a67;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  padding: 8px 6px;
  border: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
}

.indicadores-patios-table tbody th,
.indicadores-patios-table tbody td{
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 6px 7px;
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
}

.indicadores-row-name{
  text-align: left !important;
  background: #f8fafc;
  font-weight: 700;
  min-width: 160px;
}

.indicator-cell{
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.indicator-cell-verde{
  background: #18d24a;
  color: #052e16;
}

.indicator-cell-amarillo{
  background: #facc15;
  color: #422006;
}

.indicator-cell-rojo{
  background: #ef4444;
  color: #fff;
}

.indicator-cell-empty{
  background: #111827;
  color: #fff;
}

.indicadores-empty{
  text-align: center;
  padding: 14px 10px !important;
  color: #334155;
  background: #f8fafc;
}

@media (max-width: 900px){
  .indicadores-patios-table thead th,
  .indicadores-patios-table tbody th,
  .indicadores-patios-table tbody td{
    font-size: 0.72rem;
    padding: 5px 6px;
  }

  .indicadores-row-name{
    min-width: 132px;
  }
}
