/* Módulo de Limpieza - 100M Operations Dashboard
   Cumple estrictamente con el contrato de interfaz compartido (tokens semánticos de base.css y primitivas de components.css). */

.cleaning-page {
  display: grid;
  gap: var(--space-5);
}

.cleaning-subtabs {
  margin-bottom: var(--space-4);
}

.cleaning-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.cleaning-filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.cleaning-zone-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.cleaning-zone-btn {
  min-height: calc(var(--control-height-md) - 8px);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--text-subtle);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.cleaning-zone-btn:hover {
  color: var(--text-default);
}

.cleaning-zone-btn.is-active {
  background: var(--surface-raised);
  color: var(--text-default);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cleaning-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height-md);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-subtle);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.cleaning-tab-pill:hover {
  background: var(--surface-subtle);
  color: var(--text-default);
}

.cleaning-tab-pill.is-active {
  background: var(--interactive);
  border-color: var(--interactive);
  color: var(--text-on-brand);
}

.cleaning-count-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 800;
}

.cleaning-tab-pill.is-active .cleaning-count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: var(--text-on-brand);
}

.cleaning-search-input {
  min-height: var(--control-height-md);
  min-width: 220px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text-default);
  font-size: var(--text-sm);
}

.cleaning-search-input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 38%, transparent);
  outline-offset: 2px;
  background: var(--surface-raised);
}

.cleaning-cards {
  display: grid;
  gap: var(--space-3);
}

.cleaning-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.cleaning-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--elevation-2);
}

.cleaning-card--urgent {
  border-left-color: var(--bad);
}

.cleaning-card--today {
  border-left-color: var(--warn);
}

.cleaning-card--ok {
  border-left-color: var(--ok);
}

.cleaning-card-main {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
}

.cleaning-card-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 4px;
  flex-shrink: 0;
}

.cleaning-card--urgent .cleaning-card-dot { background: var(--bad); }
.cleaning-card--today .cleaning-card-dot { background: var(--warn); }
.cleaning-card--ok .cleaning-card-dot { background: var(--ok); }

.cleaning-card-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.cleaning-card-title {
  margin: 0;
  color: var(--text-default);
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1.3;
}

.cleaning-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  flex-wrap: wrap;
}

.cleaning-meta-urgent {
  color: var(--bad);
  font-weight: 800;
}

.cleaning-meta-today {
  color: var(--warn);
  font-weight: 800;
}

.cleaning-meta-ok {
  color: var(--ok);
  font-weight: 700;
}

.cleaning-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.cleaning-card-last-info {
  text-align: right;
  line-height: 1.3;
}

.cleaning-last-label {
  display: block;
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cleaning-last-person {
  display: block;
  color: var(--text-default);
  font-size: var(--text-sm);
  font-weight: 700;
}

.cleaning-last-date {
  display: block;
  color: var(--text-subtle);
  font-size: var(--text-xs);
}

/* Historial Reciente */
.cleaning-history-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cleaning-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--motion-fast);
}

.cleaning-history-row:last-child {
  border-bottom: 0;
}

.cleaning-history-row:hover {
  background: var(--surface-subtle);
}

.cleaning-history-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.cleaning-history-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--ok);
  flex-shrink: 0;
}

.cleaning-history-name {
  color: var(--text-default);
  font-size: var(--text-sm);
  font-weight: 700;
}

.cleaning-history-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  margin-top: 2px;
  flex-wrap: wrap;
}

.cleaning-history-note {
  font-style: italic;
  color: var(--text-default);
}

.cleaning-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-default);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.cleaning-photo-btn:hover {
  border-color: var(--interactive);
  color: var(--interactive);
  background: var(--interactive-soft);
}

/* Modales */
.cleaning-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 29, 27, 0.6);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.cleaning-modal-backdrop[hidden] {
  display: none !important;
}

.cleaning-modal {
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.cleaning-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.cleaning-modal-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-strong);
}

.cleaning-modal-body {
  padding: var(--space-5);
}

.cleaning-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.cleaning-photo-preview-box {
  height: 220px;
  border-radius: var(--radius-md);
  background: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: var(--space-4);
}

.cleaning-photo-geo {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #34d399;
  font-family: monospace;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
}

/* Breakpoints Canónicos (640px y 960px) */
@media (max-width: 960px) {
  .cleaning-card {
    padding: var(--space-3) var(--space-4);
  }
}

@media (max-width: 640px) {
  .cleaning-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cleaning-search-input {
    width: 100%;
    min-width: 0;
  }

  .cleaning-card {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .cleaning-card-actions {
    justify-content: space-between;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle);
  }

  .cleaning-card-last-info {
    text-align: left;
  }
}
