:root {
  --green-900: #113d2b;
  --green-700: #1f8a55;
  --green-600: #24a05f;
  --green-100: #e8f6ee;
  --blue-700: #2166d5;
  --blue-100: #eaf2ff;
  --ink: #14211b;
  --muted: #66756d;
  --line: #dbe6df;
  --surface: #ffffff;
  --surface-soft: #f6faf8;
  --danger: #c63f3f;
  --danger-soft: #fff0f0;
  --shadow: 0 18px 48px rgba(17, 61, 43, 0.12);
  --radius: 8px;
  --max: 1120px;
  --app-header-height: 68px;
  --mobile-nav-height: 76px;
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--surface);
  color: var(--ink);
}

body,
button,
input,
textarea {
  font: inherit;
}

button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  border: 0;
  cursor: pointer;
}

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

.site-header,
.site-footer,
.section-shell {
  width: min(100% - 32px, var(--max));
  margin-inline: auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(31, 138, 85, 0.16);
  box-shadow: 0 8px 20px rgba(31, 138, 85, 0.22);
}

.brand-mark img {
  width: 86%;
  height: 86%;
  object-fit: contain;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.header-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--green-900);
  font-weight: 700;
  white-space: nowrap;
}

.home-hero {
  min-height: calc(100svh - 104px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.72fr);
  align-items: center;
  gap: 40px;
  padding: 36px 0 56px;
}

.eyebrow {
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-title-image {
  width: min(100%, 720px);
  max-height: 210px;
  margin-top: 12px;
  object-fit: contain;
  object-position: left center;
}

.hero-copy h1 {
  max-width: 760px;
  margin-top: 14px;
  font-size: clamp(40px, 7vw, 78px);
  line-height: 1.02;
  letter-spacing: 0;
  color: var(--green-900);
}

.hero-kicker {
  margin-top: 18px;
  color: var(--green-900);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.5;
}

.hero-value-list {
  max-width: 680px;
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.hero-value-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 138, 85, 0.16);
  border-radius: var(--radius);
  background: rgba(246, 250, 248, 0.96);
}

.hero-value-item strong {
  color: var(--green-900);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.3;
}

.hero-value-item p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-weight: 800;
  line-height: 1.2;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn:active,
.icon-button:active,
.nav-item:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--green-700);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-600);
}

.btn-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-900);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(198, 63, 63, 0.22);
}

.btn-large {
  min-height: 52px;
  padding-inline: 24px;
  font-size: 16px;
}

.btn-full {
  width: 100%;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.trust-row span,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  font-size: 13px;
  font-weight: 800;
}

.phone-preview {
  width: min(100%, 370px);
  justify-self: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f9f6 100%);
  box-shadow: var(--shadow);
}

.preview-top {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue-700);
}

.preview-card,
.preview-answer {
  margin-top: 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.preview-card {
  padding: 18px;
}

.preview-card p {
  margin-top: 14px;
  font-size: 19px;
  line-height: 1.45;
  font-weight: 800;
  color: var(--green-900);
}

.preview-answer {
  display: flex;
  gap: 12px;
  padding: 16px;
}

.answer-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-weight: 900;
}

.preview-answer p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 24px 0 58px;
}

.feature-tile {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tile-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 900;
}

.tile-icon.blue {
  background: var(--blue-100);
  color: var(--blue-700);
}

.feature-tile h2 {
  margin-top: 16px;
  font-size: 19px;
  color: var(--green-900);
}

.feature-tile p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.65;
}

.agent-section {
  padding: 38px 0 64px;
  border-top: 1px solid var(--line);
}

.section-heading {
  max-width: 720px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-top: 8px;
  color: var(--green-900);
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.08;
}

.section-heading p:not(.eyebrow) {
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.agent-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(31, 138, 85, 0.18);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 28px rgba(17, 61, 43, 0.06);
}

.agent-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  padding: 18px;
  border-bottom: 1px solid rgba(31, 138, 85, 0.12);
  background: #fff;
}

.agent-body {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.agent-code {
  width: fit-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 900;
}

.agent-body h3 {
  color: var(--green-900);
  font-size: 24px;
  line-height: 1;
}

.agent-body p {
  min-height: 72px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.agent-cases {
  display: grid;
  gap: 8px;
}

.agent-cases a {
  min-width: 0;
  min-height: 64px;
  display: grid;
  gap: 7px;
  align-content: center;
  padding: 10px;
  border: 1px solid rgba(31, 138, 85, 0.16);
  border-radius: var(--radius);
  background: rgba(232, 246, 238, 0.62);
  color: var(--green-900);
  line-height: 1.35;
}

.agent-cases a:hover {
  border-color: rgba(33, 102, 213, 0.35);
  background: #fff;
  color: var(--blue-700);
}

.case-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 900;
}

.case-meta {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.case-meta span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.case-meta .case-badge {
  color: var(--green-900);
  background: rgba(31, 138, 85, 0.12);
}

.case-meta .case-badge.is-multimodal {
  color: var(--blue-700);
  background: rgba(33, 102, 213, 0.12);
}

.partner-section {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  padding: 34px 0 54px;
  border-top: 1px solid var(--line);
}

.partner-section h2 {
  margin-top: 8px;
  color: var(--green-900);
  font-size: clamp(24px, 4vw, 34px);
}

.partner-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.partner-links a {
  min-width: 0;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid rgba(31, 138, 85, 0.18);
  border-radius: var(--radius);
  background: rgba(236, 247, 241, 0.72);
  color: var(--green-900);
}

.partner-links a:hover {
  border-color: rgba(31, 138, 85, 0.42);
  background: #fff;
}

.partner-links span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.auth-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(300px, 0.58fr);
  gap: 28px;
  align-items: start;
  padding: 48px 0 74px;
  border-top: 1px solid var(--line);
}

.auth-copy h2,
.view-heading h1 {
  margin-top: 8px;
  color: var(--green-900);
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.08;
}

.auth-copy p:not(.eyebrow) {
  max-width: 560px;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(17, 61, 43, 0.08);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--green-900);
  font-size: 14px;
  font-weight: 800;
}

.field + .field,
.code-row,
.checkline,
.auth-card .btn-full {
  margin-top: 14px;
}

.field input,
.composer textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input {
  padding: 0 14px;
}

.field input:focus,
.composer textarea:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(33, 102, 213, 0.12);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: end;
}

.code-button {
  width: 100%;
}

.checkline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.checkline input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--green-700);
}

.form-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-status.is-error {
  color: var(--danger);
}

.form-status.is-success {
  color: var(--green-700);
}

.site-footer {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--surface-soft);
  overflow: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: var(--app-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.user-pill {
  max-width: 46vw;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  width: min(100%, 960px);
  min-width: 0;
  height: calc(100vh - var(--app-header-height) - var(--mobile-nav-height));
  height: calc(100svh - var(--app-header-height) - var(--mobile-nav-height));
  height: calc(100dvh - var(--app-header-height) - var(--mobile-nav-height));
  overflow: hidden;
  margin: 0 auto;
  padding: 12px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

#view-chat.is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
}

.icon-button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--green-900);
  font-weight: 900;
  font-size: 22px;
}

.icon-button.subtle {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 24px;
}

.chat-panel {
  min-height: 0;
  width: min(100%, 1080px);
  margin-inline: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 10px;
  scroll-padding-bottom: 10px;
}

.case-package {
  width: min(100%, 980px);
  margin: 0 auto 8px;
  padding: 16px;
  border: 1px solid rgba(31, 138, 85, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, rgba(243, 250, 246, 0.96) 100%);
  box-shadow: 0 18px 44px rgba(19, 72, 47, 0.08);
}

.case-package-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.case-package-kicker {
  margin-bottom: 6px;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 900;
}

.case-package h3 {
  margin: 0;
  color: var(--green-900);
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
}

.case-package-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.case-package-meta span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(31, 138, 85, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.case-package-meta .is-mode {
  color: var(--blue-700);
  border-color: rgba(33, 102, 213, 0.18);
  background: rgba(236, 246, 255, 0.9);
}

.case-package-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.case-package-section {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(31, 138, 85, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.case-package-section strong {
  display: block;
  margin-bottom: 7px;
  color: var(--green-900);
  font-size: 13px;
}

.case-package-section p,
.case-package-section li {
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.case-package-section ul {
  margin: 0;
  padding-left: 18px;
}

.case-package-section li + li {
  margin-top: 5px;
}

.case-package-assets {
  display: grid;
  gap: 10px;
}

.case-asset {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.case-asset img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
}

.case-asset figcaption {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.case-package-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.case-package-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(31, 138, 85, 0.2);
  border-radius: var(--radius);
  background: #fff;
  color: var(--green-900);
  font-weight: 900;
}

.case-package-actions .primary {
  border-color: rgba(31, 138, 85, 0.38);
  background: var(--green-600);
  color: #fff;
}

.message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
}

.message.user {
  justify-content: flex-end;
}

.message.user .avatar {
  display: none;
}

.avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(31, 138, 85, 0.16);
  font-weight: 900;
}

.avatar img {
  width: 86%;
  height: 86%;
  object-fit: contain;
}

.bubble {
  max-width: min(86vw, 860px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.message.assistant .bubble {
  width: min(100%, 860px);
}

.message.user .bubble {
  max-width: min(78vw, 680px);
}

.message.user .bubble {
  border-color: rgba(31, 138, 85, 0.24);
  background: rgba(232, 246, 238, 0.78);
  color: var(--green-900);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.bubble p + p {
  margin-top: 8px;
}

.bubble.markdown {
  font-size: 15.5px;
}

.bubble.markdown h2,
.bubble.markdown h3,
.bubble.markdown h4 {
  margin: 12px 0 6px;
  color: var(--green-900);
  line-height: 1.28;
}

.bubble.markdown h2 {
  font-size: 20px;
}

.bubble.markdown h3 {
  font-size: 17px;
}

.bubble.markdown h4 {
  font-size: 16px;
}

.bubble.markdown ul,
.bubble.markdown ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

.bubble.markdown li + li {
  margin-top: 6px;
}

.bubble.markdown hr {
  height: 1px;
  margin: 14px 0;
  border: 0;
  background: var(--line);
}

.bubble.markdown code {
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--green-900);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.bubble.markdown pre {
  margin: 10px 0 0;
  padding: 12px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: #10231a;
  color: #e9fff3;
}

.bubble.markdown pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.bubble.markdown .table-wrap {
  width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bubble.markdown table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}

.bubble.markdown th,
.bubble.markdown td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.bubble.markdown .source-ref {
  color: var(--blue-700);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bubble.markdown .source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.bubble.markdown .source-chip {
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue-700);
  background: #f8fbff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bubble.markdown .source-chip:hover {
  border-color: rgba(35, 119, 210, 0.35);
  background: #eef6ff;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.copy-message,
.regenerate-message {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.copy-message:hover,
.regenerate-message:hover {
  color: var(--blue-700);
  border-color: rgba(33, 102, 213, 0.26);
  background: #f8fbff;
}

.copy-message:disabled,
.regenerate-message:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.bubble.markdown th:last-child,
.bubble.markdown td:last-child {
  border-right: 0;
}

.bubble.markdown th {
  background: var(--surface-soft);
  color: var(--green-900);
  font-weight: 800;
  white-space: nowrap;
}

.bubble.markdown tbody tr:last-child td {
  border-bottom: 0;
}

.attachment-list {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.attachment-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: min(300px, 100%);
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid rgba(33, 128, 205, 0.24);
  border-radius: 8px;
  background: #eaf5ff;
  color: #1464b3;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.attachment-card:hover {
  border-color: rgba(33, 128, 205, 0.42);
  background: #dff0ff;
}

.attachment-card.is-disabled {
  pointer-events: none;
  opacity: 0.78;
}

.attachment-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #1b83d8;
  font-size: 22px;
  line-height: 1;
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  color: #1168bd;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card span:nth-child(3) {
  display: none;
}

.attachment-card strong {
  min-width: 42px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #1f86df;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.message.user .attachment-list {
  justify-items: end;
}

.message.user .attachment-card {
  background: #e7f4ff;
}

.bubble img {
  width: min(260px, 68vw);
  margin-top: 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.composer {
  position: relative;
  z-index: 4;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(17, 61, 43, 0.09);
  backdrop-filter: blur(16px);
}

.composer .form-status {
  min-height: 0;
  margin-top: 6px;
}

.composer .form-status:empty {
  display: none;
}

.composer textarea {
  min-height: 44px;
  max-height: 104px;
  resize: none;
  padding: 10px 12px;
  line-height: 1.45;
}

.composer-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-input {
  flex: 1 1 auto;
  min-width: min(220px, 100%);
}

.attach-wrap {
  position: relative;
  flex: 0 0 auto;
}

.attach-button {
  border-radius: 999px;
  background: var(--surface-soft);
}

.composer-tools {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-toggle {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tool-toggle:hover {
  border-color: rgba(33, 102, 213, 0.26);
  color: var(--green-900);
}

.tool-toggle.is-active {
  border-color: rgba(31, 138, 85, 0.34);
  background: var(--green-100);
  color: var(--green-900);
  box-shadow: inset 0 0 0 1px rgba(31, 138, 85, 0.08);
}

.attach-menu {
  position: absolute;
  right: auto;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(280px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 42px rgba(17, 61, 43, 0.16);
}

.attach-menu.is-hidden {
  display: none;
}

.attach-option {
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--green-900);
  cursor: pointer;
}

.attach-option:hover {
  background: var(--green-100);
}

.attach-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attach-option span {
  font-weight: 900;
}

.attach-option small {
  color: var(--muted);
  font-size: 12px;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.send-button {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 44px;
  padding-inline: 14px;
}

.upload-preview {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.upload-preview.is-hidden {
  display: none;
}

.upload-preview img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.upload-preview.is-text-file img {
  display: none;
}

.upload-preview.is-text-file {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.upload-preview strong,
.upload-preview span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-preview strong {
  color: var(--green-900);
  font-size: 14px;
}

.upload-preview span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-card,
.empty-state,
.profile-panel,
.profile-actions {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.history-card button {
  justify-self: end;
}

.history-main {
  min-width: 0;
  display: block;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.history-title {
  color: var(--green-900);
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.profile-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.profile-avatar {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 24px;
  font-weight: 900;
}

.profile-panel h2 {
  color: var(--green-900);
  font-size: 22px;
}

.profile-panel p {
  margin-top: 4px;
  color: var(--muted);
}

.profile-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.nav-item {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
}

.nav-item span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 900;
}

.nav-item strong {
  font-size: 12px;
}

.nav-item.is-active {
  background: var(--green-100);
  color: var(--green-900);
}

.nav-item.is-active span {
  background: var(--green-700);
  color: #fff;
}

.nav-new-chat {
  border: 1px solid rgba(31, 138, 85, 0.26);
  background: var(--green-600);
  color: #fff;
}

.nav-new-chat:hover {
  background: var(--green-700);
}

@media (min-width: 760px) {
  :root {
    --mobile-nav-height: 0px;
  }

  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .app-header {
    grid-column: 1 / -1;
    padding-inline: 24px;
  }

  .app-main {
    grid-column: 2;
    height: calc(100svh - var(--app-header-height));
    overflow: hidden;
    padding: 28px 28px 42px;
  }

  .bottom-nav {
    position: sticky;
    top: 69px;
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - 69px);
    padding: 18px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: #fff;
  }

  .nav-new-chat {
    margin-bottom: 8px;
    justify-content: flex-start;
  }

  .nav-item {
    justify-content: flex-start;
    min-height: 48px;
    padding: 0 12px;
  }

  .nav-item strong {
    justify-self: start;
    font-size: 14px;
  }

  .composer {
    max-width: 984px;
  }
}

@media (min-width: 1180px) {
  .app-main {
    width: min(100%, 1040px);
  }
}

@media (max-width: 1040px) {
  .agent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app-main {
    width: 100%;
    height: calc(100vh - var(--app-header-height) - var(--mobile-nav-height));
    height: calc(100dvh - var(--app-header-height) - var(--mobile-nav-height));
    padding: 12px 12px 0;
  }

  #view-chat.is-active {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  .chat-panel {
    width: 100%;
    padding-bottom: 168px;
    scroll-padding-bottom: 168px;
  }

  .composer {
    position: fixed;
    right: 10px;
    bottom: calc(var(--mobile-nav-height) + max(8px, env(safe-area-inset-bottom)));
    left: 10px;
    z-index: 8;
    width: auto;
    max-height: min(36vh, 188px);
    padding: 6px;
    overflow-y: auto;
  }

  .composer-row {
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .composer textarea {
    min-height: 38px;
    max-height: 82px;
    padding: 8px 9px;
    font-size: 14px;
    line-height: 1.35;
  }

  .composer .icon-button {
    width: 38px;
    height: 38px;
    font-size: 19px;
  }

  .composer-tools {
    order: 1;
    gap: 4px;
  }

  .tool-toggle {
    min-height: 32px;
    padding: 0 8px;
    font-size: 11px;
  }

  .composer-input {
    order: 2;
    min-width: 0;
    flex: 1 1 0;
  }

  .send-button {
    order: 3;
    flex: 0 0 56px;
    min-width: 56px;
    min-height: 38px;
    padding-inline: 8px;
    font-size: 14px;
  }

  .bubble,
  .message.assistant .bubble,
  .message.user .bubble {
    width: auto;
    max-width: calc(100vw - 34px);
  }

  .bubble.markdown table {
    min-width: 640px;
  }

  .case-package {
    padding: 13px;
  }

  .case-package-header,
  .case-package-grid {
    grid-template-columns: 1fr;
  }

  .case-package-header {
    display: grid;
  }

  .home-hero,
  .auth-section,
  .partner-section,
  .home-grid {
    grid-template-columns: 1fr;
  }

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

  .home-hero {
    min-height: auto;
    gap: 28px;
    padding-top: 18px;
  }

  .phone-preview {
    justify-self: stretch;
    width: 100%;
  }

  .hero-copy h1 {
    font-size: clamp(36px, 11vw, 52px);
  }

  .hero-title-image {
    max-height: 150px;
    object-position: left center;
  }

  .hero-kicker {
    font-size: 18px;
  }

  .hero-value-item {
    padding: 13px 14px;
  }

  .hero-value-item p {
    font-size: 14px;
  }

  .auth-section {
    padding-top: 36px;
  }

  .partner-links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .site-header,
  .site-footer,
  .section-shell {
    width: min(100% - 24px, var(--max));
  }

  .site-header {
    min-height: 64px;
  }

  .brand small {
    display: none;
  }

  .header-link {
    padding-inline: 10px;
    font-size: 13px;
  }

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

  .btn-large {
    width: 100%;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

  .site-footer {
    display: grid;
    align-content: center;
  }

  .app-header {
    padding-inline: 12px;
  }

  .brand.compact small {
    display: none;
  }

  .user-pill {
    max-width: 42vw;
  }

  .app-main {
    padding: 12px 12px 0;
  }

  .view-heading h1 {
    font-size: 30px;
  }

  .history-card {
    grid-template-columns: 1fr;
  }

  .history-actions {
    width: 100%;
  }

  .history-actions .btn,
  .history-actions .icon-button {
    flex: 1;
  }
}
