:root {
  --composer-offset: 248px;
  --bg-top: #f3f7ff;
  --bg-bottom: #eef3fb;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: rgba(255, 255, 255, 0.985);
  --surface-soft: rgba(248, 251, 255, 0.95);
  --line: rgba(201, 215, 241, 0.72);
  --line-soft: rgba(227, 235, 248, 0.92);
  --text-main: #1a2554;
  --text-soft: #58668f;
  --text-faint: #8d98bd;
  --brand: #2c75ff;
  --brand-2: #20d0df;
  --brand-3: #7ba9ff;
  --navy: #132768;
  --good: #45a55f;
  --warn: #e19523;
  --danger: #f16e4e;
  --shadow-page: 0 24px 54px rgba(70, 111, 188, 0.16);
  --shadow-card: 0 12px 28px rgba(62, 109, 198, 0.08);
  --shadow-soft: 0 8px 24px rgba(97, 136, 207, 0.07);
  --radius-page: 34px;
  --radius-card: 24px;
  --radius-mid: 18px;
  --radius-pill: 999px;
  --font-body: "MiSans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text-main);
  background:
    radial-gradient(circle at 10% 8%, rgba(95, 150, 255, 0.18), transparent 26%),
    radial-gradient(circle at 100% 0%, rgba(65, 214, 255, 0.14), transparent 24%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  padding: 18px;
}

.floating-notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: min(360px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(187, 209, 248, 0.92);
  background: rgba(18, 38, 95, 0.92);
  color: #f4f8ff;
  box-shadow: 0 18px 44px rgba(24, 48, 112, 0.24);
  line-height: 1.65;
  font-size: 0.94rem;
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.floating-notice.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

button,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

.skip-link,
.sr-only {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 12px;
  background: white;
}

.chat-page {
  min-height: calc(100vh - 48px);
}

.page-shell {
  max-width: 1640px;
  margin: 0 auto;
}

.screen-card {
  padding: 18px;
  border-radius: var(--radius-page);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.8)),
    linear-gradient(180deg, rgba(244, 248, 255, 0.96), rgba(238, 243, 252, 0.9));
  border: 1px solid rgba(218, 228, 247, 0.9);
  box-shadow: var(--shadow-page);
}

.ama-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  gap: 18px;
  align-items: stretch;
  transition: grid-template-columns 260ms ease;
}

.ama-layout:has(.ama-sidebar.is-open) {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
}

.ama-main {
  display: contents;
}

.hero-card {
  grid-column: 1 / -1;
}

.workspace-panel,
.guess-panel,
.composer-dock {
  grid-column: 1;
  min-width: 0;
}

.section-card {
  position: relative;
  border-radius: 24px;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(250, 252, 255, 0.97));
  box-shadow: var(--shadow-card);
}

.block-card,
.composer-card {
  overflow: hidden;
}

.hero-card {
  position: relative;
  overflow: visible;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(260px, 0.72fr);
  gap: 14px;
  padding: 44px 26px 18px;
  min-height: 154px;
  border-color: rgba(214, 225, 244, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(247, 250, 255, 0.965));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 12px 30px rgba(85, 122, 193, 0.08);
}

.hero-actions {
  position: absolute;
  top: 18px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  max-width: calc(100% - 28px);
}

.language-switch {
  display: flex;
}

.new-chat-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(215, 226, 246, 0.94);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(97, 136, 207, 0.08);
}

.new-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(225, 233, 248, 0.96);
  background: rgba(246, 249, 255, 0.9);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.new-chat-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.new-chat-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(90, 143, 244, 0.4);
  color: var(--brand);
  box-shadow: 0 10px 22px rgba(98, 136, 207, 0.14);
}

.new-chat-btn:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
  box-shadow: none;
}

.language-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  min-width: 160px;
  min-height: 40px;
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(215, 226, 246, 0.94);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  box-shadow: 0 8px 20px rgba(97, 136, 207, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.language-toggle-track {
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(231, 239, 255, 0.92), rgba(242, 247, 255, 0.96));
}

.language-toggle-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(50% - 2px);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #2f76ff, #1e57d8);
  box-shadow: 0 12px 24px rgba(41, 116, 255, 0.24);
  transition: transform 200ms ease;
}

.language-toggle[data-lang="en"] .language-toggle-thumb {
  transform: translateX(100%);
}

.language-toggle-option {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--text-soft);
  transition: color 180ms ease;
}

.language-toggle[data-lang="zh"] .language-toggle-option-zh,
.language-toggle[data-lang="en"] .language-toggle-option-en {
  color: #fff;
}

.language-toggle[data-lang="zh"] .language-toggle-option-en,
.language-toggle[data-lang="en"] .language-toggle-option-zh {
  color: var(--text-soft);
}

.language-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(90, 143, 244, 0.45);
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 6px 4px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(215, 226, 246, 0.94);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(97, 136, 207, 0.08);
  color: var(--text-main);
}

.account-avatar {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 190, 118, 0.95), rgba(238, 133, 83, 0.95));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(238, 133, 83, 0.24);
}

.account-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 700;
}

.account-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(225, 233, 248, 0.96);
  background: rgba(246, 249, 255, 0.9);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.account-logout svg {
  width: 16px;
  height: 16px;
}

.account-logout:hover {
  transform: translateY(-1px);
  border-color: rgba(90, 143, 244, 0.4);
  color: var(--brand);
  box-shadow: 0 10px 22px rgba(98, 136, 207, 0.14);
}

.hero-card::before,
.block-card::before,
.composer-card::before,
.workflow-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 0% 0%, rgba(82, 147, 255, 0.045), transparent 32%),
    radial-gradient(circle at 100% 100%, rgba(98, 214, 255, 0.04), transparent 24%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.hero-copy h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.14;
  letter-spacing: -0.03em;
}

.hero-desc,
.muted-copy,
.message-body,
.workflow-stage-body,
.analysis-summary,
.insight-summary,
.composer-hint {
  color: var(--text-soft);
  line-height: 1.75;
}

.hero-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
}

.hero-tool,
.message-logo,
.data-switch-tab,
.insight-action,
.insight-priority,
.date-chip,
.composer-counter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(222, 230, 245, 0.96);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-soft);
  font-size: 0.86rem;
  box-shadow: 0 6px 18px rgba(97, 136, 207, 0.06);
}

.hero-tool {
  position: relative;
  justify-content: center;
  min-width: 104px;
  padding-right: calc(13px + 1em);
  white-space: nowrap;
}

.hero-tool-knowledge-wrap {
  position: relative;
  display: inline-flex;
  z-index: 8;
}

.hero-tool-knowledge {
  color: #1849b8;
  border-color: rgba(73, 129, 233, 0.78);
  background: linear-gradient(135deg, rgba(209, 226, 255, 0.98), rgba(179, 208, 255, 0.98));
  box-shadow: 0 12px 24px rgba(79, 123, 210, 0.24);
}

.hero-tool-knowledge[aria-expanded="true"] {
  border-color: rgba(48, 101, 214, 0.88);
  box-shadow: 0 14px 28px rgba(60, 105, 196, 0.28);
}

.hero-tool-knowledge i {
  color: inherit;
}

.hero-tool-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a5c, #ff5f6d);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(255, 95, 109, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.95);
}

.knowledge-popover {
  position: absolute;
  top: 0;
  left: calc(100% + 14px);
  z-index: 30;
  width: min(420px, calc(100vw - 72px));
  transform: translate3d(0, 0, 0);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
}

.knowledge-popover::before {
  content: "";
  position: absolute;
  top: 0;
  right: 100%;
  width: 18px;
  height: 100%;
}

.knowledge-popover.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.knowledge-popover-inner {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(189, 209, 245, 0.96);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.998), rgba(244, 248, 255, 0.99));
  box-shadow: 0 24px 56px rgba(33, 66, 138, 0.22);
  backdrop-filter: blur(12px);
}

.knowledge-popover-inner::before {
  content: "";
  position: absolute;
  top: 28px;
  right: 100%;
  width: 14px;
  height: 14px;
  background: rgba(250, 252, 255, 0.99);
  border-left: 1px solid rgba(189, 209, 245, 0.96);
  border-bottom: 1px solid rgba(189, 209, 245, 0.96);
  transform: translate(7px, 0) rotate(45deg);
}

.knowledge-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(560px, calc(100vh - 96px));
}

@media (min-width: 1181px) {
  .hero-tools {
    flex-wrap: nowrap;
    gap: 4px;
  }

  .hero-tool {
    min-width: 0;
    padding-left: 11px;
    padding-right: calc(11px + 1em);
    font-size: 0.84rem;
  }
}

.knowledge-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(219, 229, 247, 0.96);
  background: linear-gradient(135deg, rgba(240, 246, 255, 0.98), rgba(230, 240, 255, 0.98));
}

.knowledge-panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #18306e;
}

.knowledge-panel-subtitle {
  margin: 6px 0 0;
  color: #6f80a8;
  font-size: 12.5px;
  line-height: 1.5;
}

.knowledge-panel-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(195, 210, 239, 0.96);
  background: rgba(255, 255, 255, 0.9);
  color: #5c6f97;
  box-shadow: 0 8px 18px rgba(93, 123, 184, 0.12);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.knowledge-panel-close:hover {
  background: rgba(242, 247, 255, 0.98);
  border-color: rgba(146, 176, 229, 0.98);
  color: #224da8;
}

.knowledge-panel-close:focus-visible {
  outline: none;
  border-color: rgba(68, 118, 227, 0.94);
  box-shadow: 0 0 0 4px rgba(77, 131, 255, 0.12);
}

.knowledge-panel-close span {
  font-size: 22px;
  line-height: 1;
  transform: translateY(-1px);
}

.knowledge-panel-body {
  overflow-y: auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.knowledge-panel-status,
.knowledge-panel-empty {
  padding: 18px 16px;
  border-radius: 18px;
  border: 1px dashed rgba(198, 214, 241, 0.96);
  background: rgba(248, 251, 255, 0.92);
  color: #6f80a8;
  line-height: 1.7;
  font-size: 13px;
}

.knowledge-panel-error {
  color: #c3563f;
  border-color: rgba(240, 195, 182, 0.98);
  background: rgba(255, 246, 243, 0.94);
}

.knowledge-item {
  border: 1px solid rgba(213, 225, 245, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 24px rgba(92, 128, 195, 0.08);
}

.knowledge-item-view,
.knowledge-item-edit {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.knowledge-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.knowledge-item-name {
  margin: 0;
  color: #1c2e66;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 800;
}

.knowledge-item-time {
  color: #8190b3;
  font-size: 12px;
  line-height: 1.4;
}

.knowledge-item-value {
  margin: 0;
  color: #4d5d82;
  font-size: 13px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.knowledge-item-actions,
.knowledge-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.knowledge-action,
.knowledge-save,
.knowledge-cancel {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(214, 224, 243, 0.96);
  background: rgba(247, 250, 255, 0.95);
  color: #48608f;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: none;
}

.knowledge-action:hover,
.knowledge-save:hover,
.knowledge-cancel:hover {
  border-color: rgba(156, 185, 236, 0.98);
  background: rgba(237, 244, 255, 0.98);
}

.knowledge-action-danger {
  color: #c3563f;
  background: rgba(255, 245, 241, 0.95);
  border-color: rgba(244, 201, 191, 0.98);
}

.knowledge-action-danger:hover {
  background: rgba(255, 239, 233, 0.98);
  border-color: rgba(236, 174, 160, 0.98);
}

.knowledge-save {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #2f76ff, #1f59dd);
  box-shadow: 0 10px 18px rgba(47, 118, 255, 0.22);
}

.knowledge-cancel {
  background: rgba(255, 255, 255, 0.98);
}

.knowledge-edit-field {
  display: grid;
  gap: 6px;
}

.knowledge-edit-label {
  color: #607196;
  font-size: 12px;
  font-weight: 700;
}

.knowledge-edit-input,
.knowledge-edit-textarea {
  width: 100%;
  border: 1px solid rgba(203, 217, 242, 0.98);
  border-radius: 14px;
  background: rgba(251, 253, 255, 0.98);
  color: #1f2d5f;
  padding: 10px 12px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.knowledge-edit-input:focus,
.knowledge-edit-textarea:focus {
  border-color: rgba(68, 118, 227, 0.94);
  box-shadow: 0 0 0 4px rgba(77, 131, 255, 0.12);
}

.knowledge-edit-textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.65;
}

.knowledge-panel-body::-webkit-scrollbar {
  width: 10px;
}

.knowledge-panel-body::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(151, 174, 222, 0.85);
  background-clip: padding-box;
}

.knowledge-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.hero-tool i,
.title-badge i,
.stage-title i,
.message-logo,
.insight-action,
.data-switch-tab.is-active {
  display: inline-grid;
  place-items: center;
}

.hero-tool svg,
.title-badge svg,
.stage-title svg,
.message-logo svg {
  width: 20px;
  height: 20px;
}

.hero-visual {
  position: relative;
  min-height: 108px;
  opacity: 0.64;
}

.float-cube,
.stack-layer,
.stack-core {
  position: absolute;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(132, 180, 255, 0.25));
  border: 1px solid rgba(215, 228, 255, 0.88);
  box-shadow: 0 14px 28px rgba(90, 133, 214, 0.12);
}

.float-cube-sm {
  top: 10px;
  left: 26%;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  transform: rotate(18deg);
}

.float-cube-md {
  top: 34px;
  left: 36%;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  transform: rotate(16deg);
}

.hero-stack {
  position: absolute;
  right: 16px;
  bottom: -2px;
  width: 188px;
  height: 122px;
}

.stack-layer {
  width: 132px;
  height: 84px;
  right: 12px;
}

.layer-1 { bottom: 0; opacity: 0.95; }
.layer-2 { right: 22px; bottom: 18px; opacity: 0.9; }
.layer-3 { right: 32px; bottom: 36px; opacity: 0.82; }

.stack-core {
  width: 32px;
  height: 32px;
  right: 82px;
  bottom: 66px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 205, 233, 0.95), rgba(132, 180, 255, 0.08) 65%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(132, 180, 255, 0.2));
}

.block-card,
.composer-card {
  margin-top: 16px;
  padding: 18px 20px 20px;
}

.guess-panel {
  border: 1px solid rgba(220, 232, 250, 0.98);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.995), rgba(249, 251, 255, 0.985));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 10px 22px rgba(96, 129, 196, 0.08);
}

.guess-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 0% 0%, rgba(82, 147, 255, 0.035), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 44%);
}

.composer-dock {
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.composer-dock .composer-card {
  margin-top: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.992), rgba(249, 251, 255, 0.984));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 18px 44px rgba(62, 109, 198, 0.16),
    0 10px 30px rgba(97, 136, 207, 0.12);
}

.block-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-badge,
.stage-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.title-badge h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.workspace-panel {
  margin-top: 16px;
}

.ama-sidebar {
  grid-column: 2;
  grid-row: 2 / span 12;
  width: 0;
  max-height: 0;
  min-width: 0;
  height: auto;
  min-height: 0;
  align-self: start;
  opacity: 0;
  overflow: visible;
  pointer-events: none;
  transform: translateX(18px);
  transition: width 480ms ease, max-height 480ms ease, opacity 400ms ease, transform 480ms ease;
  transform-origin: top right;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.ama-sidebar.is-open {
  position: sticky;
  top: 18px;
  width: 100%;
  max-height: none;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.ama-sidebar.is-opening {
  animation: sidebarReveal 780ms cubic-bezier(0.16, 0.84, 0.2, 1);
}

.analysis-sidebar-inner {
  display: grid;
  align-content: start;
  align-items: start;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  scrollbar-gutter: stable;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.analysis-sidebar-inner::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.analysis-sidebar-group {
  display: grid;
  gap: 12px;
}

.analysis-sidebar-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: 1px solid rgba(223, 232, 246, 0.98);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.992), rgba(248, 251, 255, 0.982));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 18px rgba(96, 129, 196, 0.05);
}

.analysis-sidebar-card.is-complete,
.analysis-sidebar-card.is-pending {
  max-height: calc((var(--analysis-sidebar-height, 100vh) - 12px) / 2);
}

.ama-sidebar.is-opening .analysis-sidebar-card {
  opacity: 0;
  transform: translate3d(18px, 12px, 0) scale(0.985);
  animation: sidebarCardReveal 680ms cubic-bezier(0.16, 0.84, 0.2, 1) forwards;
}

.ama-sidebar.is-opening .analysis-sidebar-card:nth-of-type(1) {
  animation-delay: 120ms;
}

.ama-sidebar.is-opening .analysis-sidebar-card:nth-of-type(2) {
  animation-delay: 230ms;
}

.ama-sidebar.is-opening .analysis-sidebar-card:nth-of-type(3) {
  animation-delay: 340ms;
}

.ama-sidebar.is-opening .analysis-sidebar-card:nth-of-type(4) {
  animation-delay: 450ms;
}

.analysis-sidebar-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 0% 0%, rgba(82, 147, 255, 0.035), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 44%);
}

@keyframes sidebarReveal {
  0% {
    opacity: 0;
    transform: translateX(26px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes sidebarCardReveal {
  0% {
    opacity: 0;
    transform: translate3d(18px, 12px, 0) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.analysis-sidebar-head,
.analysis-sidebar-title,
.analysis-sidebar-body,
.analysis-sidebar-points,
.analysis-sidebar-empty {
  position: relative;
  z-index: 1;
}

.analysis-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(231, 237, 248, 0.92);
}

.analysis-sidebar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.analysis-sidebar-title i {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #4b86ff;
  background: linear-gradient(180deg, rgba(231, 239, 255, 0.98), rgba(243, 247, 255, 0.98));
  border: 1px solid rgba(211, 224, 247, 0.98);
  box-shadow: 0 8px 16px rgba(101, 137, 211, 0.08);
}

.analysis-sidebar-title svg {
  width: 16px;
  height: 16px;
}

.analysis-sidebar-title h3 {
  margin: 0;
  color: #19306f;
  font-size: 16px;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.analysis-sidebar-status {
  display: none;
}

.analysis-sidebar-body p {
  margin: 0;
  color: #7382a4;
  line-height: 1.74;
  font-size: 13.8px;
  font-weight: 400;
}

.analysis-sidebar-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(134, 160, 211, 0.9) rgba(230, 237, 248, 0.88);
}

.analysis-sidebar-body::-webkit-scrollbar {
  width: 8px;
}

.analysis-sidebar-body::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(230, 237, 248, 0.88);
}

.analysis-sidebar-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(134, 160, 211, 0.9);
}

.intent-stage {
  display: grid;
  gap: 12px;
}

.intent-stage-intro {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.72;
  font-size: 14px;
}

.intent-focus-card,
.intent-detail-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(216, 227, 246, 0.96);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.998), rgba(246, 250, 255, 0.99));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.intent-focus-card {
  padding: 14px 16px;
  border-radius: 18px;
}

.intent-focus-label {
  display: inline-block;
  margin-bottom: 8px;
  color: #6c7ea5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intent-focus-card strong {
  display: block;
  color: #18306e;
  font-size: 18px;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.intent-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.intent-detail-card {
  padding: 13px 14px 14px;
  border-radius: 16px;
}

.intent-detail-title {
  margin: 0 0 10px;
  color: #27437f;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 700;
}

.intent-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.intent-token {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(205, 219, 245, 0.98);
  background: rgba(255, 255, 255, 0.94);
  color: #566684;
  font-size: 13px;
  line-height: 1.45;
}

.intent-token-muted {
  color: #8191b2;
  background: rgba(246, 249, 255, 0.96);
}

.analysis-sidebar-body > .data-switch-card,
.analysis-sidebar-body > .viz-card,
.analysis-sidebar-body > .table-card {
  margin-top: 14px;
}

.analysis-sidebar-stage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.analysis-sidebar-stage-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.analysis-sidebar-stage-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--brand);
  background: linear-gradient(180deg, rgba(80, 140, 255, 0.16), rgba(80, 140, 255, 0.03));
  border: 1px solid rgba(80, 140, 255, 0.16);
  font-weight: 700;
  font-size: 0.8rem;
}

.analysis-sidebar-stage-copy {
  color: #7384a5;
  font-size: 13.8px;
  line-height: 1.72;
}

.analysis-sidebar-stage-copy-insight {
  display: grid;
  gap: 12px;
}

.analysis-sidebar-stage-text {
  display: grid;
  gap: 4px;
}

.analysis-sidebar-stage-copy strong {
  color: var(--text-main);
  font-weight: 600;
}

.analysis-sidebar-stage-copy span {
  display: block;
  margin-top: 4px;
  color: inherit;
}

.analysis-sidebar-stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.analysis-sidebar-points {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-main);
  display: grid;
  gap: 10px;
}

.analysis-sidebar-points li {
  color: #7384a5;
  line-height: 1.72;
  font-size: 13.8px;
}

.analysis-sidebar-card.is-pending {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.97));
}

.analysis-sidebar-card.is-pending .analysis-sidebar-title i {
  color: #8aa1c8;
  background: linear-gradient(180deg, rgba(239, 243, 251, 0.98), rgba(247, 249, 253, 0.98));
  border-color: rgba(223, 231, 244, 0.98);
}

.analysis-sidebar-card.is-pending .analysis-sidebar-status {
  visibility: hidden;
}

.analysis-sidebar-placeholder {
  min-height: 148px;
  display: grid;
  place-items: center;
  text-align: left;
}

.analysis-sidebar-empty p {
  color: #8a98bb;
  font-weight: 500;
}

.message-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
}

.message-list:empty::before {
  content: attr(data-empty);
  display: block;
  padding: 20px 22px;
  border-radius: 20px;
  border: 1px dashed rgba(166, 187, 228, 0.92);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-soft);
  line-height: 1.7;
}

.message {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  animation: message-in .22s ease;
}

.message-user {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: end;
  align-items: center;
}

.message-assistant {
  grid-template-columns: minmax(0, 1fr);
}

.message-user .message-bubble {
  order: 1;
  justify-self: end;
  width: fit-content;
  max-width: min(100%, 820px);
}

.message-user .message-meta {
  order: 2;
  align-self: center;
  padding-top: 0;
}

.message-assistant .message-bubble {
  order: 1;
  width: 100%;
  max-width: 100%;
}

.message-meta {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.message-logo {
  min-width: 46px;
  height: 46px;
  padding: 0 11px;
  color: var(--brand);
}

.message-logo-core {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.message-user .message-logo {
  min-width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  color: #f5f9ff;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.34), transparent 34%),
    linear-gradient(145deg, #5b8ff6, #6aa8ff 52%, #71d3dd 100%);
  border: 1px solid rgba(103, 158, 244, 0.78);
  box-shadow: 0 14px 28px rgba(86, 137, 226, 0.2);
}

.message-user .message-logo-core {
  min-width: 28px;
  min-height: 28px;
  color: inherit;
  font-size: 0;
  letter-spacing: 0;
}

.message-user .message-logo-core svg {
  width: 28px;
  height: 28px;
}

.message-assistant .message-logo {
  min-width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 16px;
  color: #2450b7;
  background: linear-gradient(180deg, rgba(232, 240, 255, 0.98), rgba(247, 250, 255, 0.96));
  border: 1px solid rgba(198, 215, 246, 0.96);
  box-shadow: 0 10px 24px rgba(89, 132, 220, 0.12);
}

.message-assistant .message-logo-core {
  min-width: 46px;
  min-height: 46px;
  color: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.message-bubble,
.message-stack {
  min-width: 0;
}

.message-stack {
  display: grid;
  gap: 12px;
}

.message-body {
  margin: 0;
  padding: 16px 20px;
  border-radius: 22px;
  border: 1px solid rgba(221, 231, 247, 0.9);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 14px 28px rgba(90, 120, 178, 0.06);
  font-size: 0.9rem;
}

.message-assistant .message-bubble {
  max-width: 100%;
}

.message-assistant:has(.workflow-card) .message-bubble {
  max-width: 100%;
  width: 100%;
}

.message-assistant .message-body {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  padding: 18px 22px;
  border-radius: 20px;
  border-color: rgba(202, 216, 236, 0.92);
  color: #526278;
  background: rgba(255, 255, 255, 0.99);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 8px 20px rgba(101, 124, 166, 0.05);
  box-sizing: border-box;
}

.message-assistant .message-body::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%);
  pointer-events: none;
}

.message-assistant .message-body.message-body-collapsible {
  position: relative;
  padding-right: 76px;
  padding-bottom: 20px;
}

.message-assistant .message-body.message-summary-card {
  padding: 16px 78px 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(201, 218, 245, 0.96);
  background: rgba(255, 255, 255, 0.995);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 10px 24px rgba(101, 124, 166, 0.06);
}

.message-assistant .message-body.message-body-clickable {
  cursor: pointer;
}

.message-summary-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.message-summary-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #4986ff;
  background: linear-gradient(180deg, rgba(228, 238, 255, 0.98), rgba(241, 247, 255, 0.96));
  border: 1px solid rgba(203, 220, 248, 0.98);
  box-shadow: 0 8px 18px rgba(89, 132, 220, 0.12);
}

.message-summary-icon svg {
  width: 22px;
  height: 22px;
}

.message-summary-title {
  margin: 0;
  color: #1c2b67;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.message-summary-content {
  position: relative;
  z-index: 1;
  color: #7384a8;
  font-size: 14px;
  line-height: 1.78;
  font-weight: 400;
}

.message-summary-arrow {
  position: absolute;
  top: 50%;
  right: 18px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #5c74a3;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 255, 0.98));
  border: 1px solid rgba(214, 224, 246, 0.98);
  box-shadow: 0 8px 18px rgba(121, 145, 184, 0.12);
  transform: translateY(-50%);
  transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  pointer-events: none;
}

.message-summary-arrow svg {
  width: 16px;
  height: 16px;
}

.message-assistant .message-body.message-body-clickable:hover .message-summary-arrow {
  color: #446188;
  border-color: rgba(145, 170, 205, 0.98);
  box-shadow: 0 12px 24px rgba(121, 145, 184, 0.16);
  transform: translateY(calc(-50% - 1px));
}

.message-summary-content p + p,
.message-summary-content ul + p,
.message-summary-content p + ul {
  margin-top: 12px;
}

.query-intent-snapshot {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(215, 227, 247, 0.96);
  background: rgba(249, 251, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.query-intent-markdown {
  display: grid;
  gap: 8px;
}

.query-intent-line {
  margin: 0;
  color: #607297;
  font-size: 13px;
  line-height: 1.7;
}

.query-intent-line strong {
  color: #1f3368;
  font-weight: 700;
}

.message-user .message-body {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 60px;
  padding: 14px 22px;
  border-radius: 20px;
  line-height: 1.5;
  color: #fff;
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, 0.2), transparent 30%),
    linear-gradient(90deg, #5a8ef4 0%, #4d99f1 38%, #47bfd6 100%);
  border: 1px solid rgba(97, 157, 234, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 14px 26px rgba(79, 135, 220, 0.16);
}

.message-user .message-body::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 48%);
  pointer-events: none;
}

.message-assistant .message-body p,
.message-assistant .message-body ul {
  width: 100%;
}

.message-assistant .message-body strong,
.workflow-stage-body strong,
.message-summary-content strong {
  font-weight: 500;
  color: inherit;
}

.nowrap-number {
  white-space: nowrap;
}

.message-workflow-toggle {
  position: absolute;
  top: 50%;
  right: 16px;
  bottom: auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(214, 224, 246, 0.98);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.96));
  color: #667ca5;
  backdrop-filter: blur(12px);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(121, 145, 184, 0.12);
  transform: translateY(-50%);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.message-workflow-toggle:hover {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(145, 170, 205, 0.98);
  color: #45607f;
  box-shadow: 0 14px 28px rgba(121, 145, 184, 0.18);
  transform: translateY(calc(-50% - 1px));
}

.message-workflow-toggle svg {
  width: 16px;
  height: 16px;
}

.analysis-sidebar-card.is-jumping {
  border-color: rgba(81, 136, 255, 0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 0 0 3px rgba(95, 149, 255, 0.16),
    0 16px 34px rgba(87, 128, 210, 0.16);
}

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

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

.message-body ul {
  padding-left: 18px;
}

.message-status {
  margin-top: -2px;
}

.message-status .message-bubble {
  max-width: 100%;
}

.message-status-body {
  width: fit-content;
  max-width: min(100%, 920px);
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px dashed rgba(166, 187, 228, 0.92);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.workflow-card {
  position: relative;
  display: grid;
  gap: 14px;
}

.message-assistant .workflow-card {
  margin-top: 4px;
  margin-left: 0;
  width: 100%;
  padding-left: 0;
  box-sizing: border-box;
}

.message-assistant .workflow-card::before {
  content: none;
}

.workflow-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-left: 0;
  padding: 18px 18px 17px;
  border-radius: 20px;
  border: 1px solid rgba(227, 235, 248, 0.95);
  background: rgba(255, 255, 255, 0.995);
  box-shadow: var(--shadow-soft);
  box-sizing: border-box;
}

.stage-title {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
}

.stage-title i,
.title-badge i {
  color: var(--brand);
}

.stage-title h3 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.workflow-stage-body,
.intent-stage,
.analysis-stage,
.insight-stage,
.data-switch-card,
.viz-card,
.table-card {
  position: relative;
  z-index: 1;
}

.workflow-stage-body {
  font-size: 14px;
  line-height: 1.72;
  font-weight: 400;
}

.analysis-stage,
.insight-stage {
  display: grid;
  gap: 12px;
}

.analysis-summary,
.insight-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
  font-weight: 400;
}

.analysis-summary {
  color: var(--text-main);
}

.insight-summary {
  color: var(--text-main);
}

.analysis-list,
.insight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.analysis-item,
.insight-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.analysis-index,
.insight-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--brand);
  background: linear-gradient(180deg, rgba(80, 140, 255, 0.16), rgba(80, 140, 255, 0.03));
  border: 1px solid rgba(80, 140, 255, 0.16);
  font-weight: 700;
  font-size: 0.82rem;
}

.analysis-copy,
.insight-copy {
  min-width: 0;
  color: var(--text-soft);
  line-height: 1.72;
  font-size: 14px;
}

.analysis-copy strong,
.insight-copy strong {
  color: var(--text-main);
  font-weight: 600;
}

.analysis-copy p,
.insight-copy p {
  margin: 0;
  display: inline;
}

.insight-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}

.insight-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.insight-priority {
  min-height: 30px;
  font-size: 0.78rem;
  border-color: transparent;
  box-shadow: none;
  font-weight: 700;
}

.insight-priority-high {
  background: rgba(255, 146, 127, 0.14);
  color: var(--danger);
}

.insight-priority-medium {
  background: rgba(255, 190, 63, 0.16);
  color: var(--warn);
}

.insight-priority-low {
  background: rgba(125, 214, 140, 0.16);
  color: var(--good);
}

.insight-action {
  color: var(--brand);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 255, 0.98));
  border-color: rgba(204, 220, 248, 0.96);
  box-shadow: 0 8px 18px rgba(80, 124, 214, 0.08);
  font-weight: 700;
}

.data-switch-card {
  margin-top: 18px;
}

.data-switch-card-compact {
  margin-top: 12px;
}

.data-switch-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 0;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(215, 226, 246, 0.94);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(97, 136, 207, 0.08);
  width: fit-content;
  max-width: 100%;
}

.data-switch-card-compact .data-switch-tabs {
  margin-bottom: 4px;
  padding: 3px;
}

.data-switch-tab {
  justify-content: center;
  min-width: 92px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  box-shadow: none;
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 700;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.data-switch-card-compact .data-switch-tab {
  min-height: 30px;
  padding: 0 12px;
  font-size: 0.8rem;
}

.data-switch-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, #2f76ff, #1e57d8);
  box-shadow: 0 12px 24px rgba(41, 116, 255, 0.24);
}

.data-switch-tab:not(.is-active):hover {
  color: var(--brand);
}

.data-switch-panel {
  display: none;
}

.data-switch-panel.is-active {
  display: block;
}

.viz-card,
.table-card {
  overflow: hidden;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(227, 235, 248, 0.95);
  background: rgba(255, 255, 255, 0.97);
}

.viz-canvas {
  width: 100%;
}

.viz-error {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-soft);
}

.table-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.table-reason,
.table-description {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.table-wrap {
  overflow: auto;
}

.table-scroll-hint {
  margin-bottom: 10px;
  color: var(--text-faint);
  font-size: 0.88rem;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
}

.result-table th,
.result-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(229, 236, 248, 0.95);
}

.result-table th.is-numeric,
.result-table td.is-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.result-table th {
  color: var(--text-main);
  font-size: 0.96rem;
}

.result-table td {
  color: var(--text-soft);
}

.prompt-grid {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  margin-top: 18px;
}

.quick-prompt {
  flex: 0 1 auto;
  width: fit-content;
  max-width: min(100%, 720px);
  min-height: 56px;
  padding: 14px 60px 14px 18px;
  border-radius: 20px;
  border: 1px solid rgba(224, 233, 248, 0.98);
  background: #fff;
  box-shadow: none;
  text-align: left;
  color: var(--text-soft);
  font-size: 15.3px;
  line-height: 1.5;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.quick-prompt::after {
  content: "›";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.6rem;
  color: var(--brand);
}

.quick-prompt:hover,
.insight-action:hover,
.data-switch-tab:hover,
.send-button:hover {
  transform: translateY(-1px);
}

.composer-field {
  position: relative;
  z-index: 1;
  display: block;
}

.chat-input {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.8;
}

.chat-input::placeholder {
  color: #99a4c4;
}

.composer-actions,
.composer-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
}

.composer-actions {
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}

.composer-meta {
  gap: 14px;
  flex-wrap: wrap;
}

.composer-hint {
  margin: 0;
}

.composer-counter {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.submit-btn {
  min-width: 146px;
  min-height: 62px;
  padding: 0 28px;
  border-radius: 18px;
  background: linear-gradient(135deg, #253c9a, #132768);
  color: #fff;
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 24px 34px rgba(19, 39, 104, 0.28);
}

.send-button.is-pausing {
  background: linear-gradient(135deg, rgba(255, 190, 118, 0.95), rgba(238, 133, 83, 0.95));
  box-shadow: 0 24px 34px rgba(238, 133, 83, 0.28);
}

.send-button:disabled,
.quick-prompt:disabled,
.insight-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .ama-layout,
  .ama-layout:has(.ama-sidebar.is-open) {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .workspace-panel,
  .guess-panel,
  .composer-dock,
  .ama-sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .ama-sidebar {
    width: 100%;
    max-height: 0;
    transform: none;
    height: auto;
  }

  .ama-sidebar.is-open {
    max-height: none;
  }

  .hero-card,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 210px;
  }

  .hero-stack {
    left: 50%;
    right: auto;
    transform: translateX(-20%);
  }

  .insight-main {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .insight-actions {
    justify-content: flex-start;
  }

}

@media (max-width: 820px) {
  body {
    padding: 14px;
  }

  .floating-notice {
    right: 14px;
    bottom: 14px;
    width: calc(100vw - 28px);
  }

  .screen-card {
    padding: 14px;
  }

  .ama-layout {
    gap: 16px;
  }

  .hero-card,
  .block-card,
  .composer-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero-copy h1 {
    font-size: 1.8rem;
  }

  .hero-card {
    padding-top: 132px;
  }

  .hero-actions {
    top: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .new-chat-chip {
    min-height: 44px;
    padding: 6px 8px;
  }

  .new-chat-btn {
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .language-toggle {
    min-width: 152px;
    min-height: 44px;
    font-size: 0.82rem;
  }

  .language-toggle-option {
    min-height: 36px;
    padding: 0 10px;
  }

  .account-chip {
    min-height: 44px;
    padding: 6px 8px;
    gap: 10px;
  }

  .account-name {
    max-width: 108px;
    font-size: 0.88rem;
  }

  .account-logout {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .message-assistant .message-body.message-summary-card {
    padding: 16px 78px 18px 18px;
  }

  .message-summary-title {
    font-size: 19px;
  }

  .message-summary-content {
    font-size: 15.3px;
    line-height: 1.82;
  }

  .message-workflow-toggle {
    right: 14px;
    width: 40px;
    height: 40px;
  }

  .title-badge h2 {
    font-size: 19px;
  }

  .stage-title h3 {
    font-size: 1.3rem;
  }

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

  .message-user .message-meta,
  .message-assistant .message-meta {
    display: none;
  }

  .message-assistant {
    grid-template-columns: minmax(0, 1fr);
  }

  .prompt-grid,
  .composer-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .analysis-sidebar-card {
    padding: 18px 16px 16px;
    border-radius: 20px;
  }

  .analysis-sidebar-card.is-complete,
  .analysis-sidebar-card.is-pending {
    max-height: none;
  }

  .analysis-sidebar-inner {
    padding: 0;
    border-radius: 0;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
  }

  .analysis-sidebar-body {
    overflow-y: visible;
    padding-right: 0;
  }

  .knowledge-popover {
    top: calc(100% + 12px);
    left: 0;
    width: min(100vw - 48px, 420px);
    transform: translate3d(0, 0, 0);
  }

  .knowledge-popover-inner::before {
    top: auto;
    bottom: 100%;
    left: 28px;
    right: auto;
    border-left: 1px solid rgba(189, 209, 245, 0.96);
    border-bottom: 1px solid rgba(189, 209, 245, 0.96);
    transform: translate(0, 7px) rotate(135deg);
  }
}
