/* ============================================================
   Tokens
   ============================================================ */
:root {
  --canvas: #f5f5f7;
  --surface: #ffffff;
  --fill: #e8e8ed;          /* campos, pistas, chips */
  --fill-hover: #dedee3;
  --hairline: rgba(0, 0, 0, .08);
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --accent: #ff4800;
  --accent-hover: #e64100;
  --focus: #ff4800;
  --on-accent: #ffffff;
  --glass: rgba(245, 245, 247, .78);
  --menu-bg: rgba(242, 242, 245, .82);
  --menu-hover: #ff4800;
  --product-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .08);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 980px;

  --drawer-w: 400px;
  --bar-h: 56px;
  --gutter: 20px;
  --ease: cubic-bezier(.32, .72, 0, 1);

  --z-drawer: 20;
  --z-menu: 50;

  color-scheme: light;
}

/* Tema oscuro: solo cuando el usuario lo elige (botón del panel) */
:root[data-theme="dark"] {
  --canvas: #000000;
  --surface: #1c1c1e;
  --fill: #2c2c2e;
  --fill-hover: #3a3a3c;
  --hairline: rgba(255, 255, 255, .1);
  --ink: #f5f5f7;
  --ink-2: #d2d2d7;
  --muted: #98989d;
  --faint: #636366;
  --accent: #ff4800;
  --accent-hover: #e64100;
  --focus: #ff4800;
  --glass: rgba(0, 0, 0, .72);
  --menu-bg: rgba(44, 44, 46, .82);
  --product-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: -.016em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss03", "cv11";
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

.app { display: flex; height: 100dvh; }

/* ============================================================
   Panel lateral
   ============================================================ */
.drawer {
  width: var(--drawer-w);
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--canvas);
  transition: margin-left .45s var(--ease);
}
.app.collapsed .drawer { margin-left: calc(-1 * var(--drawer-w)); }

.drawer-head {
  height: var(--bar-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 var(--gutter);
}
/* Las dos versiones del logo ocupan exactamente la misma celda: cambiar de tema no mueve nada */
.brand { display: grid; align-items: center; }
.brand img { grid-area: 1 / 1; display: block; height: 22px; width: auto; }
.brand .logo-dark { visibility: hidden; }
:root[data-theme="dark"] .brand .logo-light { visibility: hidden; }
:root[data-theme="dark"] .brand .logo-dark { visibility: visible; }

/* Selector de idioma */
.lang-switch {
  display: flex;
  align-items: center;
  margin-right: 4px;
  padding: 2px;
  border-radius: 8px;
  background: var(--fill);
}
.lang-switch button {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px var(--hairline);
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--canvas);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.icon-btn:hover { background: var(--fill); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.head-actions { display: flex; align-items: center; gap: 2px; }
#themeToggle .ico-sun { display: none; }
:root[data-theme="dark"] #themeToggle .ico-sun { display: block; }
:root[data-theme="dark"] #themeToggle .ico-moon { display: none; }

/* Selector de herramientas: tarjetas con icono (solo aparece con más de una herramienta) */
.tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 4px;
  margin: 4px var(--gutter) 14px;
  padding: 4px;
  border-radius: 14px;
  background: var(--fill);
}
.tools[hidden] { display: none; }
.tools button {
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -.005em;
  cursor: pointer;
  transition: background .25s var(--ease), color .2s, box-shadow .25s var(--ease), transform .15s;
}
.tools button svg { flex: none; transition: transform .3s var(--ease); }
.tools button:hover { color: var(--ink); }
.tools button:hover svg { transform: translateY(-1px); }
.tools button:active { transform: scale(.97); }
.tools button[aria-selected="true"] {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 .5px var(--hairline);
}

.tool-empty {
  margin: auto;
  padding: 40px 16px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}
.tool-empty[hidden] { display: none; }
.tool-empty svg { color: var(--faint); margin-bottom: 6px; }
.tool-empty strong { color: var(--ink); font-size: 17px; font-weight: 600; }

.tool {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px var(--gutter) 0;
}
.tool[hidden] { display: none; }

.tool-title {
  margin: 0 0 14px;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.035em;
  -webkit-font-smoothing: antialiased;
}

/* Búsqueda */
.search-wrap { position: relative; }
.search-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
#search, #haulSearch {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--fill);
  font-size: 15px;
  outline: none;
  transition: background .2s, box-shadow .2s;
}
#search::placeholder, #haulSearch::placeholder { color: var(--muted); }
#search:hover, #haulSearch:hover { background: var(--fill-hover); }
#search:focus, #haulSearch:focus { background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent), 0 0 0 1px var(--focus); }
#search::-webkit-search-cancel-button, #haulSearch::-webkit-search-cancel-button { filter: grayscale(1); opacity: .5; }

/* Filtros */
.filters {
  position: relative;
  margin: 14px calc(-1 * var(--gutter)) 0;
}
.chips {
  display: flex;
  gap: 6px;
  padding: 0 var(--gutter);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
  /* Difuminado solo en el lado donde quedan categorías ocultas */
  --fade-l: 0px;
  --fade-r: 0px;
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
}
.chips.dragging { cursor: grabbing; scroll-behavior: auto; }
.chips.dragging .chip { pointer-events: none; }
.filters.can-prev .chips { --fade-l: 48px; }
.filters.can-next .chips { --fade-r: 48px; }
.chip-arrow {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .14), 0 0 0 .5px var(--hairline);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(.85);
  transition: opacity .2s, transform .2s var(--ease);
}
.chip-arrow.prev { left: 10px; }
.chip-arrow.next { right: 10px; }
.filters.can-prev .chip-arrow.prev, .filters.can-next .chip-arrow.next {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}
.chip-arrow:hover { background: var(--fill); }
.chip-arrow:active { transform: translateY(-50%) scale(.9); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.chip:hover { background: var(--fill-hover); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--canvas); font-weight: 500; }

.sort-wrap { position: relative; flex: none; }
#sort {
  appearance: none;
  height: 30px;
  padding: 0 22px 0 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}
.sort-wrap::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 8px;
}
.count {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Lista de productos */
.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 calc(-1 * var(--gutter));
  /* Margen superior para que el borde del producto activo y la elevación al pasar el ratón no se corten */
  padding: 6px var(--gutter) 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--fill-hover) transparent;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.sentinel { height: 1px; }

.card {
  display: flex;
  flex-direction: column;
  padding: 8px 8px 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  animation: rise .5s var(--ease) both;
}
.card:hover { box-shadow: var(--product-shadow); transform: translateY(-2px); }
.card:active { transform: scale(.98); }
.card.active { box-shadow: 0 0 0 2px var(--accent); }

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: #fff;   /* blanco puro en ambos temas, como fondo de foto de producto */
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* se ve entera: sin recortes ni deformación */
  transition: transform .6s var(--ease);
}
.card:hover .thumb img { transform: scale(1.04); }
.thumb img.broken { display: none; }

.meta { display: flex; flex-direction: column; gap: 3px; padding: 10px 4px 0; }
.name {
  min-height: 2.66em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.33;
}
.price { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Esqueleto de carga */
.card.skeleton { pointer-events: none; animation: none; }
.skeleton .thumb, .skeleton .bar-line {
  background: linear-gradient(90deg, var(--fill) 0%, var(--fill-hover) 50%, var(--fill) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.bar-line { height: 10px; border-radius: 5px; margin-top: 6px; }
.bar-line.short { width: 40%; }

.empty {
  grid-column: 1 / -1;
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
  text-wrap: balance;
}
.empty strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 17px; font-weight: 600; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   Zona principal
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 12px 0 0;
}
.app.collapsed .main { padding-left: 12px; }

/* ---------- Divisor y modo expandido ---------- */
.resizer {
  position: relative;
  flex: none;
  width: 12px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.resizer::before {
  content: "";
  position: absolute;
  top: var(--bar-h);
  bottom: 40px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: transparent;
  transition: background .2s;
}
.resizer:hover:not(:has(.expand-tab:hover))::before, .resizer:focus-visible::before, .app.resizing .resizer::before { background: var(--accent); }
.app.collapsed .resizer { display: none; }
.app.resizing, .app.resizing * { cursor: col-resize !important; user-select: none; }
/* Mientras se arrastra, el iframe no debe "tragarse" el ratón */
.app.resizing .frame-wrap iframe { pointer-events: none; }
.app.resizing .drawer { transition: none; }

/* Misma pestaña que en el móvil: pegada al borde del panel, con la flecha en naranja que "empuja" */
.expand-tab {
  position: absolute;
  top: 50%;
  left: 100%;
  z-index: 2;
  width: 26px;
  height: 64px;
  margin-top: -32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0 14px 14px 0;
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18), 0 0 0 .5px var(--hairline);
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s;
}
.expand-tab:hover { box-shadow: 0 3px 14px rgba(0, 0, 0, .24), 0 0 0 .5px var(--hairline); }
.expand-tab:active { transform: scale(1.06); }
.expand-tab svg { animation: nudgeRight 2.4s var(--ease) infinite; }
.app.expanded .expand-tab { left: auto; right: 0; border-radius: 14px 0 0 14px; }
.app.expanded .expand-tab svg { rotate: 180deg; }

.app.expanded .drawer { flex: 1; width: auto; }
.app.expanded .main { display: none; }
.app.expanded .resizer { cursor: default; }
.app.expanded .resizer::before { display: none; }
.app.expanded .resizer { width: 28px; }

.bar {
  height: var(--bar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

/* Pestañas al estilo Safari */
.tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 1 220px;
  min-width: 100px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 12px;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: background .25s var(--ease), color .25s;
}
.tab:hover { background: var(--fill); color: var(--ink); }
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 .5px var(--hairline);
}
.tab-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--faint); transition: background .25s; }
.tab[aria-selected="true"] .tab-dot { background: var(--accent); }
.tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 500;
}
.tab-close {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
  transition: opacity .2s, background .2s;
}
.tab:hover .tab-close, .tab[aria-selected="true"] .tab-close { opacity: 1; }
.tab-close:hover { background: var(--fill); color: var(--ink); }
.tab.new { animation: tabIn .9s var(--ease); }
@keyframes tabIn {
  0% { background: color-mix(in srgb, var(--accent) 22%, transparent); transform: scale(.94); }
  40% { transform: scale(1); }
  100% { background: transparent; }
}

/* Botones */
.btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 15px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.95); }
.btn.ghost { background: transparent; color: var(--accent); padding: 0 10px; }
.btn.ghost:hover { background: var(--fill); }
.btn[hidden] { display: none; }
#openTab { display: none; }
.app:not(.collapsed) #openDrawer { display: none; }

/* Barra de direcciones bajo las pestañas */
.icon-btn.sm { width: 28px; height: 28px; text-decoration: none; }
.urlbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  margin-bottom: 8px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--fill);
}
.url-field {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-overflow: ellipsis;
}
.url-field:focus { color: var(--ink); }
#copyUrl .ico-done { display: none; color: var(--accent); }
#copyUrl.copied .ico-copy { display: none; }
#copyUrl.copied .ico-done { display: block; }

/* Iframe enmarcado como una pantalla */
.frame-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: 0 0 0 .5px var(--hairline), var(--product-shadow);
}
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.frame-wrap iframe[hidden] { display: none; }
.frame-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  transition: opacity .35s var(--ease);
}
.frame-loading.done { opacity: 0; pointer-events: none; }
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--fill);
  border-top-color: var(--muted);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  margin: 0;
  padding: 10px 4px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-wrap: balance;
}
.hint strong { color: var(--ink-2); font-weight: 500; }

/* ============================================================
   Menú contextual al estilo macOS
   ============================================================ */
.menu {
  position: fixed;
  z-index: var(--z-menu);
  min-width: 230px;
  max-width: 300px;
  padding: 5px;
  border-radius: 11px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .15), 0 10px 36px rgba(0, 0, 0, .2), inset 0 .5px 0 rgba(255, 255, 255, .35);
  transform-origin: top left;
  animation: pop .16s var(--ease);
}
.menu[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.menu-head {
  padding: 5px 10px 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.menu-item {
  width: 100%;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: default;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--menu-hover); color: #fff; outline: none; }
.menu-item .ico { width: 18px; color: var(--muted); text-align: center; }
.menu-item:hover .ico, .menu-item:focus-visible .ico { color: #fff; }
.menu-item .kbd { margin-left: auto; padding-left: 16px; color: var(--faint); font-size: 12px; }
.menu-item:hover .kbd, .menu-item:focus-visible .kbd { color: rgba(255, 255, 255, .75); }
.menu-sep { height: 1px; margin: 5px 10px; background: var(--hairline); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 820px) {
  :root { --gutter: 16px; }
  .resizer { display: none; }
  .app.expanded .main { display: flex; }
  .drawer, .app.expanded .drawer {
    width: 100vw;
    position: fixed;
    inset: 0;
    z-index: var(--z-drawer);
    margin-left: 0;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }
  .app.collapsed .drawer { margin-left: 0; transform: translateX(-100%); }
  .main {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: var(--canvas);
    will-change: transform;
  }
  /* El panel siempre va por encima de USFans; su sombra da profundidad al superponerse */
  .drawer { box-shadow: 14px 0 34px rgba(0, 0, 0, .16); }
  .urlbar { display: none; }
  #openTab { display: inline-flex; }
  .app.collapsed #openDrawer, .app:not(.collapsed) #openDrawer { display: inline-flex; }
  .main, .app.collapsed .main { padding: 0 8px; }
  .bar { gap: 4px; padding: 0; }
  #openDrawer span, #goHome { display: none; }
  .tab { min-width: 90px; }
  .tab-close { opacity: 1; }
  #openTab { padding: 0 12px; font-size: 12px; }
  .hint { display: none; }
  .frame-wrap { margin-bottom: calc(8px + env(safe-area-inset-bottom)); border-radius: var(--r-md); }
  .tool-title { font-size: 28px; }

  /* Márgenes seguros (muesca y barra inferior del iPhone, sobre todo en modo app) */
  .drawer-head { padding-top: env(safe-area-inset-top); height: calc(var(--bar-h) + env(safe-area-inset-top)); }
  .bar { padding-top: env(safe-area-inset-top); height: calc(var(--bar-h) + env(safe-area-inset-top)); }
  .main, .app.collapsed .main { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .list, .qc-result { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

  /* Deslizar: las capas siguen al dedo (la dirección del gesto se decide en JS) */
  .drawer { will-change: transform; }
}

/* ---------- Lengüetas para deslizar (solo móvil) ---------- */
.pull-tab {
  display: none;
  position: fixed;
  top: 50%;
  z-index: 25;
  width: 34px;
  height: 120px;
  margin-top: -60px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
}
.pull-left { left: 0; }
.pull-right { right: 0; }
.pull-tab-grip {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 64px;
  margin-top: -32px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18), 0 0 0 .5px var(--hairline);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.pull-left .pull-tab-grip { left: 0; border-radius: 0 14px 14px 0; }
.pull-right .pull-tab-grip { right: 0; border-radius: 14px 0 0 14px; }
.pull-tab:active .pull-tab-grip { transform: scale(1.06); }
/* La flecha "empuja" suavemente hacia donde hay que deslizar */
.pull-left svg { animation: nudgeRight 2.4s var(--ease) infinite; }
.pull-right svg { animation: nudgeLeft 2.4s var(--ease) infinite; }
@keyframes nudgeRight { 0%, 60%, 100% { transform: translateX(0); } 75% { transform: translateX(3px); } }
@keyframes nudgeLeft { 0%, 60%, 100% { transform: translateX(0); } 75% { transform: translateX(-3px); } }

/* ---------- Guía de gestos (primera vez en móvil) ---------- */
.coach {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .32);
  -webkit-backdrop-filter: blur(12px) saturate(115%);
  backdrop-filter: blur(12px) saturate(115%);
  touch-action: none;
  transition: opacity .3s ease;
  animation: fadeIn .35s ease;
}
.coach[hidden] { display: none; }
.coach.dragging { opacity: 0; }
.coach, .coach * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* La lengüeta que hay que deslizar queda nítida por encima del desenfoque, con un halo */
body.coaching .pull-tab { z-index: 71; }
body.coaching .pull-tab-grip { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent), 0 2px 10px rgba(0, 0, 0, .25); animation: halo 1.8s ease-out infinite; }
@keyframes halo { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent), 0 2px 10px rgba(0, 0, 0, .25); } 100% { box-shadow: 0 0 0 16px transparent, 0 2px 10px rgba(0, 0, 0, .25); } }

.coach-hint {
  position: absolute;
  top: calc(50% - 150px);
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  animation: coachIn .5s var(--ease) both;
}
.coach-hint { left: 40px; right: 24px; text-align: left; }
@keyframes coachIn { from { opacity: 0; transform: translateY(10px); } }
.coach-title { margin: 0 0 4px; font-family: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif; font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.025em; text-wrap: balance; }
.coach-text { margin: 0; font-size: 15px; opacity: .9; text-wrap: balance; }

/* Dedo que pulsa la pestaña */
.coach-gesture { position: absolute; top: 50%; left: 0; width: 0; height: 0; pointer-events: none; }
.coach-trail { display: none; }
.coach-hand { position: absolute; left: 12px; top: 6px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35)); animation: tapHand 1.6s var(--ease) infinite; }
@keyframes tapHand {
  0%, 100% { transform: translate(14px, 10px) scale(1); opacity: 0; }
  15% { transform: translate(8px, 4px) scale(1); opacity: 1; }
  40% { transform: translate(4px, 0) scale(.88); opacity: 1; }
  60% { transform: translate(8px, 4px) scale(1); opacity: 1; }
  85% { opacity: 0; }
}

.coach-skip {
  position: absolute;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  translate: -50% 0;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.coach-skip:active { background: rgba(255, 255, 255, .3); }
@media (min-width: 1400px) {
  :root { --drawer-w: 470px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Herramienta de fotos QC
   ============================================================ */
.qc-form { display: flex; gap: 8px; }
.qc-form .search-wrap { flex: 1; min-width: 0; }
.qc-form input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 38px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--fill);
  font-size: 14px;
  outline: none;
  transition: background .2s, box-shadow .2s;
}
.qc-form input::placeholder { color: var(--muted); }
.qc-form input:focus { background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent), 0 0 0 1px var(--focus); }
.qc-submit { height: 40px; flex: none; }
.qc-help { margin: 8px 2px 0; color: var(--muted); font-size: 12px; }

.qc-result { flex: 1; min-height: 0; overflow-y: auto; margin: 14px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter) 28px; }
.qc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.qc-title { margin: 0; font-size: 14px; font-weight: 600; }
.qc-meta { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.qc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.qc-thumb {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--fill);
  cursor: zoom-in;
}
.qc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.qc-thumb:hover img { transform: scale(1.05); }
.qc-thumb.skeleton { cursor: default; background: linear-gradient(90deg, var(--fill) 0%, var(--fill-hover) 50%, var(--fill) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.qc-msg { padding: 40px 12px; text-align: center; color: var(--muted); text-wrap: balance; }
.qc-msg strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 16px; font-weight: 600; }
.qc-msg .btn { margin-top: 14px; }


/* Las lengüetas van después de su regla base para poder mostrarse: la izquierda con USFans a la vista, la derecha con el panel abierto */
@media (max-width: 820px) {
  .pull-tab { display: block; will-change: transform; }
}

/* ---------- Fotos QC con FinderQC ---------- */
.qc-view { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 12px 0 16px; }
.qc-view[hidden] { display: none; }
.qc-view-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.qc-view-label { min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.qc-frame-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: 0 0 0 .5px var(--hairline), var(--product-shadow);
}
.qc-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.qc-result:empty { display: none; }
.qc-result { flex: none; overflow: visible; }
@media (max-width: 820px) {
  .qc-view { margin-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* Galería de fotos QC de USFans (enlaces con código de USFans) */
.qc-result.scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 14px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter) 28px; }
a.qc-thumb { display: block; cursor: zoom-in; }
.qc-title { margin: 0; font-size: 14px; font-weight: 600; }
.qc-meta { margin: 2px 0 0; color: var(--muted); font-size: 12px; text-wrap: balance; }

/* Texto solo para lectores de pantalla y buscadores (el <h1> de la página) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ============================================================
   Cuentas e importación
   ============================================================ */
.list-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.mini-btn {
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.mini-btn[hidden] { display: none; }
.mini-btn:hover { background: var(--fill); color: var(--ink); }
.mini-btn[aria-pressed="true"] { background: var(--fill); color: var(--ink); }
#accountBtn[hidden] { display: none; }
#accountBtn.on { color: var(--accent); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .38);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 26px 24px 22px;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35), 0 0 0 .5px var(--hairline);
  animation: rise .3s var(--ease) both;
}
.modal-x { position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-x:hover { background: var(--fill); color: var(--ink); }
.modal-title { margin: 0 24px 4px 0; font-family: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif; font-size: 22px; font-weight: 600; letter-spacing: -.025em; text-wrap: balance; }
.modal-sub { margin: 0 0 4px; color: var(--muted); font-size: 14px; text-wrap: pretty; overflow-wrap: anywhere; }
.modal-h3 { margin: 18px 0 6px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }
.modal-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.modal-label { color: var(--muted); font-size: 12px; }
.modal-note { margin: 0; color: var(--muted); font-size: 12.5px; text-wrap: pretty; }
.modal-note.dev { padding: 8px 10px; border-radius: 10px; background: var(--fill); color: var(--ink); }
.modal-err { margin: 0; color: #e5484d; font-size: 13px; }
.modal-err[hidden] { display: none; }
.modal-btn { height: 42px; justify-content: center; }
.modal-btn:disabled { opacity: .55; cursor: default; }
.modal-row { display: flex; align-items: center; gap: 4px; margin-top: 14px; }
.modal-row.spread { justify-content: space-between; margin-top: 18px; }
.modal-spin { display: grid; place-items: center; height: 90px; }
.field input[type="email"], .field input[type="url"], .field input[type="text"] {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  outline: 0;
  background: var(--fill);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.field input:focus { background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent), 0 0 0 1px var(--focus); }
.code-input { letter-spacing: .4em; text-align: center; font-size: 20px !important; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: flex-start; gap: 10px; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.btn.ghost.danger { color: #e5484d; }
.acc-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.acc-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.acc-name { min-width: 0; display: flex; flex-direction: column; }
.acc-name b { overflow: hidden; font-size: 14px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.acc-name small, .acc-empty { color: var(--muted); font-size: 12.5px; }
.prog { height: 6px; margin-top: 14px; overflow: hidden; border-radius: 6px; background: var(--fill); }
.prog-fill { width: 0; height: 100%; border-radius: 6px; background: var(--accent); transition: width .3s var(--ease); }
body.modal-open { overflow: hidden; }
@media (max-width: 820px) {
  .modal { place-items: end center; padding: 0; }
  .modal-card { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

@keyframes fadeIn { from { opacity: 0; } }

/* Selector de origen de los productos (verificados / mis hojas importadas) */
.source-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 8px; }
.source-bar[hidden] { display: none; }
.source-select { position: relative; min-width: 0; }
.source-btn {
  max-width: 100%;
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.source-btn:hover, .source-btn[aria-expanded="true"] { background: var(--fill); }
.source-btn .lbl { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.source-btn .chev { flex: none; color: var(--muted); transition: transform .2s var(--ease); }
.source-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.source-btn.single { cursor: default; }
.source-btn.single:hover { background: transparent; }
.source-btn.single .chev { display: none; }
.source-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 230px;
  max-width: min(320px, 80vw);
  max-height: 320px;
  overflow-y: auto;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .22), 0 0 0 .5px var(--hairline);
  animation: pop .16s var(--ease);
}
.source-menu[hidden] { display: none; }
.source-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.source-opt:hover { background: var(--fill); }
.source-opt .lbl { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.source-opt .tick { flex: none; color: var(--accent); opacity: 0; }
.source-opt[aria-selected="true"] .tick { opacity: 1; }
.source-sep { height: 1px; margin: 4px 6px; background: var(--hairline); }
.verified { flex: none; }

/* ============================================================
   Mis hauls
   ============================================================ */
#tool-hauls { overflow: hidden; }
.haul-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.haul-head .tool-title { margin: 0; }
.haul-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; overflow-y: auto; padding: 6px 0 28px; }
.haul-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 8px 12px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--product-shadow);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.haul-card:hover { transform: translateY(-2px); }
.haul-cover { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; aspect-ratio: 1; margin-bottom: 8px; overflow: hidden; border-radius: 10px; background: #fff; }
.haul-cell { position: relative; background: #fff; box-shadow: inset 0 0 0 .5px var(--hairline); }
.haul-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.haul-name { overflow: hidden; font-size: 13.5px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.haul-meta { color: var(--muted); font-size: 12px; }
.haul-empty { margin: 24px 8px; color: var(--muted); font-size: 14px; text-align: center; text-wrap: balance; }
.haul-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.haul-back { display: inline-flex; align-items: center; gap: 2px; padding: 4px 8px 4px 0; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px; cursor: pointer; }
.haul-title {
  width: 100%;
  margin: 2px 0 12px;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.03em;
  border-radius: 8px;
}
.haul-title:hover { background: var(--fill); }
.haul-title:focus { background: var(--fill); box-shadow: 0 0 0 2px var(--focus); }
.haul-body { flex: 1; min-height: 0; overflow-y: auto; margin: 6px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter) 28px; scrollbar-width: thin; scrollbar-color: var(--fill-hover) transparent; }
.haul-sub { margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }
.card { position: relative; }
.card-act {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #1d1d1f;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .25);
  cursor: pointer;
  transition: transform .15s;
}
.card-act:hover { transform: scale(1.1); }
.card-act.on { background: var(--accent); color: #fff; }
.card-act.remove:hover { background: #e5484d; color: #fff; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 95;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: rgba(29, 29, 31, .92);
  color: #fff;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Subcarpetas, compartir y totales de los hauls */
.haul-actions { display: inline-flex; align-items: center; gap: 2px; }
.haul-actions .btn { display: inline-flex; align-items: center; gap: 4px; }
.haul-total { margin: -6px 0 12px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.haul-title.static { cursor: default; }
.haul-title.static:hover { background: transparent; }
.haul-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: var(--r-pill); background: var(--fill); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.haul-save { margin-bottom: 4px; }
.haul-save .btn { height: 38px; }
.haul-meta span, .card .price span { font-variant-numeric: tabular-nums; }
.folder-card, .add-card { cursor: pointer; border: 0; font: inherit; text-align: left; width: 100%; }
.folder-card .thumb { background: transparent; }
.folder-card .haul-cover { width: 100%; height: 100%; margin: 0; border-radius: var(--r-md); }
.add-card { background: transparent; box-shadow: none; border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, transparent); color: var(--muted); }
.add-card:hover { box-shadow: none; border-color: var(--accent); color: var(--accent); }
.add-card .thumb { background: transparent; color: inherit; }
.add-card .name { color: inherit; min-height: 2.66em; }
.card-act.move { right: auto; left: 12px; }
.card-act.busy { opacity: .5; pointer-events: none; }

/* Vista previa de cada haul: alargada, con las fotos en fila y el botón de compartir dentro */
.haul-card { padding: 8px 8px 10px; gap: 0; cursor: pointer; }
.haul-cover.wide { grid-template-columns: repeat(4, 1fr); aspect-ratio: 4 / 1; margin-bottom: 10px; }
.haul-cell:empty { background: var(--fill); box-shadow: none; }
.haul-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.haul-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.haul-share { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--fill); color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s, transform .15s; }
.haul-share:hover { background: var(--accent); color: #fff; }
.haul-share:active { transform: scale(.92); }
/* Botón de añadir subcarpeta: icono grande y texto centrados y juntos */
.add-card { aspect-ratio: 1 / 1.27; align-items: center; justify-content: center; gap: 2px; padding: 12px; text-align: center; }
.add-card .thumb { flex: none; width: auto; aspect-ratio: auto; background: transparent; overflow: visible; }
.add-card .meta { padding: 0; align-items: center; }
.add-card .name { min-height: 0; text-align: center; -webkit-line-clamp: 2; }

/* Tamaño de las vistas previas de los hauls: con la ventana de herramientas desplegada por completo caben 3 por fila.
   Es el tamaño máximo; con el panel más estrecho se reducen y nunca lo superan. */
.haul-grid {
  --haul-max: calc((100vw - 110px) / 3);
  /* Columnas de tamaño fijo (el máximo) y pegadas a la izquierda: una columna nueva solo aparece cuando cabe entera, y las demás no se mueven */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--haul-max)), var(--haul-max)));
  justify-content: start;
}
.haul-card { width: 100%; }
@media (max-width: 820px) {
  .haul-grid { --haul-max: 100%; }
}

/* Hauls compartidos */
.share-block { padding: 12px 0; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 10px; }
.share-block:first-of-type { border-top: 0; padding-top: 0; }
.share-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.share-create { align-self: flex-start; }
.haul-collab { margin: -4px 0 10px; color: var(--muted); font-size: 12.5px; }
.haul-collab[hidden] { display: none; }
.haul-people { margin-left: 6px; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.haul-share[hidden] { display: none; }

/* Mosaico de los hauls: sin fondo blanco detrás (se veía en el tema oscuro en los huecos y las esquinas); cada casilla lleva su propio fondo y esquinas */
.haul-cover { background: transparent; }
.haul-cell { border-radius: 7px; overflow: hidden; }

/* Barra de direcciones editable */
.url-field { cursor: text; }
.url-field::placeholder { color: var(--faint); }
.urlbar:focus-within { background: var(--surface); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 40%, transparent), 0 0 0 .5px var(--hairline); }
.people-ico { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--accent); font-size: 11.5px; font-weight: 500; vertical-align: -2px; }
.haul-people { color: var(--accent); }

/* iPhone/iPad: Safari amplía la página al tocar un campo de texto con letra menor de 16 px y luego no la devuelve a su tamaño.
   Con 16 px o más no hace zoom. */
@media (max-width: 820px), (pointer: coarse) {
  #search, #haulSearch, .qc-form input, .field input:not(.code-input):not([type="checkbox"]):not([type="radio"]) { font-size: 16px !important; }
}
