:root {
  --red: #d8262f;
  --red-deep: #b81e26;
  --ink: #111827;
  --muted: #64748b;
  --line: #f3c4c7;
  --ok: #128a3e;
  --shadow: 0 8px 14px -4px rgb(17 24 39 / 0.12);
  font-family: Nunito, sans-serif;
  font-size: 17px;
}

strong, b {
  font-weight: 600;
}

svg.icon-svg {
  width: 1.2em;
  height: 1.2em;
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
  flex: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #e8ecf1;
  color: var(--ink);
}

.chat-shell {
  width: min(100%, 28rem);
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(17 24 39 / 0.06);
  overflow: hidden;
}

.chat-header {
  flex: none;
  background: #fff;
  border-bottom: 3px solid var(--red);
  padding: max(0.35rem, env(safe-area-inset-top)) 0.85rem 0.4rem;
}

.chat-header__inner {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
}

.chat-header img {
  height: 42px;
  width: auto;
  max-width: 220px;
  justify-self: center;
  display: block;
}

.chat-header__close {
  justify-self: end;
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.3);
  background: linear-gradient(135deg, #25D366 0%, #1EBE5D 100%);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.chat-header__close:hover,
.chat-header__close:active {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.24);
}

.chat-header__close svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: none;
}

.chat-header__pulse {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #075E54;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 0 rgb(7 94 84 / 0.7);
  animation: wa-pulse 2.2s infinite;
  flex: none;
}

@keyframes wa-pulse {
  0% { box-shadow: 0 0 0 0 rgb(7 94 84 / 0.75); }
  70% { box-shadow: 0 0 0 6px rgb(7 94 84 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(7 94 84 / 0); }
}

.chat-main {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.stage {
  position: relative;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.watermark {
  pointer-events: none;
  background: url("/brand/icon.png") center / min(42%, 150px) no-repeat;
  opacity: 0.16;
}

.stage--bottom .watermark { flex: 1; min-height: 7.5rem; }
.stage--top .watermark { position: absolute; inset: 0; }

.sheet { padding: 1.15rem 1rem max(1rem, env(safe-area-inset-bottom)); }

.stage--top .sheet {
  position: relative;
  z-index: 1;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.stage--top .sheet:has(.created) {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  overflow-y: auto;
  padding-bottom: 1.75rem;
}

.stage--bottom .sheet { flex: none; padding-top: 0.35rem; }

.intro {
  margin: 0 0 0.75rem;
  font-size: 1.08rem;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-wrap;
}

.intro.err { color: var(--red-deep); }

.menu {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.stage--top .menu { overflow-y: auto; }

.choice {
  width: 100%;
  min-height: 3.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff6f6;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: 1.05rem;
  text-align: left;
  padding: 0.7rem 1rem 0.7rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.choice span.icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}

.choice span.icon svg { width: 1.2rem; height: 1.2rem; display: block; }

.choice span.icon.icon-bg {
  background: #004481;
  border-radius: 0.55rem;
  font-size: 0.68rem;
  letter-spacing: -0.04em;
}

.choice .label { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.choice small { color: var(--muted); font-weight: 700; font-size: 0.78rem; }

.composer { display: flex; gap: 0.55rem; align-items: center; }

.composer input, .gate input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e6edf5;
  background: #fff;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 1rem;
  outline: none;
}

.composer input:focus, .gate input:focus { border-color: var(--red); }

.composer button, .primary, .locate {
  border: 0;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.composer button {
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
}

.composer button svg { width: 1.25rem; height: 1.25rem; }

.primary, .locate {
  width: 100%;
  min-height: 3.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.primary svg,
.locate svg,
.track svg,
.created .primary svg,
.created .track svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  flex: none;
}
.locate { background: #0ea5e9; }

.hint, .err { margin: 0.45rem 0 0; font-size: 0.82rem; }
.hint { color: var(--muted); }
.err { color: var(--red-deep); font-weight: 800; }

.created {
  flex: 1 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  border: 1.5px solid #c8ead4;
  border-radius: 28px;
  padding: 2rem 1.25rem 1.4rem;
  box-shadow: 0 18px 40px rgb(17 24 39 / 0.08);
}

.created h2 { margin: 1rem 0 0.35rem; font-size: 1.55rem; }

.created-mark {
  width: 5.4rem;
  height: 5.4rem;
  border-radius: 999px;
  background: var(--ok);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px #fff, 0 0 0 10px #c8ead4;
  display: grid;
  place-items: center;
}

.created-mark svg { width: 2.6rem; height: 2.6rem; display: block; }
.created .service { margin: 0 0 0.85rem; color: var(--red); font-size: 1.15rem; font-weight: 800; }
.created .case { margin: 0.15rem 0; color: var(--muted); font-weight: 800; }

.created-facts {
  width: 100%;
  margin: 0.85rem 0 0.2rem;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: #f4faf6;
  text-align: left;
}

.created-facts p {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.35rem 0;
  font-size: 0.95rem;
}

.created-facts span { color: var(--muted); font-weight: 400; }
.created-facts strong { font-weight: 600; }
.created-copy { margin: 0.8rem 0 1.1rem; max-width: 22rem; line-height: 1.45; font-weight: 400; }

.created .track {
  width: 100%;
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 2px solid var(--red);
  border-radius: 999px;
  background: #fff;
  color: var(--red);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.created .track + .primary { margin-top: 1.15rem; }
.created .primary + .track { margin-top: 1rem; }

.sheet:has(.created) > .intro { margin: 0.2rem 0 0; }

.sheet:has(.created) > .menu { gap: 0.85rem; }

.guide { width: 100%; border-radius: 18px; display: block; margin-bottom: 0.75rem; }
