.customers-page {
  background: #f7f8fb;
  color: #11224a;
}

.customers-shell {
  width: min(100% - 28px, 1480px);
  padding-top: 18px;
}

.customers-hero,
.customers-toolbar,
.customers-list-card,
.customer-detail {
  border: 1px solid rgba(11, 42, 107, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 48px rgba(11, 42, 107, 0.08);
}

.customers-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.customers-hero h2,
.customers-list-header h2,
.customer-detail h2,
.customer-section h3,
.customer-loyalty-card h4,
.customer-admin-movements h4 {
  color: #0b2a6b;
  margin: 0;
}

.customers-hero p {
  margin: 8px 0 0;
  color: #52607a;
}

.customers-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 240px auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin-bottom: 14px;
}

.customers-toolbar .admin-button,
.customers-export-button {
  min-height: 44px;
}

.customers-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}

.customers-export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: #0b2a6b;
  background: #0b2a6b;
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 42, 107, 0.18);
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.customers-export-button:hover:not(:disabled) {
  border-color: #071f50;
  background: #071f50;
  box-shadow: 0 10px 22px rgba(11, 42, 107, 0.24);
  transform: translateY(-1px);
}

.customers-export-button:focus-visible {
  outline: 3px solid rgba(140, 198, 63, 0.55);
  outline-offset: 3px;
}

.customers-export-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.customers-search,
.customers-filter {
  display: grid;
  gap: 7px;
  color: #52607a;
  font-weight: 850;
  font-size: 0.86rem;
}

.customers-search input,
.customers-filter select,
.customer-action-form input,
.customer-action-form select,
.customer-action-form textarea,
.customer-notes textarea {
  width: 100%;
  border: 1px solid rgba(11, 42, 107, 0.18);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: #11224a;
  font: inherit;
}

.customers-layout {
  display: block;
}

.customers-list-card {
  padding: 14px;
}

.customer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(7, 20, 48, 0.56);
  overscroll-behavior: contain;
}

.customer-modal.hidden {
  display: none;
}

.customer-modal-panel {
  display: flex;
  width: min(1100px, 94vw);
  max-width: 100%;
  max-height: 90vh;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(11, 42, 107, 0.18);
  border-radius: 16px;
  background: #fef9e7;
  box-shadow: 0 28px 80px rgba(7, 20, 48, 0.34);
}

.customer-modal-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(11, 42, 107, 0.12);
  background: #fff;
}

.customer-modal-header h2,
.customer-modal-header p {
  margin: 0;
}

.customer-modal-header h2 {
  color: #0b2a6b;
}

.customer-modal-status {
  margin-top: 4px !important;
  color: #52607a;
  font-size: 0.84rem;
  font-weight: 800;
}

.customer-modal-close {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid rgba(11, 42, 107, 0.16);
  border-radius: 12px;
  background: #f3f6fa;
  color: #0b2a6b;
  font: inherit;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.customer-modal-close:hover {
  background: #eaf6da;
}

.customer-modal-close:focus-visible,
.customer-row:focus-visible {
  outline: 3px solid rgba(140, 198, 63, 0.55);
  outline-offset: 3px;
}

.customer-detail {
  min-height: 180px;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.customers-list-header,
.customer-detail-header,
.customer-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.customers-list-header {
  align-items: center;
  margin-bottom: 12px;
}

.customers-count,
.customer-status {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #0b2a6b;
  background: #eaf6da;
  font-weight: 950;
  white-space: nowrap;
}

.customer-status.is-warning {
  color: #7a4b00;
  background: #fff3cd;
}

.customer-status.is-pending {
  color: #12305e;
  background: #e8eef8;
}

.customer-status.is-linked {
  color: #0b2a6b;
  background: #dff3c9;
}

.customers-list {
  display: grid;
  gap: 6px;
  width: 100%;
  padding-right: 2px;
}

.customer-table-head,
.customer-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1.4fr)
    minmax(0, 0.85fr)
    minmax(0, 1.2fr)
    minmax(0, 0.62fr)
    minmax(0, 0.52fr)
    minmax(0, 0.56fr)
    minmax(0, 0.8fr);
  gap: 10px;
  align-items: center;
}

.customer-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border: 1px solid rgba(11, 42, 107, 0.1);
  border-radius: 8px;
  background: #eef4f9;
  color: #0b2a6b;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.customer-row {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(11, 42, 107, 0.1);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.customer-row:hover,
.customer-row.is-active {
  border-color: #8cc63f;
  box-shadow: inset 4px 0 0 #8cc63f;
}

.customer-row:hover {
  transform: translateY(-1px);
}

.customer-row strong {
  color: #0b2a6b;
}

.customer-row-name,
.customer-table-value,
.customer-table-number,
.customer-account {
  min-width: 0;
}

.customer-row-name strong,
.customer-row-name small,
.customer-table-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row-name small,
.customer-table-number small,
.customer-metric small {
  display: block;
  margin-top: 2px;
  color: #52607a;
  font-size: 0.74rem;
  font-weight: 800;
}

.customer-table-value,
.customer-table-number {
  color: #11224a;
  font-size: 0.86rem;
  font-weight: 850;
}

.customer-account {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  color: #7a4b00;
  background: #fff3cd;
  font-size: 0.78rem;
  font-weight: 950;
}

.customer-account.is-linked {
  color: #0b2a6b;
  background: #eaf6da;
}

.customer-row p,
.customer-meta,
.customer-empty,
.customer-small,
.customer-note-preview,
.customer-loyalty-card p,
.customer-movement p {
  margin: 0;
  color: #52607a;
  font-size: 0.9rem;
}

.customer-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.customer-fields,
.customer-metrics,
.customer-loyalty-grid {
  display: grid;
  gap: 8px;
}

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

.customer-metrics.is-operational {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.customer-field,
.customer-metric,
.customer-card,
.customer-loyalty-card,
.customer-movement,
.customer-note-preview {
  border: 1px solid rgba(11, 42, 107, 0.08);
  border-radius: 8px;
  background: #fff;
}

.customer-field {
  padding: 10px;
}

.customer-field span,
.customer-metric span,
.customer-cita-grid strong,
.customer-movement span {
  display: block;
  color: #52607a;
  font-size: 0.76rem;
  font-weight: 850;
}

.customer-field strong {
  display: block;
  margin-top: 4px;
  color: #11224a;
}

.customer-metric {
  padding: 9px;
  color: #0b2a6b;
}

.customer-metric strong {
  display: block;
  margin-top: 2px;
  font-size: 1.08rem;
}

.customer-section {
  border-top: 1px solid rgba(11, 42, 107, 0.1);
  padding-top: 14px;
  margin-top: 14px;
}

.customer-section h3 {
  margin-bottom: 10px;
}

.customer-card-list,
.customer-loyalty-list,
.customer-admin-movements,
.customer-record-columns {
  display: grid;
  gap: 9px;
}

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

.customer-record-columns h4,
.customer-timeline-group h4 {
  margin: 0 0 8px;
  color: #0b2a6b;
}

.customer-card,
.customer-loyalty-card,
.customer-movement,
.customer-note-preview {
  padding: 10px;
}

.customer-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.customer-action-button {
  border: 0;
  border-radius: 8px;
  padding: 9px 11px;
  color: #fff;
  background: #0b2a6b;
  font-weight: 900;
  cursor: pointer;
}

.customer-action-button.is-light {
  color: #0b2a6b;
  background: #eaf6da;
}

.customer-action-button.is-danger {
  background: #b42318;
}

.customer-action-button.is-whatsapp {
  color: #10351f;
  background: #bff0c8;
}

.customer-action-button.is-disabled,
.customer-action-button:disabled {
  color: #6b7280;
  background: #e5e7eb;
  cursor: not-allowed;
}

.customer-reminder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(11, 42, 107, 0.12);
  border-radius: 14px;
  background: #fef9e7;
  overflow-wrap: anywhere;
}

.customer-elapsed-label {
  margin-top: 5px;
  color: #0b2a6b;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
}

.customer-reminder-summary {
  min-width: 0;
  flex: 1 1 280px;
}

.customer-reminder-summary .customer-reminder-button {
  margin-top: 10px;
}

.customer-reminder-frequency {
  min-width: min(100%, 280px);
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(11, 42, 107, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.customer-reminder-frequency label {
  display: grid;
  grid-template-columns: auto minmax(70px, 92px) auto;
  align-items: center;
  gap: 7px;
  color: #0b2a6b;
  font-size: 0.82rem;
  font-weight: 850;
}

.customer-reminder-frequency .customer-reminder-frequency-title {
  grid-column: 1 / -1;
  font-weight: 950;
}

.customer-reminder-frequency input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid rgba(11, 42, 107, 0.18);
  border-radius: 10px;
  padding: 0 10px;
  color: #0b2a6b;
  background: #ffffff;
  font: inherit;
  font-weight: 900;
}

.customer-reminder-frequency input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.customer-reminder-frequency-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.customer-reminder-frequency-actions > * {
  flex: 1 1 120px;
  min-height: 44px;
}

.customer-reminder-save-status {
  min-height: 1.2em;
  margin: 0;
  color: #52607a;
  font-size: 0.78rem;
  font-weight: 800;
}

.customer-reminder.is-eligible {
  border-color: rgba(140, 198, 63, 0.4);
  background: #edf4ff;
}

.customer-reminder span,
.customer-reminder strong,
.customer-reminder p {
  display: block;
}

.customer-reminder span {
  color: #4f7f19;
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.customer-reminder strong {
  margin-top: 3px;
  color: #0b2a6b;
}

.customer-reminder p {
  margin: 4px 0 0;
  color: #52607a;
  font-size: 0.84rem;
}

.customer-reminder-button {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid #0b2a6b;
  border-radius: 11px;
  background: #0b2a6b;
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.customer-reminder-button:hover {
  background: #123b8a;
  transform: translateY(-1px);
}

.customer-reminder-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

.customer-reminder-button:disabled {
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #64748b;
  cursor: not-allowed;
}

.customer-action-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.customer-action-form textarea,
.customer-action-form button,
.customer-notes {
  grid-column: 1 / -1;
}

.customer-notes {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.customer-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef8;
  margin: 10px 0;
}

.customer-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #8cc63f;
}

.customer-loyalty-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.customer-timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.customer-timeline::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 8px;
  width: 2px;
  background: #d8e1ec;
}

.customer-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
}

.customer-timeline-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 12px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #8cc63f;
  box-shadow: 0 0 0 1px rgba(11, 42, 107, 0.18);
}

.customer-timeline-item.is-cancelada .customer-timeline-dot,
.customer-timeline-item.is-no_asistio .customer-timeline-dot {
  background: #b42318;
}

.customer-timeline-item.is-pendiente .customer-timeline-dot,
.customer-timeline-item.is-confirmada .customer-timeline-dot,
.customer-timeline-item.is-en_camino .customer-timeline-dot {
  background: #f4b740;
}

.customer-timeline-card {
  border: 1px solid rgba(11, 42, 107, 0.1);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.customer-cita-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  color: #11224a;
  font-size: 0.84rem;
}

.customer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.customer-badge,
.customer-link-reason {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 900;
}

.customer-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.customer-badge.is-good {
  color: #0b2a6b;
  background: #dff3c9;
}

.customer-badge.is-muted {
  color: #52607a;
  background: #eef2f7;
}

.customer-badge.is-reward {
  color: #7a4b00;
  background: #fff3cd;
}

.customer-badge.is-warning {
  color: #7a4b00;
  background: #fff3cd;
}

.customer-link-reason {
  width: fit-content;
  margin-top: 10px;
  color: #0b2a6b;
  background: #e8eef8;
}

.customer-cita-comment {
  margin: 10px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: #f7f8fb;
  color: #52607a;
  font-size: 0.86rem;
}

.customer-item-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid rgba(11, 42, 107, 0.1);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.customer-item-photo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 8px;
  background: #f7f8fb;
  color: #52607a;
  font-size: 0.78rem;
  font-weight: 900;
}

.customer-item-photo img {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 3px;
  background: #fff;
  object-fit: contain;
  object-position: center;
}

.customer-item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
  color: #11224a;
  font-size: 0.82rem;
}

.customer-item-grid strong {
  display: block;
  color: #52607a;
  font-size: 0.72rem;
}

.customer-timeline-group + .customer-timeline-group {
  margin-top: 14px;
}

@media (max-width: 1180px) {
  .customer-modal-panel {
    width: min(1040px, 95vw);
  }
}

@media (max-width: 820px) {
  .customers-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .customers-hero-actions,
  .customers-export-button {
    width: 100%;
  }

  .customers-hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .customers-export-button {
    white-space: normal;
  }

  .customer-modal {
    padding: 10px;
  }

  .customer-modal-panel {
    width: 96vw;
    max-height: 94dvh;
    border-radius: 14px;
  }

  .customer-modal-header {
    align-items: flex-start;
    padding: 13px 14px;
  }
}

@media (max-width: 900px) {
  .customer-table-head {
    display: none;
  }

  .customer-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
  }

  .customer-row-name,
  .customer-status {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .customers-toolbar,
  .customer-fields,
  .customer-action-form,
  .customer-metrics.is-operational,
  .customer-loyalty-grid,
  .customer-cita-grid,
  .customer-record-columns,
  .customer-item-grid {
    grid-template-columns: 1fr;
  }

  .customer-detail-header,
  .customer-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .customer-header-actions {
    justify-content: flex-start;
  }

  .customer-reminder {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-reminder-frequency {
    width: 100%;
    min-width: 0;
  }

  .customer-reminder-frequency label {
    grid-template-columns: auto minmax(64px, 1fr) auto;
  }

  .customer-reminder-button {
    width: 100%;
  }

  .customer-row {
    padding: 12px;
  }

  .customer-row-name,
  .customer-status {
    grid-column: 1 / -1;
  }

  .customer-row-name strong,
  .customer-row-name small,
  .customer-table-value {
    white-space: normal;
  }
}

@media (max-width: 430px) {
  .customer-modal {
    padding: 6px;
  }

  .customer-modal-panel {
    width: 100%;
    max-height: 96dvh;
    border-radius: 12px;
  }

  .customer-detail {
    padding: 12px;
  }

  .customer-modal-header {
    padding: 11px 12px;
  }
}

.customer-behavior-form {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin-top: 12px;
}
.customer-behavior-badge.is-green { background: #dcfce7; color: #166534; }
.customer-behavior-badge.is-orange { background: #ffedd5; color: #9a3412; }
.customer-behavior-badge.is-red { background: #fee2e2; color: #991b1b; }
.customer-behavior-badge.is-unclassified { background: #f1f5f9; color: #475569; }
.customer-behavior-form fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.customer-behavior-form legend { margin-bottom: 7px; color: #0b2a6b; font-weight: 900; }
.customer-behavior-option { display: block; min-width: 0; cursor: pointer; }
.customer-behavior-option input { position: absolute; opacity: 0; pointer-events: none; }
.customer-behavior-option span {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid #dbe3ef;
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.customer-behavior-option input:checked + span { border-color: #0b2a6b; box-shadow: 0 0 0 2px rgba(11,42,107,.14); }
.customer-behavior-option input:focus-visible + span { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
.customer-behavior-form [data-behavior-status] { min-height: 1.2em; margin: 0; }
@media (max-width: 430px) {
  .customer-behavior-form fieldset { grid-template-columns: minmax(0, 1fr); }
  .customer-behavior-form button { width: 100%; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .customer-behavior-option span,
  .customer-row { transition: none; }
}
