.assistant-page {
  min-height: 76vh;
  background: var(--canvas);
}

.assistant-stage {
  position: relative;
  overflow: hidden;
  padding: 26px 0 48px;
  background:
    radial-gradient(circle at 15% 4%, rgba(184, 95, 60, 0.08), transparent 27%),
    radial-gradient(circle at 88% 12%, rgba(22, 119, 90, 0.09), transparent 30%),
    linear-gradient(180deg, #f7faf7, #f2f6f3);
}

.assistant-stage-inner {
  width: min(1080px, calc(100% - 40px));
}

.assistant-page-heading {
  margin: 0 auto 17px;
  text-align: center;
}

.assistant-page-heading .eyebrow {
  margin-bottom: 8px;
}

.assistant-page-heading .eyebrow span {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(184, 95, 60, 0.12);
  font-size: 0.62rem;
  vertical-align: 1px;
}

.assistant-page-heading h1 {
  max-width: none;
  font-size: clamp(2.5rem, 5vw, 3.65rem);
  letter-spacing: -0.035em;
}

.assistant-page-heading > p:not(.eyebrow):not(.assistant-urdu) {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.assistant-urdu {
  margin: 0;
  color: var(--green-dark);
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  font-size: 0.98rem;
  line-height: 1.9;
  text-align: center;
}

.assistant-shell {
  overflow: hidden;
  min-height: clamp(560px, 68vh, 680px);
  display: grid;
  grid-template-rows: auto minmax(350px, 1fr) auto auto auto;
  border: 1px solid rgba(13, 72, 54, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 30px 80px rgba(13, 72, 54, 0.12), 0 2px 8px rgba(16, 24, 20, 0.04);
}

.assistant-shell-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.assistant-advisor {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.assistant-head-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(13, 72, 54, 0.1);
  border-radius: 13px;
  background: linear-gradient(145deg, #fff, #f2f6f3);
  box-shadow: 0 5px 14px rgba(16, 24, 20, 0.08);
}

.assistant-head-avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.assistant-head-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.assistant-head-copy strong {
  line-height: 1.15;
}

.assistant-head-copy small {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.assistant-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #20a466;
  box-shadow: 0 0 0 3px rgba(32, 164, 102, 0.12);
}

.assistant-advisor-role {
  display: inline-flex;
  gap: 5px;
}

.assistant-new-chat {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(63, 69, 65, 0.16);
  border-radius: 9px;
  background: white;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16, 24, 20, 0.04);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.assistant-new-chat[hidden] {
  display: none;
}

.assistant-new-chat:hover,
.assistant-new-chat:focus-visible {
  border-color: rgba(13, 72, 54, 0.25);
  background: var(--mist);
  color: var(--green-dark);
  box-shadow: 0 3px 9px rgba(16, 24, 20, 0.07);
}

.assistant-new-chat:focus-visible {
  outline: 3px solid rgba(13, 72, 54, 0.12);
  outline-offset: 2px;
}

.assistant-messages {
  overflow-y: auto;
  max-height: 590px;
  padding: 18px 22px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-color: rgba(13, 72, 54, 0.2) transparent;
  scrollbar-width: thin;
}

.assistant-messages:empty {
  min-height: 230px;
}

.assistant-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
}

.assistant-message-animate {
  animation: assistant-message-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.assistant-message-user {
  justify-content: flex-end;
}

.assistant-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(13, 72, 54, 0.1);
  background: white;
  box-shadow: 0 4px 12px rgba(16, 24, 20, 0.08);
}

.assistant-avatar img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.assistant-bubble {
  max-width: min(70%, 640px);
  padding: 13px 16px;
  border: 1px solid rgba(13, 72, 54, 0.07);
  border-radius: 6px 18px 18px 18px;
  background: linear-gradient(145deg, #f0f6f2, #e9f1ec);
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
  box-shadow: 0 6px 18px rgba(16, 24, 20, 0.055);
}

.assistant-bubble p {
  margin: 0;
}

.assistant-bubble p + p {
  margin-top: 6px;
}

.assistant-message-user .assistant-bubble {
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 18px 6px 18px 18px;
  background: linear-gradient(145deg, #155c47, var(--green-dark));
  color: white;
  box-shadow: 0 7px 20px rgba(13, 72, 54, 0.14);
}

.assistant-message-error .assistant-bubble {
  background: #fff0eb;
  color: #7a2f1d;
}

.assistant-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.assistant-error-actions button,
.assistant-error-actions a {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 820;
  text-decoration: underline;
  cursor: pointer;
}

.assistant-inline-results {
  margin: 2px 0 20px 42px;
}

.assistant-inline-results-label {
  margin: 0 0 12px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 820;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.assistant-product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.assistant-product-card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 7px 20px rgba(16, 24, 20, 0.05);
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.assistant-product-card:hover,
.assistant-product-card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(184, 95, 60, 0.38);
  box-shadow: 0 13px 30px rgba(16, 24, 20, 0.1);
}

.assistant-product-card a {
  display: block;
  height: 100%;
}

.assistant-product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  background: var(--sage);
}

.assistant-product-image.is-fallback {
  padding: 16px;
  object-fit: contain;
  background: var(--mist);
}

.assistant-product-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 132px;
  padding: 12px 13px 13px;
}

.assistant-product-type {
  color: #a44f30;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.assistant-product-card h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 0;
  font-size: 1rem;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.assistant-product-meta {
  overflow: hidden;
  max-width: 100%;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-product-price {
  margin-top: 8px;
  color: var(--green-dark);
  font-size: 0.82rem;
}

.assistant-product-price small {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 650;
}

.assistant-discount {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #e7f6ed;
  color: #117044;
  font-size: 0.61rem;
}

.assistant-product-action {
  margin-top: auto;
  padding-top: 7px;
  color: #a44f30;
  font-size: 0.71rem;
  font-weight: 820;
}

.assistant-products-reveal {
  display: block;
  margin: 14px auto 0;
  padding: 9px 14px;
  border: 1px solid rgba(184, 95, 60, 0.34);
  border-radius: 999px;
  background: transparent;
  color: #98492d;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.assistant-products-reveal:hover,
.assistant-products-reveal:focus-visible {
  background: rgba(184, 95, 60, 0.08);
  border-color: #b85f3c;
}

.assistant-live-status {
  align-items: center;
  gap: 10px;
  padding: 0 22px 14px;
  color: var(--muted);
  font-size: 0.73rem;
}

.assistant-live-status:not([hidden]) {
  display: flex;
}

.assistant-typing-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(13, 72, 54, 0.09);
  border-radius: 10px;
  background: white;
  box-shadow: 0 4px 12px rgba(16, 24, 20, 0.07);
}

.assistant-typing-avatar img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.assistant-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid rgba(13, 72, 54, 0.07);
  border-radius: 5px 14px 14px 14px;
  background: var(--mist);
  box-shadow: 0 5px 15px rgba(16, 24, 20, 0.045);
}

.assistant-typing-bubble strong {
  font-weight: 700;
}

.assistant-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.assistant-typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: assistant-pulse 900ms infinite alternate;
}

.assistant-typing-dots i:nth-child(2) { animation-delay: 180ms; }
.assistant-typing-dots i:nth-child(3) { animation-delay: 360ms; }

@keyframes assistant-pulse {
  to { opacity: 0.25; transform: translateY(-3px); }
}

@keyframes assistant-message-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: end;
  gap: 8px;
  margin: 0 16px;
  padding: 6px;
  border: 1px solid rgba(63, 69, 65, 0.2);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fcfdfc);
  box-shadow: 0 10px 30px rgba(16, 24, 20, 0.075), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.assistant-form:focus-within {
  border-color: rgba(184, 95, 60, 0.62);
  box-shadow: 0 0 0 3px rgba(184, 95, 60, 0.1), 0 14px 34px rgba(16, 24, 20, 0.1);
  transform: translateY(-1px);
}

.assistant-form textarea {
  width: 100%;
  max-height: 128px;
  min-height: 46px;
  resize: none;
  padding: 11px 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
}

.assistant-form button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: #d6b5a8;
  color: white;
  box-shadow: none;
  cursor: default;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.assistant-form.has-text button {
  background: linear-gradient(145deg, #c66d49, #a84f31);
  box-shadow: 0 6px 15px rgba(168, 79, 49, 0.24);
  cursor: pointer;
}

.assistant-form.has-text button:hover:not(:disabled) {
  background: linear-gradient(145deg, #b85f3c, #98492d);
  transform: translateY(-1px);
}

.assistant-form button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.assistant-form-notes {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 7px 18px 12px;
  color: var(--muted);
  font-size: 0.67rem;
}

.assistant-form-notes span:last-child {
  text-align: right;
}

@media (max-width: 700px) {
  .assistant-stage {
    padding: 32px 0 46px;
  }

  .assistant-stage-inner {
    width: min(100% - 24px, 1080px);
  }

  .assistant-page-heading {
    margin-bottom: 20px;
  }

  .assistant-page-heading h1 {
    font-size: 2.55rem;
  }

  .assistant-shell {
    min-height: clamp(470px, calc(100dvh - 350px), 560px);
    grid-template-rows: auto minmax(230px, 1fr) auto auto auto;
    border-radius: 14px;
  }

  .assistant-shell-head {
    gap: 10px;
    padding-left: 14px;
    padding-right: 12px;
  }

  .assistant-advisor-role {
    display: none;
  }

  .assistant-new-chat {
    min-height: 36px;
    padding: 8px 10px;
  }

  .assistant-messages {
    max-height: 570px;
    padding: 16px 12px;
  }

  .assistant-bubble {
    max-width: 87%;
  }

  .assistant-inline-results {
    margin-left: 42px;
  }

  .assistant-product-grid {
    grid-template-columns: 1fr;
  }

  .assistant-product-card a {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .assistant-product-image {
    width: 128px;
    height: 100%;
    min-height: 172px;
    aspect-ratio: auto;
  }

  .assistant-product-content {
    min-height: 172px;
  }

  .assistant-form {
    position: sticky;
    bottom: 8px;
    z-index: 2;
    margin-left: 10px;
    margin-right: 10px;
  }

  .assistant-form-notes {
    display: grid;
    gap: 3px;
    text-align: center;
  }

  .assistant-form-notes span:last-child {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-typing-dots i {
    animation: none;
  }

  .assistant-message-animate {
    animation: none;
  }

  .assistant-product-card,
  .assistant-form,
  .assistant-form button,
  .assistant-new-chat {
    transition: none;
  }
}
