:root {
  --bg: #09090b;
  --gold: #c9a227;
  --gold-20: rgba(201, 162, 39, 0.2);
  --gold-30: rgba(201, 162, 39, 0.3);
  --gold-10: rgba(201, 162, 39, 0.1);
  --zinc-600-50: rgba(82, 82, 91, 0.5);
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-800-30: rgba(39, 39, 42, 0.3);
  --zinc-800-50: rgba(39, 39, 42, 0.5);
  --text: #f8fafc;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --green-text: #6ee7b7;
  --green-bg: rgba(6, 78, 59, 0.4);
  --green-border: rgba(4, 120, 87, 0.4);
  --red-text: #fca5a5;
  --red-bg: rgba(127, 29, 29, 0.4);
  --red-border: rgba(185, 28, 28, 0.4);
  --teal-border: rgba(20, 184, 166, 0.5);
  --amber-border: rgba(217, 119, 6, 0.5);
  --max-width: 768px;
  --radius-xl: 12px;
  --radius-lg: 8px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  font-size: 16px;
}

.app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 12px 80px;
}

@media (min-width: 640px) {
  .app {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Header */
.header {
  padding: 12px 0 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(to bottom, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand-logo {
  height: 72px;
  max-width: 340px;
  width: auto;
  object-fit: contain;
  object-position: left center;
}

@media (max-width: 480px) {
  .header-top {
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand-logo {
    height: 56px;
    max-width: 210px;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-share,
.btn-novidades,
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-family: inherit;
  text-decoration: none;
}

.btn-share,
.btn-novidades {
  border: 1px solid var(--gold-30);
  background: var(--gold-10);
  color: var(--gold);
}

.btn-whatsapp {
  border: 1px solid rgba(37, 211, 102, 0.35);
  background: rgba(37, 211, 102, 0.12);
  color: #4ade80;
}

.btn-share:hover,
.btn-novidades:hover {
  background: var(--gold-20);
}

.btn-whatsapp:hover {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.5);
}

.btn-novidades .badge-count {
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}

.header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.page-title {
  font-size: 1rem;
  font-weight: 600;
}

.updated-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--zinc-800);
  border: 1px solid var(--zinc-700);
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  white-space: nowrap;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  font-family: inherit;
}

.stat-total {
  background: var(--gold-10);
  color: var(--gold);
  border: 1px solid var(--gold-30);
}

.search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 4px 12px 4px 36px;
  border: 1px solid var(--zinc-700);
  border-radius: var(--radius-lg);
  background: var(--zinc-800);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  border-color: #52525b;
}

/* Update banner */
.update-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--gold-10);
  border: 1px solid var(--gold-30);
  border-radius: var(--radius-xl);
  cursor: pointer;
}

.update-banner.hidden {
  display: none;
}

.update-banner-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.update-banner-text strong {
  color: var(--gold);
  font-size: 13px;
}

.update-banner-text small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.update-banner-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-xl);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: background 0.2s;
}

.action-card:hover {
  background: rgba(255, 255, 255, 0.03);
}

.action-frete {
  border: 1px solid var(--teal-border);
}

.action-regras {
  border: 1px solid var(--amber-border);
}

.action-icon {
  font-size: 1.2rem;
}

.action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-text strong {
  font-size: 14px;
  font-weight: 600;
}

.action-text small {
  font-size: 12px;
  color: var(--text-muted);
}

/* Info banner */
.info-banner {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--zinc-800-50);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}

.info-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 7px;
}

.info-banner p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.info-banner strong {
  color: var(--gold);
}

.info-link {
  color: #4ade80;
  text-decoration: none;
  font-weight: 500;
}

.info-link:hover {
  text-decoration: underline;
}

.text-danger {
  color: var(--red-text);
}

/* Catalog */
.catalog-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loading,
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--zinc-800);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Category */
.category {
  border-radius: var(--radius-xl);
  background: #000;
  overflow: hidden;
}

.category.border-gold {
  border: 1px solid var(--gold-30);
}

.category.border-zinc {
  border: 1px solid var(--zinc-600-50);
}

.category.open {
  border-color: var(--gold-30);
}

.category-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.2s;
}

@media (min-width: 640px) {
  .category-header {
    padding: 16px;
  }
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.category-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.category-badge {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 700;
  background: var(--gold-20);
  color: var(--gold);
}

.category-badge-img {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  border: 1px solid var(--gold-30);
  background: #fff;
}

.category-info {
  min-width: 0;
}

.category-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 14px;
  color: var(--text-muted);
}

.category-meta .missing-count {
  color: var(--red-text);
}

.category-chevron {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.25s ease;
}

.category.open .category-chevron {
  transform: rotate(180deg);
}

.category-body {
  display: none;
  border-top: 1px solid var(--zinc-800-50);
}

.category.open .category-body {
  display: block;
}

/* Brand */
.brand-row {
  border-bottom: 1px solid var(--zinc-800-30);
}

.brand-row:last-child {
  border-bottom: none;
}

.brand-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.2s;
}

.brand-header:hover {
  background: rgba(39, 39, 42, 0.3);
}

.brand-header-left {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.brand-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 14px;
  color: var(--text-muted);
}


.brand-chevron {
  color: var(--text-dim);
  transition: transform 0.25s ease;
  font-size: 12px;
}

.brand.open .brand-chevron {
  transform: rotate(180deg);
}

.brand-body {
  display: none;
}

.brand.open .brand-body {
  display: block;
}

/* Subcategorias (forma) dentro da marca */
.forma-hint {
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--zinc-800-30);
}

.forma-row {
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--zinc-800-30);
}

.forma-row:last-child {
  border-bottom: none;
}

.forma-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.2s;
}

.forma-header:hover {
  background: rgba(39, 39, 42, 0.4);
}

.forma-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.forma-icon {
  font-size: 15px;
}

.forma-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

.forma-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.forma-count {
  font-size: 13px;
  color: var(--text-muted);
}

.forma-chevron {
  color: var(--text-dim);
  transition: transform 0.25s ease;
  font-size: 11px;
}

.forma.open .forma-chevron {
  transform: rotate(180deg);
}

.forma-body {
  display: none;
  background: var(--bg);
}

.forma.open .forma-body {
  display: block;
}

/* Products */
.product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--zinc-800-30);
  cursor: pointer;
  transition: background 0.2s;
}

.product-row:last-child {
  border-bottom: none;
}

.product-row:hover {
  background: rgba(39, 39, 42, 0.4);
}

.product-img-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--zinc-700);
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.product-img-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-price {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

.modal-price {
  font-weight: 700;
  color: var(--gold);
}

.product-img-placeholder {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--zinc-700);
  font-size: 1rem;
  opacity: 0.4;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-dosage {
  font-size: 14px;
  color: var(--gold);
  font-weight: 500;
}

.product-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.product-status {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.product-status.available {
  color: var(--green-text);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.product-status.unavailable {
  color: var(--red-text);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 0 8px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

@media (min-width: 480px) {
  .modal-overlay {
    padding: 24px;
  }
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #000;
  border: 1px solid var(--zinc-600-50);
  border-radius: var(--radius-xl);
  padding: 20px;
  width: 100%;
  max-width: min(540px, calc(100vw - 32px));
  max-height: min(90dvh, 780px);
  overflow-y: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 480px) {
  .modal {
    padding: 28px 32px;
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-right: 28px;
  line-height: 1.3;
}

@media (min-width: 480px) {
  .modal-title {
    font-size: 1.35rem;
    margin-bottom: 20px;
  }
}

.modal-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
}

@media (min-width: 480px) {
  .modal-body {
    font-size: 15px;
  }
}

.modal-product-img {
  width: 100%;
  max-height: min(44vh, 320px);
  min-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  background: var(--zinc-800);
  margin-bottom: 18px;
}

@media (min-width: 480px) {
  .modal-product-img {
    max-height: min(48vh, 380px);
    min-height: 240px;
    margin-bottom: 22px;
  }
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--zinc-800-30);
  font-size: 14px;
}

@media (min-width: 480px) {
  .modal-detail-row {
    padding: 12px 0;
    font-size: 15px;
  }
}

.modal-detail-row:last-child {
  border-bottom: none;
}

.modal-detail-label {
  color: var(--text-dim);
}

.modal-highlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--gold-10);
  border: 1px solid var(--gold-30);
  border-radius: var(--radius-lg);
  font-size: 14px;
}

.modal-highlight strong {
  color: var(--gold);
  font-size: 1.05rem;
}

.modal-lead {
  margin-bottom: 10px;
}

.modal-note {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.55;
}

.modal-section {
  margin-bottom: 18px;
}

.modal-section--muted {
  padding-top: 14px;
  border-top: 1px solid var(--zinc-800-30);
}

.modal-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-section-title--spaced {
  margin-top: 4px;
}

.modal-section-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.modal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.modal-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
}

.modal-list-icon {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.modal-list-check .modal-list-icon {
  color: var(--green-text);
}

.modal-list-cross .modal-list-icon {
  color: var(--red-text);
}

.modal-labs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 4px;
  font-size: 13px;
}

.modal-labs li::before {
  content: "•";
  color: var(--gold);
  margin-right: 8px;
}

.modal-envio-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-envio-list strong {
  color: var(--text);
}

.modal-seguro-custo {
  margin: 8px 0;
}

.modal-compromisso {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--zinc-800-30);
}

.modal-cta-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: #25d366;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.modal-cta-whatsapp:hover {
  background: #20bd5a;
  transform: translateY(-1px);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  border: 1px solid var(--zinc-600-50);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 300;
  transition: opacity 0.3s;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 400px) {
  .header-actions .btn-novidades span:not(.badge-count) {
    display: none;
  }

  .product-status {
    font-size: 10px;
    padding: 2px 6px;
  }
}