
:root {
  color-scheme: dark;
  --background: #111110;
  --surface: #1a1917;
  --surface-light: #22211e;
  --text: #f4f0e8;
  --muted: #aaa49a;
  --gold: #c5a36a;
  --gold-light: #d9bd8a;
  --border: #39352e;
  --error: #f1a6a6;
  --success: #b9d9b5;
  --warning: #e4c58c;
  --container: 1440px;
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(197, 163, 106, 0.07),
      transparent 40%
    ),
    var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

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

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h1 span,
.brand span,
.admin-footer span,
.login-card h1 span {
  color: var(--gold);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

h3 {
  line-height: 1.3;
}

.app-shell {
  width: min(100% - 48px, var(--container));
  min-height: 100vh;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.brand {
  flex-shrink: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1;
  text-decoration: none;
}

.header-right,
.admin-label,
.dashboard-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.admin-label {
  gap: 9px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.public-link {
  color: var(--gold-light);
  font-size: 0.85rem;
  text-decoration: none;
}

.public-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.muted-text {
  color: var(--muted);
}

/* Login */

.login-section {
  position: relative;
  display: grid;
  min-height: 680px;
  place-items: center;
  overflow: hidden;
  padding: 72px 0;
}

.login-decoration {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(70vw, 550px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(197, 163, 106, 0.12);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-decoration::before,
.login-decoration::after {
  position: absolute;
  width: 78%;
  height: 78%;
  border: 1px solid rgba(197, 163, 106, 0.1);
  border-radius: 50%;
  content: "";
}

.login-decoration::after {
  width: 55%;
  height: 55%;
}

.login-decoration span {
  color: rgba(197, 163, 106, 0.08);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(8rem, 20vw, 15rem);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  padding: clamp(26px, 5vw, 44px);
  border: 1px solid var(--border);
  background: rgba(26, 25, 23, 0.96);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.3);
}

.login-card h1 {
  margin-bottom: 14px;
}

.login-card > .muted-text {
  margin: 0 0 28px;
}

#login-form {
  display: grid;
  gap: 18px;
}

.form-field {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.form-field label {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
}

.form-field input,
.form-field select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #111110;
  color: var(--text);
  transition: border-color var(--transition);
}

.form-field input::placeholder {
  color: #77736c;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(197, 163, 106, 0.15);
  outline-offset: 1px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 17px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.button-primary {
  background: var(--gold);
  color: #171512;
}

.button-primary:hover:not(:disabled) {
  border-color: var(--gold-light);
  background: var(--gold-light);
}

.button-secondary {
  background: var(--surface-light);
  color: var(--text);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--gold-light);
  color: var(--gold-light);
}

.button-outline {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.button-outline:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--text);
}

.full-width {
  width: 100%;
}

.login-footer {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

/* Dashboard */

.dashboard {
  padding: 58px 0 70px;
}

.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.welcome-row .muted-text {
  margin: 14px 0 0;
}

.dashboard-actions {
  justify-content: flex-end;
}

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

.stat-card {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-card strong {
  margin: 3px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1.2;
}

.stat-caption {
  color: var(--muted);
  font-size: 0.72rem;
}

.stat-pending strong {
  color: var(--warning);
}

.stat-approved strong {
  color: var(--success);
}

/* Tabla */

.bookings-panel {
  border: 1px solid var(--border);
  background: var(--surface);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px;
  border-bottom: 1px solid var(--border);
}

.panel-heading .eyebrow {
  margin-bottom: 7px;
}

.last-updated {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 250px);
  gap: 18px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
}

.search-field {
  max-width: 560px;
}

.filter-field {
  max-width: 250px;
}

.message {
  min-height: 22px;
  margin: 0;
  font-size: 0.85rem;
}

#login-message {
  margin-top: -6px;
}

#dashboard-message {
  padding: 0 26px;
}

.message[data-state="error"] {
  color: var(--error);
}

.message[data-state="success"] {
  color: var(--success);
}

.message[data-state="info"] {
  color: var(--muted);
}

.empty-state {
  display: grid;
  min-height: 200px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state h3 {
  color: var(--text);
  font-size: 1rem;
}

.loading-spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 17px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: #201f1c;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  font-size: 0.82rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

.booking-date {
  min-width: 145px;
  white-space: nowrap;
}

.booking-date strong,
.booking-date span,
.customer-cell strong,
.customer-cell span,
.service-cell strong,
.service-cell span {
  display: block;
}

.booking-date strong,
.customer-cell strong,
.service-cell strong {
  color: var(--text);
  font-weight: 600;
}

.booking-date span,
.customer-cell span,
.service-cell span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.customer-cell {
  min-width: 160px;
}

.service-cell {
  min-width: 125px;
}

.barber-cell {
  min-width: 110px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.status-pending {
  border-color: rgba(228, 197, 140, 0.4);
  color: var(--warning);
}

.status-approved {
  border-color: rgba(185, 217, 181, 0.4);
  color: var(--success);
}

.status-rejected,
.status-cancelled {
  color: var(--muted);
}

.actions-cell {
  min-width: 190px;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-button {
  min-height: 31px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-size: 0.72rem;
  transition:
    border-color var(--transition),
    color var(--transition);
}

.action-button:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-light);
}

.action-approve {
  border-color: rgba(185, 217, 181, 0.35);
  color: var(--success);
}

.action-reject {
  color: var(--error);
}

.table-note {
  margin: 0;
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}

/* Footer y avisos */

.admin-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0 30px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

.admin-footer p {
  margin: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 32px));
  padding: 15px 18px;
  border: 1px solid var(--gold);
  background: var(--surface-light);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-size: 0.85rem;
}

/* Adaptación a pantallas medianas */

@media (max-width: 1000px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .welcome-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-actions {
    justify-content: flex-start;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .last-updated {
    text-align: left;
  }
}

/* Adaptación a móviles */

@media (max-width: 650px) {
  .app-shell {
    width: min(100% - 32px, var(--container));
  }

  .admin-header {
    min-height: 80px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 20px 0;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .admin-label {
    font-size: 0.58rem;
  }

  .public-link {
    font-size: 0.75rem;
  }

  .login-section {
    min-height: 610px;
    padding: 48px 0;
  }

  .login-decoration {
    width: 90vw;
  }

  .dashboard {
    padding-top: 40px;
  }

  .dashboard-actions {
    width: 100%;
    gap: 10px;
  }

  .dashboard-actions .button {
    flex: 1;
    padding: 10px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    min-height: 125px;
    padding: 16px;
  }

  .stat-card strong {
    font-size: 2rem;
  }

  .stat-caption {
    font-size: 0.66rem;
  }

  .panel-heading {
    padding: 22px 18px;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px;
  }

  .filter-field,
  .search-field {
    max-width: none;
  }

  #dashboard-message {
    padding: 0 18px;
  }

  .table-note {
    padding: 16px 18px;
  }

  .admin-footer {
    flex-direction: column;
    gap: 8px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
}

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


/* ==========================================================
   AÑADIDOS PARA admin.css
   Pega este bloque al final de admin.css (antes del bloque
   prefers-reduced-motion, o después, da igual).
   Solo cubre clases que ya usas en admin.html.
   ========================================================== */

/* Ganancias */

.earnings-panel {
  margin-bottom: 28px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.earnings-filters {
  min-width: 190px;
}

.filter-select {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #111110;
  color: var(--text);
  transition: border-color var(--transition);
}

.filter-select:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(197, 163, 106, 0.15);
  outline-offset: 1px;
}

.earnings-content {
  padding: 26px;
}

.earnings-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  background: var(--surface-light);
}

.earnings-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.earnings-card strong {
  color: var(--gold-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
}

/* Estado "Completada" (faltaba el badge) */

.status-completed {
  border-color: rgba(217, 189, 138, 0.4);
  color: var(--gold-light);
}

/* Pantallas medianas */

@media (max-width: 1000px) {
  .earnings-filters {
    width: 100%;
    max-width: 250px;
  }
}

/* Móviles */

@media (max-width: 650px) {
  .hide-mobile {
    display: none;
  }

  .earnings-content {
    padding: 18px;
  }

  .earnings-card {
    padding: 18px;
  }
}

.availability-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px; margin-bottom: 24px; border: 1px solid rgba(255,255,255,.12); }
.availability-panel[data-state="off"] { border-color: #e0b44c; }
.availability-panel strong { display: block; margin: 4px 0; }
.earnings-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.earnings-services { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.earnings-services li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.overdue-alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; border: 1px solid #e0b44c; color: #e0b44c; }
.overdue-alert[hidden] { display: none; }
.row-overdue { background: rgba(224,180,76,.08); }
.overdue-tag { display: inline-block; margin-left: 8px; font-size: .75em; color: #e0b44c; text-transform: uppercase; letter-spacing: .06em; }
.action-whatsapp { text-decoration: none; color: #6fcf8e; border: 1px solid #6fcf8e; background: transparent; }