/* ============================================================
   TIENDA — estilo ROVZA (marketplace limpio: slate + esmeralda,
   tarjetas blancas, botones grandes, carrito como hoja inferior).
   Carga DESPUES de theme.css/components.css. Prefijo tn-.
   ============================================================ */

body { background: var(--bg); }
.tn-muted { color: var(--muted); font-size: .86rem; }
.tn-center { text-align: center; margin-top: 10px; }
.tn-dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; flex: none; }

/* ---------- cabecera ---------- */
.tn-header {
  position: sticky; top: 0; z-index: var(--z-top);
  background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.tn-header__in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.tn-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tn-brand__mark { border-radius: 10px; flex: none; }
.tn-brand__name { font-size: 1.15rem; font-weight: 800; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-cartbtn {
  position: relative; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; color: var(--ink); flex: none;
}
.tn-cartbtn svg { width: 21px; height: 21px; }
.tn-cartbtn__count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: .72rem; font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.tn-cartbtn.is-bump { animation: tn-bump .35s ease; }
@keyframes tn-bump { 40% { transform: scale(1.15); } }

/* ---------- layout ---------- */
.tn-wrap { max-width: 1120px; margin: 0 auto; padding: 16px 16px 120px; }
.tn-section { margin-top: 28px; }
.tn-section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tn-h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.025em; }

/* ---------- hero ---------- */
.tn-hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 26px 20px;
  background: radial-gradient(520px 260px at 100% -10%, rgba(5, 150, 105, .12), transparent 62%), var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.tn-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent-soft); color: var(--accent-hover);
  font-weight: 700; font-size: .76rem; padding: 6px 12px; border-radius: 999px; margin-bottom: 14px;
}
.tn-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: var(--accent); }
.tn-hero__title { font-size: clamp(1.9rem, 7vw, 2.8rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.tn-hero__text { color: var(--muted); font-size: 1rem; line-height: 1.5; margin-top: 10px; max-width: 520px; }

.tn-search {
  display: flex; align-items: center; gap: 10px; margin-top: 20px; max-width: 520px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 16px;
  transition: border-color .16s, box-shadow .16s;
}
.tn-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.tn-search svg { width: 18px; height: 18px; color: var(--muted); }
.tn-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); padding: 10px 0; }
.tn-search input::placeholder { color: var(--muted); font-weight: 500; }

.tn-cats { display: flex; gap: 8px; overflow-x: auto; margin: 14px -20px 0; padding: 0 20px 2px; scrollbar-width: none; }
.tn-cats::-webkit-scrollbar { display: none; }
.tn-cat {
  flex: none; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px;
  font: inherit; font-weight: 700; font-size: .88rem; color: var(--ink); transition: .15s;
}
.tn-cat.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tn-cat.is-on .tn-dot { background: #fff !important; }

/* ---------- tarjetas ---------- */
.tn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tn-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .22s ease, box-shadow .22s ease;
}
.tn-card__media { position: relative; aspect-ratio: 1; background: #eef0f4; overflow: hidden; border: 0; padding: 0; cursor: pointer; display: block; width: 100%; }
.tn-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.tn-card__ph { display: grid; place-items: center; height: 100%; color: var(--line-strong); }
.tn-card__ph svg { width: 34px; height: 34px; }
.tn-badge { position: absolute; top: 8px; left: 8px; background: var(--ink); color: #fff; font-size: .7rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
.tn-card__body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.tn-card__brand { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; color: var(--muted); }
.tn-card__title { font-size: .93rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tn-card__price { display: flex; align-items: baseline; gap: 6px; margin-top: auto; padding-top: 4px; }
.tn-price { font-weight: 800; font-size: 1.15rem; color: var(--accent); letter-spacing: -.02em; }
.tn-price--lg { font-size: 1.6rem; }
.tn-cur { font-size: .7rem; color: var(--muted); font-weight: 700; }
.tn-card__action { margin-top: 8px; }
@media (hover: hover) {
  .tn-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
  .tn-card:hover .tn-card__img { transform: scale(1.06); }
}

/* ---------- botones ---------- */
.tn-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  border: 0; border-radius: 10px; min-height: 42px; padding: 0 16px; font: inherit; font-weight: 700; font-size: .9rem;
  transition: background .16s, transform .12s;
}
.tn-btn:active { transform: scale(.97); }
.tn-btn svg { width: 17px; height: 17px; }
.tn-btn--primary { background: var(--accent); color: #fff; }
.tn-btn--primary:hover { background: var(--accent-hover); }
.tn-btn--wa { background: var(--wa); color: #fff; }
.tn-btn--block { width: 100%; }
.tn-btn--lg { min-height: 54px; font-size: 1rem; border-radius: 14px; }
.tn-btn:disabled { opacity: .5; cursor: default; }

/* Selector de cantidad */
.tn-qty { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-hover); overflow: hidden; }
.tn-qty button { height: 100%; border: 0; background: none; color: inherit; font-size: 1.25rem; font-weight: 700; cursor: pointer; }
.tn-qty button:disabled { opacity: .35; cursor: default; }
.tn-qty output { text-align: center; font-weight: 800; }
.tn-qty--sm { grid-template-columns: 34px 30px 34px; height: 34px; }

/* ---------- barra flotante ---------- */
.tn-bar {
  position: fixed; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: var(--z-nav);
  max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 10px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--ink); color: #fff; font: inherit; font-weight: 700;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .28); animation: tn-up .3s cubic-bezier(.2, .8, .2, 1);
}
.tn-bar__count { min-width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; font-weight: 800; }
.tn-bar__label { flex: 1; text-align: left; }
.tn-bar__total { font-weight: 800; font-size: 1.05rem; }
@keyframes tn-up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- hojas (detalle y carrito) ---------- */
.tn-overlay { position: fixed; inset: 0; z-index: var(--z-sheet); background: rgba(15, 23, 42, .45); animation: tn-fade .2s ease; }
@keyframes tn-fade { from { opacity: 0; } }
.tn-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-sheet) + 1);
  max-height: 90dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(15, 23, 42, .18);
  padding-bottom: env(safe-area-inset-bottom); animation: tn-sheet .32s cubic-bezier(.2, .8, .2, 1);
}
.tn-sheet::before { content: ""; width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
@keyframes tn-sheet { from { transform: translateY(100%); } }
.tn-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 12px; border-bottom: 1px solid var(--line); }
.tn-sheet__body { overflow-y: auto; padding: 4px 18px 16px; flex: 1; }
.tn-sheet__foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.tn-sheet__close {
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 99px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .92); box-shadow: var(--shadow); font-size: 1.5rem; line-height: 1; color: var(--ink);
}
.tn-sheet__close--inline { position: static; box-shadow: none; background: var(--surface-2); }

.tn-detail { overflow-y: auto; }
.tn-detail__media { aspect-ratio: 1; max-height: 46dvh; width: 100%; background: #eef0f4; margin-top: -12px; overflow: hidden; display: grid; place-items: center; color: var(--line-strong); }
.tn-detail__media img { width: 100%; height: 100%; object-fit: cover; }
.tn-detail__media svg { width: 44px; height: 44px; }
.tn-detail__body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.tn-detail__title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.2; }
.tn-detail__text { color: var(--ink-2); font-size: .95rem; line-height: 1.55; white-space: pre-line; margin-top: 6px; }
.tn-detail__body [data-detalle-accion] { margin-top: 12px; }
.tn-detail__body .tn-qty, .tn-detail__body .tn-btn { height: 52px; min-height: 52px; font-size: 1rem; }

/* Lineas del carrito */
.tn-lines { list-style: none; margin: 0; padding: 0; }
.tn-line { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 14px 0; }
.tn-line + .tn-line { border-top: 1px solid var(--line); }
.tn-line__img { width: 56px; height: 56px; border-radius: 12px; background: #eef0f4; overflow: hidden; display: grid; place-items: center; color: var(--line-strong); }
.tn-line__img img { width: 100%; height: 100%; object-fit: cover; }
.tn-line__img svg { width: 22px; height: 22px; }
.tn-line__name { font-weight: 700; font-size: .92rem; line-height: 1.3; }
.tn-line__unit { font-size: .78rem; color: var(--muted); }
.tn-line__end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tn-line__total { font-weight: 800; }
.tn-line__warn { font-size: .74rem; color: var(--warn); font-weight: 700; }

.tn-order { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.tn-field span { display: block; font-size: .84rem; font-weight: 700; margin-bottom: 6px; color: var(--ink-2); }
.tn-field small { font-weight: 500; color: var(--muted); }
.tn-input {
  width: 100%; font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 14px; min-height: 46px;
}
.tn-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.tn-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.tn-total span { font-weight: 700; color: var(--muted); }
.tn-total b { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }

/* Vacios */
.tn-empty { text-align: center; color: var(--muted); padding: 36px 16px; display: grid; justify-items: center; gap: 4px; font-size: .9rem; }
.tn-empty svg { width: 34px; height: 34px; color: var(--line-strong); margin-bottom: 6px; }
.tn-empty b { color: var(--ink); font-size: 1rem; }

.tn-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: .84rem; font-weight: 700; color: var(--muted); text-decoration: underline; }
.tn-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 36px; }
body.tn-lock { overflow: hidden; }

/* ---------- pantallas grandes ---------- */
@media (min-width: 640px) {
  .tn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .tn-hero { padding: 44px 40px; }
  .tn-cats { margin: 16px 0 0; padding: 0; flex-wrap: wrap; }
}
@media (min-width: 960px) {
  .tn-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .tn-sheet { left: auto; top: 0; width: 420px; max-height: none; border-radius: 0; animation-name: tn-drawer; }
  .tn-sheet::before { display: none; }
  .tn-detail__media { margin-top: 0; }
  @keyframes tn-drawer { from { transform: translateX(100%); } }
}
@media (prefers-reduced-motion: reduce) {
  .tn-sheet, .tn-bar, .tn-overlay { animation: none; }
}
