:root {
  --primary: #0f766e;
  --primary-dark: #134e4a;
  --accent: #f59e0b;
  --surface: #f6fbf9;
  --ink: #10231f;
  --muted: #667974;
  --line: rgba(15, 118, 110, 0.14);
  --white: #ffffff;
  --danger: #c2410c;
  --shell-width: 560px;
  --shadow: 0 22px 70px rgba(15, 54, 48, 0.18);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #dfeeea; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(15, 118, 110, 0.32), transparent 70%),
    linear-gradient(180deg, #e8f3f0 0%, #d7e9e4 55%, #cce2dc 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--primary); }
[hidden] { display: none !important; }

.visually-hidden {
  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;
}

.app-shell {
  position: relative;
  width: min(100%, var(--shell-width));
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 34% at 50% 0%, rgba(15, 118, 110, 0.12), transparent 66%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, var(--surface) 50%, #f3f8f6 100%);
}

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-avatar {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  box-shadow: 0 7px 18px rgba(15, 118, 110, 0.28);
}
.brand-copy { min-width: 0; }
.brand-copy h1 { margin: 0 0 2px; font-size: 16px; line-height: 1.2; letter-spacing: -0.2px; }
.brand-copy p { margin: 0; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 7px 10px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 999px;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 600;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12); }

.service-banner {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 13px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 0%, rgba(255, 255, 255, 0.12), transparent 34%),
    linear-gradient(100deg, #153b37 0%, #0f5a52 55%, #0f766e 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 230, 173, 0.14), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}
.service-banner-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: #ffe6ad;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.service-banner-icon svg { width: 19px; height: 19px; }
.service-banner-copy { min-width: 0; }
.service-banner-copy strong { display: block; font-size: 12px; font-weight: 700; line-height: 1.5; letter-spacing: 0.15px; }
.service-banner-copy small { display: block; margin-top: 3px; color: rgba(255, 255, 255, 0.76); font-size: 10.5px; line-height: 1.55; letter-spacing: 0.05px; text-wrap: balance; }
.service-banner button {
  padding: 7px 10px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #ffe6ad;
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.18s ease;
}
.service-banner button:hover, .service-banner button:focus-visible { background: rgba(255, 255, 255, 0.13); outline: none; }

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 0;
  scroll-behavior: smooth;
}
.scroll-spacer { height: 18px; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 19px;
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(circle at 94% 5%, rgba(255, 255, 255, 0.2), transparent 32%),
    linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 16px 42px rgba(15, 78, 70, 0.24);
  animation: rise-in 0.5s ease both;
}
.hero::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -52px;
  bottom: -64px;
  border: 22px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  pointer-events: none;
}
.hero-kicker { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 1.1px; opacity: 0.8; }
.hero h2 { position: relative; z-index: 1; margin: 13px 0 9px; font-size: clamp(25px, 6.6vw, 32px); line-height: 1.15; letter-spacing: -1px; }
.hero-welcome { position: relative; z-index: 1; margin: 0; max-width: 390px; color: rgba(255, 255, 255, 0.82); font-size: 14px; line-height: 1.65; }
.suggestions { position: relative; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.suggestion-chip {
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  font-size: 12px;
  line-height: 1.2;
  transition: background 0.18s ease, transform 0.18s ease;
}
.suggestion-chip:hover, .suggestion-chip:focus-visible { background: rgba(255, 255, 255, 0.2); transform: translateY(-1px); outline: none; }
.hero-note { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.13); color: rgba(255, 255, 255, 0.66); font-size: 11px; }
.mini-spark { color: var(--accent); }

.messages { display: flex; flex-direction: column; gap: 16px; padding: 18px 0 4px; }
.message { display: flex; align-items: flex-start; gap: 9px; animation: rise-in 0.28s ease both; }
.message.user { justify-content: flex-end; }
.message-avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  margin-top: 2px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  font-size: 10px;
  font-weight: 800;
}
.bubble {
  max-width: min(82%, 410px);
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.1);
  border-radius: 7px 18px 18px 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(21, 66, 58, 0.07);
  color: #20332f;
  font-size: 14px;
  line-height: 1.72;
  word-break: break-word;
}
.message.user .bubble {
  border: 0;
  border-radius: 18px 7px 18px 18px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.2);
}
.bubble strong { font-weight: 700; color: var(--primary-dark); }
.message.user .bubble strong { color: #fff; }
.bubble.error { border-color: rgba(194, 65, 12, 0.18); color: #9a3412; background: #fff7ed; }
.typing { display: inline-flex; align-items: center; gap: 4px; min-height: 20px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); opacity: 0.32; animation: bounce 1.1s infinite; }
.typing span:nth-child(2) { animation-delay: 0.12s; }
.typing span:nth-child(3) { animation-delay: 0.24s; }

.handoff {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 15px;
  border: 1px solid rgba(15, 118, 110, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 24px rgba(21, 66, 58, 0.06);
  animation: rise-in 0.3s ease both;
}
.handoff strong { font-size: 13px; }
.handoff p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.handoff-actions { display: flex; align-items: center; gap: 9px; flex: none; }
.text-button { padding: 4px 0; border: 0; color: var(--muted); background: transparent; font-size: 11px; white-space: nowrap; }
.small-primary { padding: 9px 12px; border: 0; border-radius: 11px; color: #fff; background: var(--primary); font-size: 11px; font-weight: 700; white-space: nowrap; }

.composer-wrap {
  position: relative;
  z-index: 8;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(246, 251, 249, 0) 0%, rgba(246, 251, 249, 0.96) 30%, #f6fbf9 100%);
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 15px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 34px rgba(21, 66, 58, 0.1);
}
.composer:focus-within { border-color: rgba(15, 118, 110, 0.38); box-shadow: 0 12px 34px rgba(21, 66, 58, 0.1), 0 0 0 3px rgba(15, 118, 110, 0.07); }
.composer textarea {
  width: 100%;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 0 7px;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  line-height: 1.45;
}
.composer textarea::placeholder { color: #96a7a2; }
.send-button {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.24);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.send-button svg { width: 18px; height: 18px; transform: translateX(-1px); }
.send-button:hover { transform: translateY(-1px); }
.send-button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.composer-meta { display: flex; justify-content: space-between; gap: 12px; padding: 7px 5px 0; color: #8a9c96; font-size: 9.5px; }
.composer-meta a { color: #748a84; text-decoration: none; }
.composer-meta a:hover { text-decoration: underline; }

.contact-fab {
  position: fixed;
  z-index: 20;
  right: 18px;
  bottom: calc(112px + env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  box-shadow: 0 12px 30px rgba(15, 78, 70, 0.3);
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.contact-fab:hover { transform: translateY(-2px); }
.fab-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.fab-icon svg { width: 16px; height: 16px; }
body.sheet-open .contact-fab { transform: translateY(120%); opacity: 0; pointer-events: none; }

.sheet-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: rgba(9, 33, 29, 0.46);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.sheet-backdrop.open { opacity: 1; }
.contact-sheet {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 0;
  width: min(100%, var(--shell-width));
  max-height: min(88dvh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 9px 20px max(20px, env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: #fff;
  box-shadow: 0 -24px 70px rgba(9, 33, 29, 0.2);
  transform: translate(-50%, 105%);
  transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.25, 1);
}
.contact-sheet.open { transform: translate(-50%, 0); }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 17px; border-radius: 999px; background: #dce8e4; }
.sheet-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.sheet-heading h2 { margin: 0; font-size: 23px; line-height: 1.25; letter-spacing: -0.5px; }
.icon-button { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 1px solid #e5eeeb; border-radius: 50%; color: #5f746e; background: #f7faf9; }
.icon-button svg { width: 19px; height: 19px; }
.sheet-note { margin: 11px 0 17px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.contact-actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 9px; }
.primary-button, .secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 15px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.primary-button { border: 0; color: #fff; background: linear-gradient(145deg, var(--primary), var(--primary-dark)); box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22); }
.primary-button svg { width: 17px; height: 17px; }
.secondary-button { border: 1px solid rgba(15, 118, 110, 0.18); color: var(--primary-dark); background: #f3faf8; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: 0.55; cursor: wait; transform: none; }
.primary-button.full { width: 100%; }

.lead-wrap { margin-top: 19px; padding-top: 18px; border-top: 1px solid #edf3f1; animation: rise-in 0.25s ease both; }
.lead-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; }
.lead-form label { display: flex; flex-direction: column; gap: 6px; color: #4d625d; font-size: 11px; font-weight: 600; }
.lead-form input, .lead-form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #dfeae7;
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #fbfdfc;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}
.lead-form textarea { resize: vertical; min-height: 78px; }
.lead-form input:focus, .lead-form textarea:focus { border-color: rgba(15, 118, 110, 0.48); background: #fff; box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.07); }
.consent-row { flex-direction: row !important; align-items: flex-start; gap: 8px !important; color: var(--muted) !important; font-size: 10.5px !important; font-weight: 400 !important; line-height: 1.55; }
.consent-row input { width: 16px; height: 16px; margin: 1px 0 0; flex: none; accent-color: var(--primary); }
.form-error { min-height: 0; margin: 0; color: var(--danger); font-size: 11px; line-height: 1.45; }
.form-error:empty { display: none; }
.lead-success { padding-top: 8px; text-align: center; animation: rise-in 0.28s ease both; }
.success-mark { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 11px; border-radius: 50%; color: #fff; background: var(--primary); font-size: 22px; box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22); }
.lead-success h3 { margin: 0 0 5px; font-size: 19px; }
.lead-success p { margin: 0 0 15px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.success-disclosure:empty { display: none; }
.sheet-disclosure { margin: 16px 0 0; padding: 11px 12px; border-radius: 12px; color: #6d7f7a; background: #f7faf9; font-size: 10.5px; line-height: 1.6; }
.sheet-disclosure:empty { display: none; }
.privacy-link { display: inline-block; margin-top: 12px; color: #7c918b; font-size: 10.5px; text-decoration: none; }
.privacy-link:hover { text-decoration: underline; }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 40px);
  padding: 10px 15px;
  border-radius: 999px;
  color: #fff;
  background: rgba(16, 35, 31, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { padding: 20px; color: var(--danger); }

.legal-page { padding: 24px 16px 48px; }
.legal-card { width: min(100%, 720px); margin: 0 auto; padding: clamp(24px, 5vw, 46px); border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.legal-card h1 { margin: 8px 0 18px; font-size: clamp(27px, 5vw, 38px); letter-spacing: -1px; }
.legal-card h2 { margin: 27px 0 8px; font-size: 17px; }
.legal-card p { margin: 0 0 12px; color: #4b5f5a; font-size: 14px; line-height: 1.8; }
.legal-back { display: inline-block; margin-bottom: 18px; color: var(--muted); font-size: 12px; text-decoration: none; }
.legal-updated { margin-top: 30px !important; color: #8a9c96 !important; font-size: 11px !important; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.32; }
  30% { transform: translateY(-4px); opacity: 0.8; }
}

@media (min-width: 600px) {
  body { padding: 16px 0; }
  .app-shell { height: calc(100dvh - 32px); border: 1px solid rgba(255, 255, 255, 0.72); border-radius: 30px; box-shadow: var(--shadow); }
  .contact-sheet { bottom: 16px; border-radius: 26px; }
  .contact-fab { right: calc((100vw - 560px) / 2 + 18px); bottom: calc(122px + 16px); }
}

@media (max-width: 380px) {
  .brand-copy p { max-width: 160px; }
  .status-pill span:last-child { display: none; }
  .status-pill { padding: 10px; }
  .hero { padding: 20px 17px 17px; }
  .handoff { align-items: flex-start; flex-direction: column; }
  .handoff-actions { width: 100%; justify-content: flex-end; }
  .contact-actions { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .service-banner { grid-template-columns: 30px minmax(0, 1fr); }
  .service-banner button { grid-column: 2; justify-self: start; margin-top: 2px; }
}

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