:root {
  color-scheme: light;
  --page: #eceeea;
  --surface: #ffffff;
  --surface-soft: #f5f5f2;
  --surface-deep: #e8e9e4;
  --ink: #16181a;
  --ink-soft: #5e625f;
  --ink-faint: #8a8f8b;
  --line: #d9dcd7;
  --blue: #2020e8;
  --blue-dark: #1111a9;
  --red: #c93b35;
  --green: #27915a;
  --focus: #6767ef;
  --mobile-touch-target: 44px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
}

button,
textarea,
input {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  width: min(100%, 1180px);
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border-inline: 1px solid var(--line);
}

body.is-welcome .app-shell {
  width: 100%;
  max-width: none;
  grid-template-rows: auto minmax(0, 1fr);
  border-inline: 0;
}

body.is-welcome .agent-bar,
body.is-welcome .topic-nav,
body.is-welcome .composer-tools,
body.is-welcome .panel-actions,
body.is-welcome .design-panel,
body.is-welcome .profile-trigger {
  display: none;
}

body.is-welcome .topbar {
  padding-right: max(28px, calc((100vw - 1320px) / 2));
  padding-left: max(28px, calc((100vw - 1320px) / 2));
  background: #f7f8f5;
}

body.is-welcome .workspace {
  grid-template-columns: 1fr;
  background: #f7f8f5;
}

body.is-welcome .conversation {
  display: block;
}

body.is-welcome .chat-log {
  min-height: 100%;
  padding: 0 max(28px, calc((100vw - 1320px) / 2));
  overflow-y: auto;
}

.topbar {
  min-height: 76px;
  padding: 13px 20px;
  padding-top: max(13px, env(safe-area-inset-top));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-left: max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.brand-copy p {
  margin: 0;
}

.brand-copy h1 {
  overflow: hidden;
  font-size: 17px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy p {
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  margin-right: 5px;
  display: inline-block;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.offline {
  background: var(--red);
}

.topbar-actions,
.dialog-actions,
.panel-actions,
.composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions {
  flex: 0 0 auto;
}

.primary-button,
.secondary-button,
.text-button,
.quiet-button,
.danger-button {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  text-decoration: none;
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.primary-button:hover {
  background: #313438;
}

.secondary-button,
.text-button,
.quiet-button,
.danger-button {
  border: 1px solid var(--line);
  background: var(--surface);
}

.secondary-button:hover,
.text-button:hover,
.quiet-button:hover {
  border-color: var(--ink);
}

.danger-button {
  color: var(--red);
}

.quiet-button {
  min-height: 32px;
  padding-inline: 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

.quiet-button.accent {
  border-color: color-mix(in srgb, var(--blue) 30%, var(--line));
  color: var(--blue-dark);
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
}

.icon-button:hover {
  background: var(--surface-soft);
}

.agent-bar {
  min-height: 45px;
  padding: 8px 20px;
  padding-right: max(20px, env(safe-area-inset-right));
  padding-left: max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) 42px auto;
  align-items: center;
  gap: 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.agent-progress-copy {
  min-width: 130px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stage-index {
  color: var(--ink-faint);
  font-size: 11px;
}

.agent-progress-copy strong {
  font-size: 13px;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  background: var(--surface-deep);
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--blue);
  transition: width 240ms ease;
}

.progress-value {
  color: var(--ink-faint);
  font-size: 11px;
  text-align: right;
}

.memory-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
}

.memory-control input,
.consent-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.topic-nav {
  padding: 9px 20px;
  padding-right: max(20px, env(safe-area-inset-right));
  padding-left: max(20px, env(safe-area-inset-left));
  display: flex;
  gap: 7px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.topic-nav::-webkit-scrollbar {
  display: none;
}

.topic-nav button,
.quick-reply {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.topic-nav button:hover,
.quick-reply:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
}

.conversation {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-log {
  min-height: 0;
  padding: 24px 24px;
  padding-right: max(24px, env(safe-area-inset-right));
  padding-left: max(24px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #c7cac5 transparent;
  scrollbar-width: thin;
}

.welcome {
  width: 100%;
  max-width: 1180px;
  min-height: calc(100dvh - 77px);
  margin: auto;
  padding: clamp(40px, 7vh, 72px) 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(480px, 1.12fr);
  align-items: center;
  gap: clamp(56px, 8vw, 116px);
}

.welcome-intro {
  align-self: center;
}

.welcome-signature {
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.welcome-signature img {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.welcome-signature span {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 760;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 760;
}

.welcome h2 {
  margin: 0;
  max-width: 560px;
  font-size: clamp(42px, 4.3vw, 64px);
  line-height: 1.08;
  text-wrap: balance;
}

.welcome-copy {
  max-width: 430px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.75;
}

.welcome-reception {
  padding-left: clamp(32px, 5vw, 68px);
  border-left: 1px solid var(--line);
}

.designer-opening {
  padding-top: 18px;
  border-top: 3px solid var(--blue);
}

.designer-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.designer-identity img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.designer-identity span {
  display: grid;
  gap: 2px;
}

.designer-identity strong {
  font-size: 13px;
}

.designer-identity small {
  color: var(--ink-faint);
  font-size: 11px;
}

.designer-opening > p {
  max-width: 500px;
  margin: 18px 0 0;
  font-size: 22px;
  font-weight: 660;
  line-height: 1.55;
}

.welcome-composer {
  margin-top: 24px;
  padding: 0;
  border-top: 0;
  background: transparent;
}

.welcome-composer #chatForm {
  min-height: 68px;
  padding: 9px 9px 9px 18px;
  border-color: #cfd3ce;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgb(38 45 39 / 8%);
}

.welcome-composer #userInput {
  padding-block: 10px;
  font-size: 15px;
}

.welcome-composer .send-button {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
}

.welcome-composer .contact-strip {
  display: none;
}

.starter-section {
  margin-top: 24px;
}

.starter-section > p {
  margin: 0 0 3px;
  color: var(--ink-faint);
  font-size: 11px;
}

.starter-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.starter-grid button {
  min-height: 48px;
  padding: 10px 2px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  column-gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color 160ms ease, transform 160ms ease;
}

.starter-grid button:hover {
  color: var(--blue-dark);
  transform: translateX(3px);
}

.starter-grid button::after {
  content: "→";
  grid-column: 2;
  align-self: center;
  color: var(--blue);
  font-size: 17px;
}

.starter-grid strong {
  font-size: 14px;
  font-weight: 650;
}

.message {
  width: min(90%, 650px);
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.message-avatar img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.message.user .message-avatar {
  border-color: var(--ink);
  background: var(--ink);
}

.message-content {
  min-width: 0;
}

.message-bubble {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 7px;
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.message-bubble p,
.message-bubble ul {
  margin: 0;
}

.message-bubble p + p,
.message-bubble p + ul,
.message-bubble ul + p {
  margin-top: 10px;
}

.message-bubble ul {
  padding-left: 20px;
}

.message-bubble strong {
  font-weight: 720;
}

.message.user .message-bubble {
  white-space: pre-wrap;
}

.message.user .message-bubble {
  background: var(--ink);
  color: #ffffff;
}

.message-references {
  margin-top: 8px;
  display: grid;
  gap: 7px;
}

.message-references-label {
  color: var(--ink-faint);
  font-size: 11px;
}

.reference-card {
  width: 100%;
  max-width: 360px;
  min-height: 58px;
  padding: 8px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.reference-card:hover:not(:disabled) {
  border-color: var(--blue);
}

.reference-card:disabled {
  cursor: default;
  opacity: 0.62;
}

.reference-thumb {
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(29, 29, 29, 0.12), rgba(30, 30, 200, 0.2)),
    linear-gradient(45deg, #f4f1ec 0 45%, #d4c1a8 45% 62%, #2f2b28 62%);
  color: var(--surface);
  font-size: 12px;
  font-weight: 750;
}

.reference-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-image.focus-living {
  object-position: 25% 25%;
}

.reference-image.focus-material {
  object-position: 75% 75%;
}

.reference-image.focus-detail {
  object-position: 25% 75%;
}

.reference-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.reference-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-copy small {
  color: var(--ink-faint);
  font-size: 11px;
}

.message-meta,
.feedback-controls {
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: 11px;
}

.feedback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.feedback-controls button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
}

.feedback-controls button:hover {
  border-color: var(--ink-faint);
  color: var(--ink);
}

.typing {
  min-width: 48px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: typing 1.1s infinite ease-in-out;
}

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

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

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.quick-replies {
  width: min(90%, 650px);
  margin-left: 41px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-replies-label {
  flex-basis: 100%;
  color: var(--ink-faint);
  font-size: 11px;
}

.composer {
  padding: 8px 20px max(12px, env(safe-area-inset-bottom));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-left: max(20px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.composer-tools {
  margin-bottom: 7px;
}

.service-note {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-note.error,
.form-status {
  color: var(--red);
}

#chatForm {
  min-height: 52px;
  padding: 6px 6px 6px 14px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

#chatForm:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 12%, transparent);
}

#userInput {
  width: 100%;
  max-height: 116px;
  padding: 8px 0;
  overflow-y: auto;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
  scrollbar-color: #b8bcb7 transparent;
  scrollbar-width: thin;
}

#userInput::-webkit-scrollbar {
  width: 4px;
}

#userInput::-webkit-scrollbar-button {
  display: none;
}

#userInput::-webkit-scrollbar-thumb {
  border-radius: 2px;
  background: #b8bcb7;
}

#userInput::placeholder {
  color: var(--ink-faint);
}

.send-button {
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
}

.send-button:hover {
  background: var(--blue-dark);
}

.send-button.is-stopping {
  background: var(--red);
  font-size: 13px;
}

.contact-strip {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 11px;
}

.contact-strip a,
.modal a:not(.primary-button),
.source-list a {
  color: var(--blue-dark);
  font-weight: 700;
  text-decoration: none;
}

.design-panel {
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #fafaf8;
}

.panel-heading,
.section-heading,
.dialog-header,
.direction-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  padding-bottom: 13px;
  border-bottom: 2px solid var(--ink);
}

.panel-heading h2,
.dialog-header h2 {
  margin: 0;
  font-size: 18px;
}

.panel-heading > span,
.section-heading span {
  color: var(--ink-faint);
  font-size: 10px;
}

.profile-facts,
.dialog-profile {
  padding-block: 6px;
}

.profile-empty {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.profile-empty strong {
  font-size: 13px;
}

.profile-empty p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.profile-trust {
  margin-top: 13px;
  padding-top: 11px;
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 11px;
}

.profile-trust span::before {
  content: "✓";
  margin-right: 7px;
  color: var(--green);
  font-weight: 760;
}

.profile-row {
  padding: 9px 0;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.profile-row span {
  color: var(--ink-faint);
}

.profile-row strong {
  font-weight: 650;
  line-height: 1.55;
}

.empty-state {
  margin: 13px 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.panel-section {
  margin-top: 20px;
}

.dialog-agent-team {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}

.section-heading {
  margin-bottom: 8px;
  align-items: baseline;
}

.section-heading h3 {
  margin: 0;
  font-size: 13px;
}

.direction-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.chief-decision {
  padding: 12px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.chief-decision > span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 760;
}

.chief-decision.requires-review > span {
  color: var(--red);
}

.chief-decision p {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 640;
  line-height: 1.65;
}

.agent-team-row {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.agent-team-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.agent-team-heading strong {
  font-size: 12px;
}

.agent-status {
  color: var(--green);
  font-size: 10px;
  white-space: nowrap;
}

.agent-status.review {
  color: var(--red);
}

.agent-role,
.agent-finding {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.55;
}

.agent-role {
  color: var(--ink-faint);
}

.agent-finding {
  color: var(--ink-soft);
}

.direction-heading {
  align-items: baseline;
  justify-content: flex-start;
}

.direction-heading span {
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.direction-heading h4 {
  margin: 0;
  font-size: 13px;
}

.direction-item p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.direction-item p strong {
  color: var(--ink);
}

.budget-range {
  margin-top: 7px;
  display: block;
  color: var(--blue-dark);
  font-size: 18px;
}

.source-list {
  border-top: 1px solid var(--line);
}

.source-list button {
  width: 100%;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.source-list button span {
  color: var(--ink-faint);
  font-weight: 400;
  line-height: 1.55;
}

.source-list button small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.panel-actions {
  margin-top: 22px;
}

.panel-actions > * {
  flex: 1;
}

.modal {
  width: min(92%, 560px);
  max-height: min(84dvh, 760px);
  padding: 22px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.modal::backdrop {
  background: rgb(12 14 14 / 62%);
}

.image-dialog {
  width: min(94%, 820px);
}

.image-dialog img {
  width: 100%;
  max-height: 68dvh;
  display: block;
  object-fit: contain;
  border-radius: 7px;
  background: var(--surface-soft);
}

.dialog-intro {
  margin: 14px 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.brief-view {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}

.brief-summary {
  margin: 0 0 15px;
  font-size: 13px;
  line-height: 1.75;
}

.brief-view section {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.brief-view h3 {
  margin: 0 0 7px;
  font-size: 13px;
}

.brief-view ol {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.dialog-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

#handoffForm {
  display: grid;
  gap: 14px;
}

#handoffForm > label:not(.consent-row) {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

#handoffForm input:not([type="checkbox"]) {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 14px;
}

.consent-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.consent-row input {
  margin-top: 1px;
}

.form-status {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
}

.submit-handoff,
.dialog-call {
  width: 100%;
}

.direct-contact {
  margin: 14px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.about-dialog dl {
  margin: 0;
  border-top: 1px solid var(--line);
}

.about-dialog dl > div {
  padding: 11px 0;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.about-dialog dt {
  color: var(--ink-faint);
}

.about-dialog dd {
  margin: 0;
}

.dialog-call {
  margin-top: 18px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .app-shell {
    max-width: 760px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .design-panel {
    display: none;
  }

  .profile-trigger {
    display: inline-flex;
  }
}

@media (min-width: 901px) {
  .profile-trigger {
    display: none;
  }
}

@media (max-width: 620px) {
  .app-shell {
    border-inline: 0;
  }

  .topbar {
    min-height: 68px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .brand-copy h1 {
    font-size: 15px;
  }

  .brand-copy p {
    font-size: 11px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .call-link {
    min-height: var(--mobile-touch-target);
    padding-inline: 10px;
    font-size: 12px;
  }

  .primary-button,
  .secondary-button,
  .text-button,
  .quiet-button,
  .danger-button,
  .icon-button {
    min-height: var(--mobile-touch-target);
  }

  .icon-button {
    width: var(--mobile-touch-target);
    height: var(--mobile-touch-target);
  }

  .agent-bar {
    padding: 8px 14px;
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
    grid-template-columns: auto minmax(55px, 1fr) 36px;
    gap: 8px;
  }

  .memory-control {
    grid-column: 1 / -1;
    min-height: 30px;
    padding-top: 2px;
  }

  .memory-control input,
  .consent-row input {
    width: 20px;
    height: 20px;
  }

  .agent-progress-copy {
    min-width: 106px;
  }

  .stage-index {
    display: none;
  }

  .topic-nav {
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .topic-nav button,
  .quick-reply {
    min-height: var(--mobile-touch-target);
  }

  .chat-log {
    padding: 18px 14px;
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .welcome {
    padding-block: 2px 6px;
  }

  .welcome-mark {
    margin-bottom: 10px;
  }

  .welcome-mark img {
    width: 48px;
    height: 48px;
  }

  .welcome h2 {
    font-size: 23px;
  }

  .starter-grid {
    margin-top: 20px;
  }

  .starter-grid button {
    min-height: 76px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 11px;
  }

  .message {
    width: 96%;
  }

  .feedback-controls button {
    width: auto;
    min-width: var(--mobile-touch-target);
    height: var(--mobile-touch-target);
  }

  .quick-replies {
    width: calc(100% - 41px);
  }

  .composer {
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  #userInput {
    font-size: 16px;
  }

  .send-button {
    width: var(--mobile-touch-target);
    height: var(--mobile-touch-target);
    flex-basis: var(--mobile-touch-target);
  }

  .service-note {
    display: none;
  }

  .contact-strip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .call-link {
    display: none;
  }

  .topbar {
    gap: 10px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .profile-trigger {
    padding-inline: 10px;
  }

  .agent-bar {
    padding-block: 6px;
  }

  .topic-nav {
    padding-block: 6px;
  }

  .composer-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quiet-button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

  .contact-strip {
    justify-content: flex-end;
  }

  .contact-strip span {
    display: none;
  }

  .brand-copy p {
    max-width: 134px;
  }

  .starter-grid {
    grid-template-columns: 1fr;
  }

  .starter-grid button:last-child {
    grid-column: auto;
  }

  .welcome-copy {
    font-size: 13px;
  }

  .quiet-button {
    flex: 1;
  }
}

@media (max-width: 360px) {
  .topbar {
    min-height: 58px;
    padding-top: max(7px, env(safe-area-inset-top));
    padding-bottom: 7px;
    gap: 7px;
  }

  .brand {
    gap: 7px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .brand-copy h1 {
    font-size: 14px;
  }

  .brand-copy p {
    display: none;
  }

  .profile-trigger {
    padding-inline: 8px;
    font-size: 12px;
  }

  .agent-progress-copy {
    min-width: 88px;
  }

  .agent-progress-copy strong,
  .memory-control {
    font-size: 11px;
  }

  .chat-log {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .welcome-mark img {
    width: 44px;
    height: 44px;
  }

  .welcome h2 {
    font-size: 21px;
  }

  .message {
    width: 100%;
    gap: 7px;
  }

  .message-avatar {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
  }

  .message-avatar img {
    width: 25px;
    height: 25px;
  }

  .message-bubble {
    padding: 11px 12px;
  }

  .quick-replies {
    width: calc(100% - 36px);
    margin-left: 36px;
  }

  .modal {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    padding: 15px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .app-shell {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .topbar {
    min-height: 54px;
    padding-top: max(5px, env(safe-area-inset-top));
    padding-bottom: 5px;
  }

  .primary-button,
  .secondary-button,
  .text-button,
  .quiet-button,
  .danger-button,
  .icon-button {
    min-height: var(--mobile-touch-target);
  }

  .icon-button,
  .send-button {
    width: var(--mobile-touch-target);
    height: var(--mobile-touch-target);
  }

  .send-button {
    flex-basis: var(--mobile-touch-target);
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .brand-copy p,
  .topic-nav,
  .welcome-mark,
  .welcome-copy,
  .composer-tools,
  .contact-strip {
    display: none;
  }

  .agent-bar {
    min-height: 38px;
    padding-block: 4px;
    grid-template-columns: auto minmax(80px, 1fr) 34px auto;
  }

  .memory-control {
    min-height: 30px;
    grid-column: auto;
    padding-top: 0;
  }

  .chat-log {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .welcome {
    margin-block: 0;
    padding-block: 4px 10px;
  }

  .welcome h2 {
    font-size: 20px;
  }

  .starter-grid {
    margin-top: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .starter-grid button {
    min-height: 66px;
    padding-block: 8px;
  }

  .composer {
    padding-top: 5px;
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }

  #chatForm {
    min-height: 48px;
  }

  #userInput {
    font-size: 16px;
  }

  .memory-control input,
  .consent-row input {
    width: 20px;
    height: 20px;
  }

  .modal {
    max-height: calc(100dvh - 12px);
  }
}

@media (max-width: 900px) {
  body.is-welcome .chat-log {
    padding-inline: max(20px, env(safe-area-inset-left));
  }

  .welcome {
    max-width: 680px;
    min-height: auto;
    padding: 38px 0 44px;
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .welcome-intro {
    max-width: 580px;
  }

  .welcome-signature {
    margin-bottom: 18px;
  }

  .welcome-signature img {
    width: 64px;
    height: 64px;
  }

  .welcome h2 {
    font-size: clamp(38px, 8vw, 52px);
  }

  .welcome-copy {
    margin-top: 15px;
    font-size: 15px;
  }

  .welcome-reception {
    padding: 26px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .designer-opening {
    padding-top: 15px;
  }
}

@media (max-width: 620px) {
  body.is-welcome .topbar {
    padding-inline: 14px;
  }

  body.is-welcome .chat-log {
    padding: 0 max(14px, env(safe-area-inset-left));
  }

  .welcome {
    min-height: auto;
    padding: 26px 0 32px;
    gap: 24px;
  }

  .welcome-signature {
    margin-bottom: 14px;
  }

  .welcome-signature img {
    width: 54px;
    height: 54px;
  }

  .welcome-signature span {
    font-size: 11px;
  }

  .welcome h2 {
    font-size: 34px;
    line-height: 1.13;
  }

  .welcome-copy {
    font-size: 14px;
    line-height: 1.65;
  }

  .welcome-reception {
    padding-top: 20px;
  }

  .designer-opening > p {
    margin-top: 14px;
    font-size: 18px;
    line-height: 1.5;
  }

  .welcome-composer {
    margin-top: 18px;
    padding: 0;
  }

  .welcome-composer #chatForm {
    min-height: 60px;
    padding: 7px 7px 7px 13px;
  }

  .welcome-composer #userInput {
    font-size: 16px;
  }

  .welcome-composer .send-button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .starter-section {
    margin-top: 18px;
  }

  .starter-grid {
    margin-top: 0;
  }

  .starter-grid button {
    min-height: 46px;
    padding: 8px 2px;
  }
}

@media (max-width: 360px) {
  .welcome h2 {
    font-size: 29px;
  }

  .welcome-signature img {
    width: 48px;
    height: 48px;
  }

  .designer-opening > p {
    font-size: 17px;
  }

  .starter-grid button {
    min-height: 44px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  body.is-welcome .chat-log {
    padding-inline: max(18px, calc((100vw - 1120px) / 2));
  }

  .welcome {
    min-height: auto;
    padding: 18px 0;
    grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
    gap: 40px;
  }

  .welcome-signature {
    margin-bottom: 10px;
  }

  .welcome-signature img {
    width: 48px;
    height: 48px;
  }

  .welcome h2 {
    font-size: 32px;
  }

  .welcome-copy {
    display: block;
    margin-top: 10px;
    font-size: 13px;
  }

  .welcome-reception {
    padding: 0 0 0 30px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .designer-opening {
    padding-top: 10px;
  }

  .designer-opening > p {
    margin-top: 8px;
    font-size: 16px;
  }

  .welcome-composer {
    margin-top: 10px;
    padding: 0;
  }

  .welcome-composer #chatForm {
    min-height: 50px;
  }

  .starter-section {
    margin-top: 8px;
  }

  .starter-section > p {
    display: none;
  }

  .starter-grid {
    margin-top: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
  }

  .starter-grid button {
    min-height: 38px;
    padding: 5px 2px;
  }
}

@keyframes welcome-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .welcome-intro {
    animation: welcome-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .welcome-reception {
    animation: welcome-rise 0.55s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

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