/* Mi Peluquería — estilos. Diseño móvil primero; crece bien en tablet y PC. */
:root {
  --primario: #8e4a63;
  --primario-osc: #6f3a4e;
  --primario-claro: #f3e3ea;
  --fondo: #faf7f5;
  --tarjeta: #ffffff;
  --texto: #3a2e33;
  --texto-suave: #8a7580;
  --borde: #e8dde2;
  --ok: #3d8b5f;
  --peligro: #b04444;
  --aviso: #b58a2f;
  --minpx: 1.7; /* píxeles por minuto en la agenda */
  --radio: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  min-height: 100vh;
  padding-bottom: 110px; /* hueco para el menú inferior: que nada quede tapado */
}
.oculto { display: none !important; }

/* Portada de bienvenida */
.portada {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0c0c0d;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity .45s;
}
.portada.saliendo { opacity: 0; pointer-events: none; }
.portada img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
/* En pantallas apaisadas (PC, tablet girada) la foto vertical se muestra entera */
@media (orientation: landscape) {
  .portada img { object-fit: contain; object-position: center; }
}
.portada-entrar {
  position: absolute;
  bottom: max(48px, env(safe-area-inset-bottom, 0px) + 48px);
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 15px 54px;
  border-radius: 40px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.portada-entrar:active { transform: translateX(-50%) scale(.97); }

/* Cabecera */
.cabecera {
  background: var(--primario);
  color: #fff;
  padding: 14px 18px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.cabecera h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: .3px; }
.cab-fecha { font-size: .85rem; opacity: .85; }

.contenido { padding: 14px; max-width: 1100px; margin: 0 auto; }

/* Aviso copia de seguridad */
.aviso-copia {
  background: #fdf3dc;
  color: #6d5410;
  padding: 10px 14px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Menú inferior */
.menu {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--tarjeta);
  border-top: 1px solid var(--borde);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.menu-btn {
  flex: 1;
  border: 0;
  background: none;
  padding: 8px 4px 10px;
  font-size: .78rem;
  color: var(--texto-suave);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.menu-btn span { font-size: 1.35rem; }
.menu-btn.activo { color: var(--primario); font-weight: 700; }

/* Botón flotante */
.fab {
  position: fixed;
  right: 16px;
  bottom: 86px;
  background: var(--primario);
  color: #fff;
  border: 0;
  border-radius: 30px;
  padding: 14px 22px;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  cursor: pointer;
  z-index: 25;
}
.fab:active { transform: scale(.97); }

/* Botones */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primario-claro);
  color: var(--primario-osc);
}
.btn-primario { background: var(--primario); color: #fff; }
.btn-peligro { background: #f7e2e2; color: var(--peligro); }
.btn-ok { background: #e0f0e7; color: var(--ok); }
.btn-mini { padding: 5px 10px; font-size: .8rem; }
.btn-bloque { display: block; width: 100%; margin-top: 10px; padding: 13px; font-size: 1rem; }
.btn:disabled { opacity: .45; cursor: default; }

/* Tarjetas y listas */
.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 14px;
  margin-bottom: 12px;
}
.tarjeta h3 { font-size: 1rem; margin-bottom: 8px; }
.fila-lista {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--borde);
  cursor: pointer;
}
.fila-lista:last-child { border-bottom: 0; }
.fila-lista .crece { flex: 1; min-width: 0; }
.fila-lista .sub { font-size: .82rem; color: var(--texto-suave); }
.etiqueta {
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primario-claro);
  color: var(--primario-osc);
  white-space: nowrap;
}
.etiqueta.ok { background: #e0f0e7; color: var(--ok); }
.etiqueta.mal { background: #f7e2e2; color: var(--peligro); }
.etiqueta.aviso { background: #fdf3dc; color: #6d5410; }

/* Formularios */
.campo { margin-bottom: 12px; }
.campo label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 4px; color: var(--texto-suave); }
.campo input, .campo select, .campo textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--texto);
}
.campo textarea { min-height: 70px; resize: vertical; }
.campos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Modal */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(40,25,32,.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-caja {
  background: var(--fondo);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
}
@media (min-width: 700px) {
  .modal-fondo { align-items: center; }
  .modal-caja { border-radius: 18px; }
}
.modal-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}
.modal-cab h2 { font-size: 1.1rem; }
.btn-cerrar { border: 0; background: var(--primario-claro); color: var(--primario-osc); width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; cursor: pointer; }
.modal-cuerpo { padding: 0 16px 20px; overflow-y: auto; }

/* ===== Agenda ===== */
.agenda-barra {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.agenda-barra .crece { flex: 1; text-align: center; font-weight: 700; }
.selector-vista { display: flex; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.selector-vista button { border: 0; background: #fff; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--texto-suave); }
.selector-vista button.activo { background: var(--primario); color: #fff; }

.agenda-cerrado { text-align: center; padding: 40px 10px; color: var(--texto-suave); }

.agenda-rejilla {
  display: grid;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  overflow-x: auto;
}
.ag-cab-op {
  padding: 8px 6px;
  text-align: center;
  font-size: .85rem;
  font-weight: 700;
  border-bottom: 2px solid var(--borde);
  border-left: 1px solid var(--borde);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-horas { position: relative; border-right: 1px solid var(--borde); }
.ag-hora-marca {
  position: absolute;
  right: 6px;
  transform: translateY(-50%);
  font-size: .72rem;
  color: var(--texto-suave);
}
.ag-col { position: relative; border-left: 1px solid var(--borde); }
.ag-linea { position: absolute; left: 0; right: 0; border-top: 1px dashed #f0e8ec; }
.ag-fuera { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #f5eff2, #f5eff2 6px, #efe7eb 6px, #efe7eb 12px); }
.ag-ahora {
  position: absolute;
  left: 0; right: 0;
  border-top: 2px solid #e03131;
  z-index: 2;
  pointer-events: none;
}
.ag-ahora::before {
  content: "";
  position: absolute;
  left: 0; top: -5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #e03131;
}
.agenda-resumen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.agenda-resumen .etiqueta { font-size: .82rem; padding: 5px 11px; }
.qr-caja {
  text-align: center;
  margin: 12px 0;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 14px;
}
.qr-caja img { width: min(260px, 70vw); image-rendering: pixelated; }
.qr-caja p { font-size: .85rem; color: var(--texto-suave); margin-top: 8px; }
.ag-cita {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 8px;
  padding: 3px 6px;
  font-size: .78rem;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.ag-cita.cobrada { opacity: .55; }
.ag-cita .ag-c-hora { font-weight: 700; font-size: .72rem; }
.ag-cita .ag-c-serv { opacity: .9; font-size: .7rem; }

/* Vista semana */
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.sem-dia {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 8px 6px;
  min-height: 90px;
  cursor: pointer;
  font-size: .78rem;
}
.sem-dia.hoy { border-color: var(--primario); box-shadow: 0 0 0 1px var(--primario); }
.sem-dia.cerrado { background: #f4eff1; color: var(--texto-suave); }
.sem-dia h4 { font-size: .78rem; margin-bottom: 5px; }
.sem-cita { border-radius: 5px; color: #fff; padding: 1px 4px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .semana { grid-template-columns: repeat(2, 1fr); } }

/* Huecos (chips de horas) */
.huecos { display: flex; flex-wrap: wrap; gap: 8px; }
.hueco {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 9px;
  padding: 9px 13px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
.hueco.activo { background: var(--primario); color: #fff; border-color: var(--primario); }

/* Chips genéricos (servicios, operadores, días) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 20px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: .92rem;
}
.chip.activo { background: var(--primario); color: #fff; border-color: var(--primario); font-weight: 600; }

/* Resumen caja */
.caja-cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.cifra { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; text-align: center; }
.cifra .num { font-size: 1.25rem; font-weight: 800; color: var(--primario-osc); }
.cifra .txt { font-size: .75rem; color: var(--texto-suave); }

/* Modo cliente */
.mc {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, var(--primario) 0%, var(--primario-osc) 100%);
  z-index: 100;
  overflow-y: auto;
  color: #fff;
  padding: 24px 18px 40px;
}
.mc-caja { max-width: 520px; margin: 0 auto; }
.mc h1 { text-align: center; font-size: 1.6rem; margin: 18px 0 6px; }
.mc .mc-sub { text-align: center; opacity: .85; margin-bottom: 24px; }
.mc-panel { background: #fff; color: var(--texto); border-radius: 18px; padding: 18px; }
.mc-panel h2 { font-size: 1.1rem; margin-bottom: 12px; }
.mc-salir { position: fixed; top: 10px; right: 10px; background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 20px; padding: 7px 13px; font-size: .8rem; cursor: pointer; }
.mc-exito { text-align: center; padding: 30px 10px; }
.mc-exito .mc-icono { font-size: 3.2rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #3a2e33;
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: .92rem;
  opacity: 0;
  transition: all .3s;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.mal { background: var(--peligro); }
.toast.ok { background: var(--ok); }

/* Detalle cita */
.detalle-linea { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--borde); font-size: .95rem; }
.detalle-linea b { text-align: right; }
.botonera { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.botonera .ancho { grid-column: 1 / -1; }

.vacio { text-align: center; color: var(--texto-suave); padding: 30px 10px; font-size: .95rem; }
.espera-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.espera-cab h3 { margin-bottom: 0; }
.punto-color { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; }
.subtitulo { font-size: .85rem; font-weight: 700; color: var(--texto-suave); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
