:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #687084;
  --line: #e3e6ec;
  --brand: #356ae6;
  --brand-dark: #2858c7;
  --danger: #d64242;
  --danger-bg: #fff2f2;
  --success: #18a071;
  --shadow: 0 18px 60px rgba(27, 38, 68, .10);
  --r: 14px;
}

body { background: var(--bg); color: var(--ink); }
.brand-logo { display: block; width: 92px; height: 52px; flex: 0 0 auto; border-radius: 9px; object-fit: contain; background: transparent; }
.sidebar-logo { width: 72px; height: 46px; }
.sidebar-brand .brand-lockup { gap: 9px; }
.sidebar-brand .brand-lockup strong { font-size: 14px; line-height: 1.35; }
.eyebrow { color: var(--brand); }

/* Authentication becomes a light, residential service surface. */
.auth-layout { grid-template-columns: minmax(430px, 1fr) minmax(500px, .88fr); background: #f6f7fb; }
.auth-brand { position: relative; overflow: hidden; background: #eaf0fb; color: var(--ink); border-right: 1px solid #dfe5f0; }
.auth-brand::before { content: ""; position: absolute; inset: 0; opacity: .42; background-image: linear-gradient(#d9e2f2 1px, transparent 1px), linear-gradient(90deg, #d9e2f2 1px, transparent 1px); background-size: 56px 56px; pointer-events: none; }
.auth-brand > * { position: relative; }
.auth-brand .brand-lockup { color: var(--ink); }
.auth-message { max-width: 650px; }
.auth-message h1 { max-width: 600px; font-size: clamp(44px, 5vw, 68px); color: #1d2a44; }
.auth-message > p:last-child { color: #59657a; }
.service-status { color: #4f5d70; }
.service-status span, .chat-header i { background: var(--success); }
.auth-panel { background: #fff; }
.auth-box { width: min(440px, 100%); }
.auth-tabs { padding: 5px; border: 0; border-radius: 14px; background: #f0f2f6; }
.auth-tabs button { min-height: 44px; border-radius: 10px; }
.auth-tabs button.active { background: #fff; box-shadow: 0 3px 12px rgba(29, 42, 68, .08); }
.auth-tabs button.active::after { display: none; }
.auth-box input, .profile-form input, .profile-form textarea { border-radius: 12px; border-color: #dce1ea; background: #fbfcfe; transition: border-color .18s, box-shadow .18s, background .18s; }
.auth-box input:focus, .profile-form input:focus, .profile-form textarea:focus { border-color: #7da0ef; background: #fff; box-shadow: 0 0 0 4px rgba(53, 106, 230, .10); outline: 0; }
.password-field button { color: var(--brand); border-radius: 9px; }
.verification-field { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 10px; }
.verification-field button { min-height: 52px; border: 1px solid #c8d2df; border-radius: 12px; background: #fff; color: var(--brand); font-size: 13px; font-weight: 700; }
.verification-field button:disabled { cursor: not-allowed; color: var(--muted); background: #f3f5f8; }
.auth-assist { display: flex; justify-content: flex-end; min-height: 30px; margin-top: 10px; }
.link-button { border: 0; background: none; color: var(--brand); font-size: 13px; }
.form-success { margin-top: 16px; padding: 11px 13px; border-radius: 8px; background: #edf8f3; color: #176b52; font-size: 14px; }
.composer .voice-input { flex: 0 0 44px; background: #eef3ff; color: var(--brand); font-size: 15px; }
.composer .voice-input.recording { background: #d94747; color: #fff; animation: voice-pulse 1s ease-in-out infinite; }
.microphone-icon { position: relative; display: inline-block; width: 22px; height: 27px; color: inherit; vertical-align: middle; }
.microphone-icon::before { content: ""; position: absolute; left: 7px; top: 2px; width: 8px; height: 14px; border: 2px solid currentColor; border-radius: 7px; box-sizing: border-box; }
.microphone-icon::after { content: ""; position: absolute; left: 4px; top: 10px; width: 14px; height: 11px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 9px 9px; box-sizing: border-box; }
.microphone-icon i { position: absolute; left: 10px; top: 20px; width: 2px; height: 5px; border-radius: 2px; background: currentColor; }
.microphone-icon i::after { content: ""; position: absolute; left: -4px; top: 4px; width: 10px; height: 2px; border-radius: 2px; background: currentColor; }
.voice-input.recording .microphone-icon { animation: microphone-active 1s ease-in-out infinite; }
.voice-output-toggle { margin-top: 18px; border: 1px solid #d7dfec; border-radius: 999px; padding: 9px 14px; background: #fff; color: #667085; font-size: 13px; }
.header-actions .voice-output-toggle { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-height: 44px; margin: 0; text-align: center; }
.voice-output-toggle.active { border-color: #a8bff2; background: #eef3ff; color: var(--brand); }
.voice-output-toggle span { margin-right: 6px; }
.message-row.assistant { flex-direction: column; align-items: flex-start; gap: 3px; }
.message-speak { position: relative; align-self: flex-start; width: 38px; height: 30px; margin-left: 7px; border: 0; border-radius: 999px; background: transparent; color: #98a0af; cursor: pointer; padding: 0; line-height: 1; }
.message-speak .speaker-icon { position: absolute; left: 5px; top: 50%; font-size: 17px; filter: grayscale(1); opacity: .72; transform: translateY(-50%); }
.message-speak:not(.playing)::after { content: ""; position: absolute; left: 7px; top: 14px; width: 21px; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(-43deg); }
.message-speak .speaker-wave { position: absolute; top: 50%; border: 2px solid transparent; border-right-color: currentColor; border-radius: 50%; opacity: 0; transform: translateY(-50%) scale(.65); }
.message-speak .speaker-wave-one { left: 20px; width: 8px; height: 13px; }
.message-speak .speaker-wave-two { left: 22px; width: 13px; height: 21px; }
.message-speak.playing { color: var(--brand); background: #eef3ff; }
.message-speak.playing .speaker-icon { filter: none; opacity: 1; }
.message-speak.playing .speaker-wave { animation: speaker-wave 1.05s ease-out infinite; }
.message-speak.playing .speaker-wave-two { animation-delay: .22s; }
.wake-session-cancel { min-height: 38px; padding: 0 12px; border: 1px solid #efc7c7; border-radius: 999px; background: #fff7f7; color: #b92f2f; font-size: 12px; font-weight: 700; }
@keyframes voice-pulse { 50% { transform: scale(.9); opacity: .72; } }
@keyframes microphone-active { 50% { transform: scale(.88); opacity: .78; } }
@keyframes speaker-wave { 0% { opacity: 0; transform: translateY(-50%) scale(.55); } 38% { opacity: 1; } 100% { opacity: 0; transform: translateY(-50%) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .message-speak.playing .speaker-wave { animation: none; opacity: 1; transform: translateY(-50%) scale(1); } }
.primary-button { border-radius: 13px; box-shadow: 0 9px 24px rgba(53, 106, 230, .22); }
.profile-form { border-radius: 18px; border-color: #e3e6ee; }

/* Chat workspace */
.chat-app { grid-template-columns: 292px minmax(0, 1fr); background: #fff; }
.sidebar { padding: 20px 16px 16px; background: #f6f7f9; border-color: #e5e7ec; }
.new-chat { border: 0; border-radius: 13px; min-height: 50px; color: #fff; background: var(--brand); box-shadow: 0 8px 20px rgba(53, 106, 230, .18); }
.new-chat span { color: #fff; }
.new-chat:hover { background: var(--brand-dark); }
.conversation-item { border-radius: 11px; padding: 13px 12px; }
.conversation-item:hover, .conversation-item.active { background: #e9edf5; }
.account-card { gap: 8px; padding-top: 12px; }
.account-profile { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 52px; padding: 5px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.account-profile:hover { background: #e9edf5; }
.account-profile > span { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #dfe8fb; color: #2858c7; font-weight: 800; }
.account-profile div { min-width: 0; }
.account-card > button:last-child { border-radius: 10px; padding: 0 10px; }
.chat-main { grid-template-rows: auto minmax(0, 1fr) auto auto; background: #fff; }
.chat-header { min-height: 78px; height: auto; gap: 20px; padding: 12px clamp(20px, 3vw, 42px); background: rgba(255, 255, 255, .96); border-color: #e8eaf0; }
.chat-heading { display: flex; align-items: center; gap: 28px; min-width: 0; }
.chat-heading > div:first-child { flex: 0 0 auto; }
.chat-heading > div:first-child > strong, .chat-heading > div:first-child > span { display: block; }
.chat-heading > div:first-child > span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; gap: 10px; }
.header-action { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 15px; border: 1px solid #dfe4ec; border-radius: 12px; background: #fff; color: #344054; font-weight: 700; transition: background .18s, border-color .18s, transform .18s; }
.header-action:hover { border-color: #aebbd2; background: #f6f8fc; }
.header-action:active { transform: translateY(1px); }
.header-action span { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; background: #e7eefc; color: var(--brand); font-weight: 900; }
.header-action.emergency { border-color: #f0caca; color: #b92f2f; }
.header-action.emergency:hover { border-color: #e79595; background: #fff4f4; }
.header-action.emergency span { background: #fde2e2; color: var(--danger); }
.address-display { min-width: 0; max-width: 320px; margin-left: auto; text-align: right; }
.address-display span, .address-display b { display: block; }
.address-display span { color: var(--muted); font-size: 11px; }
.address-display b { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.messages { padding-top: 38px; background: #fff; }
.welcome { padding-top: min(16vh, 150px); }
.assistant-logo { display: block; width: 108px; height: 68px; margin: 0 auto 22px; border-radius: 12px; object-fit: contain; background: transparent; box-shadow: none; }
.welcome h1 { color: #1b263d; font-size: 32px; }
.message-row { margin: 18px 0; }
.message-bubble { border-radius: 16px 16px 16px 5px; background: #f0f2f6; color: #263149; padding: 13px 17px; }
.user .message-bubble { border-radius: 16px 16px 5px 16px; background: var(--brand); }
.chat-notice { border-radius: 12px; }
.composer { border-radius: 18px; border-color: #d9dee8; padding: 8px 8px 8px 18px; box-shadow: 0 10px 32px rgba(30, 43, 72, .09); }
.composer:focus-within { border-color: #84a3eb; box-shadow: 0 0 0 4px rgba(53, 106, 230, .10), 0 10px 32px rgba(30, 43, 72, .09); }
.composer button { border-radius: 13px; background: var(--brand); }

/* Read-only profile modal opened from the user avatar. */
.modal-open { overflow: hidden; }
.modal-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-scrim { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(19, 27, 45, .48); }
.profile-modal { position: relative; width: min(430px, 100%); border: 1px solid #e3e6ec; border-radius: 20px; padding: 24px; background: #fff; box-shadow: 0 28px 90px rgba(21, 31, 54, .24); animation: modal-in .2s ease-out; }
.profile-modal header { display: flex; align-items: flex-start; justify-content: space-between; }
.profile-modal header span { color: var(--brand); font-size: 11px; font-weight: 800; }
.profile-modal h2 { margin: 5px 0 0; font-size: 24px; }
.modal-close { width: 44px; height: 44px; border: 0; border-radius: 12px; background: #f1f3f7; color: #4e586d; font-size: 24px; }
.profile-identity { display: flex; align-items: center; gap: 14px; margin: 28px 0 22px; padding: 18px; border-radius: 15px; background: #f5f7fb; }
.profile-identity > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #dfe8fb; color: var(--brand); font-size: 18px; font-weight: 800; }
.profile-identity strong, .profile-identity small { display: block; }
.profile-identity small { margin-top: 4px; color: var(--muted); }
.modal-profile-form label { display: block; margin: 14px 0 7px; color: #4d5669; font-size: 13px; font-weight: 700; }
.modal-profile-form input, .modal-profile-form textarea { width: 100%; min-height: 48px; border: 1px solid #dce1ea; border-radius: 12px; padding: 11px 13px; background: #fbfcfe; color: var(--ink); }
.modal-profile-form textarea { min-height: 78px; resize: vertical; line-height: 1.55; }
.modal-profile-form input:focus, .modal-profile-form textarea:focus { border-color: #7da0ef; background: #fff; box-shadow: 0 0 0 4px rgba(53, 106, 230, .10); outline: 0; }
.modal-done { width: 100%; min-height: 48px; margin-top: 22px; border: 0; border-radius: 13px; background: var(--brand); color: #fff; font-weight: 800; }
.modal-done:disabled { cursor: wait; opacity: .62; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 960px) {
  .chat-header { flex-wrap: wrap; }
  .chat-heading { flex: 1; }
  .address-display { display: none; }
}
@media (max-width: 800px) {
  .auth-layout { display: block; }
  .auth-panel { background: #f7f8fb; }
  .auth-box { padding: 24px; border: 1px solid #e3e6ec; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
  .mobile-brand .brand-logo { width: 84px; height: 48px; }
  .chat-header { flex-wrap: nowrap; min-height: 126px; align-items: flex-start; padding: 12px 14px; }
  .chat-heading { flex: 1; flex-wrap: wrap; gap: 10px; }
  .header-actions { order: 2; width: 100%; }
  .header-actions .voice-output-toggle { flex: 1; justify-content: center; padding: 0 8px; }
  .header-action { flex: 1; justify-content: center; padding: 0 10px; }
  .welcome { padding-top: 13vh; }
}
@media (max-width: 420px) {
  .auth-box { padding: 20px; }
  .header-action { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .profile-modal { animation: none; }
}

/* Fluid chat layout for phones, tablets, elevator displays and wide screens. */
.chat-app {
  grid-template-columns: clamp(260px, 18vw, 320px) minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.chat-app > .sidebar,
.chat-app > .chat-main {
  height: 100%;
  max-height: 100%;
  min-height: 0;
}
.sidebar { overflow: hidden; }
.sidebar-brand,
.sidebar > .new-chat,
.sidebar > .section-label,
.sidebar > .account-card { flex: 0 0 auto; }
.conversation-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.chat-main { min-width: 0; min-height: 0; overflow: hidden; }
.messages {
  min-height: 0;
  padding: clamp(22px, 3vh, 42px) clamp(18px, 3vw, 44px);
  background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
}
.messages > .message-row,
.messages > .welcome {
  width: min(980px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.assistant .message-bubble > p { margin: 0 0 10px; white-space: pre-wrap; }
.assistant .message-bubble > p:last-child { margin-bottom: 0; }
.assistant .message-bubble > h1,.assistant .message-bubble > h2,.assistant .message-bubble > h3,.assistant .message-bubble > h4,.assistant .message-bubble > h5,.assistant .message-bubble > h6 { margin: 18px 0 9px; color: #17243d; line-height: 1.35; }
.assistant .message-bubble > h1:first-child,.assistant .message-bubble > h2:first-child,.assistant .message-bubble > h3:first-child { margin-top: 0; }
.assistant .message-bubble > h1 { font-size: 1.38em; }.assistant .message-bubble > h2 { font-size: 1.25em; }.assistant .message-bubble > h3 { font-size: 1.12em; }
.assistant .message-bubble > ul,.assistant .message-bubble > ol { margin: 8px 0 13px; padding-left: 1.55em; }.assistant .message-bubble li { margin: 4px 0; }
.assistant .message-bubble blockquote { margin: 12px 0; padding: 9px 13px; border-left: 4px solid #3b6ee8; border-radius: 0 8px 8px 0; background: #e8eefc; color: #34435f; white-space: pre-wrap; }
.assistant .message-bubble pre { max-width: 100%; margin: 12px 0; padding: 12px 14px; overflow:auto; border-radius:8px; background:#172033; color:#f2f5fb; }.assistant .message-bubble code { padding:.08em .3em; border-radius:4px; background:#e3e7ee; font-family:Consolas,monospace; }.assistant .message-bubble pre code { padding:0; background:transparent; color:inherit; }
.assistant .message-bubble a { color:#245fd6; text-decoration:underline; text-underline-offset:2px; }.assistant .message-bubble hr { margin:16px 0; border:0; border-top:1px solid #d8dee9; }
.knowledge-figure { margin: 14px 0; }
.knowledge-figure img { display: block; width: min(100%, 920px); max-height: 70vh; object-fit: contain; border: 1px solid #dce3e0; border-radius: 8px; background: #fff; }
.knowledge-figure figcaption { margin-top: 7px; color: #63706b; font-size: 13px; }
.knowledge-table-wrap { max-width: 100%; margin: 14px 0; overflow-x: auto; border: 1px solid #dce3e0; border-radius: 8px; background: #fff; }
.knowledge-table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: normal; }
.knowledge-table-wrap th,.knowledge-table-wrap td { min-width: 110px; padding: 9px 11px; border-right: 1px solid #e5eae8; border-bottom: 1px solid #e5eae8; text-align: left; vertical-align: top; white-space: pre-wrap; }
.knowledge-table-wrap th { background: #edf5f2; color: #104c3b; font-weight: 800; }
.knowledge-table-wrap tr:last-child td { border-bottom: 0; }
.knowledge-table-wrap th:last-child,.knowledge-table-wrap td:last-child { border-right: 0; }
.message-bubble {
  max-width: min(72%, 720px);
  font-size: clamp(15px, .2vw + 14px, 17px);
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.composer-wrap {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 12px clamp(18px, 3vw, 40px) max(16px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97);
}
.composer textarea { min-width: 0; font-size: 16px; }
.voice-session-card {
  position: fixed;
  right: clamp(18px, 2.4vw, 42px);
  bottom: clamp(112px, 13vh, 150px);
  z-index: 12;
  width: min(292px, calc(100vw - 36px));
  padding: 16px 18px 14px;
  border: 1px solid #dfe6f2;
  border-radius: 17px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 50px rgba(40, 65, 116, .17);
  backdrop-filter: blur(16px);
}
.voice-session-close { position: absolute; top: 9px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: #7b879d; font-size: 21px; line-height: 1; }
.voice-session-close:hover { background: #f0f3f9; color: #263a63; }
.voice-session-heading { display: flex; align-items: center; gap: 12px; padding-right: 28px; }
.voice-session-heading strong,.voice-session-heading small { display: block; }
.voice-session-heading strong { color: #1e2e4c; font-size: 15px; }
.voice-session-heading small { margin-top: 4px; color: #7c879b; font-size: 12px; }
.voice-session-mic { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: #eaf1ff; color: #356ee6; box-shadow: 0 0 0 0 rgba(53, 110, 230, .2); animation: voice-session-mic-pulse 1.45s ease-out infinite; }
.voice-session-mic .microphone-icon { animation: microphone-active 1s ease-in-out infinite; }
.voice-session-wave { display: flex; align-items: center; gap: 4px; height: 38px; margin-top: 10px; padding: 0 4px; }
.voice-session-wave i { width: 4px; height: 12px; border-radius: 999px; background: linear-gradient(180deg, #3973ec, #75a3ff); transform-origin: center; animation: voice-session-bar .9s ease-in-out infinite alternate; }
.voice-session-wave i:nth-child(2),.voice-session-wave i:nth-child(8) { height: 23px; animation-delay: -.65s; }
.voice-session-wave i:nth-child(3),.voice-session-wave i:nth-child(7) { height: 31px; animation-delay: -.35s; }
.voice-session-wave i:nth-child(4),.voice-session-wave i:nth-child(6) { height: 18px; animation-delay: -.8s; }
.voice-session-wave i:nth-child(5),.voice-session-wave i:nth-child(9) { height: 27px; animation-delay: -.15s; }
.voice-session-card[data-state="processing"] .voice-session-wave i { animation-duration: 1.35s; opacity: .62; }
.voice-session-card[data-state="speaking"] .voice-session-mic { background: #edf7f3; color: #17835e; }
.voice-session-card[data-state="speaking"] .voice-session-wave i { background: linear-gradient(180deg, #16835e, #55bd96); animation-duration: .72s; }
@keyframes voice-session-bar { from { transform: scaleY(.35); opacity: .48; } to { transform: scaleY(1); opacity: 1; } }
@keyframes voice-session-mic-pulse { 70% { box-shadow: 0 0 0 9px rgba(53, 110, 230, 0); } 100% { box-shadow: 0 0 0 0 rgba(53, 110, 230, 0); } }

@media (min-width: 1500px) {
  .chat-header { padding-inline: clamp(32px, 4vw, 72px); }
  .messages > .message-row,
  .messages > .welcome { width: min(1080px, 100%); }
  .composer-wrap { width: min(1140px, 100%); }
}

@media (max-width: 800px) {
  .chat-app { display: block; height: 100dvh; }
  .chat-main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    height: 100dvh;
  }
  .chat-header {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: start;
    gap: 8px 10px;
    min-height: 0;
    padding: 10px 12px 11px;
    box-shadow: 0 1px 0 #edf0f5;
  }
  .chat-header #openSidebar {
    grid-column: 1;
    grid-row: 1;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    color: var(--brand);
    background: #f1f5ff;
    font-size: 20px;
  }
  .chat-heading {
    grid-column: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    width: 100%;
  }
  .chat-heading > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
  }
  .chat-heading > div:first-child > strong {
    overflow: hidden;
    color: #1d2940;
    font-size: 18px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chat-heading > div:first-child > span {
    flex: 0 0 auto;
    margin: 2px 0 0 10px;
    font-size: 11px;
    white-space: nowrap;
  }
  .header-actions {
    display: grid;
    grid-template-columns: .82fr 1fr 1fr;
    gap: 7px;
    width: 100%;
  }
  .header-actions .voice-output-toggle,
  .header-actions .header-action {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: 38px;
    height: 38px;
    justify-content: center;
    gap: 5px;
    margin: 0;
    border-radius: 10px;
    padding: 0 7px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }
  .header-actions .voice-output-toggle span,
  .header-actions .header-action span {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 19px;
    height: 19px;
    margin: 0;
    border-radius: 6px;
    font-size: 12px;
  }
  .address-display { display: none; }
  .messages {
    padding: 16px 14px 24px;
    scroll-padding-bottom: 20px;
  }
  .message-row { margin: 12px auto; }
  .message-bubble {
    max-width: 86%;
    border-radius: 15px 15px 15px 4px;
    padding: 11px 14px;
    font-size: 15px;
    line-height: 1.65;
  }
  .user .message-bubble { border-radius: 15px 15px 4px 15px; }
  .welcome { padding-top: min(10vh, 72px); }
  .welcome h1 { font-size: 25px; }
  .assistant-logo { width: 92px; height: 58px; margin-bottom: 18px; }
  .composer-wrap {
    width: 100%;
    padding: 9px 10px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid #edf0f5;
    box-shadow: 0 -8px 28px rgba(30, 43, 72, .05);
  }
  .composer {
    gap: 6px;
    border-radius: 16px;
    padding: 6px;
  }
  .composer textarea {
    min-height: 42px;
    max-height: 112px;
    padding: 9px 2px;
    font-size: 16px;
  }
  .composer button,
  .composer .voice-input {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }
  .composer-wrap > p {
    margin-top: 6px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .voice-session-card { right: 12px; bottom: calc(92px + env(safe-area-inset-bottom)); width: min(270px, calc(100vw - 24px)); padding: 13px 15px 11px; }
  .voice-session-wave { height: 30px; margin-top: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .voice-session-mic,.voice-session-wave i,.voice-session-mic .microphone-icon,.voice-input.recording .microphone-icon { animation: none; }
}

@media (max-width: 390px) {
  .chat-header { padding-inline: 9px; }
  .header-actions { gap: 5px; }
  .header-actions .voice-output-toggle,
  .header-actions .header-action { padding-inline: 5px; font-size: 11px; }
  .message-bubble { max-width: 90%; }
  .messages { padding-inline: 11px; }
}

@media (max-height: 680px) and (max-width: 800px) {
  .chat-header { padding-block: 7px 8px; }
  .header-actions .voice-output-toggle,
  .header-actions .header-action { min-height: 34px; height: 34px; }
  .messages { padding-top: 10px; padding-bottom: 12px; }
  .composer-wrap > p { display: none; }
}

/* Guest entry, per-response tools, and immutable single-turn sharing. */
.auth-back-button { width: 100%; min-height: 46px; margin-top: 10px; border: 0; border-radius: 12px; background: transparent; color: #526078; font-weight: 700; }
.auth-back-button:hover { background: #f2f5fa; color: var(--brand); }
.header-account { display: flex; align-items: center; justify-content: flex-end; min-width: 120px; margin-left: auto; }
.header-login { min-width: 88px; min-height: 42px; border: 1px solid #b9c8e9; border-radius: 12px; background: #fff; color: #2458c9; font-weight: 800; }
.header-login:hover { border-color: var(--brand); background: #f3f6fd; }
.guest-account { display: flex; align-items: center; gap: 10px; padding: 14px 8px 2px; border-top: 1px solid var(--line); }
.guest-account div { flex: 1; min-width: 0; }
.guest-account strong,.guest-account small { display: block; }
.guest-account small { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.guest-account button { flex: 0 0 auto; min-width: 66px; min-height: 40px; border: 1px solid #b9c8e9; border-radius: 11px; background: #fff; color: var(--brand); font-weight: 800; }
.guest-history { margin: 8px 5px; padding: 16px; border: 1px solid #dfe5ef; border-radius: 13px; background: #fff; }
.guest-history strong,.guest-history span { display: block; }
.guest-history span { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.message-actions { display: flex; align-items: center; gap: 3px; min-height: 34px; margin-left: 5px; }
.message-actions .message-speak { align-self: center; margin: 0; }
.message-tool { min-width: 50px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: #68758b; font-size: 13px; font-weight: 700; }
.message-tool:hover { background: #edf2fb; color: #2858c7; }
.message-tool:active,.header-login:active,.guest-account button:active,.primary-action:active,.secondary-action:active,.share-open-agent:active { transform: translateY(1px); }
.message-tool:disabled { cursor: wait; opacity: .58; }

.login-prompt-card,.share-modal-card { position: relative; width: min(440px, 100%); border: 1px solid #dfe4ed; border-radius: 20px; background: #fff; box-shadow: 0 28px 90px rgba(21, 31, 54, .24); animation: modal-in .2s ease-out; }
.login-prompt-card { padding: 30px; text-align: center; }
.login-prompt-mark { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 15px; background: #e8effd; color: var(--brand); font-size: 18px; font-weight: 900; }
.login-prompt-card h2 { margin: 0; color: #1b2943; font-size: 24px; }
.login-prompt-card p { margin: 12px 0 24px; color: #606c80; line-height: 1.75; }
.login-prompt-card > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-action,.secondary-action { min-height: 46px; border-radius: 12px; font-weight: 800; }
.primary-action { border: 0; background: var(--brand); color: #fff; }
.secondary-action { border: 1px solid #d6dde8; background: #fff; color: #4f5c71; }
.secondary-action.full { width: 100%; margin-top: 10px; }

.share-modal-card { width: min(720px, 100%); max-height: min(88dvh, 820px); padding: 24px; overflow: auto; }
.share-modal-card > header { display: flex; align-items: flex-start; justify-content: space-between; }
.share-modal-card > header span { color: var(--brand); font-size: 12px; font-weight: 800; }
.share-modal-card h2 { margin: 5px 0 0; font-size: 25px; }
.share-privacy-note { margin: 18px 0; padding: 12px 14px; border-radius: 11px; background: #fff7e8; color: #76541b; font-size: 13px; line-height: 1.65; }
.share-preview { max-height: 48dvh; padding: 18px; overflow: auto; border: 1px solid #e1e6ef; border-radius: 15px; background: #f8f9fc; }
.share-preview-question > span,.share-preview-answer > span { display: block; margin-bottom: 8px; color: #66738a; font-size: 12px; font-weight: 800; }
.share-preview-question p { margin: 0 0 18px auto; width: fit-content; max-width: 82%; padding: 11px 15px; border-radius: 14px 14px 4px 14px; background: var(--brand); color: #fff; line-height: 1.65; white-space: pre-wrap; }
.share-preview-answer .message-bubble { max-width: 100%; background: #fff; }
.share-modal-card > label { display: block; margin: 18px 0 7px; color: #4d596e; font-size: 13px; font-weight: 800; }
.share-link-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.share-link-field input { min-width: 0; height: 46px; border: 1px solid #d8dfea; border-radius: 11px; padding: 0 12px; background: #f8f9fc; color: #344258; }
.share-link-field button { min-width: 96px; border: 0; border-radius: 11px; background: var(--brand); color: #fff; font-weight: 800; }

.share-page { min-height: 100dvh; background: #f5f7fa; }
.share-page-header { height: 72px; border-bottom: 1px solid #e2e7ef; background: #fff; }
.share-page-header .brand-lockup { width: min(960px, calc(100% - 36px)); height: 100%; margin: 0 auto; text-decoration: none; }
.share-page-main { width: min(800px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 56px; }
.share-document { min-height: 320px; padding: clamp(24px, 5vw, 52px); border: 1px solid #e0e5ed; border-radius: 20px; background: #fff; box-shadow: 0 18px 54px rgba(29, 42, 68, .08); }
.share-document article > header { margin-bottom: 34px; padding-bottom: 26px; border-bottom: 1px solid #e4e8ef; }
.share-document article > header span { color: var(--brand); font-size: 13px; font-weight: 800; }
.share-document article > header h1 { margin: 10px 0 8px; color: #18253e; font-size: clamp(26px, 4vw, 38px); line-height: 1.35; }
.share-document article > header p { margin: 0; color: #7a8597; font-size: 13px; }
.share-document .share-preview-question p { max-width: 76%; }
.share-document .share-preview-answer .message-bubble { padding: 20px; border: 1px solid #e4e8f0; }
.share-loading,.share-error { display: grid; place-items: center; min-height: 220px; text-align: center; }
.share-loading span,.share-error p { margin-top: 8px; color: var(--muted); }
.share-open-agent { display: grid; place-items: center; width: min(360px, 100%); min-height: 52px; margin: 22px auto 0; border-radius: 13px; background: var(--brand); color: #fff; font-weight: 800; text-decoration: none; box-shadow: 0 10px 26px rgba(53, 106, 230, .2); }

@media (max-width: 800px) {
  .header-account { grid-column: 2; position: absolute; right: 12px; top: 10px; min-width: 72px; }
  .header-login { min-width: 70px; height: 38px; min-height: 38px; }
  .chat-heading > div:first-child { padding-right: 78px; }
  .share-page-main { padding-top: 24px; }
  .share-document { padding: 22px 17px; border-radius: 16px; }
  .share-document .share-preview-question p { max-width: 88%; }
  .share-modal-card { padding: 18px; }
  .share-preview { padding: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-prompt-card,.share-modal-card { animation: none; }
}
