*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink:       #1A1A1A;
  --paper:     #FDF9F6;
  --mist:      #EDE8E2;
  --slate:     #6B6860;
  --warm:      #ee6e6a;
  --warm-h:    #A8472C;
  --pulse:     #3A8C6E;
  --alert-bg:  #FFF4F0;
  --alert-bdr: #F5C4B5;
  --ocean:     #5ce1e6;
  --sky:       #5ce1e6;
  --fire:      #ee6e6a;
  --water:     #5ce1e6;
  --radius:    14px;
}
html, body { height: 100%; font-family: 'DM Sans', sans-serif; background: var(--paper); color: var(--ink); }
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }

/* Header */
header { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px; border-bottom: 1px solid var(--mist); background: var(--sky); position: sticky; top: 0; z-index: 10; }
.logo-wrap { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-wrap img { height: 60px; width: auto; display: block; }
.logo-text { display: flex; flex-direction: column; }
.logo-text .name { font-family: 'DM Serif Display', serif; font-size: 1.1rem; color: var(--fire); letter-spacing: -0.01em; line-height: 1.2; }
.logo-text .tagline { font-size: 0.68rem; color: var(--paper); font-weight: 400; letter-spacing: 0.02em; }
.status-pill { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 500; color: var(--slate); background: var(--paper); padding: 6px 14px; border-radius: 99px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pulse); animation: ping 2s ease-in-out infinite; }
@keyframes ping { 0%, 100% { box-shadow: 0 0 0 0 rgba(58,140,110,0.5); } 50% { box-shadow: 0 0 0 5px rgba(58,140,110,0); } }

/* Main */
main { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 52px 24px 48px; text-align: center; }
.eyebrow { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--warm); margin-bottom: 14px; }
h1 { font-family: 'DM Serif Display', serif; font-size: clamp(1.8rem, 4.5vw, 2.9rem); line-height: 1.1; letter-spacing: -0.025em; max-width: 580px; margin-bottom: 28px; color: var(--ink); }
.welcome-card { background: #fff; border: 1px solid var(--mist); border-radius: var(--radius); padding: 28px 32px; max-width: 560px; width: 100%; text-align: left; margin-bottom: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.welcome-card p { font-size: 0.97rem; line-height: 1.75; color: #3A3632; }
.welcome-card .care-label { font-weight: 600; color: var(--warm); }
.alert-bar { display: flex; align-items: flex-start; gap: 12px; background: var(--alert-bg); border: 1px solid var(--alert-bdr); border-radius: var(--radius); padding: 16px 20px; max-width: 560px; width: 100%; margin-bottom: 32px; text-align: left; }
.alert-icon { flex-shrink: 0; width: 22px; height: 22px; color: var(--warm); margin-top: 1px; }
.alert-bar p { font-size: 0.85rem; line-height: 1.6; color: #7A3020; }
.alert-bar strong { font-weight: 600; }
.cta-btn { display: inline-flex; align-items: center; gap: 9px; background: var(--warm); color: #fff; font-family: 'DM Sans', sans-serif; font-size: 0.95rem; font-weight: 600; padding: 15px 30px; border-radius: var(--radius); border: none; cursor: pointer; transition: background 0.18s, transform 0.12s; text-decoration: none; }
.cta-btn:hover { background: var(--warm-h); transform: translateY(-1px); }
.cta-btn:active { transform: translateY(0); }
.btn-container { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 32px; width: 100%; }
.btn-container .cta-btn { width: 100%; max-width: 320px; justify-content: center; }
.cta-call { margin-top: 12px; }
@media (min-width: 480px) {
  .cta-call { margin-top: 0; margin-left: 12px; }
}
.features { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 52px; max-width: 700px; }
.card { background: #fff; border: 1px solid var(--mist); border-radius: var(--radius); padding: 20px 22px; flex: 1 1 190px; max-width: 220px; text-align: left; }
.card-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--paper); display: grid; place-items: center; margin-bottom: 12px; color: var(--warm); }
.card h3 { font-size: 0.88rem; font-weight: 600; margin-bottom: 5px; }
.card p { font-size: 0.8rem; color: var(--slate); line-height: 1.55; }

/* Footer */
footer { padding: 18px 32px; border-top: 1px solid var(--ocean); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 0.76rem; color: var(--paper); background: var(--sky); }
footer a { color: var(--paper); text-decoration: none; }
footer a:hover { color: var(--paper); }

/* ── Modern PWA Install Prompt ─────────────────────────────────────── */
#install-prompt {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  padding: 0 16px 16px;
  pointer-events: none;
}
#install-prompt.visible { display: flex; justify-content: center; }
.install-prompt-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
  padding: 20px 22px 22px;
  width: 100%;
  max-width: 400px;
  pointer-events: auto;
  transform: translateY(120%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
#install-prompt.visible .install-prompt-card {
  transform: translateY(0);
}
.install-prompt-card::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px;
  background: #e5e5e5;
  border-radius: 2px;
}
.install-prompt-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-top: 6px;
}
.install-prompt-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.install-prompt-icon img { width: 100%; height: 100%; object-fit: cover; }
.install-prompt-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 3px;
}
.install-prompt-subtitle {
  font-size: 0.8rem;
  color: var(--slate);
  line-height: 1.4;
}
.install-prompt-actions {
  display: flex;
  gap: 10px;
}
.install-prompt-actions button {
  flex: 1;
  padding: 13px 0;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.install-prompt-btn-install {
  background: var(--warm);
  color: #fff;
}
.install-prompt-btn-install:hover { background: var(--warm-h); }
.install-prompt-btn-install:active { transform: scale(0.97); }
.install-prompt-btn-dismiss {
  background: #f5f5f5;
  color: var(--slate);
}
.install-prompt-btn-dismiss:hover { background: #eaeaea; }
.install-prompt-btn-dismiss:active { transform: scale(0.97); }

/* iOS Instructions Sheet */
#ios-sheet {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10000;
  align-items: flex-end;
  justify-content: center;
}
#ios-sheet.visible { display: flex; }
.ios-sheet-inner {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.25s ease;
}
.ios-sheet-inner h3 { font-family: 'DM Serif Display', serif; font-size: 1.2rem; color: var(--ink); margin-bottom: 8px; }
.ios-sheet-inner p { font-size: 0.85rem; color: var(--slate); line-height: 1.6; margin-bottom: 18px; }
.ios-steps { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.ios-steps li { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; color: #3A3632; }
.ios-step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--warm); color: #fff; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.ios-close-btn { width: 100%; padding: 13px; background: var(--paper); border: 1px solid var(--mist); border-radius: var(--radius); font-size: 0.88rem; font-weight: 600; color: var(--ink); cursor: pointer; font-family: 'DM Sans', sans-serif; }

@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.btn-call { width:100%; display:flex; align-items:center; justify-content:center; gap:10px; }

/* ── Chat bottom sheet (replaces 3rd-party floating widget) ───────── */
#chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#chat-overlay.visible { opacity: 1; pointer-events: auto; }

#chat-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9991;
  height: 88vh;
  max-height: 880px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
#chat-sheet.visible { transform: translateY(0); }

.chat-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  flex-shrink: 0;
  cursor: grab;
}
.chat-sheet-handle span {
  width: 36px; height: 4px;
  background: var(--mist);
  border-radius: 2px;
}

.chat-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 12px;
  border-bottom: 1px solid var(--mist);
  flex-shrink: 0;
}
.chat-sheet-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  color: var(--ink);
}
.chat-sheet-title .status-dot { background: var(--pulse); }
.chat-sheet-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--paper);
  color: var(--slate);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-sheet-close:hover { background: var(--mist); }

.chat-sheet-body {
  flex: 1;
  position: relative;
  background: var(--paper);
  overflow: hidden;
}
.chat-sheet-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.chat-sheet-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--paper);
}
.chat-sheet-spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--mist);
  border-top-color: var(--warm);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.chat-sheet-loading p { font-size: 0.85rem; color: var(--slate); }

.chat-sheet-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  background: var(--paper);
}
.chat-sheet-fallback.visible { display: flex; }
.chat-sheet-fallback p { font-size: 0.88rem; color: var(--slate); line-height: 1.6; max-width: 360px; }
.chat-sheet-fallback .cta-btn { padding: 13px 26px; font-size: 0.9rem; }

@media (min-width: 640px) {
  #chat-sheet {
    left: 50%;
    right: auto;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: 480px;
    border-radius: 20px 20px 0 0;
  }
  #chat-sheet.visible { transform: translate(-50%, 0); }
}

@media (max-width: 520px) {
  header { padding: 12px 16px; }
  main { padding: 36px 16px 32px; }
  footer { padding: 14px 16px; }
  .logo-wrap img { height: 46px; }
  .welcome-card { padding: 20px 18px; }
  .card { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
  .cta-btn, #install-prompt, .install-prompt-card, .ios-sheet-inner { transition: none; animation: none; }
  #chat-overlay, #chat-sheet, .chat-sheet-spinner { transition: none; animation: none; }
}
