* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--brand-bg);
  color: var(--brand-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 0% 0%, rgba(19, 104, 73, 0.07), transparent),
    radial-gradient(ellipse 50% 30% at 100% 100%, rgba(19, 104, 73, 0.05), transparent);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--brand-primary-dark);
}

.muted {
  color: var(--brand-text-muted);
}

.site-logo {
  display: block;
  border-radius: 6px;
}

.site-logo--small {
  width: 44px;
  height: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.topbar {
  position: relative;
  z-index: 50;
  flex-shrink: 0;
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(12, 74, 52, 0.25);
  --topbar-height: 64px;
}

.topbar--sticky {
  position: sticky;
  top: 0;
}

.topbar-inner {
  max-width: min(var(--site-max), calc(100vw - 2rem));
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 48px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-inner--narrow {
  max-width: min(var(--podcast-max, 1280px), calc(100vw - 2rem));
  padding-top: max(12px, env(safe-area-inset-top));
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.topbar-brand:hover {
  color: inherit;
}

.topbar-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.topbar-brand .muted {
  display: block;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.topbar-nav-link {
  padding: 8px 12px;
  border-radius: var(--brand-radius-sm);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.topbar-nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.topbar-nav-link.is-active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.topbar-nav-link--menu {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.topbar-nav-chevron {
  font-size: 0.72rem;
  opacity: 0.85;
}

.topbar-actions .topbar-nav-link {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.topbar-menu-toggle {
  display: none;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.topbar-menu-toggle:hover,
.topbar-menu-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.34);
}

.topbar-menu-toggle__bar {
  display: block;
  width: 18px;
  height: 2px;
  margin: 3px auto;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.topbar-menu-open .topbar-menu-toggle__bar:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

body.topbar-menu-open .topbar-menu-toggle__bar:nth-child(2) {
  opacity: 0;
}

body.topbar-menu-open .topbar-menu-toggle__bar:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.topbar-menu-backdrop {
  display: none;
}

.header-store-link.is-active {
  background: var(--brand-tint);
  color: var(--brand-primary-dark);
  font-weight: 700;
}

.topbar .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.topbar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--brand-radius-sm);
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-primary-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--brand-surface);
  color: var(--brand-primary);
  border: 1px solid var(--brand-border);
}

.btn-secondary:hover {
  background: var(--brand-tint);
  color: var(--brand-primary-dark);
}

.header-user-menu,
.header-store-menu {
  position: relative;
}

.topbar-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 168px;
  padding: 5px 10px 5px 5px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.topbar-user-trigger:hover,
.topbar-user-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.34);
}

.topbar-user-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.topbar-user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-dropdown,
.header-store-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 220px;
  padding: 8px;
  border-radius: var(--brand-radius);
  background: #fff;
  border: 1px solid var(--brand-border);
  box-shadow: var(--brand-shadow);
}

.header-user-dropdown[hidden],
.header-store-dropdown[hidden] {
  display: none;
}

.header-user-dropdown-head {
  padding: 6px 10px 8px;
}

.header-user-dropdown-head strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--brand-text);
  word-break: break-word;
}

.header-user-dropdown-head .muted {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--brand-text-muted);
  word-break: break-all;
}

.header-user-dropdown-divider {
  height: 1px;
  margin: 2px 0 6px;
  background: var(--brand-border);
}

.header-user-link,
.header-store-dropdown a {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-text);
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.header-user-link:hover,
.header-store-dropdown a:hover {
  background: var(--brand-tint);
  color: var(--brand-primary-dark);
}

.header-user-link--logout {
  color: #991b1b;
}

.header-user-link--logout:hover {
  background: #fef2f2;
  color: #991b1b;
}

.page-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-main {
  width: 100%;
  max-width: min(var(--site-max), calc(100vw - 2rem));
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 48px) 48px;
}

.page-main--narrow {
  max-width: min(var(--content-narrow), calc(100vw - 2rem));
}

.section-heading {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--brand-primary);
}

.site-footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--brand-border);
  background: var(--brand-surface);
}

.site-footer-inner {
  max-width: min(var(--site-max), calc(100vw - 2rem));
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 48px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer-copy {
  margin: 0;
  font-size: 0.88rem;
  color: var(--brand-text-muted);
}

.site-footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer-nav a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-text-muted);
}

.site-footer-nav a:hover {
  color: var(--brand-primary);
}

.whatsapp-support {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-support:hover,
.whatsapp-support:focus-visible {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  color: #fff;
  outline: none;
}

.whatsapp-support:focus-visible {
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.22),
    0 0 0 3px rgba(37, 211, 102, 0.35);
}

.whatsapp-support__icon {
  width: 30px;
  height: 30px;
  display: block;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.status-badge--active {
  background: rgba(19, 104, 73, 0.12);
  color: var(--brand-primary-dark);
}

.status-badge--inactive {
  background: #f3f4f6;
  color: #4b5563;
}

.status-badge--warning {
  background: #fffbeb;
  color: #b45309;
}

.status-badge--neutral {
  background: var(--brand-tint);
  color: var(--brand-text-muted);
}

@media (max-width: 720px) {
  .topbar {
    --topbar-height: 58px;
  }

  .topbar-inner {
    padding: 10px 16px;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .topbar-brand {
    min-width: 0;
    flex: 1 1 auto;
  }

  .topbar-brand strong {
    font-size: 1.05rem;
  }

  .topbar-menu-toggle {
    display: grid;
    place-items: center;
    margin-left: auto;
  }

  .topbar-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(26, 46, 38, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.topbar-menu-open .topbar-menu-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar-menu-backdrop[hidden] {
    display: block;
    visibility: hidden;
  }

  body.topbar-menu-open .topbar-menu-backdrop[hidden] {
    visibility: visible;
  }

  .topbar-actions {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    width: min(320px, 88vw);
    height: calc(100dvh - var(--topbar-height));
    margin: 0;
    padding: 16px 16px 24px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    background: var(--brand-surface);
    color: var(--brand-text);
    box-shadow: -10px 0 36px rgba(12, 74, 52, 0.18);
    transform: translateX(105%);
    transition: transform 0.24s ease;
    z-index: 48;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
  }

  body.topbar-menu-open .topbar-actions {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .topbar-nav {
    order: 0;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 0;
    border-top: 0;
  }

  .header-store-menu,
  .header-user-menu {
    width: 100%;
  }

  .topbar-actions #storeMenuBtn {
    display: none;
  }

  body.topbar-menu-open .topbar-actions .header-store-dropdown,
  body.topbar-menu-open .topbar-actions .header-store-dropdown[hidden] {
    position: static;
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  body.topbar-menu-open .topbar-actions .header-store-dropdown::before {
    content: "Browse";
    display: block;
    padding: 0 4px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-text-muted);
  }

  .topbar-actions .header-store-link {
    color: var(--brand-text);
    border-radius: 8px;
  }

  .topbar-actions .topbar-nav-link,
  .topbar-actions #accountBtn {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 14px;
    color: var(--brand-text);
    background: transparent;
    border-radius: 8px;
    font-size: 0.95rem;
  }

  .topbar-actions .topbar-nav-link:hover,
  .topbar-actions #accountBtn:hover {
    background: var(--brand-tint);
    color: var(--brand-primary-dark);
  }

  .topbar-user-trigger {
    max-width: none;
    width: 100%;
    justify-content: flex-start;
    padding: 8px 10px;
    color: var(--brand-text);
    background: var(--brand-tint);
    border-color: var(--brand-border);
  }

  .topbar-user-trigger:hover,
  .topbar-user-trigger[aria-expanded="true"] {
    background: var(--brand-tint-strong);
    border-color: var(--brand-border);
    color: var(--brand-text);
  }

  .topbar-user-name {
    font-size: 0.9rem;
    color: var(--brand-text);
    display: inline;
  }

  .topbar-actions .header-user-dropdown {
    position: static;
    min-width: 0;
    width: 100%;
    margin-top: 4px;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .topbar-actions .header-user-dropdown-head {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--brand-tint);
  }

  .topbar-actions .header-user-dropdown-head strong,
  .topbar-actions .header-user-dropdown-head .muted {
    color: var(--brand-text);
  }

  .topbar-actions .header-user-dropdown-divider {
    margin: 8px 0;
  }

  .page-main,
  .page-main--narrow {
    padding: 20px 16px 40px;
  }

  .section-heading {
    font-size: 1.45rem;
  }

  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .topbar-brand .muted {
    font-size: 0.76rem;
  }
}

/* Auth flow — shared alert & step indicator */
.auth-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1rem;
}

.auth-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-text-muted);
  background: var(--brand-tint);
  border: 1px solid var(--brand-border);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.auth-step.is-active {
  color: #fff;
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.auth-step.is-done {
  color: var(--brand-primary-dark);
  background: rgba(19, 104, 73, 0.14);
  border-color: rgba(19, 104, 73, 0.28);
}

.auth-step-line {
  flex: 1;
  height: 2px;
  margin: 0 0.5rem;
  background: var(--brand-border);
  border-radius: 1px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--brand-radius-sm);
  border: 1px solid transparent;
  animation: auth-alert-in 0.2s ease-out;
}

.auth-alert[hidden] {
  display: none !important;
}

@keyframes auth-alert-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-alert__icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.auth-alert__content {
  min-width: 0;
}

.auth-alert__title {
  display: block;
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.auth-alert__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-alert--success {
  background: rgba(19, 104, 73, 0.1);
  border-color: rgba(19, 104, 73, 0.22);
  color: var(--brand-primary-dark);
}

.auth-alert--success .auth-alert__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23136849' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}

.auth-alert--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.auth-alert--error .auth-alert__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b91c1c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
}

.auth-alert--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.auth-alert--info .auth-alert__icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d4ed8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
}

input.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

button.linkish {
  width: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--brand-primary);
  background: transparent;
  cursor: pointer;
}

button.linkish:hover:not(:disabled) {
  color: var(--brand-primary-dark);
  text-decoration: underline;
}

button.linkish:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  text-decoration: none;
}
