/* ============================================================
   Ventas de Joselyn — tonos morados y rosa, elegante y moderno
   Para ajustar colores o tipos, toca solo las variables de aquí.
   ============================================================ */
:root {
  --rosa: #8e44ad;
  --rosa-fuerte: #7d3c98;
  --rosa-oscuro: #5b2c6f;
  --rosa-claro: #e8d5f5;
  --rosa-palido: #f6e9f9;
  --rosa-borde: #d9b8ec;
  --rosa-suave: #f9a8c9;
  --fondo: #faf5fc;
  --blanco: #ffffff;
  --texto: #4a235a;
  --texto-suave: #7d5a8a;
  --dorado: #c9962e;
  --verde: #2e9e5b;
  --verde-claro: #e6f7ec;
  --amarillo-bg: #fff3cd;
  --amarillo-tx: #8a6d00;
  --lila-bg: #efe7fd;
  --lila-tx: #5b4a8a;
  --gris: #9a8f94;
  --sombra: 0 10px 30px rgba(91, 44, 111, 0.10);
  --sombra-sm: 0 4px 14px rgba(91, 44, 111, 0.08);
  --radio: 20px;
  --fuente-titulo: "Playfair Display", Georgia, serif;
  --fuente-texto: "Quicksand", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { scroll-padding-bottom: 120px; }

body {
  font-family: var(--fuente-texto);
  color: var(--texto);
  background:
    radial-gradient(420px 220px at 85% -40px, var(--rosa-claro) 0%, transparent 70%),
    radial-gradient(380px 200px at -10% 30%, var(--rosa-palido) 0%, transparent 70%),
    var(--fondo);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ---------- Encabezado ---------- */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 34px 20px 44px;
  color: #fff;
  background: linear-gradient(135deg, var(--rosa-suave) 0%, var(--rosa) 48%, var(--rosa-oscuro) 100%);
  border-radius: 0 0 32px 32px;
  box-shadow: var(--sombra);
}
.hero-deco {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.hero-deco-1 { width: 150px; height: 150px; top: -70px; right: -40px; }
.hero-deco-2 { width: 90px; height: 90px; bottom: -30px; left: 8%; }
.hero-deco-3 { width: 46px; height: 46px; top: 18px; left: 12%; }
.hero-kicker {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  opacity: 0.92;
}
.hero-title {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 2px 12px rgba(60, 10, 90, 0.25);
}
.hero-sub { margin: 8px 0 0; font-size: 15px; opacity: 0.95; }
.power-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.power-btn:active { transform: scale(0.95); background: rgba(255, 255, 255, 0.30); }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px 120px;
}

/* ---------- Resumen ---------- */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: -26px;
  position: relative;
  z-index: 2;
}
.stat {
  background: var(--blanco);
  border: 1px solid var(--rosa-borde);
  border-radius: var(--radio);
  padding: 14px 16px;
  box-shadow: var(--sombra-sm);
}
.stat-gold { grid-column: 1 / -1; background: linear-gradient(135deg, #fffdf5, #fff6e0); border-color: #f0dcb0; }
.stat-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--texto-suave);
}
.stat-value {
  display: block;
  margin-top: 4px;
  font-family: var(--fuente-titulo);
  font-size: 26px;
  font-weight: 700;
  color: var(--rosa-oscuro);
}
.stat-gold .stat-value { color: var(--dorado); font-size: 30px; }
.stat-note { display: block; font-size: 12px; color: var(--texto-suave); margin-top: 2px; }

/* ---------- Buscador y filtros ---------- */
.toolbar { margin: 18px 0 14px; }
.search {
  width: 100%;
  padding: 13px 16px;
  font-family: var(--fuente-texto);
  font-size: 15px;
  color: var(--texto);
  background: var(--blanco);
  border: 1.5px solid var(--rosa-borde);
  border-radius: 999px;
  outline: none;
  box-shadow: var(--sombra-sm);
}
.search:focus { border-color: var(--rosa); box-shadow: 0 0 0 3px var(--rosa-claro); }
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.chip {
  padding: 8px 14px;
  font-family: var(--fuente-texto);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--rosa-oscuro);
  background: var(--blanco);
  border: 1.5px solid var(--rosa-borde);
  border-radius: 999px;
  cursor: pointer;
}
.chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--rosa), var(--rosa-fuerte));
  border-color: transparent;
  box-shadow: var(--sombra-sm);
}

/* ---------- Tarjetas de venta ---------- */
.sales-list { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.sale-card {
  background: var(--blanco);
  border: 1px solid var(--rosa-borde);
  border-radius: var(--radio);
  padding: 16px;
  box-shadow: var(--sombra-sm);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.sale-card:active { transform: scale(0.99); box-shadow: var(--sombra); }
.sale-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sale-cliente {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: 19px;
  font-weight: 700;
  color: var(--texto);
}
.sale-producto { margin: 3px 0 0; font-size: 14.5px; color: var(--texto-suave); }
.sale-precio {
  font-family: var(--fuente-titulo);
  font-size: 20px;
  font-weight: 700;
  color: var(--rosa-oscuro);
  white-space: nowrap;
}
.sale-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.sale-fecha { font-size: 13px; color: var(--texto-suave); }
.badge {
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}
.badge-Cotización { background: var(--amarillo-bg); color: var(--amarillo-tx); }
.badge-Apartada { background: var(--lila-bg); color: var(--lila-tx); }
.badge-Entregada { background: var(--verde-claro); color: var(--verde); }
.badge-Pagada { background: var(--rosa-claro); color: var(--rosa-oscuro); }
.badge-Cancelada { background: #f1eef0; color: var(--gris); text-decoration: line-through; }
.sale-thumbs { display: flex; gap: 8px; margin-top: 12px; }
.sale-thumbs img {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--rosa-palido);
}
.sale-thumbs .more {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  color: var(--rosa-oscuro);
  background: var(--rosa-palido);
  border-radius: 12px;
}
.empty {
  text-align: center;
  color: var(--texto-suave);
  font-size: 15px;
  line-height: 1.6;
  padding: 36px 10px;
}

/* ---------- Detalle ---------- */
.detail-card {
  background: var(--blanco);
  border: 1px solid var(--rosa-borde);
  border-radius: 24px;
  padding: 20px;
  margin-top: 12px;
  box-shadow: var(--sombra);
}
.detail-cliente {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: 26px;
  color: var(--texto);
}
.detail-producto { margin: 6px 0 0; font-size: 16px; color: var(--texto-suave); }
.detail-precio {
  margin: 14px 0 0;
  font-family: var(--fuente-titulo);
  font-size: 32px;
  font-weight: 700;
  color: var(--rosa-oscuro);
}
.detail-rows { margin-top: 16px; border-top: 1px dashed var(--rosa-borde); padding-top: 12px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14.5px; }
.detail-row b { color: var(--texto-suave); font-weight: 600; }
.detail-notas {
  margin-top: 12px;
  background: var(--rosa-palido);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14.5px;
  line-height: 1.55;
}
.detail-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.detail-photos img {
  width: 100%; aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid var(--rosa-palido);
  cursor: zoom-in;
}
.detail-actions { display: flex; gap: 10px; margin-top: 18px; }
.detail-actions .btn { flex: 1; }

/* ---------- Formulario ---------- */
.form-card {
  background: var(--blanco);
  border: 1px solid var(--rosa-borde);
  border-radius: 24px;
  padding: 20px;
  margin-top: 12px;
  box-shadow: var(--sombra);
}
.form-title { margin: 0 0 16px; font-family: var(--fuente-titulo); font-size: 24px; color: var(--rosa-oscuro); }
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--texto-suave);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--fuente-texto);
  font-size: 15.5px;
  color: var(--texto);
  background: #fffafa;
  border: 1.5px solid var(--rosa-borde);
  border-radius: 14px;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--rosa);
  box-shadow: 0 0 0 3px var(--rosa-claro);
  background: #fff;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.photo-picker {
  display: block;
  text-align: center;
  padding: 14px;
  font-weight: 700;
  color: var(--rosa-oscuro);
  background: var(--rosa-palido);
  border: 1.5px dashed var(--rosa-suave);
  border-radius: 14px;
  cursor: pointer;
}
.photo-pickers { display: flex; gap: 10px; }
.photo-pickers .photo-picker { flex: 1; padding: 12px 6px; font-size: 14px; }
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-preview img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--rosa-palido);
}
.form-error { color: #a31621; font-size: 14px; font-weight: 600; }
.form-ok { color: var(--verde); font-size: 14px; font-weight: 600; }

/* ---------- Botones ---------- */
.btn {
  padding: 12px 18px;
  font-family: var(--fuente-texto);
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--rosa), var(--rosa-fuerte));
  box-shadow: 0 6px 18px rgba(123, 47, 190, 0.35);
}
.btn-primary:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-big { padding: 15px 18px; font-size: 17px; }
.btn-ghost {
  background: transparent;
  color: var(--rosa-oscuro);
  padding: 8px 4px;
}
.btn-outline {
  background: var(--blanco);
  color: var(--rosa-oscuro);
  border: 1.5px solid var(--rosa-borde);
}
.btn-danger {
  color: #a31621;
  background: #fdecec;
  border: 1.5px solid #f6c6c6;
}
.bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 247, 250, 0), var(--fondo) 30%);
  text-align: center;
}
.logout-link {
  margin-top: 8px;
  background: none;
  border: none;
  font-family: var(--fuente-texto);
  font-size: 13px;
  color: var(--texto-suave);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- PIN ---------- */
.pin-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pin-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: var(--blanco);
  border: 1px solid var(--rosa-borde);
  border-radius: 28px;
  padding: 32px 24px;
  box-shadow: var(--sombra);
}
.pin-flower { font-size: 44px; }
.pin-title { margin: 8px 0 4px; font-family: var(--fuente-titulo); font-size: 28px; color: var(--rosa-oscuro); }
.pin-sub { margin: 0 0 20px; color: var(--texto-suave); font-size: 14.5px; }
.pin-input {
  width: 100%;
  padding: 14px;
  margin-bottom: 10px;
  text-align: center;
  font-size: 26px;
  letter-spacing: 12px;
  font-family: var(--fuente-texto);
  color: var(--texto);
  border: 2px solid var(--rosa-borde);
  border-radius: 16px;
  outline: none;
}
.pin-input:focus { border-color: var(--rosa); box-shadow: 0 0 0 3px var(--rosa-claro); }
.pin-error { color: #a31621; font-size: 13.5px; font-weight: 600; }
.pin-ok { color: var(--verde); font-size: 13.5px; font-weight: 600; }

/* ---------- Pestañas Ventas | Personas ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1;
  padding: 11px;
  font-family: var(--fuente-texto);
  font-size: 15px;
  font-weight: 700;
  color: var(--rosa-oscuro);
  background: var(--blanco);
  border: 1.5px solid var(--rosa-borde);
  border-radius: 999px;
  cursor: pointer;
}
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--rosa), var(--rosa-fuerte));
  border-color: transparent;
  box-shadow: var(--sombra-sm);
}

/* ---------- Lista de personas (acordeón) ---------- */
.person-card { padding: 16px; }
.person-head { display: flex; gap: 12px; align-items: center; width: 100%; background: none; border: none; padding: 0; text-align: left; cursor: pointer; font-family: inherit; color: inherit; }
.person-head .person-info { flex: 1; min-width: 0; }
.person-head .sale-cliente, .person-head .person-sub { display: block; }
.person-arrow { flex: 0 0 auto; font-size: 20px; color: var(--rosa-oscuro); transition: transform 0.2s ease; }
.person-card.open .person-arrow { transform: rotate(180deg); }
.person-body { border-top: 1px dashed var(--rosa-borde); margin-top: 12px; padding-top: 12px; }
.datos-lista { margin: 0 0 4px; padding-left: 22px; font-size: 14.5px; line-height: 1.5; }
.datos-lista li { padding: 4px 0; }
.datos-lista li b { color: var(--texto-suave); font-weight: 600; }
.datos-lista li span { overflow-wrap: anywhere; }
.fotos-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 2px; margin-top: 10px; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.foto-item { flex: 0 0 auto; width: 180px; scroll-snap-align: start; }
.foto-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; border: 2px solid var(--rosa-palido); cursor: zoom-in; }
.foto-mas { flex: 0 0 auto; width: 180px; aspect-ratio: 1; scroll-snap-align: start; font-size: 56px; color: var(--rosa-oscuro); background: var(--rosa-palido); border: 2px dashed var(--rosa-borde); border-radius: 16px; cursor: pointer; }
.person-num {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fuente-titulo);
  font-size: 17px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--rosa), var(--rosa-fuerte));
  border-radius: 50%;
}
.person-info { min-width: 0; }
.person-sub { margin: 3px 0 0; font-size: 13.5px; color: var(--texto-suave); }
.photo-wrap { position: relative; }
.photo-del {
  position: absolute;
  top: 6px; right: 6px;
  width: 28px; height: 28px;
  font-size: 14px;
  color: #fff;
  background: rgba(43, 10, 26, 0.65);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* ---------- Foto en grande ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: #230837;
  touch-action: none;
}
.lightbox-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px 12px 16px;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform-origin: center center;
  transition: transform .18s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-top {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #230837;
}
.lightbox-counter {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.lightbox-download {
  margin-left: auto;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--fuente-texto);
  text-decoration: none;
  cursor: pointer;
}
.lightbox-close {
  position: static;
  flex: 0 0 auto;
  width: 44px; height: 44px;
  font-size: 18px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  font-size: 26px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
/* Ventana pequeña de admin (PIN), escondida: se abre con 3 toques al título */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 8, 55, 0.7);
  padding: 20px;
  overflow-y: auto;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--blanco);
  border-radius: 24px;
  padding: 22px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  font-size: 15px;
  color: var(--rosa-oscuro);
  background: var(--rosa-claro);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.modal-sep { border: none; border-top: 1px solid var(--rosa-borde); margin: 20px 0; }
.modal-note { font-size: 14px; color: var(--texto-suave); margin: 0 0 12px; }

/* Notas personales de la clienta (recuadro autoajustable en la tarjeta) */
.notas-box { margin-top: 14px; }
.notas-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-family: var(--fuente-texto);
  font-size: 15.5px;
  color: var(--texto);
  background: #fffafa;
  border: 1.5px solid var(--rosa-borde);
  border-radius: 14px;
  outline: none;
  resize: none;
  overflow-y: auto;
  max-height: 320px;
}
.notas-textarea:focus {
  border-color: var(--rosa);
  box-shadow: 0 0 0 3px var(--rosa-claro);
  background: #fff;
}
.notas-estado { text-align: right; font-size: 12px; color: var(--texto-suave); min-height: 16px; margin-top: 4px; }
