/* ==========================================================================
   BCCI Expo 2026 — hoja de estilos compartida de las pantallas del vendedor
   (login.php, sales.php, my-sales.php).

   La paleta, tipografía y radios salen de los bocetos de design/canvas-source/
   (Login.dc.html, Main.dc.html, MyStats.dc.html). No inventar colores nuevos:
   si falta un componente, construirlo con estas variables.

   Los artboards son de 390x844 px (móvil). Aquí se centra el contenido con un
   ancho máximo un poco mayor para que también se vea bien en un teléfono más
   ancho o en el escritorio, sin scroll horizontal en ningún caso.
   ========================================================================== */

:root {
  --navy: #12294B;
  --navy-2: #1B3A63;
  --navy-3: #24507F;
  --red: #C8262A;
  --red-dark: #A31E22;
  --paper: #EFF2F6;
  --ink: #12294B;
  --ink-soft: #5B6B85;
  --line: #DCE2EA;
  --green: #1E7A46;
  --green-bg: #E8F3EC;
  --muted-bg: #F1F2F5;
  --amber: #8A5B00;
  --amber-bg: #FFF3D6;

  --app-max: 430px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

button, input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Contenedor de pantalla. Todo vive dentro de este ancho: garantiza que a
   390 px no haya scroll horizontal. */
.app {
  width: 100%;
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
  overflow-x: hidden;
}

/* ============================ Cabecera común ============================ */

.topbar {
  flex-shrink: 0;
  background: var(--navy);
  background-image: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 16px 16px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-logo {
  height: 24px;
  width: auto;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.topbar-sub {
  font-size: 11px;
  color: #AFC0DA;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  flex-shrink: 0;
}

.vendor-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 5px 11px 5px 5px;
  max-width: 150px;
}

.vendor-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.vendor-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-link {
  background: none;
  border: none;
  padding: 4px 2px;
  color: #AFC0DA;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.logout-link:hover { color: #fff; }

/* ============================ Zona scrolleable ============================ */

.scroll {
  flex: 1;
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}

.muted { color: var(--ink-soft); }

.state-msg {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  text-align: center;
}

.state-msg.is-error { border-color: #E6BCBD; background: #FDF3F3; color: var(--red-dark); }

.retry-btn {
  margin-top: 10px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  min-height: 40px;
}

/* ================================ Login ================================ */

.login-app {
  justify-content: center;
  align-items: center;
  padding: 28px 24px;
  background: var(--navy);
  background-image: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
}

.brand-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}

.brand-col img { height: 34px; width: auto; }

.brand-title { color: #fff; font-size: 18px; font-weight: 800; letter-spacing: 0.02em; }
.brand-sub { color: #AFC0DA; font-size: 12px; }

.card {
  width: 100%;
  background: #fff;
  border-radius: 18px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.card-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.card-lead { font-size: 12px; color: var(--ink-soft); line-height: 1.5; margin: -6px 0 0; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input {
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0 14px;
  font-size: 15px; /* >=16px evita el zoom de iOS al enfocar; 15 es el compromiso del boceto */
  color: var(--ink);
  outline: none;
  width: 100%;
}

.field input:focus { border-color: var(--navy-3); background: #fff; }

.primary-btn {
  height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 2px;
  width: 100%;
}

.primary-btn:disabled { background: #C9CFD9; cursor: default; }

.hint { font-size: 10.5px; color: var(--ink-soft); text-align: center; line-height: 1.4; }

.form-error {
  background: #FBEAEA;
  color: var(--red-dark);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.footer-note {
  margin-top: 22px;
  font-size: 10.5px;
  color: #8FA2C2;
  text-align: center;
  line-height: 1.5;
  max-width: 300px;
}

.is-hidden { display: none !important; }

/* ============================ Bundles / productos ============================ */

.bundle-row { display: flex; gap: 10px; }

.bundle-card {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 14px;
  padding: 13px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #fff;
  min-height: 116px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(18, 41, 75, 0.18);
}

.bundle-name { font-size: 13px; font-weight: 800; }

.bundle-tag {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bundle-price { margin-top: auto; font-size: 19px; font-weight: 800; }

.product-list { display: flex; flex-direction: column; gap: 10px; }

.product-card {
  background: #fff;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(18, 41, 75, 0.08);
}

.product-img,
.product-img-fallback {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.product-img { object-fit: contain; background: #F6F7F9; }

.product-img-fallback {
  background: var(--navy-2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
}

.product-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }

.product-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }

.product-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere; /* nombres largos no rompen el layout a 390 px */
}

/* Chip de inventario. Ver sales.js: avisa, NUNCA bloquea la venta. */
.stock-chip {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
  background: var(--muted-bg);
  color: var(--ink-soft);
}

.stock-chip.is-warn { background: var(--amber-bg); color: var(--amber); }
.stock-chip.is-out { background: #FBEAEA; color: var(--red-dark); }

.tier-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }

.tier-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 46px; /* objetivo táctil */
  cursor: pointer;
  padding: 4px 2px;
}

.tier-btn:active { background: #E4EAF2; border-color: var(--navy-3); }
.tier-q { font-size: 9.5px; font-weight: 700; color: var(--ink-soft); }
.tier-price { font-size: 11.5px; font-weight: 800; color: var(--navy); }
.tier-count {
  font-size: 9px;
  font-weight: 800;
  color: var(--red-dark);
}

/* ============================ Créditos ============================ */

.credits { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 4px; }
.credits-line { width: 100%; height: 1px; background: var(--line); }
.credits-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.credits-logos { display: flex; align-items: center; justify-content: center; gap: 26px; opacity: 0.88; }
.credit-logo { height: 28px; width: auto; }
.credit-logo.is-bcci { height: 24px; }

/* ============================ Barra de carrito ============================ */

.cart-bar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(min(100vw, var(--app-max)) - 32px);
  background: var(--red);
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(163, 30, 34, 0.35);
  z-index: 8;
}

.cart-bar:disabled { background: #7C8798; box-shadow: none; cursor: default; }

.cart-bar-left { display: flex; align-items: center; gap: 10px; }

.cart-count {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-bar-label { font-size: 13px; font-weight: 800; }
.cart-bar-total { font-size: 16px; font-weight: 800; }

/* Espacio para que la barra fija no tape el final del contenido. */
.has-cart-bar .scroll { padding-bottom: 92px; }

/* ============================ Hoja del carrito ============================ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 41, 75, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 12;
}

.sheet {
  width: 100%;
  max-width: var(--app-max);
  max-height: 80vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 20px;
  gap: 13px;
}

.sheet-header { display: flex; align-items: center; justify-content: space-between; }
.sheet-title { font-size: 15px; font-weight: 800; color: var(--ink); }

.sheet-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cart-lines { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.cart-line-label { font-size: 12.5px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.cart-line-sub { font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; }
.cart-line-sub.is-warn { color: var(--red-dark); font-weight: 700; }
.cart-line-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cart-line-total { font-size: 13px; font-weight: 800; color: var(--navy); min-width: 54px; text-align: right; }

.step-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--red);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.cart-empty { font-size: 12.5px; color: var(--ink-soft); padding: 20px 0; text-align: center; }

.sheet-footer { display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }

.sheet-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.checkout-btn {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  min-height: 50px;
}

.checkout-btn:disabled { background: #C9CFD9; cursor: default; }

/* ================================ Toast ================================ */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 78px;
  width: calc(min(100vw, var(--app-max)) - 32px);
  background: var(--navy);
  color: #fff;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(18, 41, 75, 0.35);
  z-index: 20;
}

.toast.is-error { background: var(--red-dark); }
.toast.is-success { background: var(--green); }

/* ============================ My Sales ============================ */

.stat-row { display: flex; gap: 10px; }

.stat-card {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 14px;
  padding: 13px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid var(--line);
}

.stat-label {
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value { font-size: 18px; color: var(--ink); font-weight: 800; overflow-wrap: anywhere; }
.stat-note { font-size: 10px; color: var(--ink-soft); }

.section-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-card .section-title { text-transform: none; letter-spacing: 0; margin: 0; }
.section-sub { font-size: 11px; color: var(--ink-soft); margin-top: -6px; line-height: 1.45; }

.sale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.sale-row:first-of-type { border-top: none; padding-top: 0; }
.sale-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.sale-desc {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.sale-time { font-size: 10.5px; color: var(--ink-soft); }
.sale-right { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.sale-amount { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.sale-amount.is-voided { color: var(--ink-soft); text-decoration: line-through; font-weight: 700; }

.void-btn {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--red);
  background: #fff;
  border: 1px solid var(--red);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
}

.void-btn:disabled { color: var(--ink-soft); border-color: var(--line); cursor: default; }

.void-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--muted-bg);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.void-tag.is-voided { color: var(--red-dark); background: #FBEAEA; }

/* --- Menú por rol (index.php) -------------------------------------------
   El hub que conecta las pantallas. Tarjetas grandes en columna: en el piso
   del evento se navega con el pulgar y a veces con prisa, así que el destino
   se toca sin apuntar. La entrada de admin se distingue por el borde, no por
   el color de fondo, para que no compita con el botón de cobrar. */
.menu { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 18px;
  min-height: 64px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(18, 41, 75, 0.05);
}
.menu-item:active { background: var(--muted-bg); }
.menu-item.is-admin { border-color: var(--navy-3); }
.menu-item-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.menu-item-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
