/* SayMarket — estilos globales */
:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --navy: #1c2b48;
  --navy-hover: #16233a;
  --celeste: #2f7fc4;
  --celeste-hover: #256aa8;
  --texto: #1c2b48;
  --texto-soft: #5b6478;
  --borde: #e6e9ef;
  --borde-fuerte: #cfd5df;
  --exito: #1f9d55;
  --error: #c0392b;
  --warn: #d18a1a;
  --amarillo: #f4c542;
  --rojo-suave: #fde3e0;
  --amarillo-suave: #fdf2d3;
  --verde-suave: #dff5e6;
  --sombra: 0 1px 3px rgba(28, 43, 72, .06), 0 1px 2px rgba(28, 43, 72, .04);
  --sombra-hover: 0 6px 20px rgba(28, 43, 72, .10);
  --radio: 12px;
  --radio-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--texto);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

a { color: var(--celeste); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { color: var(--navy); font-weight: 700; margin: 0 0 .4em 0; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
small, .muted { color: var(--texto-soft); font-size: .875rem; }

/* -------- Logo -------- */
.logo-wrap { display: flex; align-items: baseline; gap: 6px; margin-bottom: 12px; }
.logo { font-weight: 800; font-size: 1.4rem; color: var(--navy); letter-spacing: -0.5px; }
.logo-sub { font-size: .75rem; color: var(--texto-soft); font-weight: 400; }

/* -------- Topbar -------- */
.topbar {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--sombra);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
}
.topbar .brand { display: flex; align-items: baseline; gap: 6px; }
.topbar .brand .logo { color: #fff; }
.topbar .brand .logo-sub { color: #b7c4d9; }
.topbar .brand:hover { text-decoration: none; }
.nav { display: flex; gap: 6px; margin-left: 12px; }
.nav-link {
  color: #cfd8e8; padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: .92rem;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav-link.is-active { color: #fff; background: rgba(255,255,255,.14); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; color: #fff; font-size: 1.15rem;
}
.icon-btn:hover { background: rgba(255,255,255,.10); text-decoration: none; }
.topbar .btn-ghost {
  color: #fff;
  border-color: rgba(255,255,255,.55);
  background: transparent;
}
.topbar .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,.12);
  border-color: #fff;
  color: #fff;
}
.badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--celeste); color: #fff; border-radius: 999px; font-size: .72rem;
  font-weight: 700; display: none; align-items: center; justify-content: center;
}
@media (max-width: 640px) {
  .nav-link { padding: 6px 8px; font-size: .85rem; }
  .topbar-inner { gap: 8px; padding: 8px 10px; }
}

/* -------- Layout -------- */
.contenedor { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
.contenedor-angosto { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.pantalla-centrada {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.card-mensaje {
  background: var(--surface); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 32px; max-width: 460px; width: 100%; box-shadow: var(--sombra);
}
.card-mensaje h1 { font-size: 1.4rem; margin-bottom: 8px; }
.card-mensaje p { color: var(--texto-soft); margin: 0 0 20px; }
.card-mensaje .acciones { display: flex; flex-wrap: wrap; gap: 8px; }

/* -------- Cards -------- */
.card {
  background: var(--surface); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 20px;
}
.card + .card { margin-top: 16px; }

/* -------- Tabs -------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); margin-bottom: 20px; }
.tab-btn {
  border: none; background: transparent; padding: 10px 16px; cursor: pointer;
  font-size: .95rem; font-weight: 600; color: var(--texto-soft); border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tab-btn.is-active { color: var(--navy); border-bottom-color: var(--celeste); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* -------- Formularios -------- */
label { display: block; font-weight: 600; margin: 12px 0 6px; color: var(--navy); font-size: .9rem; }
.hint { font-size: .78rem; color: var(--texto-soft); margin-top: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--borde-fuerte); border-radius: var(--radio-sm);
  font-family: inherit; font-size: .95rem; background: #fff; color: var(--texto);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--celeste); box-shadow: 0 0 0 3px rgba(47,127,196,.15);
}
textarea { resize: vertical; min-height: 90px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } }

/* -------- Botones -------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--radio-sm); border: 1px solid transparent;
  cursor: pointer; font-family: inherit; font-size: .95rem; font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-hover); text-decoration: none; color: #fff; }
.btn-cel { background: var(--celeste); color: #fff; }
.btn-cel:hover:not(:disabled) { background: var(--celeste-hover); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--borde-fuerte); }
.btn-ghost:hover:not(:disabled) { background: #eef1f6; text-decoration: none; color: var(--navy); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a53324; color: #fff; text-decoration: none; }
.btn-ok { background: var(--exito); color: #fff; }
.btn-ok:hover:not(:disabled) { background: #197a41; color: #fff; text-decoration: none; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover:not(:disabled) { background: #1ea855; color: #fff; text-decoration: none; }
.btn-sm { padding: 6px 10px; font-size: .82rem; }
.btn-block { width: 100%; }

/* -------- Toast -------- */
.toast-cont {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: var(--navy); color: #fff; padding: 12px 16px; border-radius: var(--radio-sm);
  max-width: 360px; box-shadow: 0 6px 16px rgba(0,0,0,.15); font-size: .9rem;
  transform: translateX(0); opacity: 1; transition: opacity .25s, transform .25s;
}
.toast.out { opacity: 0; transform: translateX(30px); }
.toast-error { background: var(--error); }
.toast-exito { background: var(--exito); }
.toast-warn { background: var(--warn); }

/* -------- Catálogo -------- */
.barra-filtros {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px;
}
.buscador {
  flex: 1; min-width: 260px; position: relative;
}
.buscador input { padding-left: 36px; }
.buscador .icono-buscador {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: #7a869a;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--borde-fuerte);
  cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--texto);
  font-family: inherit;
}
.chip:hover { border-color: var(--celeste); }
.chip.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.chip-estado { cursor: default; }
.chip.chip-verde { background: var(--verde-suave); color: #197a41; border-color: transparent; }
.chip.chip-amarillo { background: var(--amarillo-suave); color: #8b6210; border-color: transparent; }
.chip.chip-rojo { background: var(--rojo-suave); color: #a53324; border-color: transparent; }

.grid-productos {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card-prod {
  background: var(--surface); border: 1px solid var(--borde); border-radius: var(--radio);
  overflow: hidden; box-shadow: var(--sombra); display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card-prod:hover { transform: translateY(-2px); box-shadow: var(--sombra-hover); text-decoration: none; }
.card-prod .foto {
  aspect-ratio: 4 / 3; background: #eef1f6; overflow: hidden; position: relative;
}
.card-prod .foto img { width: 100%; height: 100%; object-fit: cover; }
.card-prod .body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-prod .marca { font-size: .72rem; color: var(--texto-soft); text-transform: uppercase; letter-spacing: .5px; }
.card-prod .nombre { font-size: .95rem; font-weight: 700; color: var(--navy); line-height: 1.3; min-height: 2.6em; }
.card-prod .precio { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-top: auto; }
.card-prod .sin-precio {
  font-size: .78rem; color: var(--texto-soft); margin-top: auto; font-style: italic;
}
.card-prod .minimo { font-size: .78rem; color: var(--texto-soft); }
.badge-cur {
  position: absolute; top: 8px; left: 8px; background: var(--celeste); color: #fff;
  padding: 3px 8px; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .3px;
}

/* -------- Modo asistido banner -------- */
.banner-asistido {
  background: #f4ecd8; border: 1px solid #e0d4b3; padding: 10px 14px; border-radius: var(--radio-sm);
  margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.banner-asistido strong { color: var(--navy); }
.banner-asistido select { max-width: 300px; }

/* -------- Ficha producto -------- */
.ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 780px) { .ficha { grid-template-columns: 1fr; } }
.ficha .galeria { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; }
.ficha .galeria .principal { aspect-ratio: 4 / 3; background: #eef1f6; }
.ficha .galeria .principal img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ficha .thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.ficha .thumbs img {
  width: 64px; height: 64px; object-fit: cover; border: 2px solid transparent; border-radius: 6px; cursor: pointer;
}
.ficha .thumbs img.is-active { border-color: var(--celeste); }
.ficha .info h1 { font-size: 1.4rem; }
.ficha .marca-ficha { color: var(--texto-soft); text-transform: uppercase; font-size: .78rem; letter-spacing: .5px; margin-bottom: 6px; }
.ficha .precio-ficha { font-size: 1.8rem; font-weight: 800; color: var(--navy); margin: 12px 0 4px; }
.ficha .sin-precio-ficha {
  color: var(--texto-soft); font-style: italic; padding: 10px 12px; background: #f4f6fa;
  border-radius: var(--radio-sm); margin: 12px 0;
}
.sellos { margin: 14px 0; padding: 10px 12px; background: #edf5fb; border-left: 3px solid var(--celeste); border-radius: 6px; }
.sellos div { font-size: .88rem; color: var(--navy); display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.sellos svg { flex: none; }
.selector-cant { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.selector-cant input { width: 90px; text-align: center; }
.desc { white-space: pre-line; line-height: 1.55; color: var(--texto); margin-top: 18px; }

/* -------- Carrito / pedido -------- */
.tabla-carrito { width: 100%; border-collapse: collapse; }
.tabla-carrito th, .tabla-carrito td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla-carrito th { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--texto-soft); }
.tabla-carrito .col-foto { width: 64px; }
.tabla-carrito .col-foto img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.tabla-carrito .col-cant input { width: 80px; text-align: center; }
.tabla-carrito .col-precio { text-align: right; white-space: nowrap; }
.tabla-carrito .col-sub { text-align: right; font-weight: 700; white-space: nowrap; }
.tabla-carrito .quitar { color: var(--error); background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.tabla-carrito .quitar:hover { background: var(--rojo-suave); }
.resumen {
  background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px;
  margin-top: 16px;
}
.resumen .fila { display: flex; justify-content: space-between; padding: 4px 0; }
.resumen .total { font-size: 1.15rem; font-weight: 800; color: var(--navy); border-top: 1px solid var(--borde); margin-top: 6px; padding-top: 8px; }
.carrito-vacio {
  text-align: center; padding: 60px 20px; color: var(--texto-soft);
}
.exito-pedido {
  background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 32px;
  text-align: center; box-shadow: var(--sombra);
}
.exito-pedido .num {
  display: inline-block; padding: 6px 14px; background: var(--verde-suave); color: #197a41;
  border-radius: 999px; font-weight: 800; margin: 8px 0 16px;
}

/* -------- Tablas admin -------- */
.tabla { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.tabla th, .tabla td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--borde); font-size: .9rem; vertical-align: middle; }
.tabla th { background: #f4f6fa; font-size: .76rem; text-transform: uppercase; letter-spacing: .5px; color: var(--texto-soft); font-weight: 700; }
.tabla tbody tr:hover { background: #f9fbfd; }
.tabla .col-acciones { text-align: right; white-space: nowrap; }
.tabla-wrap { overflow-x: auto; }
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.pill-pend { background: var(--amarillo-suave); color: #8b6210; }
.pill-apr { background: var(--verde-suave); color: #197a41; }
.pill-sus { background: var(--rojo-suave); color: #a53324; }
.pill-solicitado { background: var(--amarillo-suave); color: #8b6210; }
.pill-cotizado { background: #e4ecf8; color: #2b5793; }
.pill-confirmado { background: #dbe8fd; color: #1f4a90; }
.pill-pagado { background: #d7ecf7; color: #1c5a80; }
.pill-despachado { background: #dfe6f5; color: #2b3a75; }
.pill-entregado { background: var(--verde-suave); color: #197a41; }
.pill-cancelado { background: var(--rojo-suave); color: #a53324; }

/* Detalle expandible pedidos */
.detalle-pedido {
  background: #f7f9fc; border: 1px solid var(--borde); border-radius: var(--radio-sm); padding: 14px; margin-top: 8px;
}
.detalle-pedido table { width: 100%; border-collapse: collapse; }
.detalle-pedido th, .detalle-pedido td { padding: 6px 8px; border-bottom: 1px solid var(--borde); font-size: .85rem; text-align: left; }

/* Toggles inline */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: #cfd5df; border-radius: 22px; transition: .2s;
}
.switch .slider:before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--celeste); }
.switch input:checked + .slider:before { transform: translateX(18px); }

/* Estados vacíos y cargando */
.estado-vacio {
  text-align: center; padding: 40px 20px; color: var(--texto-soft);
}
.spinner {
  width: 36px; height: 36px; border: 3px solid #e6e9ef; border-top-color: var(--celeste);
  border-radius: 50%; animation: spin 1s linear infinite; margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Utilidades */
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .flex-gap { gap: 8px; } .flex-wrap { flex-wrap: wrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
