/* =====================================================================
   Tapview Visitas — sistema visual.
   Minimalista de verdad: la jerarquía la hace el tamaño y el peso, no el
   color. Un único acento (dorado Tapview). Pensado para la calle, con sol
   y una mano. Nada por debajo de 13 px. Tocables de 56 px.
   ===================================================================== */

:root {
  --bg:        #faf9f7;   /* blanco roto */
  --surface:   #ffffff;
  --text:      #1a1a1a;   /* casi negro */
  --muted:     #86868b;
  --line:      #e6e3dd;   /* gris muy claro, 1 px */
  --accent:    #d9a92a;   /* dorado Tapview: botón principal y venta */
  --accent-ink:#1a1400;   /* texto sobre el dorado */
  --danger:    #b23b3b;
  --radius:    12px;
  --gap:       16px;
  --margin:    24px;
  --tap:       56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #000000;
    --surface:   #1c1c1e;
    --text:      #f2f2f7;
    --muted:     #98989f;
    --line:      #2c2c2e;
    --accent:    #e0b23a;
    --accent-ink:#1a1400;
    --danger:    #ff6b6b;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; }

h1 { font-size: 28px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 8px; }
label, .label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin: 0 0 8px; text-transform: none;
}
p { margin: 0 0 var(--gap); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) var(--margin) 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 17px; letter-spacing: -0.01em; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__link { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit; }
.cola {
  font-size: 13px; color: var(--accent-ink); background: var(--accent);
  border-radius: 999px; padding: 3px 10px; font-weight: 600;
}

/* ---------- Contenedor de pantalla ---------- */
.app {
  max-width: 480px; margin: 0 auto;
  padding: var(--margin) var(--margin) calc(var(--tap) + 48px);
}
.screen { animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.stack > * + * { margin-top: var(--gap); }
.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--gap);
}

/* ---------- Botones ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: var(--tap);
  font-family: inherit; font-size: 17px; font-weight: 600;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  cursor: pointer; padding: 10px 16px;
  transition: transform .04s ease, background .1s ease;
  text-decoration: none; text-align: center;
}
.btn:active { transform: scale(0.98); }     /* respuesta inmediata al tocar */
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn--ghost { background: none; border: 0; color: var(--muted); font-weight: 600; min-height: 44px; }
.btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: none; }
.btn--lg { min-height: 72px; font-size: 20px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* Botón principal anclado abajo, al alcance del pulgar */
.anclado {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 12px var(--margin) max(12px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.anclado .btn { max-width: 480px; margin: 0 auto; }

/* Rejilla de opciones grandes (nunca desplegables) */
.opciones { display: grid; gap: 10px; }
.opciones--2 { grid-template-columns: 1fr 1fr; }
.opciones--3 { grid-template-columns: 1fr 1fr 1fr; }
.opcion {
  min-height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer; padding: 10px; transition: transform .04s ease;
}
.opcion:active { transform: scale(0.98); }
.opcion[aria-pressed="true"] {
  border-color: var(--text); background: var(--text); color: var(--bg);
}
/* El estado de venta sí lleva el dorado */
.opcion--venta[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Campos ---------- */
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=search], textarea {
  width: 100%; min-height: var(--tap);
  font-family: inherit; font-size: 17px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 12px 14px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Contador de unidades */
.contador { display: flex; align-items: center; gap: 12px; }
.contador__btn {
  width: var(--tap); height: var(--tap); flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 26px; font-weight: 500; cursor: pointer;
}
.contador__num { font-size: 22px; font-weight: 700; min-width: 2ch; text-align: center; }

/* Números grandes del inicio */
.numeros { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; text-align: center; }
.numero__valor { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.numero__valor--venta { color: var(--accent); }
.numero__etq { font-size: 13px; color: var(--muted); }

/* Listas (Hoy, negocios, discursos) */
.lista { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; cursor: pointer; color: var(--text); font-family: inherit;
}
.item:last-child { border-bottom: 0; }
.item__main { min-width: 0; }
.item__titulo { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__sub { font-size: 13px; color: var(--muted); }
.item__lado { font-size: 15px; font-weight: 600; white-space: nowrap; }
.item__lado--venta { color: var(--accent); }

/* Pestañas */
.tabs { display: flex; gap: 8px; margin-bottom: var(--gap); }
.tab {
  flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--muted); font-family: inherit; font-weight: 600; cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--text); border-color: var(--text); }

/* Aviso de última visita / banda */
.aviso { font-size: 13px; color: var(--muted); padding: 8px 0; }
.aviso strong { color: var(--text); }

/* Plegables */
details { border-top: 1px solid var(--line); padding-top: var(--gap); }
summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 15px; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: var(--gap); }

/* Generador */
.resultado-enlace {
  word-break: break-all; font-size: 14px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tap) + 24px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 600; z-index: 20; max-width: 90%; text-align: center;
  animation: fade .15s ease;
}

/* Selector de vendedor */
.picker {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: var(--margin);
}
.picker__card { width: 100%; max-width: 420px; }
.picker__title { font-size: 28px; }
.picker__sub { color: var(--muted); margin-bottom: var(--margin); }
.picker__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.picker__grid .btn { min-height: 72px; font-size: 20px; }

.spacer { height: var(--gap); }
.hr { height: 1px; background: var(--line); border: 0; margin: var(--gap) 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.center { text-align: center; }
.gris-vivo { color: var(--muted); font-size: 13px; }
