:root {
  color-scheme: light;
  --page: #edf5f2;
  --page-accent: #d8eee8;
  --surface: #ffffff;
  --surface-subtle: #f5f8f7;
  --surface-raised: #ffffff;
  --text: #10201b;
  --text-soft: #344b43;
  --muted: #60716b;
  --line: #d8e4df;
  --line-strong: #bfd2ca;
  --brand: #0f766e;
  --brand-strong: #095e58;
  --brand-soft: #dff3ef;
  --brand-softer: #eff9f6;
  --success: #067647;
  --warning: #b54708;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --focus: #1d4ed8;
  --shadow: 0 28px 80px rgba(21, 54, 44, 0.14);
  --shadow-small: 0 8px 24px rgba(21, 54, 44, 0.09);
  --radius-small: 10px;
  --radius: 16px;
  --radius-large: 24px;
  font-family:
    "Segoe UI", Tahoma, Arial, "Noto Sans Arabic", ui-sans-serif, system-ui, sans-serif;
}

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

html {
  min-height: 100%;
}

html[lang="en"] body {
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 88% 8%, rgba(15, 118, 110, 0.13), transparent 32rem),
    radial-gradient(circle at 8% 92%, rgba(14, 165, 151, 0.09), transparent 28rem),
    var(--page);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.dialog-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button,
summary {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-small);
  background: var(--text);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.chat-panel {
  width: min(1040px, 100%);
  height: min(860px, calc(100dvh - 40px));
  min-height: min(620px, calc(100dvh - 40px));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid rgba(191, 210, 202, 0.9);
  border-radius: var(--radius-large);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.chat-header {
  min-height: 82px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-block-end: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.welcome-mark {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
  font-weight: 800;
  direction: ltr;
  user-select: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 20px;
}

.eyebrow,
.welcome-eyebrow {
  margin: 0 0 2px;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

h1,
h2,
p {
  margin-block-start: 0;
}

h1 {
  margin-block-end: 0;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.35;
}

h2 {
  margin-block-end: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.45;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

#languageButton {
  min-width: 54px;
  min-height: 42px;
  padding-inline: 14px;
  border-radius: 999px;
  font-weight: 800;
}

#languageButtonText {
  unicode-bidi: isolate;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #98a7a1;
  box-shadow: 0 0 0 4px rgba(152, 167, 161, 0.14);
}

.connection-status[data-state="online"] {
  color: var(--success);
}

.connection-status[data-state="online"] .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(6, 118, 71, 0.12);
}

.connection-status[data-state="offline"] {
  color: var(--danger);
}

.connection-status[data-state="offline"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.11);
}

.connection-status[data-state="checking"] .status-dot {
  animation: status-pulse 1.5s ease-in-out infinite;
}

.button,
.icon-button,
.prompt-chip,
.message-action,
.retry-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.button:hover:not(:disabled) {
  background: var(--brand-strong);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.18);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.button-quiet {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 700;
}

.button-quiet:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
  color: var(--text);
  box-shadow: none;
}

.button-secondary {
  border: 1px solid rgba(15, 118, 110, 0.24);
  background: var(--brand-softer);
  color: var(--brand-strong);
}

.button-secondary:hover:not(:disabled) {
  background: var(--brand-soft);
  color: var(--brand-strong);
  box-shadow: none;
}

.conversation {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  background:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.78)),
    radial-gradient(circle at 50% 15%, var(--brand-softer), transparent 28rem);
}

.welcome {
  min-height: 100%;
  padding: 5px 24px 20px;
  display: grid;
  align-items: start;
  justify-items: center;
}

.welcome-content {
  width: min(680px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 0;
}

.welcome-mark {
  width: 66px;
  height: 66px;
  margin-block-end: 18px;
  border-radius: 21px;
  font-size: 1.2rem;
}

.welcome-description {
  max-width: 610px;
  margin: 12px auto 0;
  color: var(--text-soft);
  font-size: clamp(0.96rem, 2vw, 1.06rem);
  line-height: 1.85;
}

.prompt-list {
  width: 100%;
  margin-block-start: 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.prompt-chip {
  min-height: 54px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: 0 3px 12px rgba(20, 52, 43, 0.04);
  font-weight: 700;
  line-height: 1.55;
  text-align: start;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.prompt-chip:hover {
  border-color: rgba(15, 118, 110, 0.42);
  background: var(--brand-softer);
  color: var(--brand-strong);
  transform: translateY(-1px);
}

.welcome-cta {
  margin-block-start: 14px;
}

.messages {
  min-height: 100%;
  padding: clamp(18px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message-row {
  width: fit-content;
  max-width: min(84%, 760px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.message-row.assistant {
  align-self: flex-start;
}

.message-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 900;
  direction: ltr;
  user-select: none;
}

.message-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.message-row.user .message-stack {
  align-items: flex-end;
}

.message-bubble {
  min-width: 48px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 6px 18px 18px 18px;
  background: var(--surface-raised);
  box-shadow: 0 4px 14px rgba(20, 52, 43, 0.05);
  color: var(--text);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.message-row.user .message-bubble {
  border-color: var(--brand);
  border-radius: 18px 6px 18px 18px;
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.16);
}

.message-bubble p {
  margin-block-end: 0;
  white-space: pre-wrap;
  unicode-bidi: plaintext;
  text-align: start;
}

.message-bubble p + p,
.message-bubble p + ul,
.message-bubble p + ol,
.message-bubble ul + p,
.message-bubble ol + p {
  margin-block-start: 10px;
}

.message-bubble ul,
.message-bubble ol {
  margin: 8px 0 0;
  padding-inline-start: 24px;
}

.message-bubble li {
  margin-block: 4px;
  unicode-bidi: plaintext;
  text-align: start;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.message-action,
.retry-button {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.message-action:hover,
.retry-button:hover {
  background: var(--surface-subtle);
  color: var(--brand-strong);
}

.sources {
  width: min(100%, 640px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-subtle);
}

.sources summary {
  min-height: 42px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
  list-style: none;
}

.sources summary::-webkit-details-marker {
  display: none;
}

.sources summary::after {
  content: "+";
  color: var(--brand);
  font-size: 1.05rem;
}

.sources[open] summary::after {
  content: "−";
}

.sources-count {
  margin-inline-start: auto;
  color: var(--muted);
  font-weight: 600;
}

.source-list {
  margin: 0;
  padding: 0 16px 14px;
  display: grid;
  gap: 9px;
  list-style: none;
}

.source-item {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.source-heading {
  display: block;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.55;
  unicode-bidi: plaintext;
}

.source-file {
  display: block;
  margin-block-start: 2px;
  color: var(--brand-strong);
  font-size: 0.72rem;
  unicode-bidi: plaintext;
}

.source-preview {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
  unicode-bidi: plaintext;
}

.lead-cta {
  width: min(100%, 640px);
  padding: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 13px;
  background: var(--brand-softer);
}

.lead-cta p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.6;
}

.lead-cta .button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

.typing-bubble {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--brand);
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dot:nth-child(3) {
  animation-delay: 240ms;
}

.message-row.error {
  align-self: flex-start;
}

.error-card {
  padding: 13px 15px;
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 14px;
  background: var(--danger-soft);
  color: #7a271a;
}

.error-title {
  margin: 0 0 3px;
  font-weight: 900;
}

.error-description {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
}

.retry-button {
  margin-block-start: 8px;
  border: 1px solid rgba(180, 35, 24, 0.2);
  background: #ffffff;
  color: var(--danger);
}

.composer-area {
  position: relative;
  z-index: 10;

  padding: 13px 18px 10px;
  border-block-start: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.composer-input-wrap {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.composer-input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

#messageInput {
  width: 100%;
  min-height: 50px;
  max-height: 144px;
  margin: 0;
  padding: 13px 15px;
  overflow-y: hidden;
  resize: none;
  border: 0;
  outline: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--text);
  line-height: 1.6;
  unicode-bidi: plaintext;
  text-align: start;
}

#messageInput::placeholder {
  color: #7b8b85;
}

.send-button {
  min-width: 88px;
  min-height: 52px;
  align-self: flex-end;
}

.send-button[data-loading="true"] {
  cursor: wait;
}

.composer-meta {
  min-height: 19px;
  margin-block-start: 5px;
  padding-inline: 3px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.71rem;
}

.composer-meta p {
  margin: 0;
}

#characterCount[data-near-limit="true"] {
  color: var(--warning);
  font-weight: 700;
}

.lead-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: min(90dvh, 820px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(10, 39, 31, 0.28);
}

.lead-dialog::backdrop {
  background: rgba(12, 28, 23, 0.55);
  backdrop-filter: blur(3px);
}

.dialog-card {
  max-height: min(90dvh, 820px);
  overflow-y: auto;
}

.dialog-header {
  position: sticky;
  z-index: 2;
  inset-block-start: 0;
  padding: 20px 22px 17px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-block-end: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.dialog-header h2 {
  font-size: 1.35rem;
}

.dialog-header p:last-child {
  max-width: 590px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  font-size: 1.65rem;
  line-height: 1;
}

.icon-button:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.lead-form {
  padding: 20px 22px 22px;
  display: grid;
  gap: 17px;
}

#leadIdentityFields {
  order: 1;
}

#appointmentFields {
  order: 2;
}

#contactFields {
  order: 3;
}

#leadDetailsField {
  order: 4;
}

#leadConsentRow {
  order: 5;
}

#leadStatus {
  order: 6;
}

.lead-form > .dialog-actions {
  order: 7;
}

.request-mode {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-subtle);
}

.request-mode button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.request-mode button.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-small);
}

.booking-progress {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
}

.booking-progress li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.booking-progress li + li::before {
  content: "";
  position: absolute;
  inset-inline-end: calc(100% + 10px);
  width: calc(100% - 52px);
  height: 2px;
  background: var(--line);
}

.booking-progress li > span {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 850;
}

.booking-progress li div {
  display: grid;
}

.booking-progress strong {
  font-size: 0.76rem;
}

.booking-progress small {
  font-size: 0.64rem;
}

.booking-progress li.is-active,
.booking-progress li.is-complete {
  color: var(--brand);
}

.booking-progress li.is-active > span,
.booking-progress li.is-complete > span {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.booking-step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

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

.field {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.field label,
.contact-fields legend {
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.55;
  unicode-bidi: plaintext;
  text-align: start;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #84928d;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.appointment-fields {
  padding: 16px;
  display: grid;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--brand-softer);
}

.appointment-section-heading,
.appointment-times-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.appointment-section-heading h3,
.appointment-section-heading p {
  margin: 0;
}

.appointment-section-heading h3 {
  color: var(--text);
  font-size: 0.96rem;
}

.appointment-section-heading p,
.appointment-times-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
}

.appointment-section-heading > span {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  direction: ltr;
  font-size: 0.7rem;
  font-weight: 800;
}

.appointment-date-field {
  grid-column: 1 / -1;
}

.appointment-times-wrap {
  display: grid;
  gap: 10px;
}

.appointment-times-header strong {
  font-size: 0.82rem;
}

.appointment-times {
  min-height: 46px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.appointment-time {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  direction: ltr;
  font-weight: 800;
}

.appointment-time:hover,
.appointment-time.is-selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.appointment-times-state {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.77rem;
  text-align: center;
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
}

.contact-fields {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.contact-fields legend {
  padding-inline: 5px;
}

.field-help {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

.field-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.6;
}

.consent-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--brand);
}

.form-status {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-status[data-state="error"] {
  color: var(--danger);
}

.form-status[data-state="success"] {
  color: var(--success);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  z-index: 120;
  inset-inline-start: 50%;
  inset-block-end: max(20px, env(safe-area-inset-bottom));
  max-width: min(460px, calc(100% - 32px));
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--text);
  color: #ffffff;
  box-shadow: var(--shadow-small);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%);
}

html[dir="rtl"] .toast {
  transform: translateX(50%);
}

@keyframes status-pulse {
  50% {
    opacity: 0.4;
    transform: scale(0.78);
  }
}

@keyframes typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0;
  }

  .chat-panel {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .chat-header {
    min-height: 72px;
    padding:
      max(10px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      10px
      max(14px, env(safe-area-inset-left));
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 1rem;
  }

  .eyebrow {
    font-size: 0.7rem;
  }

  h1 {
    font-size: 1rem;
  }

  .connection-status {
    font-size: 0.72rem;
  }

  .header-actions {
    gap: 8px;
  }

  #languageButton {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding-inline: 0;
    font-size: 0.74rem;
  }

  #newChatButton {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.76rem;
  }

  .welcome {
    padding: 28px 18px;
  }

  .prompt-list {
    grid-template-columns: 1fr;
  }

  .prompt-chip {
    min-height: 48px;
  }

  .messages {
    padding: 18px 14px;
  }

  .message-row {
    max-width: 94%;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .message-bubble {
    padding: 11px 13px;
    font-size: 0.94rem;
  }

  .lead-cta {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer-area {
    padding: 9px 10px 6px;
  }

  .send-button {
    min-width: 72px;
    padding-inline: 12px;
  }

  .composer-meta {
    font-size: 0.65rem;
  }

  .lead-dialog {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin-block-end: 0;
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }

  .dialog-card {
    max-height: 92dvh;
  }

  .dialog-header,
  .lead-form {
    padding-inline: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .appointment-date-field {
    grid-column: auto;
  }

  .appointment-times {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .appointment-times {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #statusText {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .composer-meta p {
    display: none;
  }

  .composer-meta {
    justify-content: flex-end;
  }
}

@media (max-width: 380px) {
  #newChatButton {
    width: 40px;
    min-width: 40px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  #newChatButton::before {
    content: "+";
    color: var(--text-soft);
    font-size: 1.35rem;
    line-height: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .brand-mark,
  .welcome-mark,
  .message-row.user .message-bubble {
    border: 1px solid ButtonText;
  }

  .status-dot,
  .typing-dot {
    forced-color-adjust: none;
  }
}


/* ===== Accordev stable chat layout ===== */
.composer-area {
  position: relative;
  inset: auto;
  width: auto;
  margin: 0;
}

.conversation {
  min-height: 0;
  overflow-y: auto;
}
