:root {
  --bg: #f6f7f9;
  --paper: #ffffff;
  --ink: #1b1f23;
  --ink-mute: #6b7280;
  --accent: #4f46e5;
  --line: #e5e7eb;
  --danger: #dc2626;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }

.panel-shell { display: flex; flex-direction: column; min-height: 100vh; }
@media (min-width: 1000px) {
  .panel-shell { flex-direction: row; }
}

.panel-form {
  background: var(--paper);
  padding: 1.5rem;
  width: 100%;
  border-bottom: 1px solid var(--line);
  overflow-y: auto;
}
@media (min-width: 1000px) {
  .panel-form { width: 420px; min-width: 420px; height: 100vh; border-bottom: 0; border-right: 1px solid var(--line); }
}

.panel-header h1 { font-size: 1.3rem; margin: 0 0 .3rem; }
.panel-header p { font-size: .85rem; color: var(--ink-mute); margin: 0 0 1.2rem; }
.panel-header-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.logout-link { font-size: .8rem; color: var(--ink-mute); text-decoration: underline; white-space: nowrap; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 2rem; width: 100%; max-width: 340px;
}
.login-card h1 { font-size: 1.2rem; margin: 0 0 1.2rem; }
.login-card .btn { width: 100%; margin-top: .4rem; }
.login-error { background: #fee2e2; color: #991b1b; padding: .6rem .8rem; border-radius: 8px; font-size: .82rem; margin-bottom: 1rem; }

.field { display: grid; gap: .35rem; margin-bottom: .9rem; font-size: .85rem; }
.field span { font-weight: 600; color: var(--ink); }
.field input, .field textarea, select {
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; width: 100%; background: var(--paper);
}
/* Campos que se muestran pero no se editan (p. ej. el nombre del negocio:
   cambiarlo arrastra dominio, aviso legal y facturación). */
.field input[readonly] { background: #f1f0ee; color: var(--ink-mute); cursor: not-allowed; }


fieldset { border: 0; border-top: 1px solid var(--line); padding: 1rem 0; margin: 0; }
legend { font-weight: 700; font-size: .9rem; padding: 0; margin-bottom: .6rem; }

.repeat-list { display: grid; gap: .8rem; margin-bottom: .8rem; }
.repeat-row {
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem;
  display: grid; gap: .5rem; position: relative; background: #fafafa;
}
.repeat-row .row-remove {
  position: absolute; top: .4rem; right: .4rem;
  font-size: .75rem; color: var(--danger); background: none; border: 0; cursor: pointer;
}
.repeat-row label { display: grid; gap: .25rem; font-size: .78rem; color: var(--ink-mute); }
.repeat-row input, .repeat-row textarea { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: .85rem; }

.btn { border-radius: 8px; padding: .6rem 1rem; font-size: .85rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.btn-add { background: #eef2ff; color: var(--accent); border: 1px dashed var(--accent); width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--paper); border: 1px solid var(--line); color: var(--ink); }

.panel-actions { display: flex; gap: .7rem; margin-top: 1.2rem; flex-wrap: wrap; }
.save-msg { font-size: .82rem; color: #16a34a; min-height: 1.2em; margin-top: .6rem; }

.panel-preview { flex: 1; display: flex; flex-direction: column; }
.preview-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line);
  font-size: .82rem; color: var(--ink-mute);
}
.preview-toolbar a { color: var(--accent); text-decoration: none; }
#preview-frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: 60vh; }

/* =============================================================
   Menú del panel (Editar datos / Reservas / Horarios)
   ============================================================= */
.admin-nav {
  display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap;
  padding: .9rem 1.5rem; background: var(--paper); border-bottom: 1px solid var(--line);
  font-size: .88rem;
}
.admin-nav a { color: var(--ink-mute); font-weight: 600; }
.admin-nav a.active { color: var(--accent); }
.admin-nav a.logout { margin-left: auto; font-weight: 400; text-decoration: underline; }

/* =============================================================
   Páginas de Reservas y Horarios
   ============================================================= */
.admin-page { max-width: 900px; margin: 0 auto; padding: 2rem 1.75rem; }
.admin-page h1 { font-size: 1.3rem; margin-bottom: .3rem; }
.admin-page .hint { color: var(--ink-mute); font-size: .85rem; margin-bottom: 1.2rem; max-width: 600px; }
.admin-page .field { margin-bottom: 1.2rem; }
.table-scroll { overflow-x: auto; margin-top: 1rem; -webkit-overflow-scrolling: touch; }
.empty-note { color: var(--ink-mute); font-size: .9rem; margin-top: 1rem; }

.appt-table, .hours-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .88rem; }
.appt-table th, .appt-table td, .hours-table th, .hours-table td {
  padding: .7rem .9rem; border-bottom: 1px solid var(--line); text-align: left;
}
.appt-table th, .hours-table th { color: var(--ink-mute); font-weight: 600; font-size: .8rem; }
.row-cancelled td { color: var(--ink-mute); text-decoration: line-through; }
.row-notes td { padding-top: 0; padding-bottom: .8rem; font-size: .82rem; color: var(--ink-mute); }
.btn-cancel {
  background: #fee2e2; color: #991b1b; border: 0; border-radius: 6px;
  padding: .35rem .7rem; font-size: .8rem; cursor: pointer;
}
.hours-table input[type="time"], .hours-table input[type="number"] { padding: .3rem .4rem; }

/* =============================================================
   Horario de solo lectura (Editar datos → Horario)
   ============================================================= */
.schedule-readonly { list-style: none; margin: 0; padding: 0; }
.schedule-readonly li {
  display: flex; justify-content: space-between; padding: .4rem 0;
  border-bottom: 1px solid var(--line); font-size: .88rem;
}
.schedule-readonly li span:last-child { color: var(--ink-mute); }

/* =============================================================
   Alta manual de reserva
   ============================================================= */
.manual-appt { margin: 1.2rem 0 1.6rem; border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.manual-appt summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.manual-appt-form { display: grid; gap: .8rem; margin-top: 1rem; max-width: 420px; }
.manual-appt-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.manual-appt-form select, .manual-appt-form textarea { padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; width: 100%; }

/* =============================================================
   Empleados
   ============================================================= */
.services-check { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; }
.services-check legend { font-size: .82rem; font-weight: 600; color: var(--ink-mute); margin-bottom: .4rem; padding: 0; }
.check-item { display: flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 400; }

.staff-list { display: grid; gap: 1rem; margin-top: 1.2rem; }
.staff-card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: #fafafa; position: relative; }
.staff-card-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.staff-card-head input[type="text"] { flex: 1; min-width: 160px; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 600; }
.active-toggle { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--ink-mute); white-space: nowrap; }
.staff-card-actions { margin-top: .9rem; }
.staff-delete-form { position: absolute; top: .8rem; right: 1rem; }

/* =============================================================
   Interruptor de reservas online (Horarios)
   ============================================================= */
.toggle-reservations { margin: 1rem 0; }

/* =============================================================
   Campo de foto (portada, servicios, equipo)
   ============================================================= */
.image-field { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: .3rem; }
.image-preview { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f0f0f0; }
.image-field input[type="file"] { font-size: .78rem; max-width: 180px; }
.image-remove-btn { background: #fee2e2; color: #991b1b; border: 0; border-radius: 6px; padding: .3rem .6rem; font-size: .78rem; cursor: pointer; white-space: nowrap; }
.image-status { font-size: .78rem; color: var(--ink-mute); }

/* =============================================================
   Listas de fotos (portada / galería)
   ============================================================= */
.image-list { display: flex; flex-direction: column; gap: .8rem; margin-bottom: .8rem; }
.image-list-item { border: 1px solid var(--line); border-radius: 8px; padding: .6rem; background: #fafafa; }

/* =============================================================
   Aviso genérico dentro de "Editar datos"
   ============================================================= */
.panel-form .hint { color: var(--ink-mute); font-size: .82rem; margin: -.4rem 0 .8rem; }

/* =============================================================
   Mensajes de contacto
   ============================================================= */
.msg-list { display: grid; gap: 1rem; margin-top: 1.2rem; }
.msg-card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: #fafafa; }
.msg-card.msg-unread { background: #fff8ed; border-color: #f0d9a8; }
.msg-head { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.msg-date { font-size: .78rem; color: var(--ink-mute); white-space: nowrap; }
.msg-contact { font-size: .85rem; color: var(--ink-mute); margin: .3rem 0 .6rem; }
.msg-body { font-size: .92rem; white-space: pre-line; margin-bottom: .8rem; }
.msg-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
