:root {
  --ink: #18212f;
  --muted: #657385;
  --line: #d8e0e8;
  --panel: #ffffff;
  --bg: #f4f6f8;
  --brand: #06285f;
  --brand-2: #0d5f78;
  --ok: #16734d;
  --warn: #9a5b13;
  --bad: #a23a32;
  --soft-ok: #e6f3ed;
  --soft-warn: #fff2dc;
  --soft-bad: #fbe7e5;
  --shadow: 0 10px 30px rgba(18, 50, 74, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--brand);
  color: white;
}

.brand {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-copy strong {
  font-size: 18px;
}

.brand-copy span,
.session span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
}

.logout {
  background: rgba(255, 255, 255, 0.13);
  color: white;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.reception-page {
  width: min(1880px, 100%);
  padding: 24px 28px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, #eef3f7 0%, #f8fafb 100%);
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.login-logo {
  width: 176px;
  height: auto;
  display: block;
  margin: 0 0 16px;
  border-radius: 8px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.install-app {
  display: none;
  width: 100%;
  margin: 0 0 14px;
}

.install-app.visible {
  display: block;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.primary {
  background: var(--brand-2);
  color: white;
}

.secondary {
  background: #e9eef3;
  color: var(--ink);
}

.danger {
  background: var(--soft-bad);
  color: var(--bad);
}

.warning {
  background: var(--soft-warn);
  color: var(--warn);
}

.success {
  background: var(--soft-ok);
  color: var(--ok);
}

.error {
  min-height: 20px;
  color: var(--bad);
  font-size: 13px;
  font-weight: 700;
}

.toolbar,
.filters,
.actions,
.task-actions,
.summary-grid,
.admin-grid,
.split {
  display: grid;
  gap: 12px;
}

.toolbar {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 16px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.toolbar p,
.section-title p {
  margin: 0;
  color: var(--muted);
}

.filters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 16px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.workload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.maid-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
  max-width: 580px;
}

.reception-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
  max-width: none;
}

.governanta-filter {
  display: grid;
  grid-template-columns: 0.85fr 0.75fr 0.8fr 0.95fr 0.9fr 0.9fr;
  gap: 12px;
  margin: 0 0 14px;
}

.metric,
.panel,
.task-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 14px;
}

.metric-button {
  position: relative;
  width: 100%;
  min-height: 82px;
  text-align: left;
  cursor: pointer;
  padding-right: 44px;
}

.metric-button:active {
  transform: translateY(1px);
}

.metric-button .info-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--brand-2);
  border-radius: 50%;
  color: var(--brand-2);
  font-style: normal;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.workload-grid .metric {
  min-height: 82px;
}

.workload-grid .metric span {
  min-height: 28px;
}

.panel {
  padding: 16px;
}

.admin-grid {
  grid-template-columns: 1.1fr 1.9fr;
  align-items: start;
}

.director-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.reception-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.governanta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reception-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.reception-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.apartment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 7px;
}

.governanta-apartment-grid {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}

.apartment-tile {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #f6f8fa;
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
}

.tile-averia {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 13px;
  line-height: 1;
}

.apt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.apt-chip {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fa;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.apt-chip.selected {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #ffffff;
}

.apartment-tile.client-left-ready {
  min-height: 78px;
  align-content: center;
  gap: 6px;
}

.apartment-tile.client-left-done {
  min-height: 68px;
  align-content: center;
  gap: 5px;
}

.governanta-tile {
  min-height: 104px;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}

.apartment-tile strong {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.governanta-tile strong {
  font-size: 21px;
}

.apartment-tile span,
.apartment-tile small {
  display: block;
  margin-top: 4px;
}

.apartment-tile span {
  font-weight: 700;
  font-size: 13px;
}

.apartment-tile small {
  color: #23435f;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apartment-tile em {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

.governanta-group-title {
  align-items: center;
}

.zone-header-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.zone-header-actions .zonePdfBtn {
  min-height: 36px;
  padding: 6px 12px;
}

.zone-assignee {
  min-width: 150px;
  display: grid;
  gap: 5px;
}

.zone-assignee label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.zone-assignee select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}

.client-left-btn {
  width: 100%;
  min-height: 28px;
  padding: 0 6px;
  background: var(--brand-2);
  color: white;
  font-size: 11px;
  line-height: 1.1;
}

.key-notice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 8px 0 10px;
  padding: 10px;
  border: 1px solid #7db4f0;
  border-left: 4px solid #1f6fbf;
  border-radius: 8px;
  background: #dcecff;
}

.key-notice span {
  color: var(--muted);
  font-size: 13px;
}

.status-dot.done,
.apartment-tile.done {
  background: #c8f0d9;
  border-color: #2f9d63;
}

.status-dot.progress,
.apartment-tile.progress {
  background: #cfe6ff;
  border-color: #2f7fd1;
}

.status-dot.paused,
.apartment-tile.paused {
  background: #e4d4ff;
  border-color: #8b5fd9;
}

.status-dot.issue,
.apartment-tile.issue {
  background: #ffb8b1;
  border-color: #c7352c;
}

.status-dot.not-done,
.apartment-tile.not-done {
  background: #ffe1a8;
  border-color: #c77700;
}

.status-dot.pending,
.apartment-tile.pending {
  background: #d8dde5;
  border-color: #6f7a88;
}

.status-dot.task-checkout,
.apartment-tile.task-checkout {
  background: #ffb8b1;
  border-color: #c7352c;
}

.status-dot.task-stayover,
.apartment-tile.task-stayover {
  background: #c8f0d9;
  border-color: #2f9d63;
}

.status-dot.task-other,
.apartment-tile.task-other {
  background: #eef1f4;
  border-color: #9aa6b2;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title .group-breakdown {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
}

.list {
  display: grid;
  gap: 10px;
}

.task-card {
  padding: 14px;
}

/* Carros a montar (modal Carga del carrito de la camarera): un bloque por carro con las
   fichas de sus apartamentos (verde cliente / rojo salida) y la carga en rejilla de 3 columnas */
.cart-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: #f6f8fa;
}

.cart-block-head strong {
  font-size: 17px;
}

.cart-apts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.cart-apt {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.cart-apt.task-checkout {
  background: #ffb8b1;
  border-color: #c7352c;
}

.cart-apt.task-stayover {
  background: #c8f0d9;
  border-color: #2f9d63;
}

.cart-load-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.cart-load-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cart-load-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.cart-load-item strong {
  font-size: 17px;
}

/* Colores por tipo de tarea en el parte de la camarera (mismos que el cuadro de la gobernanta):
   clientes en verde, salidas y salida+entrada en rojo suave. Van ANTES de .task-card.active
   para que el resaltado de la tarea en curso gane al borde de color. */
.task-card.task-checkout {
  background: #ffb8b1;
  border-color: #c7352c;
}

.task-card.task-stayover {
  background: #c8f0d9;
  border-color: #2f9d63;
}

.task-card.active {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 2px rgba(29, 107, 122, 0.13), var(--shadow);
}

.maintenance-card.urgent {
  background: #fdecea;
  border-color: #f0b6b1;
}

.compact-table tr.urgent-row td {
  background: #fdecea;
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.apt {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.apt strong {
  font-size: 22px;
}

.apt span {
  color: var(--muted);
  font-size: 13px;
}

.apt .averia-title {
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.pending {
  background: #e9eef3;
  color: #445164;
}

.badge.progress {
  background: #e1f2f4;
  color: var(--brand-2);
}

.badge.paused {
  background: var(--soft-warn);
  color: var(--warn);
}

/* Desplegable del jefe para asignar operario, junto a la etiqueta de estado */
.assign-select {
  min-height: 28px;
  max-width: 160px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.done {
  background: var(--soft-ok);
  color: var(--ok);
}

.badge.review {
  background: var(--soft-bad);
  color: var(--bad);
}

.task-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.meta {
  background: #f6f8fa;
  border: 1px solid #e8edf2;
  border-radius: 8px;
  padding: 8px;
  min-height: 56px;
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.meta strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.note-box {
  border-left: 3px solid var(--brand-2);
  padding: 8px 10px;
  background: #eef7f8;
  border-radius: 0 8px 8px 0;
  margin: 8px 0 10px;
}

.task-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.task-actions button,
.actions button {
  width: 100%;
}

.photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.photo {
  min-width: 84px;
  min-height: 48px;
  display: grid;
  place-items: center;
  background: #f2f5f7;
  border: 1px dashed #aab6c2;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
}

.compact-table th,
.compact-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.compact-table th {
  color: var(--muted);
  font-size: 12px;
}

.review-card {
  background: #fff8f7;
  border: 1px solid #f0c4bf;
  border-radius: 8px;
  padding: 12px;
}

.history-panel {
  margin-top: 16px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.history-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  background: #fbfcfd;
}

.history-day summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.history-day summary span,
.history-summary {
  color: var(--muted);
  font-size: 13px;
}

.history-summary {
  margin: 10px 0;
}

.history-table {
  min-width: 760px;
}

.history-day[open] {
  overflow-x: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 25, 35, 0.44);
  z-index: 10;
}

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: white;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.25);
}

.user-manager {
  display: grid;
  gap: 14px;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.user-form-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.user-form-head span {
  color: var(--muted);
  font-size: 13px;
}

.user-create-title {
  margin: 4px 0 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px 12px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.pager .pagerInfo {
  color: var(--muted);
  font-size: 13px;
}

.pager button:disabled {
  opacity: 0.4;
}

.zc-picker h2 {
  margin: 0 0 6px;
}

.zc-profile-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.zc-profile-buttons button {
  padding: 18px 12px;
  font-size: 16px;
}

.zc-worker {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.zc-worker:first-of-type {
  border-top: none;
}

.zc-worker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.zc-worker-head strong {
  display: block;
}

.zc-worker-head span {
  color: var(--muted);
  font-size: 13px;
}

.check-grid .check-row {
  margin: 0;
  font-weight: 600;
}

.modal h2 {
  margin: 0 0 14px;
}

.wide-modal {
  width: min(860px, 100%);
}

.sync {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
}

.hidden-file {
  display: none;
}

.cart-summary {
  display: grid;
  gap: 14px;
}

.cart-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .session {
    width: 100%;
    justify-content: space-between;
    text-align: left;
  }

  .toolbar,
  .filters,
  .admin-grid,
  .reception-grid,
  .task-meta {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workload-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workload-grid .metric {
    min-height: 76px;
    padding: 12px;
  }

  .workload-grid .metric span {
    font-size: 11px;
    min-height: 30px;
  }

  .workload-grid .metric strong {
    font-size: 22px;
  }

  .maid-filter,
  .reception-filter {
    max-width: none;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions button {
    flex: 1 1 160px;
  }

  .page {
    padding: 14px;
  }

  .task-actions {
    grid-template-columns: 1fr;
  }
}

#globalLoading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 33, 47, 0.35);
}

#globalLoading[hidden] {
  display: none;
}

.loading-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  color: var(--brand);
  font-weight: bold;
  padding: 14px 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.reparto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 14px;
}

.reparto-head {
  font-weight: bold;
  font-size: 14px;
  color: var(--muted);
}

.cardToggle {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.task-card.maid-collapsed {
  padding: 10px 14px;
}

.task-card.maid-collapsed .task-head {
  margin: 0;
}

.maid-collapsed-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
