/* SmartBinder · estilos (mobile-first) */
:root {
  --ink: #0d1b2a;
  --navy: #1b263b;
  --slate: #415a77;
  --mist: #778da9;
  --bone: #e0e1dd;
  /* tintes derivados para contraste AA sobre --navy */
  --muted: #aab6c6;
  --line: rgba(119, 141, 169, .3);
  --page: #213049;
  --danger: #eba59f;
  --r-card: 4.75% / 3.4%;
  --r-ctl: 10px;
  --r-sheet: 18px;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-disp: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 64px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
/* `hidden` siempre gana, aunque la clase defina display (p. ej. .field { display: flex }) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--ink); color: var(--bone);
  font: 400 16px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--bone); }
h1, h2, h3 { font-family: var(--f-disp); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: .005em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0; }
code { font-size: .88em; background: var(--ink); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--bone); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: calc(8px + var(--safe-t)); }
.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--mist); }
/* bienvenida estática de index.html: se ve igual que renderLanding */
.boot-static { display: block; color: inherit; }
.hint { color: var(--muted); font-size: .92rem; }
.error { color: var(--danger); font-size: .95rem; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: transparent; border: 1px solid var(--slate); border-radius: var(--r-ctl);
  font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.btn:hover:not(:disabled) { background: rgba(65, 90, 119, .35); border-color: var(--mist); }
.btn.primary { background: var(--bone); color: var(--ink); border-color: var(--bone); }
.btn.primary:hover:not(:disabled) { background: #fff; }
.btn.danger { color: var(--danger); border-color: rgba(235, 165, 159, .5); }
.btn.btn-ghost { border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1.05rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1px solid var(--slate); background: transparent; border-radius: 50%; font-size: 1.15rem; line-height: 1;
}
.icon-btn:hover:not(:disabled) { background: rgba(65, 90, 119, .35); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--slate); font-size: .8rem; font-weight: 600; color: var(--bone); white-space: nowrap;
}
.chip-warn { border-style: dashed; color: var(--muted); }
.chip-req, .chip-ok { background: var(--bone); color: var(--ink); border-color: var(--bone); }
.chip-foil { background: linear-gradient(110deg, #778da9, #e0e1dd 45%, #9fb3cf 60%, #778da9); color: var(--ink); border: 0; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: .92rem; color: var(--muted); }
.field > span:first-child, .ctl-label { font-weight: 600; color: var(--bone); font-size: .9rem; }
.field small { color: var(--muted); font-size: .82rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--ink); border: 1px solid var(--slate); border-radius: var(--r-ctl);
  color: var(--bone); font-size: 16px; /* evita zoom en iOS */
}
textarea { resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #8797ad; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--mist) 50%), linear-gradient(135deg, var(--mist) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--bone); outline-offset: 1px; border-color: var(--bone); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-row { flex-wrap: nowrap; }
.search-row > .field:last-child { width: 9.5rem; flex: none; }
/* fila con filtros: en celular, búsqueda arriba y [Filtros][Ordenar] abajo */
.search-row.with-filters { flex-wrap: wrap; }
.search-row.with-filters > .field.grow { flex: 1 1 100%; }
.search-tools { display: flex; gap: 8px; flex: 1 1 100%; min-width: 0; }
.search-tools .field { flex: 1 1 auto; min-width: 0; }
.filter-btn { flex: none; gap: 8px; }
.filter-btn[aria-expanded=true] { background: rgba(65, 90, 119, .45); border-color: var(--mist); }
.f-count { min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--bone); color: var(--ink); font-size: .8rem; }
.f-count[hidden] { display: none; }
@media (min-width: 600px) {
  .search-row.with-filters { flex-wrap: nowrap; }
  .search-row.with-filters > .field.grow { flex: 1 1 auto; }
  .search-tools { flex: none; }
  .search-tools .field { width: 10rem; flex: none; }
}

/* ---------- panel de filtros ---------- */
.fpanel {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 16px 0; min-width: 0;
  background: var(--navy); border: 1px solid var(--slate); border-radius: 16px;
  animation: sheet-in .18s ease-out;
}
.fpanel[hidden] { display: none; }
.fp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.fp-group { display: grid; gap: 8px; align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.fp-group > legend { padding: 0; margin-bottom: 8px; font-weight: 600; font-size: .9rem; color: var(--bone); }
.fp-help { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.mana-row { display: grid; grid-template-columns: repeat(6, minmax(0, 44px)); justify-content: start; gap: 6px; }
.mana-btn {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 0;
  background: var(--ink); border: 2px solid var(--slate); border-radius: 50%; opacity: .5; transition: opacity .15s, border-color .15s;
}
.mana-btn img { width: 68%; height: auto; }
.mana-btn:hover { opacity: .8; }
.mana-btn[aria-pressed=true] { opacity: 1; border-color: var(--bone); box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--bone); }
.tog-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tog-mv { display: grid; grid-template-columns: repeat(8, minmax(0, 44px)); gap: 4px; }
.tog-mv .tog { min-width: 0; padding: 0; }
.tog {
  min-width: 44px; min-height: 40px; padding: 0 12px; border-radius: 999px;
  background: transparent; border: 1px solid var(--slate); color: var(--muted); font-weight: 600; font-size: .9rem;
}
.tog:hover { border-color: var(--mist); color: var(--bone); }
.tog[aria-pressed=true] { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.fp-price { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.fp-price .field { flex: 1; }
.fp-foot {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 2;
  display: flex; justify-content: flex-end; gap: 8px;
  margin: 0 -16px; padding: 12px 16px; background: var(--navy); border-top: 1px solid var(--line); border-radius: 0 0 16px 16px;
}
.fp-foot .btn { padding: 0 12px; }
.fp-foot [data-f=clear] { margin-right: auto; }
.fp-foot [data-f=apply] { flex: 0 1 12rem; }
.buyer .fp-foot { bottom: var(--safe-b); }
body.f-open .cart-fab { display: none; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchips[hidden] { display: none; }
.buyer-tools .fpanel, .buyer-tools .fchips { margin-top: 12px; }
.chip-f { min-height: 34px; padding: 0 10px 0 12px; gap: 6px; background: rgba(65, 90, 119, .35); cursor: pointer; white-space: normal; text-align: left; }
.chip-f:hover { border-color: var(--mist); }
.chip-syms { display: inline-flex; gap: 2px; }
.chip-syms .ms { margin: 0; vertical-align: 0; }
.chip-clear { background: transparent; border-style: dashed; color: var(--muted); }
@media (min-width: 600px) {
  .fp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fp-wide { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .fp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fp-wide { grid-column: span 2; }
}

.seg { align-self: flex-start; display: inline-flex; padding: 3px; border: 1px solid var(--slate); border-radius: 12px; gap: 2px; }
.seg > button, .seg label span {
  display: grid; place-items: center; min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px;
  background: transparent; font-weight: 600; font-size: .92rem; color: var(--muted); cursor: pointer;
}
.seg > button[aria-checked=true], .seg input:checked + span { background: var(--bone); color: var(--ink); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:focus-visible + span { outline: 2px solid var(--bone); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper output { min-width: 2.2ch; text-align: center; font: 600 1.15rem var(--f-disp); font-variant-numeric: tabular-nums; }
.stepper-sm .icon-btn { width: 36px; height: 36px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 52px; height: 30px; right: 0; margin: 0; cursor: pointer; }
.switch-ui { width: 52px; height: 30px; border-radius: 999px; background: var(--ink); border: 1px solid var(--slate); position: relative; flex: none; transition: background-color .15s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--mist); transition: transform .18s, background-color .18s; }
.switch input:checked + .switch-ui { background: var(--slate); }
.switch input:checked + .switch-ui::after { transform: translateX(22px); background: var(--bone); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--bone); outline-offset: 2px; }
.switch input:disabled + .switch-ui { opacity: .45; }

/* ---------- estructura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + var(--safe-t)) 16px 8px; min-height: 56px;
  background: rgba(13, 27, 42, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand, .brand-lg { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.35rem var(--f-disp); letter-spacing: .01em; }
.logo-mark { width: 24px; height: 28px; flex: none; }
.topbar-end { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--slate); background: var(--navy); overflow: hidden; display: grid; place-items: center; font-weight: 700; padding: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.4rem; flex: none; }
.account-head { justify-content: flex-start; gap: 14px; }
.account-head > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.account-head .hint { overflow: hidden; text-overflow: ellipsis; }
.btn-google { gap: 12px; }
.btn-google svg { background: #fff; border-radius: 50%; padding: 2px; width: 26px; height: 26px; }
.sync, .sync-line { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.sync-line { font-weight: 500; font-size: .92rem; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--bone); }
.sync-syncing .sync-dot { background: var(--mist); animation: pulse 1s ease-in-out infinite; }
.sync-offline .sync-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--mist); }
.sync-local .sync-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--mist); }
.sync-synced .sync-label { color: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }
@media (max-width: 380px) { .sync-synced .sync-label { display: none; } }

main { max-width: 1200px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + 32px + var(--safe-b)); }
main:focus { outline: none; }
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.toolbar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sum { color: var(--muted); font: 600 1rem var(--f-disp); font-variant-numeric: tabular-nums; }
.link-back { align-self: flex-start; background: none; border: 0; padding: 6px 0; min-height: 44px; color: var(--muted); font-weight: 600; }
.empty { text-align: center; padding: 48px 16px; display: grid; justify-items: center; gap: 10px; border: 1px dashed var(--slate); border-radius: 14px; }
.empty p:first-child { font: 600 1.3rem var(--f-disp); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(6px + var(--safe-b)); height: calc(var(--tabbar-h) + var(--safe-b));
  background: var(--navy); border-top: 1px solid var(--line);
}
.tab { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; background: none; border: 0; border-radius: 12px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current=page] { color: var(--bone); background: rgba(65, 90, 119, .45); }
.tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bone); color: var(--ink); font-size: .75rem; display: grid; place-items: center; }

.actionbar {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + 8px + var(--safe-b)); z-index: 24;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px;
  background: var(--slate); border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.actionbar[hidden] { display: none; }
.ab-count { flex: 1; font-weight: 600; }
/* selección múltiple: dos filas (estado + acciones) */
.actionbar:has(.ab-top) { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; }
.ab-top { display: flex; align-items: center; gap: 8px; padding-left: 8px; }
.ab-top .icon-btn { border-color: var(--mist); }
.ab-top .btn { border-color: var(--mist); }
.ab-acts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.ab-acts .btn { min-width: 0; padding: 0 10px; white-space: normal; line-height: 1.15; text-align: center; }
@media (max-width: 559px) { .ab-acts[data-n="4"] { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } }
.ab-acts .btn:not(.primary) { background: var(--ink); border-color: var(--ink); }
.ab-acts .ab-del { color: var(--danger); }
main.has-ab { padding-bottom: calc(var(--tabbar-h) + 210px + var(--safe-b)); }

/* ---------- menú de la cuenta ---------- */
.avatar[aria-expanded=true] { box-shadow: 0 0 0 2px var(--bone); }
.menu-pop {
  position: fixed; z-index: 40; top: calc(60px + var(--safe-t)); right: 12px; width: min(290px, calc(100vw - 24px));
  padding: 6px; background: var(--navy); border: 1px solid var(--slate); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55); animation: menu-in .14s ease-out;
}
.menu-pop[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }
.menu-head { display: grid; gap: 2px; padding: 10px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.menu-head strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head > span:not(.sync-line) { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head .sync-line { margin-top: 6px; font-size: .82rem; line-height: 1.35; align-items: flex-start; }
.menu-head .sync-line .sync-dot { margin-top: 5px; }
.menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.menu [role=menuitem] {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px;
  background: none; border: 0; border-radius: 9px; text-align: left; font-weight: 600;
}
.menu [role=menuitem]:is(:hover, :focus) { background: rgba(65, 90, 119, .5); outline: none; }
.menu [role=menuitem]:focus-visible { outline: 2px solid var(--bone); outline-offset: -2px; }
.menu [role=menuitem] svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.menu [role=separator] { height: 1px; margin: 4px 6px; background: var(--line); }

/* ---------- perfil y configuración ---------- */
.narrow { max-width: 820px; margin: 0 auto; }
.profile-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-head > div { min-width: 0; }
.profile-head .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-sec { display: grid; gap: 12px; margin-bottom: 32px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
.stat { display: grid; gap: 2px; align-content: start; min-width: 0; padding: 12px 14px; background: var(--navy); border: 1px solid var(--line); border-radius: 14px; }
.stat dt { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat dd { margin: 0; display: grid; gap: 2px; }
.stat strong { font: 700 1.8rem/1.1 var(--f-disp); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat small { color: var(--muted); font-size: .82rem; }
.stat-cols { display: grid; gap: 12px; }
.panel { display: grid; gap: 10px; align-content: start; min-width: 0; margin: 0; padding: 14px; background: var(--navy); border: 1px solid var(--line); border-radius: 14px; }
.panel > h3, .panel > figcaption { font: 700 1.15rem var(--f-disp); }
.dist ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dist li { display: grid; grid-template-columns: 6.2rem 1fr 3rem; align-items: center; gap: 10px; font-size: .9rem; }
.dist-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-bar { height: 10px; border-radius: 4px; background: var(--ink); overflow: hidden; }
.dist-bar i { display: block; height: 100%; min-width: 4px; background: var(--mist); border-radius: 0 4px 4px 0; }
.dist-n { text-align: right; font: 600 .95rem var(--f-disp); font-variant-numeric: tabular-nums; }
.months { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; height: 180px; }
.months li { display: grid; grid-template-rows: 1.3em 1fr auto; gap: 4px; min-width: 0; padding: 2px; text-align: center; border-radius: 8px; }
.months li:is(:hover, :focus-visible) { background: rgba(65, 90, 119, .3); }
.m-v { font: 600 .8rem var(--f-disp); font-variant-numeric: tabular-nums; white-space: nowrap; visibility: hidden; }
.months li.is-peak .m-v, .months li:is(:hover, :focus-visible) .m-v { visibility: visible; }
.m-bar { display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.m-bar i { display: block; width: 100%; max-width: 44px; min-height: 2px; background: var(--bone); border-radius: 4px 4px 0 0; }
.m-l { color: var(--muted); font-size: .8rem; text-transform: capitalize; }

.set-sec { display: grid; gap: 14px; margin: 0 0 16px; padding: 16px; background: var(--navy); border: 1px solid var(--line); border-radius: 16px; }
.set-sec h2 { font-size: 1.35rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.set-row + .set-row, .check-line + .set-row { padding-top: 14px; border-top: 1px solid var(--line); }
.set-row > div { display: grid; gap: 2px; flex: 1 1 15rem; min-width: 0; }
.set-row strong { font-weight: 600; }
.set-danger { border-color: rgba(235, 165, 159, .45); }
.set-danger h2 { color: var(--danger); }
.check-line { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .92rem; cursor: pointer; }
.check-line input { width: 20px; height: 20px; margin: 0; accent-color: var(--bone); }

/* ---------- grilla de cartas ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px 10px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; padding: 0; background: none; border: 0; text-align: left;
  content-visibility: auto; contain-intrinsic-size: 110px 190px; border-radius: 6px;
}
.tile-art, .pocket-card, .cd-img {
  position: relative; display: block; aspect-ratio: 488 / 680; border-radius: var(--r-card); overflow: hidden;
  background: var(--navy);
}
.tile-art { box-shadow: 0 6px 14px rgba(0, 0, 0, .35); transition: transform .15s; }
.tile:hover .tile-art { transform: translateY(-2px); }
.tile-art img, .pocket-card img, .cd-img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { display: grid; place-items: center; height: 100%; padding: 8px; text-align: center; font: 600 .85rem var(--f-disp); color: var(--muted); border: 1px solid var(--slate); border-radius: inherit; }
/* ---------- efecto foil: tinte holográfico + barrido de arcoíris + brillo ---------- */
.sheen {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: inherit; z-index: 1;
  /* tinte permanente para que el foil se note aunque no haya animación */
  background: linear-gradient(135deg, rgba(255, 120, 200, .10), rgba(120, 220, 255, .10) 35%, rgba(255, 240, 150, .08) 65%, rgba(170, 140, 255, .10));
  mix-blend-mode: color-dodge;
}
.sheen::before, .sheen::after { content: ""; position: absolute; inset: 0; background-size: 300% 100%; background-repeat: no-repeat; }
.sheen::before { /* banda de arcoíris */
  background-image: linear-gradient(112deg,
    transparent 30%, rgba(255, 70, 160, .30) 38%, rgba(255, 205, 60, .30) 43%, rgba(70, 255, 180, .30) 48%,
    rgba(50, 175, 255, .34) 53%, rgba(175, 90, 255, .30) 58%, transparent 66%);
  animation: foil-sweep 4.2s ease-in-out infinite alternate;
}
.sheen::after { /* destello blanco */
  background-image: linear-gradient(105deg, transparent 45%, rgba(255, 255, 255, .45) 50%, transparent 55%);
  mix-blend-mode: overlay;
  animation: foil-sweep 4.2s ease-in-out infinite alternate-reverse;
}
@keyframes foil-sweep { from { background-position: 100% 0; } to { background-position: 0% 0; } }
/* desfasar las cartas para que no brillen todas a la vez */
.grid > :nth-child(3n+1) .sheen::before, .grid > :nth-child(3n+1) .sheen::after,
.page > :nth-child(3n+1) .sheen::before, .page > :nth-child(3n+1) .sheen::after { animation-delay: -1.4s; }
.grid > :nth-child(3n+2) .sheen::before, .grid > :nth-child(3n+2) .sheen::after,
.page > :nth-child(3n+2) .sheen::before, .page > :nth-child(3n+2) .sheen::after { animation-delay: -2.8s; }
.tile:hover .sheen::before, .pocket:hover .sheen::before, .tile:hover .sheen::after, .pocket:hover .sheen::after { animation-duration: 1.6s; }
/* borde con reflejo en cartas foil */
.tile.is-foil .tile-art, .pocket.is-foil .pocket-card { box-shadow: 0 0 0 1px rgba(190, 215, 255, .45), 0 0 14px rgba(150, 190, 255, .28), 0 6px 14px rgba(0, 0, 0, .35); }
/* popup: la carta se inclina y el reflejo sigue al puntero */
.cd-art .sheen { display: none; }
.cd-art.is-foil .sheen { display: block; }
.cd-art .cd-img { transform: perspective(900px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)); transition: transform .12s ease-out; }
.cd-art.is-foil .cd-img.is-tilting .sheen::before, .cd-art.is-foil .cd-img.is-tilting .sheen::after { animation: none; background-position: calc((1 - var(--px, .5)) * 100%) 0; }
.cd-art.is-foil .cd-img::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; opacity: 0; transition: opacity .2s;
  background: radial-gradient(circle at calc(var(--px, .5) * 100%) calc(var(--py, .3) * 100%), rgba(255, 255, 255, .35), transparent 45%);
  mix-blend-mode: overlay;
}
.cd-art.is-foil .cd-img.is-tilting::after { opacity: 1; }
.qty, .req-dot, .check { position: absolute; font: 700 .8rem var(--f-disp); }
.qty { left: 6%; bottom: 4%; padding: 1px 6px; border-radius: 5px; background: var(--ink); color: var(--bone); border: 1px solid var(--slate); }
.req-dot { top: 5%; right: 6%; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--bone); color: var(--ink); box-shadow: 0 0 0 3px var(--ink); font-size: .85rem; }
.check { top: 5%; left: 6%; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bone); background: rgba(13, 27, 42, .6); }
.tile.is-selected .tile-art { outline: 3px solid var(--bone); outline-offset: 2px; }
.tile.is-selected .check { background: var(--bone); }
.tile.is-selected .check::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid var(--ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.tile-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; padding: 0 2px; font-size: .76rem; white-space: nowrap; }
.tile-set { color: var(--muted); display: inline-flex; gap: 4px; min-width: 0; overflow: hidden; }
.tile-meta .p { font-size: .95rem; flex: none; }
.tile-set b { color: var(--bone); font-weight: 600; }
.p { font: 600 .98rem var(--f-disp); font-variant-numeric: tabular-nums; }
.p-scryfall { color: var(--muted); }
.p-none { color: var(--muted); font-size: .78rem; }

/* ---------- binders (vendedor) ---------- */
.binder-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.binder-row {
  width: 100%; display: flex; align-items: center; gap: 16px; padding: 14px; text-align: left;
  background: var(--navy); border: 1px solid var(--line); border-radius: 14px;
}
.binder-row:hover { border-color: var(--mist); }
.fan { position: relative; width: 92px; height: 88px; flex: none; }
.fan img, .fan-empty { position: absolute; top: 5px; width: 56px; height: auto; aspect-ratio: 488/680; object-fit: cover; border-radius: 4px; box-shadow: 0 4px 10px rgba(0, 0, 0, .4); transform-origin: 50% 90%; }
.fan img:nth-child(1) { left: 0; transform: rotate(-9deg); }
.fan img:nth-child(2) { left: 18px; transform: rotate(0); z-index: 1; }
.fan img:nth-child(3) { left: 36px; transform: rotate(9deg); z-index: 2; }
.fan-empty { left: 18px; border: 1px dashed var(--slate); box-shadow: none; }
.binder-info { display: grid; gap: 4px; justify-items: start; }
.binder-info strong { font: 700 1.3rem var(--f-disp); }
.binder-info > span:not(.chip) { color: var(--muted); font-size: .92rem; }

/* ---------- solicitudes ---------- */
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.req { background: var(--navy); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.req.is-done { opacity: .82; }
.req-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.req-sub { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.wa { display: inline-flex; align-items: center; gap: 8px; justify-self: start; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--slate); font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.wa:hover { background: rgba(65, 90, 119, .35); }
.req-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.req-total strong { font: 700 1.3rem var(--f-disp); margin-left: 6px; }

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mini-list li { display: flex; align-items: center; gap: 12px; }
.mini-list img { width: 48px; flex: none; border-radius: 3px; aspect-ratio: 488/680; object-fit: cover; }
.mini-list li.is-gone { opacity: .55; }
.ml-name { flex: 1; min-width: 0; display: grid; }
.ml-name strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-name small { color: var(--muted); font-size: .82rem; }
.ml-price { font: 600 1rem var(--f-disp); font-variant-numeric: tabular-nums; }
.ml-qty input { width: 4.2rem; text-align: center; }

/* ---------- diálogos ---------- */
dialog { padding: 0; border: 0; background: transparent; color: var(--bone); max-width: 100vw; max-height: 100dvh; }
dialog::backdrop { background: rgba(13, 27, 42, .76); backdrop-filter: blur(3px); }
dialog.as-sheet, dialog.as-card { width: 100%; max-width: 640px; margin: auto auto 0; }
dialog.confirm { width: calc(100% - 32px); max-width: 420px; margin: auto; }
dialog[open].as-sheet, dialog[open].as-card { animation: sheet-in .22s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet {
  display: grid; gap: 14px; padding: 18px 16px calc(16px + var(--safe-b));
  background: var(--navy); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; max-height: 92dvh; overflow: auto;
}
.sheet-sm { border-radius: var(--r-sheet); border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.sheet-foot #bs-del { margin-right: auto; }
/* Mover al binder: botones justo bajo la elección del binder, antes de la lista de cartas */
.mv-foot { padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.mv-list li { flex-wrap: wrap; row-gap: 6px; }
.mv-list .ml-name { min-width: 9rem; }
.ml-move { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ml-move-l { font-size: .82rem; font-weight: 600; color: var(--muted); }
.ml-move small, .ml-one { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.ml-move .stepper output { min-width: 2ch; }
.drop {
  display: grid; place-items: center; min-height: 72px; padding: 12px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--mist); border-radius: 12px; font-weight: 600;
}
.drop:hover { background: rgba(65, 90, 119, .25); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 2px solid var(--bone); outline-offset: 2px; }
.progress { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.progress[hidden] { display: none; }
progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 99px; background: var(--ink); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--ink); }
progress::-webkit-progress-value { background: var(--bone); }
progress::-moz-progress-bar { background: var(--bone); }
.combo { gap: 6px; }
.combo > small { color: var(--muted); font-size: .82rem; }
.combo-list {
  list-style: none; margin: 0; padding: 4px; max-height: min(320px, 45dvh); overflow: auto; overscroll-behavior: contain;
  background: var(--ink); border: 1px solid var(--slate); border-radius: var(--r-ctl);
}
.combo-list li { display: flex; align-items: center; min-height: 44px; padding: 6px 12px; border-radius: 8px; color: var(--bone); cursor: pointer; }
.combo-list li b { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.combo-list li:hover, .combo-list li[aria-selected=true] { background: rgba(65, 90, 119, .55); }
.combo-list li[aria-selected=true] { outline: 2px solid var(--bone); outline-offset: -2px; }
.ac-card { display: grid; grid-template-columns: minmax(0, 110px) minmax(0, 1fr); gap: 14px; align-items: start; }
.ac-art .cd-img { width: 100%; box-shadow: 0 8px 20px rgba(0, 0, 0, .45); }
.ac-fields { display: grid; gap: 12px; min-width: 0; }
.ac-fields .seg-cond label span { padding: 0 4px; }
.ac-price { color: var(--muted); font-size: .9rem; }
.ac-price strong { color: var(--bone); font: 700 1.15rem var(--f-disp); }
@media (max-width: 379px) { .ac-card { grid-template-columns: minmax(0, 1fr); } .ac-art .cd-img { width: 120px; } }
@media (min-width: 600px) { .ac-card { grid-template-columns: 170px minmax(0, 1fr); gap: 20px; } }
.nf-list { max-height: 40dvh; overflow: auto; margin: 0; padding-left: 18px; color: var(--muted); }
.copy-field { font-variant-numeric: tabular-nums; }

/* popup de carta */
.card-dlg {
  position: relative; display: grid; gap: 18px; padding: 16px 16px calc(20px + var(--safe-b));
  background: var(--navy); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; max-height: 94dvh; overflow: auto; overscroll-behavior: contain;
}
.cd-close { position: sticky; top: 0; justify-self: end; margin-bottom: -58px; z-index: 5; background: var(--navy); }
.vp .link-back { justify-self: start; }
.cd-art { margin: 0; display: grid; justify-items: center; gap: 10px; }
.cd-img { width: min(72vw, 300px); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.cd-body { display: grid; gap: 14px; min-width: 0; }
.cd-title { font-size: 1.9rem; padding-right: 48px; }
.face { display: grid; gap: 6px; }
.face + .face { padding-top: 12px; border-top: 1px dashed var(--line); }
.face-name { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 1.15rem; }
.mana { display: inline-flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.ms { width: 17px; height: 17px; display: inline-block; vertical-align: -3px; margin: 0 1px; }
.ms-txt { font: 700 .85rem var(--f-disp); color: var(--muted); margin: 0 1px; }
.type-line { color: var(--muted); font-weight: 600; }
.oracle { display: grid; gap: 6px; line-height: 1.5; font-size: .98rem; }
.oracle i { color: var(--muted); }
.stats { font: 700 1.2rem var(--f-disp); }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .9rem; }
.facts div:first-child { grid-column: 1 / -1; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: 0; font-weight: 500; }
.price-box { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-end; padding: 12px 14px; background: var(--ink); border-radius: 12px; }
.price-box div { display: grid; }
.price-box span { color: var(--muted); font-size: .8rem; }
.price-box strong { font: 700 1.4rem var(--f-disp); font-variant-numeric: tabular-nums; }
.price-box small { font: 600 .95rem var(--f-disp); color: var(--muted); margin-left: 6px; }
.price-box a { margin-left: auto; font-size: .9rem; font-weight: 600; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; border: 0; }
.ctl { display: grid; gap: 6px; align-content: start; margin: 0; padding: 0; border: 0; min-width: 0; }
.ctl-full { grid-column: 1 / -1; }
.controls .switch { display: flex; align-self: center; }
.seg-cond { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; }
.seg-cond label { position: relative; }
.seg-cond label span { padding: 0; width: 100%; }
.cd-reqs { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--bone); display: grid; gap: 10px; }
.cd-reqs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cd-reqs li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-actions #cd-del { margin-left: auto; }
.versions { display: grid; gap: 10px; }
.versions[hidden] { display: none; }
.v-list { list-style: none; margin: 0; padding: 0 0 6px; display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; }
.v-list li { scroll-snap-align: start; }
.v-item { width: 100%; display: grid; gap: 6px; padding: 6px; text-align: left; background: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
.v-item.is-current { border-color: var(--bone); }
.v-item img { border-radius: 5px; aspect-ratio: 488/680; width: 100%; object-fit: cover; }
.v-item span { display: grid; gap: 1px; font-size: .82rem; }
.v-item small { color: var(--muted); }

/* selector de versiones (estilo Archidekt) */
.card-dlg.picking .cd-art { position: sticky; top: -16px; z-index: 3; margin: -16px -16px 0; padding: 12px 16px 10px; background: var(--navy); border-bottom: 1px solid var(--line); }
.card-dlg.picking .cd-img { width: 104px; box-shadow: 0 8px 20px rgba(0, 0, 0, .45); }
.vp { display: grid; gap: 12px; min-width: 0; }
.vp .cd-title { font-size: 1.6rem; padding-right: 48px; }
.vp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vp-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 6px 6px 6px 4px; border-radius: 12px; border: 1px solid transparent; }
.vp-row:hover { background: rgba(65, 90, 119, .22); }
.vp-row.is-on { background: rgba(65, 90, 119, .38); border-color: var(--mist); }
.vp-main { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 4px 6px; background: none; border: 0; border-radius: 8px; text-align: left; }
.set-ic { width: 22px; height: 22px; flex: none; filter: invert(.9) sepia(.1) saturate(.4); }
.vp-name { display: grid; min-width: 0; }
.vp-name strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-name small { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.rar { text-decoration: none; font-weight: 700; }
.rar-uncommon { color: #c3ccd6; } .rar-rare { color: #e6d39a; } .rar-mythic { color: #f0a77e; }
.vp-fin { display: flex; gap: 4px; }
.fin {
  display: grid; justify-items: center; min-width: 64px; min-height: 44px; padding: 3px 8px;
  background: var(--ink); border: 1px solid var(--slate); border-radius: 9px; font-size: .72rem; color: var(--muted); line-height: 1.15;
}
.fin b { font: 700 .98rem var(--f-disp); color: var(--bone); font-variant-numeric: tabular-nums; }
.fin-foil { background: linear-gradient(120deg, var(--ink) 30%, rgba(160, 200, 255, .16) 50%, rgba(240, 190, 255, .12) 60%, var(--ink) 80%); }
.fin[aria-pressed=true] { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.fin[aria-pressed=true] b { color: var(--ink); }
.vp-empty { color: var(--muted); padding: 16px 4px; }
.vp-foot {
  position: sticky; bottom: calc(-20px - var(--safe-b)); z-index: 2; margin: 4px -16px calc(-20px - var(--safe-b)); padding: 12px 16px calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 12px; background: var(--navy); border-top: 1px solid var(--line);
}
.vp-sel { flex: 1; min-width: 0; font-size: .88rem; color: var(--muted); }
@media (min-width: 720px) {
  .card-dlg.picking .cd-art { position: sticky; top: 0; margin: 0; padding: 0; border: 0; background: none; }
  .card-dlg.picking .cd-img { width: 100%; }
  .vp-foot { bottom: -24px; margin: 4px -24px -24px 0; padding: 14px 24px 14px 0; }
  .vp-list { max-height: none; }
}

/* ---------- landing ---------- */
.landing { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.landing-inner { max-width: 34rem; display: grid; gap: 18px; justify-items: start; }
.brand-lg { font-size: 1.6rem; }
.brand-lg .logo-mark { width: 30px; height: 34px; }
.landing h1 { font-size: clamp(2.4rem, 9vw, 3.6rem); line-height: 1; }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 30em; }

/* ================= Binder del comprador ================= */
.topbar-buyer { justify-content: center; }
main.buyer { padding-bottom: calc(96px + var(--safe-b)); }
.buyer-head { display: grid; gap: 4px; margin-bottom: 14px; }
.buyer-head h1 { font-size: clamp(2rem, 8vw, 2.8rem); }
.binder-note { color: var(--muted); font-size: .95rem; border-left: 2px solid var(--slate); padding-left: 10px; margin-top: 6px; }
.buyer-tools { margin-bottom: 16px; }

.binder-book {
  --ring-gutter: 26px;
  position: relative; padding: 12px 10px 12px var(--ring-gutter);
  border-radius: 10px 16px 16px 10px;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(119, 141, 169, .16), transparent 60%),
    linear-gradient(180deg, #1f2c44, var(--navy));
  box-shadow: 0 24px 50px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(224, 225, 221, .06);
  touch-action: pan-y;
}
/* costura de la tapa */
.binder-book::after {
  content: ""; position: absolute; inset: 5px; border: 1.5px dashed rgba(119, 141, 169, .45);
  border-radius: 7px 12px 12px 7px; pointer-events: none;
}
/* anillas (móvil: borde izquierdo) */
.binder-book::before {
  content: ""; position: absolute; z-index: 2; left: 5px; top: 14%; bottom: 14%; width: 26px; pointer-events: none;
  background:
    radial-gradient(circle at 13px 50%, transparent 5px, #c9ccc6 5.5px, #e0e1dd 7px, #8a96a5 8.5px, transparent 9px) 0 0 / 26px 33.33% repeat-y;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .5));
}
.book-pages { display: grid; gap: 12px; perspective: 1400px; }
.page {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(5px, 1.8vw, 12px);
  padding: clamp(8px, 2.4vw, 16px) clamp(8px, 2.4vw, 16px) 26px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .28), transparent 9%),
    var(--page);
  border-radius: 6px 10px 10px 6px;
  box-shadow: inset 0 0 0 1px rgba(224, 225, 221, .06), 2px 3px 0 #17223a, 4px 6px 0 #131d31;
  transform-origin: left center;
}
.page-num { position: absolute; bottom: 6px; right: 12px; font: 600 .8rem var(--f-disp); color: var(--muted); }
.page-blank { background: linear-gradient(90deg, rgba(0, 0, 0, .28), transparent 9%), var(--page); opacity: .6; }
.page-msg { grid-template-columns: 1fr; place-items: center; min-height: 60vw; max-height: 520px; text-align: center; color: var(--muted); padding: 24px; }

/* bolsillo plástico */
.pocket {
  position: relative; display: block; padding: 5%; border: 0; border-radius: 5px;
  background: rgba(13, 27, 42, .55);
  box-shadow: inset 0 1px 0 rgba(224, 225, 221, .08), inset 0 -1px 0 rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(119, 141, 169, .22);
  aspect-ratio: 488 / 680; box-sizing: content-box; width: 90%;
}
.pocket.is-empty { background: rgba(13, 27, 42, .32); }
.pocket::after { /* reflejo del plástico */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(125deg, rgba(224, 225, 221, .16) 0%, rgba(224, 225, 221, .04) 28%, transparent 40%, transparent 78%, rgba(224, 225, 221, .07) 100%);
}
.pocket-card { box-shadow: 0 2px 5px rgba(0, 0, 0, .5); transition: transform .2s; }
.pocket:hover .pocket-card { transform: translateY(-3%); }
.pocket:focus-visible { outline: 3px solid var(--bone); outline-offset: 1px; }
.sticker {
  position: absolute; z-index: 1; right: 3%; bottom: 5%;
  display: inline-flex; align-items: baseline; gap: 3px;
  padding: 1px 6px 2px; border-radius: 3px; transform: rotate(-4deg);
  background: var(--bone); color: var(--ink); font: 700 clamp(.72rem, 3vw, .95rem)/1.2 var(--f-disp); font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .45);
}
.sticker small { font-size: .8em; opacity: .75; }
.in-cart {
  position: absolute; z-index: 1; top: 3%; right: 3%; min-width: 24px; height: 24px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 999px; background: var(--ink); color: var(--bone);
  border: 2px solid var(--bone); font: 700 .8rem var(--f-disp);
}
/* pasar la hoja: capas decorativas encima de las páginas nuevas */
.book-pages { position: relative; }
.leaf, .leaf-under { position: absolute; z-index: 3; margin: 0; pointer-events: none; }
.leaf-under { z-index: 2; }
.leaf-under > .page, .leaf-face > .page { width: 100%; height: 100%; }
.leaf { transform-style: preserve-3d; animation: .62s cubic-bezier(.45, .05, .25, 1) both; will-change: transform; }
.leaf-next, .leaf-prev { transform-origin: 0 50%; }
.leaf-next { animation-name: leaf-next; }
.leaf-prev { animation-name: leaf-prev; }
.leaf-spread-next { animation-name: leaf-spread-next; }
.leaf-spread-prev { animation-name: leaf-spread-prev; }
@keyframes leaf-next { from { transform: rotateY(0); } to { transform: rotateY(-96deg); } }
@keyframes leaf-prev { from { transform: rotateY(-96deg); } to { transform: rotateY(0); } }
@keyframes leaf-spread-next { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes leaf-spread-prev { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
.leaf-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.leaf-back { transform: rotateY(180deg); }
/* sombra que se oscurece a mitad del giro */
.leaf-shade {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, .12) 55%, rgba(224, 225, 221, .08));
  animation: leaf-shade .62s ease-in-out both;
}
.leaf-back .leaf-shade { background: linear-gradient(270deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, .12) 55%, rgba(224, 225, 221, .08)); }
@keyframes leaf-shade { 50% { opacity: 1; } }

.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 18px; }
.pager-btn { width: 52px; height: 52px; font-size: 1.6rem; }
#pinfo { font: 600 1rem var(--f-disp); min-width: 11ch; text-align: center; font-variant-numeric: tabular-nums; }
.kbd-hint { text-align: center; color: var(--muted); font-size: .82rem; margin-top: 8px; }

.cart-fab {
  position: fixed; z-index: 26; right: 12px; left: 12px; bottom: calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 18px;
  background: var(--bone); color: var(--ink); border: 0; border-radius: 16px; font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}
.cart-fab[hidden] { display: none; }
.cart-fab b { min-width: 24px; height: 24px; border-radius: 999px; background: var(--ink); color: var(--bone); display: grid; place-items: center; font-size: .82rem; }
.fab-total { margin-left: auto; font: 700 1.2rem var(--f-disp); }
.cart-fab:focus-visible { outline-color: var(--bone); outline-offset: 3px; }

.buy-box { display: grid; gap: 10px; padding: 14px; background: var(--ink); border-radius: 14px; }
.buy-price { font: 700 2rem var(--f-disp); font-variant-numeric: tabular-nums; }
.buy-price small { font-size: .9rem; color: var(--muted); }
.buy-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.buy-row { display: flex; gap: 10px; align-items: center; }
.co-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: 1px solid var(--line); }
.co-total strong { font: 700 1.5rem var(--f-disp); }
.phone-row { display: flex; gap: 8px; }
.phone-row label { width: 7.2rem; flex: none; }

.toast {
  position: fixed; z-index: 200; left: 50%; bottom: calc(var(--tabbar-h) + 16px + var(--safe-b));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--bone); color: var(--ink); font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- pantallas medianas ---------- */
@media (min-width: 600px) {
  main { padding: 24px 24px calc(var(--tabbar-h) + 40px); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 14px; }
  h1 { font-size: 2.4rem; }
  .cart-fab { left: auto; min-width: 320px; }
  .stat-cols-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-cols { grid-template-columns: repeat(3, 1fr); }
  .stat-cols-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  dialog.as-sheet, dialog.as-card { margin: auto; }
  .sheet, .card-dlg { border-radius: var(--r-sheet); border-bottom: 1px solid var(--line); padding-bottom: 20px; }
  dialog.as-card { max-width: 900px; }
  .card-dlg { grid-template-columns: minmax(240px, 340px) 1fr; padding: 24px; gap: 28px; max-height: 90dvh; }
  .cd-close { position: absolute; top: 14px; right: 14px; margin: 0; }
  .cd-art { position: sticky; top: 0; align-self: start; }
  .cd-img { width: 100%; }
}
@media (min-width: 900px) {
  :root { --tabbar-h: 0px; }
  .tabbar {
    top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); z-index: 21;
    height: 56px; padding: 8px; width: 460px; background: transparent; border: 0;
  }
  .tab { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: .92rem; }
  .tab svg { width: 20px; height: 20px; }
  .tab-badge { position: static; }
  .actionbar { left: 50%; right: auto; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); bottom: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .toast { bottom: 24px; }
  /* binder abierto: dos páginas con anillas al centro */
  .binder-book { --ring-gutter: 12px; padding: 16px; border-radius: 16px; max-width: min(1100px, max(720px, calc((100dvh - 290px) * 1.36))); margin: 0 auto; }
  .buyer-head, .buyer-tools { max-width: min(1100px, max(720px, calc((100dvh - 290px) * 1.36))); margin-left: auto; margin-right: auto; }
  .binder-book::after { border-radius: 12px; }
  .binder-book::before { left: calc(50% - 13px); }
  .book-pages.spread { grid-template-columns: 1fr 1fr; gap: 34px; }
  .book-pages.spread .page-l { transform-origin: right center; border-radius: 10px 6px 6px 10px; background: linear-gradient(270deg, rgba(0, 0, 0, .3), transparent 9%), var(--page); box-shadow: inset 0 0 0 1px rgba(224, 225, 221, .06), -2px 3px 0 #17223a, -4px 6px 0 #131d31; }
  .book-pages.spread .page-msg { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cd-art .cd-img { transform: none; }
}
@media (forced-colors: active) {
  .btn, .icon-btn, .pocket, .tile-art { border: 1px solid CanvasText; }
}

/* ================= Tipos de binder e idioma ================= */
.chip-kind { background: linear-gradient(110deg, #415a77, #778da9); border-color: #778da9; color: var(--bone); }
h1 .chip { vertical-align: middle; font-family: var(--f-body); font-size: .8rem; }
.binder-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.showcase-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .95rem; }
.mv-new { display: grid; gap: 14px; }
/* abreviatura del idioma sobre la carta (solo si no está en inglés) */
.lang-badge {
  position: absolute; z-index: 2; padding: 1px 6px; border-radius: 4px;
  background: var(--ink); color: var(--bone); border: 1px solid var(--mist);
  font: 700 .72rem/1.3 var(--f-disp); letter-spacing: .05em; box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.tile-art .lang-badge { right: 6%; bottom: 4%; }
.pocket-card .lang-badge, .drag-ghost .lang-badge { left: 5%; top: 4%; font-size: clamp(.6rem, 2.4vw, .72rem); }

/* ================= Mesa, playmat y cartas separadas (comprador en computadora) ================= */
:root {
  /* mesa de madera (foto) con un velo oscuro y viñeta para que los textos encima mantengan contraste AA */
  --wood:
    radial-gradient(ellipse at 50% 40%, transparent 40%, rgba(0, 0, 0, .55)),
    linear-gradient(rgba(14, 10, 7, .42), rgba(14, 10, 7, .42)),
    url("/img/mesa-madera.jpg") center / cover no-repeat;
}
.table-area { position: relative; }
.table-area > .mat, .loose-layer, .desk-only { display: none; }
.mat { position: absolute; inset: 0; overflow: hidden; border-radius: 22px; opacity: .65; background: #0e131b; box-shadow: 0 20px 44px rgba(0, 0, 0, .6); }
.mat-img {
  position: absolute; inset: 0;
  background: var(--mat, radial-gradient(120% 90% at 30% 20%, #415a77, #1b263b 55%, #0d1b2a)) center / cover no-repeat;
}
.mat::after { /* borde cosido típico de los playmats */
  content: ""; position: absolute; inset: 6px; z-index: 2; pointer-events: none;
  border: 2px dashed rgba(224, 225, 221, .4); border-radius: 17px;
}
.mat-zones { position: absolute; inset: 0; z-index: 1; }
.z {
  position: absolute; width: clamp(78px, 7.6%, 128px); aspect-ratio: 63 / 88; display: grid; place-items: end center; padding: 0 4px 7px;
  border: 2px solid rgba(224, 225, 221, .55); border-radius: 9px; background: rgba(13, 27, 42, .28);
  font: 600 .7rem/1.1 var(--f-disp); font-style: normal; text-align: center; text-transform: uppercase; letter-spacing: .08em; color: rgba(224, 225, 221, .85);
}
.z-cmd { left: 2.4%; top: 7%; } .z-ex { left: 2.4%; top: 40%; }
.z-lib { right: 2.4%; top: 7%; } .z-gy { right: 2.4%; top: 40%; }

/* vista previa en los ajustes del binder */
.mat-preview { position: relative; aspect-ratio: 2.4 / 1; border-radius: 12px; overflow: hidden; background: var(--wood); }
.mat-preview .mat { inset: 9% 6%; border-radius: 10px; }
.mat-preview .mat::after { inset: 3px; border-width: 1px; border-radius: 8px; }
.mat-preview .z { width: 9%; font-size: 0; padding: 0; border-width: 1px; border-radius: 3px; }

@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  body.page-buyer { background: var(--wood); background-color: #2b1c12; background-attachment: fixed; }
  main.buyer { max-width: 1720px; }
  .desk-only { display: inline; }
  /* playmat grande: más margen alrededor del binder (que conserva su tamaño) */
  .table-area { padding: 64px 0 46px; margin: 10px 0 0; }
  .table-area > .mat { display: block; }
  .table-area .binder-book, .table-area .pager { position: relative; z-index: 1; }
  .loose-layer { display: block; position: absolute; inset: 0; z-index: 4; pointer-events: none; }
  .pocket[data-id] { cursor: grab; }
  .table-area.drop-book .binder-book { outline: 3px dashed var(--bone); outline-offset: 6px; }
  .kbd-hint, .more-binders { position: relative; }
}
.loose {
  position: absolute; width: clamp(96px, 8.6vw, 148px);
  transform: translate(-50%, -50%) rotate(var(--r, 0deg)); transition: transform .15s; pointer-events: auto;
}
.loose:hover { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(1.04); }
.loose.is-lifted { opacity: .25; }
.loose-card { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: var(--r-card); cursor: grab; box-shadow: 0 12px 26px rgba(0, 0, 0, .6); }
.loose-card.is-foil .pocket-card, .drag-ghost.is-foil .pocket-card { box-shadow: 0 0 0 1px rgba(190, 215, 255, .5), 0 0 14px rgba(150, 190, 255, .3); }
.loose-x {
  position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; background: var(--ink); border: 1px solid var(--bone); color: var(--bone); font-size: .9rem;
  opacity: 0; transition: opacity .15s;
}
.loose:hover .loose-x, .loose:focus-within .loose-x { opacity: 1; }
.drag-ghost {
  position: fixed; z-index: 60; width: clamp(110px, 9vw, 150px); pointer-events: none;
  transform: translate(-50%, -50%) rotate(-5deg) scale(1.06); filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .6));
}
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.pocket.is-out .pocket-card { opacity: .25; filter: grayscale(.7); }
.out-tag {
  position: absolute; z-index: 1; left: 50%; top: 45%; transform: translate(-50%, -50%) rotate(-8deg);
  padding: 2px 8px; border-radius: 4px; background: var(--ink); color: var(--bone); border: 1px dashed var(--mist);
  font: 700 clamp(.6rem, 1vw, .8rem) var(--f-disp); white-space: nowrap; text-transform: uppercase; letter-spacing: .05em;
}

/* otros binders del vendedor */
.more-binders { display: grid; gap: 12px; max-width: 900px; margin: 40px auto 0; padding: 18px; background: var(--navy); border: 1px solid var(--line); border-radius: 16px; }
.more-binders h3 { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.more-binders h3 small { font: 500 .85rem var(--f-body); color: var(--muted); }
.more-binders .binder-row { text-decoration: none; }
.more-binders .binder-row.is-here { border-color: var(--mist); }
@media (min-width: 720px) { .more-binders .binder-list { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1199px) { .table-area .mat-zones { display: none; } }

/* ================= Ordenar cartas de un showcase ================= */
.order-bar {
  position: sticky; top: calc(64px + var(--safe-t)); z-index: 15;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; padding: 12px 14px;
  background: var(--slate); border-radius: 14px; box-shadow: 0 10px 26px rgba(0, 0, 0, .4);
}
.order-bar-text { display: grid; gap: 2px; flex: 1 1 16rem; min-width: 0; }
.order-bar-text .hint { color: var(--bone); opacity: .85; }
.order-bar .field { flex: 1 1 12rem; }
.order-bar select { background-color: var(--ink); }
.order-bar .btn:not(.primary) { background: var(--ink); border-color: var(--ink); }
.order-page {
  margin-bottom: 18px; padding: 12px 12px 14px; border-radius: 10px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .28), transparent 9%), var(--page);
  box-shadow: inset 0 0 0 1px rgba(224, 225, 221, .06);
}
.order-page-t { font-size: 1rem; color: var(--muted); margin: 0 0 10px; }
.order-grid { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 560px; }
.order-item { display: grid; gap: 4px; min-width: 0; transition: transform .12s; }
.order-art {
  position: relative; display: block; aspect-ratio: 488 / 680; border-radius: var(--r-card); overflow: hidden;
  background: var(--navy); box-shadow: 0 3px 8px rgba(0, 0, 0, .45); cursor: grab; user-select: none;
}
.order-art img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.order-num {
  position: absolute; left: 6%; top: 4%; z-index: 2; min-width: 24px; height: 24px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 999px; background: var(--bone); color: var(--ink); font: 700 .8rem var(--f-disp);
}
.order-name { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-btns { display: flex; justify-content: center; gap: 6px; }
.order-btns .icon-btn { width: 40px; height: 40px; }
.order-item.is-dragging { position: relative; z-index: 20; transition: none; }
.order-item.is-dragging .order-art { box-shadow: 0 16px 30px rgba(0, 0, 0, .6); cursor: grabbing; }
.order-item.is-target .order-art { outline: 3px dashed var(--bone); outline-offset: 3px; }
.is-ordering, .is-ordering * { cursor: grabbing !important; }
@media (min-width: 900px) { .order-bar { top: 64px; } .order-grid { max-width: 620px; } }
.order-hint-m { display: none; margin: -6px 0 14px; }
@media (max-width: 599px) {
  .order-bar { gap: 8px 10px; padding: 10px 12px; }
  .order-bar-text { flex: 1 1 auto; }
  .order-bar-text .hint { display: none; }
  .order-bar .row { flex-wrap: nowrap; }
  .order-bar .field { order: 3; flex-basis: 100%; }
  .order-hint-m { display: block; }
}

/* ================= Selección de cartas separadas en la mesa ================= */
.marquee {
  position: absolute; z-index: 6; pointer-events: none;
  border: 2px dashed var(--bone); border-radius: 6px; background: rgba(224, 225, 221, .12);
}
body.is-marquee, body.is-marquee * { user-select: none; cursor: crosshair !important; }
.loose.is-selected .loose-card { outline: 3px solid var(--bone); outline-offset: 3px; box-shadow: 0 0 0 7px rgba(13, 27, 42, .55), 0 0 24px rgba(224, 225, 221, .45), 0 12px 26px rgba(0, 0, 0, .6); }
.loose.is-selected { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(1.05); }
.sel-check {
  position: absolute; z-index: 3; top: -9px; left: -9px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--bone); box-shadow: 0 0 0 3px var(--ink);
}
.sel-check::after {
  content: ""; position: absolute; left: 9px; top: 5px; width: 6px; height: 11px;
  border: solid var(--ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.sel-menu {
  position: absolute; z-index: 8; pointer-events: auto;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; white-space: nowrap;
  background: var(--navy); border: 1px solid var(--mist); border-radius: 14px; box-shadow: 0 14px 32px rgba(0, 0, 0, .6);
  animation: menu-in .14s ease-out;
}
.sel-menu.is-hidden { visibility: hidden; }
.sel-count { font-weight: 600; font-size: .9rem; margin-right: 2px; }
.sel-menu .sel-x { width: 36px; height: 36px; }
.ghost-count {
  position: absolute; right: -10px; top: -10px; min-width: 30px; height: 30px; padding: 0 8px; display: grid; place-items: center;
  border-radius: 999px; background: var(--bone); color: var(--ink); font: 700 .95rem var(--f-disp); box-shadow: 0 0 0 3px var(--ink);
}
