:root {
  --mpl-primary: #059669;
  --mpl-primary-dark: #064E3B;
  --mpl-primary-soft: #D1FAE5;
  --mpl-bg: #F8FAFC;
  --mpl-surface: #FFFFFF;
  --mpl-text: #0F172A;
  --mpl-muted: #64748B;
  --mpl-border: #E2E8F0;

  --mpl-cat-food: #EA580C;
  --mpl-cat-food-soft: #FFEDD5;
  --mpl-cat-service: #4F46E5;
  --mpl-cat-service-soft: #E0E7FF;
  --mpl-cat-market: #059669;
  --mpl-cat-market-soft: #D1FAE5;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--mpl-bg);
  color: var(--mpl-text);
  margin: 0;
  padding-bottom: 76px;
  overflow-x: clip;
}

@media (min-width: 992px) {
  body {
    padding-bottom: 24px;
  }
}

/* Fase 0 Top Banner */
.phase0-ribbon {
  background: linear-gradient(90deg, var(--mpl-primary-dark), #065F46);
  color: #ECFDF5;
  font-size: 0.8rem;
  padding: 6px 16px;
}

/* Top Prototype Switcher */
.proto-switcher-bar {
  background: var(--mpl-surface);
  border-bottom: 1px solid var(--mpl-border);
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--mpl-primary), var(--mpl-primary-dark));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.proto-nav-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.proto-nav-pills::-webkit-scrollbar {
  display: none;
}

.proto-tab-btn {
  border: 1px solid var(--mpl-border);
  background: var(--mpl-surface);
  color: var(--mpl-muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.proto-tab-btn:hover {
  border-color: var(--mpl-primary);
  color: var(--mpl-primary);
}

.proto-tab-btn.active {
  background: var(--mpl-primary);
  border-color: var(--mpl-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

/* Cards & Surfaces */
.mpl-card {
  background: var(--mpl-surface);
  border: 1px solid var(--mpl-border);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

/* Category Pills */
.cat-pill-card {
  background: var(--mpl-surface);
  border: 1px solid var(--mpl-border);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cat-pill-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.cat-pill-card.active-food { border-color: var(--mpl-cat-food); background: #FFF7ED; }
.cat-pill-card.active-service { border-color: var(--mpl-cat-service); background: #EEF2FF; }
.cat-pill-card.active-marketplace { border-color: var(--mpl-cat-market); background: #ECFDF5; }

.cat-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.cat-food { background: var(--mpl-cat-food-soft); color: var(--mpl-cat-food); }
.cat-service { background: var(--mpl-cat-service-soft); color: var(--mpl-cat-service); }
.cat-market { background: var(--mpl-cat-market-soft); color: var(--mpl-cat-market); }

/* Commercial Listing Card (Compact) */
.ad-card {
  background: var(--mpl-surface);
  border: 1px solid var(--mpl-border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ad-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.ad-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ad-badge-left {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.ad-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--mpl-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, color 0.15s ease;
}

.ad-fav-btn.favorited {
  color: #EF4444;
  transform: scale(1.06);
}

.ad-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.28;
  color: var(--mpl-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
  cursor: pointer;
}

.store-card-content {
  min-width: 0;
}

.store-card-name {
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.sticky-search {
  position: sticky;
  top: var(--storefront-header-height, 64px);
  z-index: 1020;
  padding: 8px 0;
  background: var(--mpl-bg);
}

.storefront-search-spacer { display: none; }

.sticky-search form { min-width: 0; }
.filter-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--mpl-border);
  border-radius: 12px;
  margin: 0 0 6px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.filter-choice:has(input:checked) {
  border-color: var(--mpl-primary);
  background: var(--mpl-primary-soft);
}
.filter-choice .form-check-input { margin: 0; flex-shrink: 0; }

.ad-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--mpl-primary-dark);
}

.ad-old-price {
  font-size: 0.76rem;
  text-decoration: line-through;
  color: var(--mpl-muted);
  margin-left: 4px;
}

.btn-wa-compact {
  background-color: #16A34A;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 10px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}

.btn-wa-compact:hover {
  background-color: #15803D;
  color: #fff;
}

/* Promo Banner */
.hero-banner {
  background: linear-gradient(125deg, var(--mpl-primary-dark) 0%, var(--mpl-primary) 65%, #10B981 100%);
  border-radius: 16px;
  color: #fff;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  right: -30px;
  top: -30px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

/* Allow long user supplied labels to wrap inside their own cards. */
.hero-banner h1,
.hero-banner p,
.mpl-card,
.ad-title {
  overflow-wrap: anywhere;
}

/* Mobile Fixed Bottom Nav (Vitrine) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--mpl-surface);
  border-top: 1px solid var(--mpl-border);
  display: flex;
  justify-content: space-around;
  padding: 6px 4px env(safe-area-inset-bottom, 6px);
  z-index: 1040;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.mobile-nav-item {
  border: none;
  background: transparent;
  color: var(--mpl-muted);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  cursor: pointer;
}

.mobile-nav-item.active {
  color: var(--mpl-primary);
}

.mobile-nav-item i {
  font-size: 1.2rem;
}

/* Admin Sidebar Layout */
.admin-shell {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--mpl-primary-dark);
  color: #ECFDF5;
  border-radius: 16px;
  padding: 14px;
  transition: width 0.2s ease;
}

.admin-sidebar.collapsed {
  width: 68px;
  padding: 14px 10px;
}

.admin-sidebar.collapsed .sidebar-label {
  display: none;
}

.admin-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #A7F3D0;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 3px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.admin-menu-link:hover,
.admin-menu-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}

.admin-card-menu { max-width: 100%; }
@media (min-width: 992px) {
  .admin-card-menu { width: 320px !important; flex: 0 0 320px; }
  .admin-shell > .flex-grow-1 { min-width: 0; }
}
.admin-card-menu .admin-menu-group + .admin-menu-group { margin-top: 16px; }
.admin-card-menu .admin-menu-group > div:first-child { margin: 0 0 8px !important; padding: 0 4px !important; }
.admin-menu-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.admin-card-menu .admin-menu-link {
  min-width: 0;
  min-height: 72px;
  margin: 0;
  padding: 8px 5px;
  border: 1px solid rgba(167, 243, 208, .2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 3px;
  font-size: .72rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.admin-card-menu .admin-menu-link i { font-size: 1.2rem; }
.admin-command-home .admin-shell > .flex-grow-1 { display: none; }
.admin-command-home .admin-shell { justify-content: center; }
@media (min-width: 992px) {
  .admin-command-home .admin-card-menu { width: min(100%, 720px) !important; flex: 0 1 720px; }
}
.admin-command-home .admin-card-menu .admin-menu-link {
  background: #facc15;
  border-color: #eab308;
  color: #1f2937;
  font-weight: 700;
}
.admin-command-home .admin-card-menu .admin-menu-link:hover,
.admin-command-home .admin-card-menu .admin-menu-link:focus-visible {
  background: #fde047;
  color: #111827;
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.admin-module-dialog { max-width: min(96vw, 1320px); height: calc(100dvh - 32px); margin: 16px auto; }
.admin-module-dialog .modal-content { height: 100%; }
.admin-module-dialog .modal-header { flex-shrink: 0; background: #fff; z-index: 1; }
.admin-module-dialog .modal-body { overflow: hidden; min-height: 0; }
#adminModuleFrame { display: block; width: 100%; height: 100%; border: 0; background: var(--mpl-bg); }
#sellerModuleFrame { display: block; width: 100%; height: 100%; border: 0; background: var(--mpl-bg); }
@media (max-width: 767.98px) {
  .subscription-table-wrap { overflow-x: visible !important; }
  .subscription-table-wrap .subscription-table { min-width: 0 !important; width: 100% !important; }
  .subscription-table, .subscription-table tbody, .subscription-table tr, .subscription-table td { display: block; width: 100%; }
  .subscription-table thead { display: none; }
  .subscription-table tr { border: 1px solid #dee2e6; border-radius: 12px; padding: 8px; margin-bottom: 10px; background: #fff; }
  .subscription-table td { display: grid; grid-template-columns: minmax(84px, 30%) minmax(0, 1fr); gap: 8px; border: 0; padding: 5px 2px; overflow-wrap: anywhere; }
  .subscription-table td::before { content: attr(data-label); color: #64748b; font-weight: 600; }
  .subscription-table td[data-label="Ações"] { display: block; border-top: 1px solid #e2e8f0; margin-top: 5px; padding-top: 9px; }
  .subscription-table td[data-label="Ações"]::before { display: block; margin-bottom: 5px; }
}
.seller-command-home .admin-shell > .flex-grow-1 { display: none; }
.seller-command-home .admin-shell { justify-content: center; }
.seller-card-menu .admin-menu-link { background: rgba(255, 255, 255, .025); }
.seller-card-menu .admin-menu-link:hover,
.seller-card-menu .admin-menu-link:focus-visible,
.seller-card-menu .admin-menu-link.active { background: rgba(255, 255, 255, .16); color: #fff; }
@media (min-width: 992px) {
  .seller-command-home .seller-card-menu { width: min(100%, 720px) !important; flex: 0 1 720px; }
}
@media (max-width: 767.98px) {
  .admin-module-dialog { max-width: 100vw; width: 100vw; height: 100dvh; margin: 0; }
  .admin-module-dialog .modal-content { border: 0; border-radius: 0; }
}

.kpi-mini-card {
  background: var(--mpl-surface);
  border: 1px solid var(--mpl-border);
  border-radius: 12px;
  padding: 12px 14px;
  height: 100%;
  min-width: 0;
}

.kpi-label {
  font-size: 0.74rem;
  color: var(--mpl-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--mpl-text);
  margin-top: 2px;
}

/* OTP Input Boxes */
.otp-input {
  width: 44px;
  height: 50px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  border: 1.5px solid var(--mpl-border);
  border-radius: 10px;
  background: #fff;
}
.otp-input:focus {
  border-color: var(--mpl-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.16);
}

.view-section {
  display: none;
}
.view-section.active {
  display: block;
}

/* Precedence Stack */
.precedence-step {
  border-left: 4px solid var(--mpl-primary);
  background: #fff;
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  border-top: 1px solid var(--mpl-border);
  border-right: 1px solid var(--mpl-border);
  border-bottom: 1px solid var(--mpl-border);
}
