/* Keep every catalog image fully visible inside its reserved area. */
.product-image {
  height: 200px !important;
  flex: 0 0 200px !important;
  overflow: hidden;
  padding: 22px !important;
}

.product-image img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 156px !important;
  object-fit: contain !important;
}

/* Cajovil 3235/3236: never let the square source exceed the card area. */
.product-image img[src*="cajovil_5_0"] {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 156px !important;
  object-fit: contain !important;
}

.product-image img[src*="matte_bombillas_5_0"] {
  transform: scale(.58);
}

/* The catalog filters and order form should scroll with the page, not cover each other. */
.filters-panel,
.cart-panel {
  position: static !important;
}

@media (max-width: 520px) {
  .product-image {
    height: 160px !important;
    flex-basis: 160px !important;
    padding: 16px !important;
  }

  .product-image img {
    max-height: 128px !important;
  }
}

.demo-locked > :not(.demo-login) {
  visibility: hidden;
}

.demo-login {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 59, 93, .96);
}

.demo-login[hidden] { display: none; }

.demo-login-card {
  width: min(460px, 100%);
  padding: 34px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.demo-mark { margin-bottom: 22px; }
.demo-login-card h1 { margin: 0; color: #17324d; font-size: 2rem; letter-spacing: -.04em; }
.demo-login-card > p:not(.eyebrow) { color: #6d7d8d; line-height: 1.5; margin: 10px 0 22px; }
.demo-login-form label { display: block; margin: 14px 0; }
.demo-login-form label span { display: block; color: #6d7d8d; font-size: .8rem; font-weight: 700; margin-bottom: 6px; }
.demo-login-form input { width: 100%; border: 1px solid #dbe4eb; border-radius: 9px; padding: 11px; color: #17324d; background: #fbfcfd; }
.demo-login-form input:focus { outline: none; border-color: #0e6d8c; box-shadow: 0 0 0 3px rgba(14,109,140,.12); }
.demo-submit { width: 100%; border: 0; border-radius: 9px; background: #0e6d8c; color: #fff; padding: 12px; font-weight: 800; margin-top: 6px; }
.demo-submit:hover { background: #123b5d; }
.demo-login-error { min-height: 18px; color: #b44934; font-size: .78rem; margin: 9px 0 0; }
.demo-role-list { display: grid; gap: 10px; }
.demo-role-list button { display: block; text-align: left; border: 1px solid #dbe4eb; border-radius: 11px; background: #fbfcfd; padding: 14px; color: #17324d; }
.demo-role-list button:hover { border-color: #0e6d8c; background: #eef6f8; }
.demo-role-list strong, .demo-role-list span { display: block; }
.demo-role-list span { color: #6d7d8d; font-size: .8rem; margin-top: 4px; }
.demo-login-card small { display: block; margin-top: 18px; color: #6d7d8d; line-height: 1.4; }
.session-area { display: flex; align-items: center; gap: 10px; color: #d5e3eb; font-size: .75rem; }
.session-area button { border: 1px solid rgba(255,255,255,.28); color: #fff; background: transparent; border-radius: 7px; padding: 6px 9px; font-size: .75rem; }
.public-mode .cart-button,
.public-mode .cart-panel,
.public-mode .add-row { display: none !important; }
.staff-mode:not(.cart-preview-open) .cart-panel { display: none !important; }
.staff-mode:not(.cart-preview-open) .workspace { grid-template-columns: 235px minmax(0, 1fr); }
.staff-mode.cart-preview-open .cart-panel { display: block !important; }
.cart-panel { scroll-margin-top: 98px; }
.public-mode .catalog-stat,
.public-mode .price-filter,
.public-mode .catalog-toolbar strong,
.public-mode #resultHint { display: none !important; }
.public-mode #priceSelect { opacity: .8; }
.demo-continue { width: 100%; border: 1px solid #dbe4eb; border-radius: 9px; background: #fff; color: #17324d; padding: 10px; font-weight: 700; margin-top: 8px; }
.intro-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 1fr) auto; align-items: center; }
.intro-row .visitor-invite { display: block; grid-column: 2 / 4; justify-self: end; align-self: center; width: min(100%, 720px); margin: 0; padding: 14px 16px; border: 1px solid #cfe1e8; border-radius: 14px; background: #eef6f8; text-align: right; }
.visitor-invite strong, .visitor-invite span { display: block; }
.visitor-invite strong { color: #17324d; font-size: .92rem; }
.visitor-invite span { color: #547183; font-size: .78rem; margin-top: 4px; }
.visitor-contact-link { display: inline-block; color: #0e6d8c; font-size: .78rem; font-weight: 800; margin-top: 7px; text-decoration: none; }
.visitor-contact-link:hover { text-decoration: underline; }
.visitor-invite-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }
.visitor-button { border: 1px solid #b8d2dc; border-radius: 8px; background: #fff; color: #0e6d8c; padding: 9px 11px; font-size: .78rem; font-weight: 700; }
.visitor-button-primary { background: #0e6d8c; border-color: #0e6d8c; color: #fff; }
.cart-heading-actions { display: flex; align-items: center; gap: 8px; }
.back-to-catalog-button { border: 1px solid #b8d2dc; border-radius: 8px; background: #fff; color: #0e6d8c; padding: 8px 11px; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.back-to-catalog-button:hover { background: #eef6f8; }
.cart-heading-actions .dialog-close { font-size: 1.3rem; }
.clear-cart-button { border: 0; background: transparent; color: #b44934; font-size: .72rem; font-weight: 700; padding: 4px 0; }
.clear-cart-button:disabled { opacity: .35; cursor: not-allowed; }
.remove-line-button { border: 0; background: #c62828 !important; color: #fff; border-radius: 7px !important; width: 31px !important; height: 31px !important; font-size: 1.05rem; line-height: 1; }
.remove-line-button svg { display: block; width: 18px; height: 18px; margin: auto; color: #fff; }
.remove-line-button:hover { background: #a61f1f !important; }
.managed-order-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.admin-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 24px; padding: 16px 18px; border: 1px solid #cfe1e8; border-radius: 14px; background: #eef6f8; }
.admin-tools[hidden] { display: none !important; }
.admin-tools h2 { margin: 0; color: #17324d; font-size: 1rem; }
.admin-tools p:not(.eyebrow) { margin: 5px 0 0; color: #547183; font-size: .78rem; }
.admin-tools-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-tools-actions button { flex: 0 0 auto; }
.price-unavailable { margin-top: auto; color: #b06b27; font-size: .75rem; font-weight: 700; }
.workspace { display: block; position: relative; }
.filters-panel { display: none !important; position: absolute !important; left: 0; top: 0; width: min(280px, 90vw); z-index: 6; }
.filters-panel.open { display: block !important; }
.mobile-filter-button { display: block !important; }
.product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Compact product summary and keep the filter control available while browsing. */
.intro-row { margin-bottom: 10px; }
.catalog-toolbar {
  position: relative;
  margin: 0 0 14px;
  padding: 10px 2px;
  background: var(--paper);
  border-bottom: 1px solid rgba(18, 59, 93, .08);
}
.catalog-toolbar > div { display: flex; align-items: baseline; gap: 7px; }
.mobile-filter-button {
  font-size: 1.125rem !important;
  font-weight: 800;
  padding: 9px 14px;
  white-space: nowrap;
}
.mobile-filter-button.is-floating {
  position: fixed;
  top: 88px;
  right: clamp(18px, 4vw, 64px);
  z-index: 7;
  box-shadow: 0 5px 18px rgba(18, 59, 93, .22);
}
.mobile-filter-button.is-floating { transition: box-shadow .18s ease, transform .18s ease; }
.mobile-filter-button.is-floating { border-color: #0e6d8c; background: #fff; }
@media (max-width: 850px) {
  .mobile-filter-button.is-floating { top: 78px; right: 18px; }
  .filters-panel.open { top: 126px !important; right: 18px !important; max-height: calc(100vh - 140px); }
}

/* Open the filter drawer beside the right-aligned “Filtros” control. */
.filters-panel.open {
  position: fixed !important;
  left: auto !important;
  right: clamp(18px, 4vw, 64px) !important;
  top: 142px !important;
  width: min(360px, calc(100vw - 28px)) !important;
  max-height: calc(100vh - 160px);
  overflow: auto;
  box-shadow: 0 18px 42px rgba(18, 59, 93, .18);
}
.order-choice { margin-top: 18px; padding: 16px; border: 1px solid #cfe1e8; border-radius: 12px; background: #eef6f8; }
.order-choice-title { margin: 0; color: #17324d; font-weight: 800; }
.order-choice-copy { margin: 6px 0 12px; color: #547183; font-size: .8rem; line-height: 1.4; }
.order-choice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.order-choice-actions button { flex: 1 1 220px; }
.order-fields[hidden], .order-choice[hidden], .cart-actions button[hidden] { display: none !important; }
.client-picker { display: flex; gap: 8px; align-items: stretch; }
.client-picker select { flex: 1 1 auto; min-width: 0; }
.client-picker .secondary-button { flex: 0 0 auto; white-space: nowrap; padding: 10px 12px; }
.client-dialog { max-height: min(92vh, 820px); overflow: auto; }
.client-dialog .field-grid { gap: 10px; }
.client-dialog textarea { width: 100%; resize: vertical; }
.staff-mode.cart-preview-open .cart-panel { position: fixed !important; inset: 0; z-index: 30; overflow: auto; border-radius: 0; padding: clamp(22px, 4vw, 56px); background: #f7fafb; }
.staff-mode.cart-preview-open .cart-panel .cart-items { max-height: none; overflow: visible; }
.staff-mode.cart-preview-open .cart-panel .cart-heading { max-width: 1200px; margin: 0 auto; }
.staff-mode.cart-preview-open .cart-panel .cart-items,
.staff-mode.cart-preview-open .cart-panel .cart-total,
.staff-mode.cart-preview-open .cart-panel .order-choice,
.staff-mode.cart-preview-open .cart-panel .order-fields,
.staff-mode.cart-preview-open .cart-panel .cart-actions,
.staff-mode.cart-preview-open .cart-panel .offline-note { max-width: 1200px; margin-left: auto; margin-right: auto; }
.staff-mode.cart-preview-open .cart-panel .cart-line { grid-template-columns: 1fr auto; padding: 15px 0; }
.staff-mode.cart-preview-open .cart-panel .cart-line strong { font-size: .95rem; }
.staff-mode.cart-preview-open .cart-panel .cart-line small { font-size: .88rem; }
.staff-mode.cart-preview-open .cart-panel .cart-line-actions button { width: 32px; height: 32px; }
.cart-product-image { width: 66px; height: 52px; object-fit: contain; background: #f7fafb; border-radius: 7px; margin-right: 10px; vertical-align: middle; }
.cart-line-subtotal { color: var(--blue); font-weight: 800; margin-left: 4px; }
.cart-line > div:first-child { display: flex; align-items: center; gap: 8px; }
.cart-line > div:first-child strong, .cart-line > div:first-child small { flex: 1; }
.remove-line-button { width: 30px !important; height: 30px !important; border-color: #a61f1f !important; color: #fff !important; background: #c62828 !important; font-size: .95rem; }
.remove-line-button:hover { background: #a61f1f !important; }
.product-card { cursor: zoom-in; }
.product-card:focus-visible { outline: 3px solid var(--blue2); outline-offset: 3px; }
.product-dialog { width: min(760px, calc(100% - 28px)); border: 0; border-radius: 18px; padding: 0; color: var(--ink); box-shadow: 0 24px 80px rgba(18,59,93,.3); }
.product-dialog::backdrop { background: rgba(18,59,93,.62); }
.product-dialog form { position: relative; padding: 24px; }
.product-dialog-close { position: absolute; top: 14px; right: 16px; z-index: 2; background: rgba(255,255,255,.9); border-radius: 50%; width: 34px; height: 34px; }
.product-dialog-image { min-height: 360px; display: grid; place-items: center; background: #f7fafb; border-radius: 12px; padding: 28px; }
.product-dialog-image img { display: block; max-width: 100%; max-height: 520px; width: auto; height: auto; object-fit: contain; }
.product-dialog-info { padding: 20px 4px 4px; }
.product-dialog-info .product-meta { font-size: .85rem; }
.product-dialog-info h2 { margin: 8px 0 12px; color: var(--ink); font-size: clamp(1.15rem, 2.2vw, 1.65rem); line-height: 1.25; }
.product-dialog-codes, #productDialogCodes { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.product-dialog-price { color: var(--blue); font-size: 1.35rem; }
@media (max-width: 520px) { .product-dialog form { padding: 14px; } .product-dialog-image { min-height: 260px; padding: 18px; } }
.staff-mode.cart-preview-open .cart-panel .cart-total { padding-top: 22px; }
@media (min-width: 851px) and (max-width: 1250px) {
  .workspace { display: block; }
  .filters-panel { display: none; margin-bottom: 16px; position: static !important; }
  .filters-panel.open { display: block; }
  .mobile-filter-button { display: block; }
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cart-panel { margin-top: 18px; }
}
@media (min-width: 851px) and (max-width: 1400px) {
  .workspace { display: block; }
  .filters-panel { display: none; margin-bottom: 16px; position: static !important; }
  .filters-panel.open { display: block; }
  .mobile-filter-button { display: block; }
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cart-panel { margin-top: 18px; }
}
@media (min-width: 651px) and (max-width: 850px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) { .admin-tools { display: block; } .admin-tools-actions { margin-top: 12px; } }

@media print {
  .admin-tools { display: none !important; }
  .print-page { break-after: auto; }
  .print-page-break { break-before: page; }
  .print-table thead { display: table-header-group; }
  .print-table tr { break-inside: avoid; }
  .print-product-image { width: 48px; height: 38px; object-fit: contain; display: block; }
}
.visitor-dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 16px; padding: 0; color: #17324d; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.visitor-dialog::backdrop { background: rgba(18,59,93,.55); }
.visitor-dialog form { padding: 22px; }
.visitor-dialog-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.visitor-dialog h2 { margin: 0; font-size: 1.3rem; }
.visitor-dialog-copy { color: #6d7d8d; font-size: .85rem; line-height: 1.45; margin: 7px 0 17px; }
.visitor-dialog label { display: block; margin: 12px 0; }
.visitor-dialog label > span { display: block; color: #6d7d8d; font-size: .78rem; font-weight: 700; margin-bottom: 6px; }
.visitor-dialog input:not([type="checkbox"]) { width: 100%; border: 1px solid #dbe4eb; border-radius: 9px; padding: 10px 11px; color: #17324d; background: #fbfcfd; }
.dialog-close { border: 0; background: transparent; color: #6d7d8d; font-size: 1.6rem; line-height: 1; padding: 0 4px; }
.visitor-consent { display: flex !important; align-items: center; gap: 8px; }
.visitor-consent input { width: 16px; height: 16px; }
.visitor-consent span { margin: 0 !important; font-weight: 500 !important; color: #547183 !important; }
.visitor-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.visitor-dialog-actions button { flex: 0 0 auto; min-width: 120px; }
.client-management-dialog { width: min(720px, calc(100% - 28px)); }
.client-management-actions, .client-scope-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.client-management-actions button, .client-scope-actions button { flex: 0 0 auto; }
.client-scope-actions { border-top: 1px solid #e2ebef; padding-top: 12px; }
.client-management-status { color: #6d7d8d; font-size: .78rem; min-height: 18px; margin: 8px 0; }
.managed-clients-list { display: grid; gap: 8px; max-height: 390px; overflow: auto; margin-top: 10px; }
.managed-client-card { border: 1px solid #dbe4eb; border-radius: 10px; padding: 11px 12px; background: #fbfcfd; }
.managed-client-card strong, .managed-client-card span { display: block; }
.managed-client-card strong { color: #17324d; font-size: .9rem; }
.managed-client-card span { color: #6d7d8d; font-size: .76rem; line-height: 1.45; margin-top: 3px; }
.client-management-empty { color: #6d7d8d; font-size: .82rem; padding: 18px 0; text-align: center; }
@media (max-width: 850px) { .intro-row { display: block; } .intro-row .visitor-invite { width: 100%; margin-top: 18px; } }
@media (max-width: 650px) { .visitor-invite-actions { margin-top: 12px; } }
@media (max-width: 650px) { .session-area span { display: none; } .demo-login-card { padding: 26px; } }
.install-app-button{border:1px solid rgba(255,255,255,.35);background:rgba(255,255,255,.08);color:#fff;border-radius:8px;padding:8px 11px;font-size:.78rem;font-weight:700;white-space:nowrap}
.install-app-button:hover{background:rgba(255,255,255,.16)}
@media(max-width:700px){.install-app-button{display:none!important}}
