:root {
  --bg: #fafaf8;
  --bg-page: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f6f3ec;
  --sidebar-bg: #16201f;
  --sidebar: #16201f;
  --sidebar-fg: #f2f2ee;
  --sidebar-mute: #9c9a8c;
  --sidebar-mute-soft: #7c7a6e;
  --sidebar-muted: #9c9a8c;
  --sidebar-line: rgb(255 255 255 / 0.07);
  --sidebar-hover: rgb(255 255 255 / 0.05);
  --sidebar-active: rgb(255 255 255 / 0.09);
  --ink: #16201f;
  --ink-soft: #454b47;
  --ink-muted: #6b6a5e;
  --ink-mute: #8b897c;
  --ink-faint: #9c9a8c;
  --line: #e4e4dc;
  --line-soft: #ecece5;
  --primary: #145c3f;
  --primary-deep: #0f4630;
  --primary-wash: #e1efe6;
  --primary-tint: #c5ddcf;
  --success: #2e7d4f;
  --success-wash: #e3f1e8;
  --success-dot: #2e9966;
  --warn: #b77b1f;
  --warn-wash: #faf0dd;
  --warn-dot: #d17a1f;
  --danger: #b3403a;
  --danger-wash: #fbe9e7;
  --danger-dot: #c8463f;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, "Iowan Old Style", serif;
  --serif: var(--font-display);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  padding-bottom: 42px;
}

a {
  color: var(--primary);
}

.tool-footer {
  position: fixed;
  left: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100vw - 20px);
  border-radius: 6px;
  padding: 5px 7px;
  background: rgb(251 249 244 / 0.88);
  color: var(--ink-muted);
  font-size: 0.68rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tool-footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

button {
  font: inherit;
}

input,
select,
textarea {
  font-family: var(--font);
  font-size: inherit;
  font-weight: 400;
  line-height: 1.45;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 52px;
  height: 40px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.site-header-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.lang-switch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0;
}

.lang-switch-option {
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--ink-muted);
  font-size: 0.74rem;
  line-height: 1;
  text-decoration: none;
}

.lang-switch-option:hover {
  color: var(--ink);
}

.lang-switch-option:focus-visible {
  outline: 2px solid var(--primary-wash);
  outline-offset: 1px;
  color: var(--ink);
}

.lang-switch-option:not(:last-child)::after {
  margin: 0 2px;
  color: var(--line);
  content: "|";
}

.lang-switch-option.is-active,
.lang-switch-option[aria-current] {
  background: var(--primary-wash);
  color: var(--primary);
  font-weight: 700;
}

.main-content {
  width: 100%;
  flex: 1;
  padding: 24px 18px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 13px 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-muted);
  font-size: 0.76rem;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.18;
}

h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.lead {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
}

textarea:focus {
  border-color: var(--primary);
  outline: 3px solid var(--primary-wash);
}

.form-hint,
.chat-hint,
.soft-note {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.button,
.link-button,
.send-button {
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgb(26 31 44 / 0.06);
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.button:hover,
.button:focus-visible {
  outline: 0;
  text-decoration: none;
}

.button-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px rgb(20 92 63 / 0.18);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--primary-deep);
  box-shadow: 0 12px 26px rgb(20 92 63 / 0.24);
  color: #fff;
}

.button:focus-visible {
  outline: 3px solid var(--primary-tint);
  outline-offset: 2px;
}

.button:disabled,
.button[aria-disabled="true"],
.button-primary:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: var(--line);
  color: var(--ink-muted);
  box-shadow: none;
  transform: none;
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: var(--primary-tint);
  background: var(--primary-wash);
  color: var(--primary);
  box-shadow: 0 8px 18px rgb(26 31 44 / 0.08);
}

.button-small {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 0.82rem;
  line-height: 1.15;
}

.button-danger {
  border-color: #e8c7c2;
  background: var(--surface);
  color: var(--danger);
}

.button-danger:hover,
.button-danger:focus-visible {
  border-color: #d9a6a0;
  background: var(--danger-wash);
  color: var(--danger);
}

.button-primary.button-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 22px rgb(168 47 47 / 0.16);
}

.button-primary.button-danger:hover,
.button-primary.button-danger:focus-visible {
  border-color: #862626;
  background: #862626;
  color: #fff;
  box-shadow: 0 12px 26px rgb(168 47 47 / 0.22);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
  border: 1px solid var(--primary-tint);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--primary-wash);
  color: var(--ink-soft);
  line-height: 1.45;
}

.notice h2,
.notice p {
  margin: 0;
}

.notice-icon {
  width: 22px;
  height: 22px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: inherit;
  font-weight: 800;
}

.notice-error {
  border-color: #e8c7c2;
  background: var(--danger-wash);
  color: var(--danger);
}

.notice-success {
  border-color: #c7e0cf;
  background: var(--success-wash);
  color: var(--success);
}

@font-face {
  font-family: "Participant Inter";
  src: url("./fonts/inter-variable-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Participant Fraunces";
  src: url("./fonts/fraunces-variable-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

body:not(.admin-page) {
  --bg: #fafaf8;
  --paper: #fafaf8;
  --surface: #fafaf8;
  --ink: #16201f;
  --ink-soft: #343f3c;
  --ink-muted: #6b6a5e;
  --ink-faint: #8d8d80;
  --line: #e4e4dc;
  --line-soft: #ecece5;
  --primary: #145c3f;
  --primary-deep: #0f4630;
  --primary-wash: #e1efe6;
  --primary-tint: #c5ddcf;
  --accent: #b34a5d;
  --accent-brand: #145c3f;
  --reply: #eaf2ec;
  --reply-line: #d1e2d6;
  --success: #2e7d4f;
  --success-wash: #e3f1e8;
  --warn: #b77b1f;
  --warn-wash: #faf0dd;
  --danger: #b3403a;
  --danger-wash: #fbe9e7;
  --font: "Participant Inter", Inter, system-ui, -apple-system, sans-serif;
  --font-display: "Participant Fraunces", Fraunces, Georgia, serif;
  --serif: var(--font-display);
  --column: 41rem;
  min-height: 100svh;
  padding-bottom: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
}

body:not(.admin-page)::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent calc(100% - 240px), #fafaf8 calc(100% - 12px), #fafaf8),
    url("./tidal-light.svg") center / 100% 100% no-repeat,
    radial-gradient(ellipse 58% 66% at 50% 25%, #ffffffed 0%, #f5fcfbb3 49%, transparent 100%),
    linear-gradient(145deg, #e6f2ed 0%, #eaf5f5 46%, #c2e0dd 100%);
  content: "";
}

body:not(.admin-page) .app-shell {
  min-height: 100svh;
  background: transparent;
}

body:not(.admin-page) .site-header {
  min-height: 62px;
  padding: 16px clamp(20px, 4vw, 44px) 0;
  border-bottom: 0;
  background: transparent;
}

body:not(.admin-page) .brand-logo {
  width: auto;
  height: 30px;
  max-width: 150px;
  object-fit: contain;
  object-position: left center;
}

body:not(.admin-page) .brand-mark {
  width: 26px;
  height: 26px;
  display: block;
  flex: 0 0 auto;
  overflow: visible;
}

body:not(.admin-page) .brand-mark path,
body:not(.admin-page) .brand-mark circle {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

body:not(.admin-page) .brand:hover .brand-mark path {
  opacity: 0.18;
  transform: translateY(7px) scaleX(0.55);
}

body:not(.admin-page) .brand:hover .brand-mark circle {
  transform: translateY(-7px) scale(1.15);
}

body:not(.admin-page) .brand-title {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

body:not(.admin-page) .main-content {
  display: grid;
  flex: 1;
  min-width: 0;
  place-items: center;
  padding: clamp(24px, 5vw, 56px) clamp(20px, 4vw, 44px) clamp(28px, 4vw, 48px);
}

body:not(.admin-page) .site-footer {
  align-items: center;
  padding: 4px clamp(20px, 4vw, 44px) calc(20px + env(safe-area-inset-bottom));
  border-top: 0;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
}

.footer-links a:not(:last-child)::after {
  margin-left: 4px;
  content: "·";
}

.tool-meta {
  flex: 1 0 100%;
  color: var(--ink-muted);
  font-size: 0.68rem;
  opacity: 0.8;
}

.tool-meta a {
  color: inherit;
}

body:not(.admin-page) h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.4vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

body:not(.admin-page) .lead {
  margin: 18px 0 0;
  max-width: 31rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.4vw, 1.09rem);
  line-height: 1.62;
}

body:not(.admin-page) .soft-note {
  margin: 18px 0 0;
  max-width: 30rem;
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

body:not(.admin-page) .button {
  border-radius: 999px;
  box-shadow: none;
}

body:not(.admin-page) .button-primary {
  min-height: 52px;
  padding: 0 28px;
  border-color: transparent;
  background: var(--accent-brand);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  box-shadow: 0 10px 24px rgb(22 32 31 / 0.14);
}

body:not(.admin-page) .button-primary:hover,
body:not(.admin-page) .button-primary:focus-visible {
  background: var(--accent-brand);
  color: #fff;
  filter: brightness(0.92);
  transform: translateY(-1px);
}

body:not(.admin-page) .button-small {
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.84rem;
}

body:not(.admin-page) .button:focus-visible,
body:not(.admin-page) a:focus-visible,
body:not(.admin-page) button:focus-visible,
body:not(.admin-page) summary:focus-visible,
body:not(.admin-page) textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.notice-warning {
  border-color: #e8d6ae;
  background: var(--warn-wash);
  color: #6d4f12;
}

.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
  pointer-events: none;
}

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

.tenant-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}

.tenant-logo {
  max-width: 150px;
  max-height: 30px;
  width: auto;
  display: block;
  object-fit: contain;
}

.tenant-initial {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-brand);
  color: #fff;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
}

.tenant-name {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.welcome,
.farewell {
  display: grid;
  gap: clamp(16px, 3vw, 44px);
  width: 100%;
  max-width: 1000px;
}

.welcome-bot,
.farewell-bot {
  width: clamp(122px, 17vw, 232px);
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 26px rgb(22 32 31 / 0.12));
}

.welcome-words,
.farewell-words {
  min-width: 0;
  max-width: 34rem;
}

.welcome h1,
.farewell h1 {
  font-size: clamp(1.85rem, 4.2vw, 3rem);
}

.welcome-form {
  margin: 28px 0 0;
}

.welcome-consent {
  margin: 16px 0 0;
  max-width: 32rem;
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.welcome-consent a {
  color: var(--primary);
  text-underline-offset: 2px;
}

.welcome-details {
  margin: 14px 0 0;
  max-width: 32rem;
}

.welcome-details summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-muted);
  font-size: 0.85rem;
  list-style: none;
  cursor: pointer;
}

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

.welcome-details summary::before {
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.18s ease;
  content: "";
}

.welcome-details[open] summary::before {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.welcome-details-body {
  margin-top: 12px;
  border-left: 2px solid var(--reply-line);
  padding-left: 16px;
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.welcome-details-body p {
  margin: 0;
}

.privacy-text {
  max-height: 220px;
  overflow: auto;
  margin-top: 12px;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.privacy-text strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.farewell-cta {
  margin-top: 26px;
}

.entry-panel {
  width: min(100%, 520px);
  margin: 0 auto;
}

.entry-card {
  padding: clamp(26px, 4vw, 38px);
  border: 1px solid rgb(22 32 31 / 0.09);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 12px 40px rgb(22 32 31 / 0.06), 0 2px 6px rgb(22 32 31 / 0.02);
}

.entry-bot {
  width: 84px;
  height: auto;
  display: block;
  margin-bottom: 18px;
}

.entry-state {
  margin: 14px 0 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.entry-state + .lead {
  margin-top: 8px;
}

.entry-card .button {
  margin-top: 24px;
}

.chat-page:not(.admin-page) .app-shell {
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.chat-page:not(.admin-page) .site-header {
  min-height: 0;
  padding: calc(10px + env(safe-area-inset-top)) clamp(14px, 3vw, 26px) 10px;
  border-bottom: 1px solid rgb(22 32 31 / 0.07);
  background: rgb(250 250 248 / 0.74);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.chat-page:not(.admin-page) .site-header-actions {
  flex: 1;
  justify-content: flex-end;
  gap: 14px;
}

.chat-page:not(.admin-page) .site-footer {
  display: none;
}

.chat-page:not(.admin-page) .main-content {
  display: block;
  min-height: 0;
  padding: 0;
  place-items: normal;
}

.chat-progress {
  height: 3px;
  flex: 1 1 auto;
  max-width: 240px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--reply-line);
}

.chat-progress-fill {
  height: 100%;
  display: block;
  border-radius: 999px;
  background: var(--accent-brand);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-menu-trigger {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chat-menu-trigger:hover {
  border-color: rgb(22 32 31 / 0.09);
  background: #ffffffcc;
}

.chat-menu-trigger svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.chat-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.message-list {
  min-height: 0;
  margin: 0;
  display: grid;
  overflow-y: auto;
  padding: clamp(20px, 4vw, 30px) clamp(18px, 4vw, 24px) 10px;
  list-style: none;
  gap: 26px;
  align-content: start;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.turn {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
}

.turn-bot {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.turn-avatar {
  width: 38px;
  height: 38px;
  display: block;
  border-radius: 999px;
  background: #fbfbf6;
  box-shadow: 0 1px 3px rgb(22 32 31 / 0.1);
}

.turn-block {
  min-width: 0;
}

.turn-bot .turn-text {
  margin: 0;
  max-width: 33rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.19rem, 2vw, 1.34rem);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.48;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.turn-you {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  justify-content: flex-end;
}

.turn-you .turn-text {
  margin: 0;
  max-width: 78%;
  border: 1px solid var(--reply-line);
  border-radius: 20px 20px 7px 20px;
  padding: 12px 17px;
  background: var(--reply);
  color: var(--ink);
  font-size: 0.97rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.turn-who {
  flex: 0 0 auto;
  margin-bottom: 2px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #ffffffb8;
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
}

.turn-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.message-read-button {
  position: absolute;
  top: 46px;
  left: 3px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font);
  font-size: 0.81rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.message-read-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.turn-bot:hover .message-read-button,
.message-read-button:focus-visible {
  opacity: 1;
}

.message-list .turn-bot:last-child .message-read-button {
  position: static;
  margin-top: 10px;
  padding: 5px 11px 5px 8px;
  opacity: 1;
}

.message-list .turn-bot:last-child .message-read-button span {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
}

.message-read-button:hover:not(:disabled) {
  border-color: rgb(22 32 31 / 0.09);
  background: #ffffffd9;
  color: var(--ink);
}

.message-read-button.is-playing {
  border-color: var(--primary-tint);
  background: var(--primary-wash);
  color: var(--primary-deep);
  opacity: 1;
}

.message-read-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.message-read-speaker {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.message-read-speaker polygon {
  fill: currentColor;
  stroke: none;
}

.message-finish-cta {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  margin-top: 14px;
  border-radius: 999px;
  padding: 0 20px;
  background: var(--accent-brand);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.message-finish-cta:hover,
.message-finish-cta:focus-visible {
  filter: brightness(0.92);
}

.turn-waiting .turn-text {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
}

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

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-tint);
  animation: typing-dot-pulse 1.25s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing-dot-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chat-dock {
  padding: 12px clamp(18px, 4vw, 24px) calc(12px + env(safe-area-inset-bottom));
  background: var(--paper);
  box-shadow: 0 -16px 24px -20px rgb(22 32 31 / 0.3);
}

.chat-form {
  max-width: var(--column);
  margin: 0 auto;
}

.composer {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding: 6px 6px 6px 18px;
  border: 1px solid #d8ded6;
  border-radius: 27px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgb(22 32 31 / 0.1), 0 1px 2px rgb(22 32 31 / 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer:focus-within {
  border-color: var(--primary-tint);
  box-shadow: 0 10px 28px rgb(22 32 31 / 0.12), 0 0 0 3px var(--primary-wash);
}

.composer textarea {
  min-width: 0;
  min-height: 42px;
  max-height: 148px;
  flex: 1;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
}

.composer textarea:focus {
  outline: 0;
}

.composer textarea::placeholder {
  color: var(--ink-faint);
}

.composer textarea:disabled {
  background: transparent;
  color: var(--ink-muted);
}

.composer-button {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.composer-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.composer-button:disabled {
  cursor: default;
  opacity: 0.4;
}

.voice-button:hover:not(:disabled) {
  background: var(--primary-wash);
  color: var(--primary-deep);
}

.voice-button[data-recording="true"] {
  background: var(--danger-wash);
  color: var(--danger);
}

.voice-recording-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  opacity: 0;
  transform: translate(13px, -13px);
}

.voice-button[data-recording="true"] .voice-recording-dot {
  opacity: 1;
  animation: chat-recording-dot 1s ease-in-out infinite;
}

.send-button {
  background: var(--accent-brand);
  color: #fff;
}

.send-button svg {
  stroke-width: 2;
}

.send-button:hover:not(:disabled) {
  filter: brightness(0.92);
}

.send-button:disabled {
  background: var(--reply-line);
  color: #fff;
  opacity: 1;
}

@keyframes chat-recording-dot {
  0%,
  100% {
    opacity: 0.35;
  }

  50% {
    opacity: 1;
  }
}

.chat-hint,
.chat-caution {
  max-width: var(--column);
  margin: 9px auto 0;
  color: var(--ink-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}

.chat-caution {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 0.75rem;
}

.recording-status {
  display: none;
  align-items: center;
  gap: 6px;
  justify-content: center;
  color: var(--danger);
}

.chat-form.is-recording + .chat-hint .chat-hint-text {
  display: none;
}

.chat-form.is-recording + .chat-hint .recording-status {
  display: inline-flex;
}

.recording-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  animation: chat-recording-dot 1s ease-in-out infinite;
}

.recording-time {
  font-variant-numeric: tabular-nums;
}

.form-error {
  max-width: var(--column);
  margin: 8px auto 0;
  color: var(--danger);
  font-size: 0.82rem;
  text-align: center;
}

.chat-menu-backdrop:not([hidden]) {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.chat-menu-backdrop.is-open {
  opacity: 1;
}

.chat-menu:not([hidden]) {
  position: fixed;
  z-index: 50;
  top: calc(62px + env(safe-area-inset-top));
  right: clamp(14px, 3vw, 26px);
  width: 300px;
  padding: 8px;
  border: 1px solid rgb(22 32 31 / 0.1);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 20px 44px rgb(22 32 31 / 0.16), 0 2px 6px rgb(22 32 31 / 0.06);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.17s ease, transform 0.17s ease;
}

.chat-menu.is-open {
  opacity: 1;
  transform: none;
}

.chat-menu-grab {
  display: none;
}

.chat-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 8px 12px;
}

.chat-menu-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chat-menu-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}

.chat-menu-close:hover {
  background: var(--primary-wash);
  color: var(--ink);
}

.chat-menu-close svg,
.chat-menu-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.chat-menu-action {
  width: 100%;
  display: flex;
  gap: 11px;
  align-items: center;
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.chat-menu-action:hover {
  background: var(--primary-wash);
}

.chat-menu-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--ink-muted);
}

.chat-menu-action-danger {
  color: var(--accent);
}

.chat-menu-action-danger .chat-menu-icon {
  color: var(--accent);
}

.chat-menu-action-danger:hover {
  background: #f6e9ec;
}

.chat-menu-separator {
  margin: 6px 12px;
  border: 0;
  border-top: 1px solid var(--line);
}

.chat-menu-panel {
  margin: 0 12px 8px;
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.chat-menu-panel p {
  margin: 0 0 8px;
}

.chat-menu-links:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.chat-menu-panel a {
  color: var(--primary);
}

.chat-menu-confirm {
  margin: 0 12px 8px;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.chat-menu-confirm p {
  margin: 0 0 10px;
}

.chat-menu-confirm div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 719px) {
  .chat-menu:not([hidden]) {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    padding: 6px 10px calc(14px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    transform: translateY(16px);
    transform-origin: bottom center;
  }

  .chat-menu-backdrop:not([hidden]) {
    background: rgb(22 32 31 / 0.24);
  }

  .chat-menu-grab {
    width: 40px;
    height: 4px;
    display: block;
    margin: 8px auto 6px;
    border-radius: 2px;
    background: #d5dad2;
  }

  .message-list {
    gap: 22px;
  }

  .turn-bot {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 11px;
  }

  .turn-avatar {
    width: 32px;
    height: 32px;
  }

  .turn-bot .turn-text {
    font-size: 1.15rem;
  }

  .turn-you .turn-text {
    max-width: 85%;
  }

  .message-read-button {
    top: 38px;
    opacity: 0.55;
  }
}

@media (max-width: 767px) {
  body:not(.admin-page):not(.chat-page) .main-content {
    align-items: start;
    padding: 22px 20px 30px;
  }

  .welcome-bot,
  .farewell-bot {
    width: 132px;
  }

  .welcome h1,
  .farewell h1 {
    font-size: 1.85rem;
  }
}

@media (min-width: 880px) {
  .welcome,
  .farewell {
    grid-template-columns: minmax(170px, 240px) minmax(0, 1fr);
    gap: clamp(30px, 5vw, 60px);
    align-items: center;
  }

  .welcome-bot,
  .farewell-bot {
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.admin-page) .button,
  body:not(.admin-page) .brand-mark path,
  body:not(.admin-page) .brand-mark circle,
  .chat-progress-fill,
  .chat-menu:not([hidden]),
  .chat-menu-backdrop:not([hidden]),
  .chat-menu-action,
  .chat-menu-trigger,
  .message-read-button,
  .composer,
  .composer-button,
  .welcome-details summary::before {
    transition: none;
  }

  body:not(.admin-page) .button-primary:hover,
  body:not(.admin-page) .button-primary:focus-visible,
  body:not(.admin-page) .brand:hover .brand-mark path,
  body:not(.admin-page) .brand:hover .brand-mark circle {
    opacity: 1;
    transform: none;
  }

  .typing-dot,
  .voice-button[data-recording="true"] .voice-recording-dot,
  .recording-dot {
    animation: none;
  }

  .chat-menu:not([hidden]) {
    transform: none;
  }
}
