:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #16202c;
  --muted: #5d6b7c;
  --border: #dde3ea;
  --brand: #4f46e5;
  --brand-2: #9333ea;
  --brand-ink: #ffffff;
  --brand-soft: #ebeafd;
  --accent: #25a244;
  --danger: #c23b3b;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 12px rgb(16 24 40 / 6%);
  --radius: 14px;
  color-scheme: light;
}
/* Dark theme: follows the device unless the visitor picked a theme (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a;
    --surface: #18202a;
    --surface-2: #212b37;
    --text: #e8edf3;
    --muted: #93a1b2;
    --border: #2a3542;
    --brand: #8b8cf8;
    --brand-2: #c084fc;
    --brand-ink: #0f0e2a;
    --brand-soft: #22213f;
    --accent: #3cc160;
    --danger: #e26a6a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a;
  --surface: #18202a;
  --surface-2: #212b37;
  --text: #e8edf3;
  --muted: #93a1b2;
  --border: #2a3542;
  --brand: #8b8cf8;
  --brand-2: #c084fc;
  --brand-ink: #0f0e2a;
  --brand-soft: #22213f;
  --accent: #3cc160;
  --danger: #e26a6a;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1; width: 100%; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 12px; padding-block: 8px; }
.brand-logo { width: 36px; height: 36px; flex: none; }
.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0; font-size: 1.15rem; line-height: 1.2; font-weight: 800; letter-spacing: -0.4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-sub p { margin: 0; color: var(--muted); font-size: 0.8rem; }
.delivery {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand);
  font-size: 0.74rem; font-weight: 600;
}
.delivery svg { width: 14px; height: 14px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.header-actions .btn { padding: 7px 14px; }
.header-actions .btn-icon { width: 36px; height: 36px; padding: 0; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none;
  font-weight: 600; font-size: 0.92rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-whatsapp { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-whatsapp:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 0.82rem; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Toolbar */
.toolbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.toolbar .wrap { padding-block: 10px; display: grid; gap: 8px; }
.search {
  width: 100%; min-width: 0; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
}
.search:focus, .select:focus, .ms-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.select { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }

/* Brand picker styled as a chip, followed by a horizontally scrolling row of category chips. */
.filter-row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.filter-ms { flex: none; }
.category-ms { display: none; }
.chips {
  flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity; scroll-padding-inline: 8px; padding-block: 1px;
}
.chips::-webkit-scrollbar { display: none; }
.chips.fade-end { mask-image: linear-gradient(to right, #000 82%, transparent); }
.chips.fade-start { mask-image: linear-gradient(to right, transparent, #000 14%); }
.chips.fade-start.fade-end { mask-image: linear-gradient(to right, transparent, #000 14%, #000 82%, transparent); }
.chip {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-size: 0.88rem; font-weight: 500;
}
.chip svg { width: 15px; height: 15px; flex: none; opacity: 0.8; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip[aria-pressed="true"] svg { opacity: 1; }
.chip .count { opacity: 0.7; font-variant-numeric: tabular-nums; }

/* Grid */
/* main.wrap beats .wrap, whose padding shorthand would otherwise zero this out. */
main.wrap { padding-block: 16px 40px; }
.result-info { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer; text-align: left; padding: 0;
  display: flex; flex-direction: column; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-2px); }
.card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.card-media { position: relative; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-count {
  position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px;
  background: rgb(0 0 0 / 60%); color: #fff; font-size: 0.75rem; font-weight: 600;
  display: inline-flex; gap: 4px; align-items: center;
}
.photo-count svg { width: 13px; height: 13px; }
.placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.placeholder svg { width: 38%; height: 38%; opacity: 0.45; }
.card-body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.card-category {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.75rem; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: 0.4px;
}
.card-category svg { width: 15px; height: 15px; flex: none; }
.card-name { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.badge-low { font-size: 0.75rem; color: var(--muted); }

.empty, .loading, .error-box { text-align: center; color: var(--muted); padding: 60px 16px; }
.error-box { color: var(--danger); }
.skeleton { aspect-ratio: 0.78; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Modal */
dialog.viewer {
  border: none; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text);
  width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
}
dialog.viewer::backdrop { background: rgb(5 10 15 / 70%); }
.viewer-grid { display: grid; grid-template-columns: 1.3fr 1fr; }
@media (max-width: 720px) { .viewer-grid { grid-template-columns: 1fr; } }
.gallery { position: relative; background: #000; aspect-ratio: 1; }
.gallery img { width: 100%; height: 100%; object-fit: contain; }
.gallery .placeholder { color: #8895a5; }
.gallery-nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgb(255 255 255 / 85%); color: #111; cursor: pointer; display: grid; place-items: center;
}
.gallery-nav svg { width: 20px; height: 20px; }
.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }
.thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: var(--surface-2); }
.thumbs button { flex: none; width: 56px; height: 56px; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: none; }
.thumbs button[aria-current="true"] { border-color: var(--brand); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.viewer-info { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.viewer-info h2 { margin: 0; font-size: 1.3rem; line-height: 1.25; }
.viewer-close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.availability { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.availability::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.viewer-info .note { color: var(--muted); font-size: 0.88rem; margin: 0; }
.viewer-info .btn { align-self: flex-start; }

/* Footer */
.site-footer {
  position: sticky; bottom: 0; z-index: 4;
  border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 0.88rem;
  box-shadow: 0 -4px 14px rgb(16 24 40 / 8%);
}
.site-footer .wrap { padding-block: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.footer-address {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); text-decoration: none;
}
.footer-address:hover { color: var(--text); }
.footer-address svg { width: 18px; height: 18px; flex: none; color: var(--brand); }
.footer-address span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer-links { display: flex; align-items: center; gap: 8px; flex: none; }
.social {
  height: 36px; min-width: 36px; padding: 0 9px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; font-weight: 600; color: #fff;
}
.social svg { width: 19px; height: 19px; flex: none; }
.social.phone { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.social.whatsapp { background: #25d366; }
.social.facebook { background: #1877f2; }
.social:hover { filter: brightness(1.08); }
@media (max-width: 600px) {
  .site-footer { font-size: 0.8rem; }
  .site-footer .wrap { padding-block: 6px; gap: 8px; }
  .social-label { display: none; }
  .social { width: 36px; padding: 0; }
}

@media (max-width: 600px) {
  .brand-sub p { display: none; }
  .header-actions .btn-whatsapp { width: 36px; height: 36px; padding: 0; }
  .header-actions .btn-whatsapp .label { display: none; }
  .toolbar .wrap { padding-block: 8px; gap: 8px; }
  /* Phones: brand and category become two equal dropdowns instead of the chip row. */
  .chips { display: none; }
  .category-ms { display: block; }
  .filter-ms { flex: 1; min-width: 0; }
  .filter-ms .ms-button { width: 100%; max-width: none; font-size: 0.86rem; padding-block: 8px; }
}

/* Admin */
#app { padding-block: 16px 32px; }
.admin-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 12px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.filter-line { display: flex; gap: 8px; }
.filter-line .select { flex: 1; min-width: 0; width: 0; padding: 9px 8px; font-size: 0.86rem; }
.filter-line .select.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.admin-layout > * { min-width: 0; }
.product-list { list-style: none; margin: 0; padding: 6px; max-height: 72vh; overflow: auto; }
.product-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: none; border-radius: 10px;
  background: none; cursor: pointer; text-align: left;
}
.product-list button:hover { background: var(--surface-2); }
.product-list button[aria-current="true"] { background: var(--brand-soft); }
.product-list .mini { width: 44px; height: 44px; border-radius: 9px; flex: none; background: var(--surface-2); object-fit: cover; }
.mini-icon { display: grid; place-items: center; color: var(--muted); }
.mini-icon svg { width: 58%; height: 58%; opacity: 0.7; }
.empty-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); flex: none; }
.product-list .meta { min-width: 0; flex: 1; }
.product-list .meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.product-list .meta small { color: var(--muted); }
.tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); flex: none; }
.tag.ok { background: var(--brand-soft); color: var(--brand); }

.editor { padding: 18px; display: grid; gap: 14px; align-content: start; }
.editor h2 { margin: 2px 0 0; font-size: 1.2rem; line-height: 1.25; }
.back-btn { display: none; justify-self: start; }
.back-btn svg { width: 16px; height: 16px; }
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted);
  display: grid; gap: 10px;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.upload-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upload-btn { border-radius: 14px; padding: 14px 12px; font-size: 0.95rem; flex-direction: column; gap: 6px; min-height: 76px; }
.upload-btn svg { width: 26px; height: 26px; }
.drop-hint { font-size: 0.8rem; }

.upload-queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.upload-queue:empty { display: none; }
.upload-queue li {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: 0.85rem;
}
.upload-queue img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.upload-queue .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-queue .state { flex: none; font-weight: 600; color: var(--muted); }
.upload-queue .working .state { color: var(--brand); }
.upload-queue .done .state { color: var(--accent); }
.upload-queue .error .state { color: var(--danger); white-space: normal; text-align: right; max-width: 55%; }

.photos-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.photos-head small { color: var(--muted); }
.image-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.image-tile { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.image-wrap { position: relative; }
.image-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.cover-badge {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink); font-size: 0.72rem; font-weight: 700;
}
.image-tile .actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; }
.icon-btn {
  height: 40px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn.danger { color: var(--danger); }

.login-card { max-width: 380px; margin: 40px auto; padding: 24px; display: grid; gap: 12px; }
.login-card input { padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 16px; }
.status { font-size: 0.88rem; color: var(--muted); min-height: 1.2em; }
.status.error { color: var(--danger); }

/* Phones and small tablets: list and editor are two screens. */
@media (max-width: 860px) {
  #app { padding-block: 10px 24px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-layout.editing .list-panel { display: none; }
  .admin-layout:not(.editing) .editor { display: none; }
  .back-btn { display: inline-flex; }
  .list-panel .panel-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
  .product-list { max-height: none; overflow: visible; }
  .product-list button { padding: 10px; }
  .product-list .mini { width: 52px; height: 52px; }
  .editor { padding: 14px; }
  .drop-hint { display: none; }
  .dropzone { border: none; padding: 0; }
  .image-grid { grid-template-columns: repeat(2, 1fr); }
  .search, .select, .filter-line .search { font-size: 16px; }
  #who { max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Admin product form */
.search-line { display: flex; gap: 8px; }
.search-line .search { flex: 1; width: 0; min-width: 0; }
.search-line .btn { flex: none; border-radius: 12px; }
.editor-title { display: grid; gap: 4px; justify-items: start; }
.section-title { margin: 6px 0 0; font-size: 1rem; padding-top: 14px; border-top: 1px solid var(--border); width: 100%; }
.product-form { display: grid; gap: 12px; }
.product-form label { display: grid; gap: 5px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.product-form input:not([type="checkbox"]), .product-form textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
.product-form textarea { resize: vertical; min-height: 80px; }
.product-form input:focus, .product-form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.product-form .form-row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.product-form .check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 0.95rem; cursor: pointer; }
.product-form .check input { width: 22px; height: 22px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions .btn-primary { flex: 1; min-height: 46px; }
.form-actions .btn-danger { min-height: 46px; }
.sync-note {
  margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 0.84rem; line-height: 1.4;
  background: var(--brand-soft); color: var(--text);
}
.viewer-description { margin: 0; white-space: pre-line; line-height: 1.5; }

/* Admin tabs and categories */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.admin-tabs button {
  flex: 1; max-width: 200px; padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.admin-tabs button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.categories-panel { padding: 14px; display: grid; gap: 10px; max-width: 720px; }
.category-add { display: flex; gap: 8px; }
.category-add input, .category-name {
  flex: 1; min-width: 0; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
.category-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.category-list li { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.category-list .mini { width: 40px; height: 40px; border-radius: 9px; background: var(--surface-2); flex: none; }
.category-list .meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.category-list .meta div { font-weight: 600; }
.category-list .meta small { color: var(--muted); }
.category-actions { display: flex; gap: 6px; flex: none; }
.product-form select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
@media (max-width: 600px) {
  .admin-tabs button { max-width: none; }
  .category-list li { flex-wrap: wrap; }
  .category-actions { width: 100%; justify-content: flex-end; }
}

/* Clear (✕) button on selected filter dropdowns */
.chip-clear {
  position: absolute; right: 4px; top: 50%; translate: 0 -50%;
  width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 13px; line-height: 1;
  background: var(--brand); color: var(--brand-ink);
}


/* Result count + sort */
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.result-bar .result-info { margin: 0; }
.sort-select { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.88rem; }
.sort-select select {
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.badge-new {
  position: absolute; left: 8px; top: 8px; padding: 2px 9px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px;
}

/* Admin filter dropdowns with a clear (✕) button */
.filter-line .select-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.filter-line .select-wrap .select { width: 100%; }
.filter-line .select-wrap .select.active { padding-right: 32px; }

/* Multi-select filter dropdown (multiselect.js) */
.ms { position: relative; }
.ms-button {
  display: inline-flex; align-items: center; gap: 6px; max-width: 190px; cursor: pointer;
  padding: 7px 30px 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.88rem; font-weight: 600;
}
.ms-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ms-caret { position: absolute; right: 10px; top: 50%; translate: 0 -50%; width: 14px; height: 14px; pointer-events: none; }
.ms.active .ms-button { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.ms.active .ms-caret { display: none; }
.ms-backdrop { position: fixed; inset: 0; z-index: 30; background: transparent; }
.ms-panel[hidden], .ms-backdrop[hidden] { display: none; }
.ms-panel {
  position: fixed; z-index: 31; width: 260px; max-height: min(420px, 70vh);
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: 0 12px 32px rgb(0 0 0 / 22%);
}
.ms-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 14px 6px; }
.ms-head small { color: var(--muted); }
.ms-options { list-style: none; margin: 0; padding: 4px 6px; overflow: auto; flex: 1; }
.ms-options label {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer; font-size: 0.92rem;
}
.ms-options label:hover { background: var(--surface-2); }
.ms-options input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; margin: 0; }
.ms-options svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.ms-option-label { flex: 1; min-width: 0; }
.ms-option-count { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.ms-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.ms-foot .btn { flex: 1; }
@media (max-width: 600px) {
  /* Bottom sheet on phones */
  .ms-backdrop { background: rgb(5 10 15 / 50%); }
  .ms-panel {
    left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; min-width: 0 !important; max-height: 70vh;
    border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom);
  }
  .ms-head { padding: 16px 16px 8px; font-size: 1.05rem; }
  .ms-options label { padding: 12px 10px; font-size: 1rem; }
  .ms-options input { width: 22px; height: 22px; }
  .ms-foot .btn { min-height: 46px; }
}
/* Admin filter row uses the same component */
.filter-line .filter-ms { flex: 1; min-width: 0; }
.filter-line .ms-button { width: 100%; max-width: none; border-radius: 12px; padding-block: 9px; font-size: 0.86rem; }

/* Category icon choice + picker */
.icon-choice {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; cursor: pointer; padding: 0;
  border: 1px dashed var(--brand); border-radius: 10px; background: var(--brand-soft); color: var(--brand);
}
.icon-choice svg { width: 26px; height: 26px; }
.category-list .icon-choice { width: 40px; height: 40px; }
.category-list .icon-choice svg { width: 58%; height: 58%; opacity: 1; }
dialog.icon-picker {
  width: min(560px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 24px)); padding: 14px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text);
  display: none; flex-direction: column; gap: 10px;
}
dialog.icon-picker[open] { display: flex; }
dialog.icon-picker::backdrop { background: rgb(5 10 15 / 60%); }
.icon-picker-head { display: flex; align-items: center; justify-content: space-between; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; overflow: auto; padding: 2px; }
.icon-grid button {
  display: grid; justify-items: center; gap: 6px; padding: 10px 4px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit;
}
.icon-grid button:hover { border-color: var(--brand); }
.icon-grid button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.icon-grid svg { width: 28px; height: 28px; }
.icon-grid span { font-size: 0.72rem; line-height: 1.2; text-align: center; overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 600px) {
  dialog.icon-picker { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 80vh; border-radius: 18px 18px 0 0; }
  .icon-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Admin: daily SoftCell integration summary */
.sync-banner {
  margin-bottom: 12px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--brand); background: var(--brand-soft); display: grid; gap: 10px;
}
.sync-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sync-head small { display: block; color: var(--muted); margin-top: 2px; }
.sync-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sync-pill {
  padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.sync-pill.ok { color: var(--accent); border-color: currentColor; }
.sync-pill.warn { color: var(--danger); border-color: currentColor; }
.sync-details summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.sync-details h4 { margin: 12px 0 4px; font-size: 0.85rem; }
.sync-details ul { margin: 0; padding-left: 18px; max-height: 220px; overflow: auto; font-size: 0.85rem; display: grid; gap: 2px; }
.sync-details small, .sync-empty { color: var(--muted); }
.sync-empty { margin: 0; font-size: 0.88rem; }

/* Admin: share products to social networks */
.btn-icon-text { flex: none; border-radius: 12px; gap: 6px; }
.btn-icon-text svg { width: 18px; height: 18px; }
.btn-icon-text[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.share-check {
  width: 24px; height: 24px; flex: none; border-radius: 7px; display: grid; place-items: center;
  border: 2px solid var(--border); font-weight: 800; font-size: 14px; color: var(--brand-ink);
}
.share-check.on { background: var(--brand); border-color: var(--brand); }
.product-list li.unshareable button { opacity: 0.4; cursor: not-allowed; }
.share-bar {
  position: fixed; left: 50%; bottom: 16px; translate: -50% 0; z-index: 20; width: min(520px, calc(100% - 24px));
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--brand); box-shadow: 0 12px 30px rgb(0 0 0 / 30%);
}
.share-bar span { flex: 1; font-weight: 600; font-size: 0.9rem; }
dialog.share-dialog {
  width: min(560px, calc(100% - 24px)); max-height: min(720px, calc(100vh - 24px)); padding: 14px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text);
  display: none; flex-direction: column; gap: 10px;
}
dialog.share-dialog[open] { display: flex; }
dialog.share-dialog::backdrop { background: rgb(5 10 15 / 60%); }
.share-thumbs { display: flex; gap: 6px; overflow-x: auto; flex: none; }
.share-thumbs img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; }
.share-caption { display: grid; gap: 5px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.share-caption textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); resize: vertical;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; font-weight: 400; line-height: 1.4;
}
@media (max-width: 600px) {
  .btn-icon-text span { display: none; }
  .btn-icon-text { width: 44px; padding: 0; }
  dialog.share-dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .share-bar { bottom: 10px; }
}

/* Store: "Con fotos" toggle next to the sort */
.result-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.photo-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.86rem; font-weight: 600;
}
.photo-toggle svg { width: 16px; height: 16px; }
.photo-toggle[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
@media (max-width: 600px) {
  .result-bar { align-items: center; }
  .sort-select { font-size: 0; gap: 0; }
  .sort-select select { font-size: 0.86rem; }
}

/* Phones: keep the count, "Fotos" and sort on one row */
@media (max-width: 600px) {
  .result-bar { gap: 8px; }
  .result-info { white-space: nowrap; font-size: 0.85rem; }
  .result-actions { flex-wrap: nowrap; gap: 6px; }
  .photo-toggle { padding: 6px 10px; }
  .photo-toggle-long { display: none; }
  .photo-toggle .photo-toggle-short { display: inline; }
  .sort-select select { padding: 6px 8px; }
}
.photo-toggle-short { display: none; }

/* Store: order list (🛒) */
.card-wrap { position: relative; display: flex; }
.card-wrap .card { flex: 1; width: 100%; }
.add-cart {
  position: absolute; top: 8px; right: 8px; z-index: 1; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: 0;
  background: rgb(255 255 255 / 92%); color: #1d1b4b; box-shadow: 0 2px 8px rgb(0 0 0 / 25%);
}
.add-cart svg { width: 20px; height: 20px; }
.add-cart.in { background: var(--accent); color: #fff; }
.add-cart:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cart-button { position: relative; }
.cart-count {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 800;
}
#viewer-add { gap: 8px; }
#viewer-add svg { width: 18px; height: 18px; }
#viewer-add.in { background: var(--surface); color: var(--accent); border-color: var(--accent); }
.toast {
  position: fixed; left: 50%; bottom: 72px; translate: -50% 0; z-index: 60; max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 12px; background: #111827; color: #fff; font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 8px 24px rgb(0 0 0 / 30%);
}
dialog.cart-dialog {
  width: min(520px, calc(100% - 24px)); max-height: min(760px, calc(100vh - 24px)); padding: 16px;
  border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text);
  display: none; flex-direction: column; gap: 12px;
}
dialog.cart-dialog[open] { display: flex; overflow-y: auto; overscroll-behavior: contain; }
dialog.cart-dialog::backdrop { background: rgb(5 10 15 / 60%); }
.cart-head { display: flex; align-items: center; justify-content: space-between; font-size: 1.05rem; }
.cart-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: none; }
.cart-items li { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.cart-items img, .cart-thumb { width: 48px; height: 48px; border-radius: 9px; object-fit: cover; flex: none; background: var(--surface-2); }
.cart-thumb { display: grid; place-items: center; color: var(--muted); }
.cart-thumb svg { width: 60%; height: 60%; }
.cart-name { flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem; line-height: 1.25; }
.cart-name small { display: block; color: var(--muted); font-weight: 500; font-size: 0.75rem; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; flex: none; }
.qty button { width: 32px; height: 32px; border: 0; background: none; color: var(--text); font-size: 1.1rem; cursor: pointer; }
.qty button:disabled { opacity: 0.3; cursor: default; }
.qty output { min-width: 22px; text-align: center; font-weight: 700; }
.cart-remove { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; flex: none; }
.cart-remove:hover { color: var(--danger); background: var(--surface-2); }
.cart-empty { margin: 8px 0; color: var(--muted); text-align: center; }
.cart-form { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.cart-delivery { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cart-delivery legend { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
.cart-delivery label {
  flex: 1; min-width: 140px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 12px; font-weight: 600; font-size: 0.9rem;
}
.cart-delivery label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.cart-delivery input { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
.cart-field { display: grid; gap: 5px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.cart-field small { font-weight: 400; }
.cart-field input, .cart-field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
.cart-hint { margin: 0; color: var(--muted); font-size: 0.82rem; }
.cart-send { min-height: 48px; font-size: 1rem; }
.cart-clear { justify-self: center; color: var(--muted); border-color: transparent; background: none; }
@media (max-width: 600px) {
  dialog.cart-dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .add-cart { width: 36px; height: 36px; top: 6px; right: 6px; }
}

/* Store: Tarjetas | Lista view switch */
.view-toggle {
  flex: none; display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
}
.view-toggle button {
  width: 32px; height: 30px; border: 0; border-radius: 999px; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: none; color: var(--muted);
}
.view-toggle button svg { width: 17px; height: 17px; }
.view-toggle button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

/* List view: compact rows (same markup as the cards, different layout) */
.grid.list-view { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; }
.list-view .card { flex-direction: row; align-items: center; border-radius: 12px; }
.list-view .card:hover { transform: none; }
.list-view .card-media { width: 72px; flex: none; margin: 6px; border-radius: 9px; }
.list-view .placeholder svg { width: 50%; height: 50%; }
.list-view .card-body { padding: 6px 56px 6px 4px; gap: 2px; min-width: 0; }
.list-view .card-name {
  font-size: 0.92rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.list-view .card-category { font-size: 0.68rem; }
.list-view .card-category svg { width: 13px; height: 13px; }
.list-view .badge-new { left: 3px; top: 3px; padding: 0 6px; font-size: 0.6rem; }
.list-view .photo-count { right: 3px; bottom: 3px; padding: 1px 5px; font-size: 0.65rem; }
.list-view .photo-count svg { width: 11px; height: 11px; }
.list-view .add-cart { top: 50%; right: 10px; translate: 0 -50%; }
@media (max-width: 600px) {
  .grid.list-view { grid-template-columns: 1fr; gap: 6px; }
  .list-view .card-media { width: 64px; }
}
/* Denser list rows on phones */
@media (max-width: 600px) {
  .list-view .card-media { width: 54px; margin: 5px; border-radius: 8px; }
  .list-view .card-body { padding: 4px 52px 4px 2px; gap: 1px; }
  .list-view .card-name { font-size: 0.88rem; line-height: 1.22; }
  .list-view .badge-low { font-size: 0.7rem; }
  .list-view .badge-new { display: none; }
  .list-view .add-cart { width: 34px; height: 34px; right: 8px; }
  .list-view .add-cart svg { width: 18px; height: 18px; }
}
/* Narrow phones: keep the delivery badge on one line next to the header buttons */
.delivery { white-space: nowrap; }
@media (max-width: 380px) {
  .delivery [data-store="delivery"] { display: none; }
  .delivery::after { content: "A domicilio"; }
}
.new-inline { display: none; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.6rem; letter-spacing: 0.3px; }
@media (max-width: 600px) { .list-view .new-inline { display: inline-block; } }
