:root {
  --brand-primary: var(--color-emerald-600);
  --brand-secondary: var(--color-slate-900);
  --brand-primary-rgb: 5, 150, 105;
  --brand-primary-soft: rgba(var(--brand-primary-rgb), 0.05);
}

.bg-brand-primary { background-color: var(--brand-primary); }
.text-brand-primary { color: var(--brand-primary); }
.bg-brand-secondary { background-color: var(--brand-secondary); }
.text-brand-secondary { color: var(--brand-secondary); }

/* Override layout defaults for the public referral shell */
.page:has(.referral-shell-redesign) .page-main {
  padding-block: 0;
  padding-inline: 0;
  max-inline-size: none;
}

@media (min-width: 480px) {
  .page:has(.referral-shell-redesign) {
    background: #e5ded8;
  }
}

.referral-shell-redesign {
  min-height: 100dvh;
  font-family: var(--font-sans);
}

@media (max-width: 479px) {
  .page:has(.referral-shell-redesign) {
    background: #e5ded8;
  }

  .referral-shell-redesign {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    background-color: #e5ded8;
    background-image:
      url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c2 0 3.5 1.5 3.5 3.5S32 12 30 12s-3.5-1.5-3.5-3.5S28 5 30 5zm-18 8c1.5 0 2.5 1 2.5 2.5S13.5 18 12 18s-2.5-1-2.5-2.5S10.5 13 12 13zm36 0c1.5 0 2.5 1 2.5 2.5S49.5 18 48 18s-2.5-1-2.5-2.5S46.5 13 48 13zM24 28c1 0 2 1 2 2s-1 2-2 2-2-1-2-2 1-2 2-2zm16 0c1 0 2 1 2 2s-1 2-2 2-2-1-2-2 1-2 2-2zM8 36c1.5 0 2.5 1 2.5 2.5S9.5 41 8 41s-2.5-1-2.5-2.5S6.5 36 8 36zm22 6c2 0 3 1.5 3 3s-1 3-3 3-3-1.5-3-3 1-3 3-3zm20-4c1.5 0 2.5 1 2.5 2.5S51.5 43 50 43s-2.5-1-2.5-2.5S48.5 38 50 38z' fill='%23d5cec8' fill-opacity='0.5'/%3E%3C/svg%3E");
  }
}

@media (min-width: 480px) {
  .referral-shell-redesign {
    background-color: #e5ded8;
    background-image:
      url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c2 0 3.5 1.5 3.5 3.5S32 12 30 12s-3.5-1.5-3.5-3.5S28 5 30 5zm-18 8c1.5 0 2.5 1 2.5 2.5S13.5 18 12 18s-2.5-1-2.5-2.5S10.5 13 12 13zm36 0c1.5 0 2.5 1 2.5 2.5S49.5 18 48 18s-2.5-1-2.5-2.5S46.5 13 48 13zM24 28c1 0 2 1 2 2s-1 2-2 2-2-1-2-2 1-2 2-2zm16 0c1 0 2 1 2 2s-1 2-2 2-2-1-2-2 1-2 2-2zM8 36c1.5 0 2.5 1 2.5 2.5S9.5 41 8 41s-2.5-1-2.5-2.5S6.5 36 8 36zm22 6c2 0 3 1.5 3 3s-1 3-3 3-3-1.5-3-3 1-3 3-3zm20-4c1.5 0 2.5 1 2.5 2.5S51.5 43 50 43s-2.5-1-2.5-2.5S48.5 38 50 38z' fill='%23d5cec8' fill-opacity='0.5'/%3E%3C/svg%3E");
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }
}

/* Card container */
.referral-card-redesign {
  background: var(--color-white);
  border-radius: 24px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  max-width: 420px;
  width: 100%;
  margin: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid var(--color-slate-100);
}

@media (min-width: 480px) {
  .referral-shell-redesign .referral-card-redesign {
    border-radius: 24px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    max-width: 420px;
    width: 100%;
    min-height: auto;
    margin: auto;
    border: 1px solid var(--color-slate-100);
  }
}

/* Card Body */
.card-body {
  padding: 1.5rem;
  padding-bottom: 0.75rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 480px) {
  .card-body {
    padding: 2rem;
    padding-bottom: 0.75rem;
  }
}

/* Profile Header — avatar left, info right (Image 1 style) */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-avatar-container {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.profile-avatar--card {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  object-fit: cover;
  background-color: var(--color-slate-50);
  display: block;
  border: 2px solid var(--color-slate-100);
}

@media (min-width: 480px) {
  .profile-avatar--card {
    width: 80px;
    height: 80px;
  }
}

.profile-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--color-emerald-500), var(--color-sky-500));
}

@media (min-width: 480px) {
  .profile-avatar-initials {
    font-size: 1.5rem;
  }
}

.profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.business-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-slate-900);
  line-height: 1.2;
  margin: 0;
}

.business-tagline {
  color: var(--color-slate-500);
  font-size: 0.8125rem;
  line-height: 1.4;
  margin: 0;
}

.business-service-area {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-slate-400);
  font-size: 0.75rem;
  margin: 0.125rem 0 0;
}

@media (min-width: 480px) {
  .business-name {
    font-size: 1.375rem;
  }

  .business-tagline {
    font-size: 0.875rem;
  }
}

.business-service-area--centered {
  justify-content: center;
}

.icon-xs {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.icon-location {
  color: var(--color-red-400);
}

/* Bio */
.card-bio {
  color: var(--color-slate-600);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0;
  text-align: center;
}

/* Featured Review */
.card-featured-review {
  background-color: var(--color-slate-50);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
}

.card-featured-review__stars {
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.card-featured-review__stars .star-filled {
  color: var(--color-amber-400);
}

.card-featured-review__stars .star-empty {
  color: var(--color-slate-200);
}

.card-featured-review__text {
  color: var(--color-slate-600);
  font-size: 0.8125rem;
  font-style: italic;
  line-height: 1.5;
  margin: 0 0 0.375rem;
}

.card-featured-review__author {
  color: var(--color-slate-400);
  font-size: 0.6875rem;
  margin: 0;
}

/* Review selector radio options (forms) */
.review-option {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem;
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.review-option:has(input:checked) {
  border-color: var(--color-emerald-400);
  background-color: var(--color-emerald-50);
}

.review-option input[type="radio"] {
  margin-top: 0.125rem;
  flex-shrink: 0;
}

.review-option__body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.review-option__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-slate-700);
}

.review-option__hint {
  font-size: 0.75rem;
  color: var(--color-slate-400);
}

.review-option__stars {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.review-option__stars .star-filled {
  color: var(--color-amber-400);
}

.review-option__stars .star-empty {
  color: var(--color-slate-200);
}

.review-option__text {
  font-size: 0.75rem;
  color: var(--color-slate-600);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-option__author {
  font-size: 0.6875rem;
  color: var(--color-slate-400);
}

/* Profile Stats */
.profile-stats {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0;
  background-color: var(--color-slate-50);
  border-radius: var(--radius-xl);
  padding: 1rem 0.5rem;
  border: 1px solid var(--color-slate-100);
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
  flex: 1;
  padding: 0 0.5rem;
  border-right: 1px solid var(--color-slate-200);
}

.profile-stat:last-child {
  border-right: none;
}

.profile-stat__value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-slate-800);
  line-height: 1;
  letter-spacing: -0.025em;
}

.profile-stat__label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-slate-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-stats:has(.profile-stat:nth-child(3)) .profile-stat__label {
  font-size: 0.5rem;
}

/* Licensed badge on avatar */
.profile-avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.profile-avatar-badge svg {
  width: 14px;
  height: 14px;
  color: var(--color-emerald-500);
}

@media (min-width: 480px) {
  .profile-stats {
    padding: 1.125rem 0.75rem;
  }

  .profile-stat {
    padding: 0 0.75rem;
  }

  .profile-stat__value {
    font-size: 1.375rem;
  }

  .profile-stat__label {
    font-size: 0.6875rem;
  }
}

/* Services */
.services-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.service-tag {
  background-color: var(--color-slate-100);
  color: var(--color-slate-700);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
}

/* Footer */
.referral-footer-text {
  align-items: center;
  border-top: 1px solid var(--color-slate-100);
  color: var(--color-slate-400);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.75rem;
  gap: 0.25rem;
  justify-content: center;
  margin: 0;
  padding-top: 0.75rem;
}

.referral-footer-text strong {
  color: var(--color-slate-600);
}

.referral-branding-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-slate-400);
  text-decoration: none;
  transition: color 0.15s ease;
}

.referral-branding-link:hover {
  color: var(--color-slate-500);
}

.referral-branding-logo {
  width: 1rem;
  height: 1rem;
}

/* Action Row (horizontal buttons) */
.action-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.action-row--grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.action-row--single {
  display: flex;
}

.action-row--single .btn-action-compact {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
}

.action-row--double {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.action-row--double .btn-action-compact {
  padding: 0.875rem 0.5rem;
  font-size: 0.9375rem;
}

.btn-action-compact {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-decoration: none;
  border: none;
}

.action-row--grid .btn-action-compact {
  flex-direction: column;
  padding: 1rem 0.5rem;
  gap: 0.5rem;
}

.action-row--grid .icon-sm {
  width: 24px;
  height: 24px;
}

.btn-action-compact:active {
  transform: scale(0.97);
}

.btn-action-sms {
  background-color: var(--brand-primary);
  color: white;
  box-shadow: 0 2px 4px -1px rgba(var(--brand-primary-rgb), 0.3);
}

.btn-action-sms:hover {
  background-color: var(--color-emerald-700);
}

.btn-action-whatsapp {
  background-color: #25D366;
  color: white;
  box-shadow: 0 2px 4px -1px rgba(37, 211, 102, 0.3);
}

.btn-action-whatsapp:hover {
  background-color: #128c7e;
}

.btn-action-call {
  background-color: var(--color-slate-800);
  color: white;
  box-shadow: 0 2px 4px -1px rgb(0 0 0 / 0.2);
}

.btn-action-call:hover {
  background-color: var(--color-slate-900);
}

.icon-sm {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.btn-action-whatsapp .icon-sm {
  fill: currentColor;
  stroke: none;
}

/* Editable avatar state */
.profile-avatar-container--editable {
  position: relative;
  cursor: grab;
}

.profile-avatar-container--editable.is-repositioning {
  cursor: grabbing;
}

.profile-avatar-container--editable img {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.profile-avatar-container--editable::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px dashed transparent;
  border-radius: var(--radius-xl);
  pointer-events: none;
  transition: border-color 0.15s ease;
}

.profile-avatar-container--editable:hover::after {
  border-color: var(--color-emerald-500);
}

/* Profile Preview Container (for business dashboard) */
.profile-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--block-space-double);
}

.profile-preview-wrapper {
  max-width: 480px;
  width: 100%;
}

/* Utilities */
.hidden { display: none; }
.sticky { position: sticky; }
.top-4 { top: 1rem; }
