:root {
  color-scheme: light;
  --bg: #eef5ff;
  --bg-soft: #f8fbff;
  --card: rgba(255, 255, 255, 0.94);
  --card-strong: #ffffff;
  --line: #d8e6fb;
  --line-strong: #b9d3ff;
  --text: #14254b;
  --muted: #667792;
  --primary: #ff5a00;
  --primary-strong: #f04f00;
  --cyan: #23d0d6;
  --green: #28c671;
  --orange: #ff8d3a;
  --shadow: 0 18px 45px rgba(77, 115, 177, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --page-max-width: 1840px;
  --page-shell-gutter: 20px;
  --section-gutter: 28px;
}

* {
  box-sizing: border-box;
}

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

html.search-mode,
body.search-mode {
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 10%, rgba(120, 183, 255, 0.18), transparent 30%),
    linear-gradient(180deg, #f7fbff 0%, #edf5ff 48%, #e7f1ff 100%);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease,
    background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.page-shell {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--page-shell-gutter) 36px;
}

body.search-mode .page-shell {
  display: flex;
  height: 100dvh;
  flex-direction: column;
  padding-bottom: 0;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 82px;
  padding: 0 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 252, 255, 0.9));
  border: 1px solid rgba(212, 227, 248, 0.94);
  border-radius: 0 0 24px 24px;
  box-shadow: 0 8px 28px rgba(112, 140, 196, 0.08);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-image {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #182c54;
}

.topbar-session-title {
  min-width: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #18305d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-session-title.is-empty {
  color: transparent;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #1d2f53;
  font-size: 15px;
}

.nav-item + .nav-item::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 11px;
  width: 1px;
  height: 20px;
  background: #d8e3f3;
}

.nav-item.is-active {
  font-weight: 700;
  color: var(--primary);
}

.nav-login {
  padding: 0 16px;
  border: 1px solid rgba(255, 122, 41, 0.22);
  border-radius: 999px;
  background: rgba(255, 122, 41, 0.08);
  color: #ff6a1f;
  font-weight: 700;
}

.nav-login::before {
  left: -7px;
}

.nav-login.is-authenticated {
  border-color: rgba(32, 174, 92, 0.22);
  background: rgba(32, 174, 92, 0.1);
  color: #14935a;
}

.nav-icon {
  font-size: 18px;
  color: currentColor;
}

#appRoot {
  padding: 0;
}

body.search-mode #appRoot {
  display: flex;
  flex: 1;
  min-height: 0;
}

body.search-mode #appRoot > .search-page {
  height: 100%;
}

.hero-section {
  position: relative;
  overflow: hidden;
  margin-top: 0;
  padding: 36px var(--section-gutter) 30px;
  border: 1px solid #dbe9fb;
  border-top: 0;
  border-radius: 0 0 28px 28px;
  background:
    radial-gradient(circle at 50% 24%, rgba(157, 203, 255, 0.38), transparent 28%),
    linear-gradient(180deg, #eef6ff 0%, #e8f2ff 38%, #edf5ff 100%);
}

.hero-section::before {
  content: "";
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 120px;
  height: 240px;
  background:
    radial-gradient(circle at 15% 30%, rgba(255, 255, 255, 0.9), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.86), transparent 24%);
  pointer-events: none;
}

.hero-section::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 118px;
  height: 160px;
  background:
    radial-gradient(circle at 50% 100%, rgba(154, 198, 255, 0.18), transparent 58%),
    repeating-radial-gradient(
      ellipse at center,
      rgba(255, 255, 255, 0.75) 0 1px,
      transparent 1px 16px
    );
  opacity: 0.5;
  transform: perspective(560px) rotateX(72deg);
  transform-origin: center bottom;
  pointer-events: none;
}

.hero-bg {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.hero-bg-left {
  left: 26px;
  top: 118px;
}

.hero-bg-right {
  right: 34px;
  top: 168px;
}

.hero-cube {
  width: 124px;
  height: 124px;
  border: 2px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.56), rgba(156, 200, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  transform: rotate(-18deg);
}

.hero-cube::before,
.hero-cube::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
}

.hero-cube::after {
  inset: 38px;
  border-radius: 10px;
}

.hero-ring {
  width: 162px;
  height: 162px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 0 0 16px rgba(255, 255, 255, 0.32),
    inset 0 0 0 32px rgba(185, 219, 255, 0.2);
}

.hero-ring::before {
  content: "";
  position: absolute;
  inset: 56px;
  border-radius: 999px;
  border: 10px solid rgba(73, 151, 255, 0.52);
}

.hero-title-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 34px;
  text-align: center;
}

.hero-title-block {
  position: relative;
}

.hero-title {
  margin: 0;
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #142a57;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hero-title-line {
  width: 360px;
  height: 14px;
  margin: 8px auto 14px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(167, 215, 255, 0.54), rgba(167, 215, 255, 0));
}

.hero-subtitle {
  margin: 0;
  font-size: 22px;
  color: #617089;
}

.hero-decor {
  position: relative;
  width: 48px;
  height: 24px;
}

.hero-decor::before,
.hero-decor::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 24px;
  border-radius: 10px;
  transform: skewX(-32deg);
}

.hero-decor-left::before,
.hero-decor-left::after {
  background: linear-gradient(180deg, #ff914d, #ff5a00);
}

.hero-decor-right::before,
.hero-decor-right::after {
  background: linear-gradient(180deg, #20d2d5, #2f8fff);
}

.hero-decor::before {
  left: 0;
}

.hero-decor::after {
  left: 18px;
}

.search-panel {
  position: relative;
  z-index: 1;
  max-width: 1010px;
  margin: 0 auto 34px;
  padding: 24px 24px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 255, 0.94));
  border: 1px solid #dce9fb;
  border-radius: 30px;
  box-shadow: 0 24px 36px rgba(134, 171, 230, 0.18);
}

.search-input-shell {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 112px;
  padding: 22px 20px;
  border: 2px solid #9ac0ff;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.search-icon,
.search-spark {
  flex: 0 0 auto;
  color: #5b6b86;
}

.search-icon {
  margin-top: 4px;
  font-size: 36px;
  line-height: 1;
}

.search-spark {
  margin-top: 6px;
  font-size: 34px;
  color: #59dfd4;
}

.search-input {
  flex: 1;
  min-height: 64px;
  border: 0;
  resize: none;
  background: transparent;
  color: #183264;
  font-size: 18px;
  line-height: 1.8;
}

.search-input::placeholder {
  color: #9ca8b8;
}

.search-input:focus {
  outline: none;
}

.search-page {
  display: block;
  flex: 1;
  height: 100%;
  min-height: 0;
  margin-top: 10px;
}

.back-home-btn {
  height: 38px;
  margin-bottom: 16px;
  padding: 0 14px;
  border: 1px solid #d5e3f7;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #20417a;
  font-size: 14px;
  font-weight: 700;
}

.search-page-eyebrow,
.search-section-eyebrow {
  margin: 0 0 4px;
  color: #7d8da3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-meta-rail,
.search-result-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.search-meta-chip,
.search-inline-chip,
.search-section-meta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #dce8f7;
  background: rgba(255, 255, 255, 0.84);
  color: #244173;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.question-editor[hidden],
.question-title-card[hidden] {
  display: none !important;
}

.followup-composer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 0;
  padding-top: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(249, 252, 255, 0.94) 24%, rgba(249, 252, 255, 0.98) 100%);
  border-top: 1px solid #e7eef9;
}

.followup-composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.followup-label {
  color: #1b315f;
  font-size: 14px;
  font-weight: 700;
}

.followup-composer-shell {
  position: relative;
  display: block;
}

.followup-input {
  width: 100%;
  min-height: 112px;
  max-height: 320px;
  padding: 18px 132px 54px 18px;
  border: 1px solid #d8e6fb;
  border-radius: 22px;
  resize: none;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  color: #17315f;
  font-size: 15px;
  line-height: 1.72;
  overflow-y: hidden;
}

.followup-input:focus {
  outline: none;
  border-color: #9ac0ff;
  box-shadow: 0 0 0 3px rgba(154, 192, 255, 0.12);
}

.followup-send-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-width: 0;
  width: auto;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  gap: 6px;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(255, 112, 24, 0.18);
}

.followup-send-btn .btn-icon {
  font-size: 16px;
}

.followup-send-btn span:last-child {
  font-size: 14px;
}

.interaction-status-left {
  text-align: left;
}

.search-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 20px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 236px;
  height: 60px;
  padding: 0 28px;
  border-radius: 18px;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid #d7e3f7;
  box-shadow: 0 8px 18px rgba(117, 154, 213, 0.08);
}

.search-actions .action-btn:only-child,
.search-toolbar-actions .action-btn:only-child {
  min-width: 260px;
}

.action-btn-primary {
  color: #ffffff;
  border-color: #ff8e4a;
  background: linear-gradient(90deg, #ff8d3a 0%, #ff5a00 100%);
}

.action-btn-secondary {
  color: #18356b;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.followup-composer .followup-send-btn {
  min-width: 0;
  width: auto;
  height: 44px;
  padding: 0 14px;
  gap: 6px;
  font-size: 14px;
}

.btn-icon {
  font-size: 30px;
  line-height: 1;
}

.example-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.example-label {
  font-size: 15px;
  color: #6b7a94;
}

.example-tags,
.interaction-status {
  margin-top: 10px;
  min-height: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 12px;
  padding: 4px 8px;
}

.interaction-status[aria-busy="true"] {
  color: var(--primary);
}

.interaction-status.error {
  color: #e15353;
}

.hot-question-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.example-tag,
.hot-pill {
  min-height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid #d6e3f5;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  color: #24417a;
  font-size: 15px;
  font-weight: 600;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin: 0 var(--section-gutter) 24px;
}

.feature-card,
.card-panel,
.result-card,
.side-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 253, 255, 0.94));
  border: 1px solid #d8e6f8;
  box-shadow: var(--shadow);
}

.feature-card {
  min-height: 126px;
  padding: 20px 18px;
  border-radius: 20px;
}

.feature-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 28px;
}

.feature-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  color: #1b315f;
}

.feature-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, 0.92fr);
  gap: 22px;
  margin: 0 var(--section-gutter) 26px;
}

.card-panel {
  min-height: 270px;
  padding: 18px 22px 20px;
  border-radius: 24px;
}

.panel-header,
.result-header,
.recent-item,
.status-item,
.reference-item-head,
.reply-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header h3,
.result-header h3 {
  margin: 0;
  font-size: 18px;
  color: #17315f;
  line-height: 1.2;
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  font-size: 16px;
}

.panel-badge-hot {
  background: rgba(255, 149, 69, 0.16);
}

.panel-badge-recent {
  background: rgba(41, 118, 255, 0.12);
  color: #2365e6;
}

.panel-badge-status {
  background: rgba(40, 198, 113, 0.12);
  color: #18a857;
}

.panel-link-btn {
  margin-top: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
}

.panel-link-btn::after {
  content: "›";
  margin-left: 8px;
  font-size: 18px;
}

.hot-question-list {
  margin-top: 22px;
}

.hot-pill.is-hot::after {
  content: "🔥";
  margin-left: 8px;
  font-size: 14px;
}

.recent-list,
.status-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.recent-item {
  position: relative;
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid #dfe8f6;
  border-radius: 16px;
  background: #ffffff;
  color: #29406f;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.recent-item:hover {
  border-color: #cfdcf2;
  background: #fbfdff;
  box-shadow: 0 8px 18px rgba(104, 136, 190, 0.06);
}

.recent-item.is-active {
  border-color: #b7cdf2;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 10px 20px rgba(104, 136, 190, 0.08);
}

.recent-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8d3a, #2f86ff);
}

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

.recent-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.recent-main-left {
  align-items: flex-start;
}

.recent-main-right {
  flex: 0 0 auto;
  align-items: center;
  gap: 0;
  padding-top: 2px;
}

.recent-item-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.recent-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.recent-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.recent-pin-indicator {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff2e8;
  color: #d65d09;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.recent-meta {
  color: #73839b;
  font-size: 12px;
  white-space: nowrap;
}

.recent-menu-wrap {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
  margin-left: auto;
}

.recent-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #9aa9bf;
  line-height: 1;
  transition: background 140ms ease, color 140ms ease;
}

.recent-menu-trigger svg {
  width: 14px;
  height: 14px;
}

.recent-menu-trigger:hover,
.recent-menu-trigger.is-open {
  background: #f4f7fc;
  color: #4a638d;
}

.recent-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  display: flex;
  min-width: 108px;
  flex-direction: column;
  padding: 6px;
  border: 1px solid #dbe6f5;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(102, 129, 171, 0.14);
}

.recent-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #224073;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.recent-menu-item:hover {
  background: #f5f8fd;
}

.session-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-summary-compact {
  gap: 0;
}

.session-summary-minimal {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.session-summary-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.session-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 140, 73, 0.16), rgba(72, 160, 255, 0.16));
  color: #1d3e76;
  font-size: 18px;
  font-weight: 800;
  flex: 0 0 auto;
}

.session-body {
  min-width: 0;
  flex: 1;
}

.session-name {
  margin-bottom: 0;
  color: #17315f;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
}

.session-hint,
.session-history-hint {
  color: #6f8198;
  font-size: 13px;
  line-height: 1.7;
}

.session-hint {
  margin-top: 2px;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff2e8;
  color: #ef5a00;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.session-action-btn {
  flex: 0 0 auto;
  min-width: 58px;
}

.session-settings-btn {
  flex: 0 0 auto;
  min-width: 60px;
}

.session-card {
  min-height: 0;
}

.session-card .side-card-content {
  margin-top: 0;
}

.status-item {
  padding: 2px 0;
  color: #1f345f;
  font-size: 15px;
}

.status-update-item {
  padding: 12px 0 14px;
  border-bottom: 1px solid #e7eef9;
}

.status-update-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.status-update-name {
  color: #1b315f;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.status-update-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 8px;
}

.status-update-meta-item {
  color: #6f8099;
  font-size: 13px;
  line-height: 1.45;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c25f;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  height: 30px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}

.status-chip.normal {
  background: #e3f9ee;
  color: #19aa5a;
}

.status-chip.update {
  background: #eef4ff;
  color: #2468f4;
}

.status-chip.warn {
  background: #fff4e8;
  color: #d86b08;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 22px;
  margin: 0 var(--section-gutter);
}

.search-results-layout {
  align-items: start;
}

.search-results-shell {
  display: grid;
  height: 100%;
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: clamp(248px, 20vw, 292px) minmax(0, 1fr) clamp(248px, 20vw, 292px);
  grid-template-areas:
    "history answer side"
    "history answer side";
  align-items: stretch;
  gap: 18px;
  margin: 0 var(--section-gutter);
  min-height: 0;
  overflow: hidden;
}

.search-results-shell.is-history-browser {
  grid-template-columns: clamp(248px, 20vw, 292px) minmax(0, 1fr);
  grid-template-areas: "history answer";
}

.search-results-shell.is-history-browser .search-side-right,
.search-results-shell.is-history-browser .followup-composer {
  display: none !important;
}

.search-history-actions {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.search-new-session-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #de6812;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.search-new-session-btn:hover {
  color: #c95707;
}

.search-new-session-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: currentColor;
  flex: 0 0 auto;
}

.search-new-session-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.search-side-topbar {
  display: none;
}

.search-meta-rail-right {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.search-side {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  padding-bottom: 126px;
  scroll-padding-bottom: 126px;
}

.search-side-left .side-card,
.search-side-right .side-card {
  padding: 14px 16px;
}

.search-side-left {
  grid-area: history;
  overflow: hidden;
  padding-right: 0;
  padding-bottom: 0;
  scroll-padding-bottom: 0;
}

.search-side-left .search-history-card {
  display: flex;
  min-height: 0;
  flex: 1 1 0;
  flex-direction: column;
  overflow: hidden;
}

.search-side-right {
  grid-area: side;
}

.result-card-main {
  grid-area: answer;
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.search-page .result-card,
.search-page .side-card {
  border-radius: 24px;
}

.search-page .reply-item {
  position: relative;
  overflow: hidden;
  padding: 4px 0 14px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.search-page .reply-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 10px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8d3a, #2f86ff);
}

.search-page .reply-item-head {
  align-items: flex-start;
}

.search-page .reply-title {
  font-size: 17px;
}

.search-page .reply-text {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.82;
}

.search-page .reply-item-secondary {
  padding-top: 12px;
}

.search-page .reply-item-secondary .reply-title {
  font-size: 15px;
}

.search-page .reply-item-secondary .reply-text {
  color: #5d7394;
  font-size: 14px;
  line-height: 1.78;
}

.assistant-final-message {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.assistant-final-message::before {
  display: none;
}

.assistant-final-message .reply-text {
  margin-top: 0;
  color: #364e74;
  font-size: 15px;
  line-height: 1.92;
}

.search-page .reference-item,
.search-page .demand-item-block {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.search-page .risk-line {
  background: linear-gradient(180deg, #fff8f0, #fff3e8);
}

.result-card,
.side-card {
  border-radius: 24px;
  padding: 16px 18px;
}

.result-mode {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff1e8;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.result-content,
.side-card-content {
  margin-top: 12px;
}

.side-card-content-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.side-section-divider {
  margin: 10px 0 12px;
  border-top: 1px solid #edf2fa;
}

.side-subsection-title {
  margin: 0 0 8px;
  color: #17315f;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.search-page .result-content {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.empty-result,
.reference-snippet,
.demand-summary {
  padding: 16px 18px;
  border: 1px dashed #d7e4f6;
  border-radius: 16px;
  background: #fbfdff;
  color: #6e7f97;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.reply-text {
  padding: 0;
  border: 0;
  background: transparent;
  color: #5d6f88;
  white-space: pre-wrap;
}

.side-card + .side-card {
  margin-top: 18px;
}

.search-side .side-card + .side-card {
  margin-top: 0;
}

.reply-item,
.reference-item,
.demand-item-block {
  padding: 16px;
  border: 1px solid #dce7f6;
  border-radius: 16px;
  background: #ffffff;
}

.reply-item + .reply-item,
.reference-item + .reference-item,
.demand-item-block + .demand-item-block {
  margin-top: 14px;
}

.search-page .reply-item + .reply-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #edf2f9;
}

.conversation-turn {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.conversation-turn + .conversation-turn {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eef3fb;
}

.conversation-user-row,
.conversation-assistant-wrap {
  display: flex;
  gap: 10px;
  align-items: start;
}

.conversation-user-row {
  justify-content: flex-end;
  margin-left: 72px;
}

.conversation-assistant-wrap {
  justify-content: flex-start;
  margin-right: 24px;
}

.conversation-role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  flex: 0 0 auto;
}

.conversation-role-badge.user {
  background: rgba(255, 141, 58, 0.1);
  color: #de6a18;
}

.conversation-role-badge.assistant {
  background: rgba(47, 134, 255, 0.1);
  color: #2c6fdf;
}

.conversation-user-bubble {
  max-width: min(78%, 620px);
  padding: 12px 16px;
  border: 1px solid #e6eefb;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  color: #17315f;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
  box-shadow: 0 6px 18px rgba(107, 136, 186, 0.05);
}

.conversation-assistant-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.conversation-assistant-body .reply-actions {
  margin-top: 12px;
}

.conversation-assistant-body .mini-btn-quiet {
  height: auto;
  padding: 0;
  background: transparent;
  color: #5572a2;
}

.conversation-assistant-body .mini-btn-quiet:hover {
  background: transparent;
  color: #2f5fd0;
}

.search-page .result-content.is-chat-thread {
  gap: 0;
}

.search-page .result-card-main > .result-header[hidden] {
  display: none !important;
}

.search-history-card .recent-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  gap: 0;
}

.search-history-card .recent-item {
  min-height: 0;
  padding: 12px 4px 12px 14px;
  align-items: flex-start;
  border: 0;
  border-bottom: 1px solid #edf2fa;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.search-history-card .recent-main {
  align-items: flex-start;
  flex-direction: row;
  gap: 6px;
}

.search-history-card .recent-title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-history-card .recent-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.search-history-card .recent-item:hover,
.search-history-card .recent-item.is-active {
  background: transparent;
  box-shadow: none;
}

.search-history-card .recent-item.is-active {
  border-bottom-color: #e6eefb;
}

.search-history-card .recent-item.is-active::before {
  top: 10px;
  bottom: 10px;
}

.search-history-card .result-header {
  align-items: flex-start;
}

.search-history-card h3 {
  white-space: nowrap;
}

.search-page #searchRecentTitle {
  cursor: pointer;
}

.search-page #searchRecentTitle:hover {
  color: #245dd8;
}

.result-card-reference .side-card-content {
  margin-top: 18px;
}

.result-card-reference .reference-item + .reference-item {
  margin-top: 16px;
}

.reply-badge,
.confidence-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.reply-badge.primary {
  background: #e5fdf3;
  color: #14a75c;
}

.reply-badge.secondary {
  background: #eef4ff;
  color: #2468f4;
}

.reply-badge.light {
  background: #fff1e7;
  color: #ff8535;
}

.confidence-badge.high {
  background: #e5fdf3;
  color: #14a75c;
}

.confidence-badge.medium {
  background: #fff1e7;
  color: #ff8535;
}

.confidence-badge.low {
  background: #ffeeef;
  color: #ef5858;
}

.reply-title,
.reference-title {
  font-size: 15px;
  font-weight: 700;
  color: #16325e;
}

.reference-meta {
  margin-top: 8px;
}

.reference-meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reference-location-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reference-location-item {
  color: #425a7d;
  font-size: 14px;
  line-height: 1.68;
}

.reference-meta-label {
  color: #7a8aa2;
  font-size: 12px;
  font-weight: 700;
}

.reference-meta-value {
  color: #425a7d;
  font-size: 14px;
  line-height: 1.68;
}

.reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mini-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #d8e4f5;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  color: #21457e;
}

.mini-btn-primary {
  border-color: #ffb57e;
  background: linear-gradient(180deg, #fff2e8, #ffe7d8);
  color: #de5d0f;
}

.mini-btn-quiet {
  height: 28px;
  padding: 0 8px;
  border-color: transparent;
  background: #f6f9ff;
  color: #47618e;
}

.mini-btn-quiet:hover {
  border-color: transparent;
  background: #edf4ff;
}

.demand-compact-list,
.route-compact-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.demand-compact-list-secondary {
  margin-top: 4px;
}

.demand-compact-item,
.route-compact-item {
  padding: 12px 0;
  border-bottom: 1px solid #edf2fa;
}

.demand-compact-item:last-child,
.route-compact-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.demand-compact-item-primary:first-child,
.route-compact-item:first-child {
  padding-top: 0;
}

.demand-label {
  margin-bottom: 6px;
  color: #7a8aa2;
  font-size: 12px;
}

.demand-value {
  color: #1a3360;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.68;
}

.demand-value-primary {
  font-size: 15px;
  line-height: 1.72;
}

.demand-summary-plain {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 2px solid #dce7f6;
  border-radius: 0 14px 14px 0;
  background: #f8fbff;
  color: #5c708d;
  font-size: 14px;
  line-height: 1.75;
}

.demand-summary-subtle {
  border-left-color: #e6edf8;
  background: #fbfdff;
}

.session-overview,
.route-session-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.session-overview-lead,
.route-session-lead {
  color: #5f7596;
  font-size: 13px;
  line-height: 1.7;
}

.session-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid #edf2fa;
}

.session-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.session-section-title {
  color: #7a8aa2;
  font-size: 12px;
  font-weight: 700;
}

.session-section-value {
  color: #1a3360;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
}

.session-section-note {
  color: #425a7d;
  font-size: 14px;
  line-height: 1.72;
}

.session-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f5f8ff;
  color: #33507d;
  font-size: 12px;
  line-height: 1;
}

.session-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.session-status-item {
  padding: 12px 14px;
  border: 1px solid #edf2fa;
  border-radius: 14px;
  background: #fbfdff;
}

.session-status-label {
  margin-bottom: 6px;
  color: #7a8aa2;
  font-size: 12px;
}

.session-status-value {
  color: #1a3360;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

.risk-card {
  background: linear-gradient(180deg, #fffefc, #fffaf6);
}

.risk-line {
  padding: 2px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #91501d;
  font-size: 14px;
  line-height: 1.7;
}

.route-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.route-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #f6dfd0;
  border-radius: 999px;
  background: #fff8f3;
  color: #bf6a2b;
  font-size: 11px;
  font-weight: 700;
}

.route-label {
  margin-bottom: 6px;
  color: #7a8aa2;
  font-size: 12px;
  font-weight: 700;
}

.route-value {
  color: #18305d;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.7;
}

.search-side-right .reference-item {
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid #edf2fa;
  border-radius: 0;
  background: transparent;
}

.search-side-right .reference-item:first-child {
  padding-top: 0;
}

.search-side-right .reference-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.followup-composer-head {
  display: none;
}

.followup-composer {
  padding-top: 14px;
  border-top: 1px solid #edf2fa;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(248, 251, 255, 0.96) 32%);
}

.search-side-right .empty-result {
  padding: 10px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.history-browser-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-browser-summary {
  padding: 16px 18px;
  border: 1px solid #dfe8f6;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.history-browser-summary-title {
  color: #17315f;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
}

.history-browser-summary-note {
  margin-top: 6px;
  color: #657997;
  font-size: 14px;
  line-height: 1.72;
}

.history-browser-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.history-browser-stat,
.history-browser-pin {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.history-browser-stat {
  background: #f5f8ff;
  color: #47618e;
}

.history-browser-pin {
  background: #fff1e8;
  color: #d56613;
}

.history-browser-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-browser-item {
  display: block;
  padding: 18px 20px;
  border: 1px solid #dfe8f6;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background 140ms ease;
}

.history-browser-item:hover {
  border-color: #c8d9f2;
  box-shadow: 0 10px 24px rgba(104, 136, 190, 0.08);
  transform: translateY(-1px);
}

.history-browser-item.is-active {
  border-color: #b8cef3;
  background: linear-gradient(180deg, #ffffff, #f6faff);
  box-shadow: 0 10px 24px rgba(104, 136, 190, 0.08);
}

.history-browser-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-browser-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.history-browser-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.history-browser-title {
  color: #17315f;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.history-browser-preview {
  color: #5f7392;
  font-size: 14px;
  line-height: 1.72;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-browser-time,
.history-browser-meta {
  color: #7a8aa2;
  font-size: 12px;
}

.history-browser-time {
  flex: 0 0 auto;
  white-space: nowrap;
  padding-top: 2px;
}

.history-browser-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-browser-turns,
.history-browser-action {
  white-space: nowrap;
}

.history-browser-action {
  color: #4e6fa5;
  font-weight: 700;
}

.search-side,
.search-page .result-content {
  scrollbar-width: thin;
  scrollbar-color: #c6d4e8 transparent;
}

.search-side::-webkit-scrollbar,
.search-page .result-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.search-side::-webkit-scrollbar-thumb,
.search-page .result-content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(150, 171, 204, 0.72);
}

.search-side::-webkit-scrollbar-track,
.search-page .result-content::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1380px) {
  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .info-grid,
  .result-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1220px) {
  html.search-mode,
  body.search-mode {
    height: auto;
    overflow: auto;
  }

  body.search-mode .page-shell,
  body.search-mode #appRoot {
    display: block;
    height: auto;
  }

  .search-results-shell {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.74fr);
    grid-template-areas:
      "history side"
      "answer side";
  }
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: flex-start;
    padding: 18px 18px 14px;
  }

  .topbar-session-title {
    display: none;
  }

  #appRoot {
    padding: 0 10px;
  }

  html.search-mode,
  body.search-mode {
    height: auto;
    overflow: auto;
  }

  body.search-mode .page-shell,
  body.search-mode #appRoot {
    display: block;
    height: auto;
  }

  .hero-section,
  .feature-grid,
  .info-grid,
  .result-layout,
  .search-results-shell {
    margin-left: 0;
    margin-right: 0;
  }

  .followup-composer-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .followup-send-btn {
    position: static;
    width: 100%;
    min-width: 0;
    height: 52px;
    box-shadow: none;
  }

  .hero-section {
    padding: 26px 18px 24px;
  }

  .hero-title {
    font-size: 42px;
  }

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

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

  .action-btn {
    width: 100%;
    min-width: 0;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .demand-compact-list,
  .route-compact-list {
    gap: 0;
  }

  .session-status-grid {
    grid-template-columns: 1fr;
  }

  .search-results-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    grid-template-areas:
      "history"
      "answer"
      "side";
  }

  .conversation-user-row,
  .conversation-assistant-wrap {
    margin-left: 0;
    margin-right: 0;
  }

  .search-history-actions {
    width: 100%;
    justify-content: space-between;
  }

  .search-side,
  .search-page .result-content {
    overflow: visible;
    padding-right: 0;
  }

  .result-card-main {
    overflow: visible;
  }

  .followup-composer {
    position: static;
  }
}

@media (max-width: 640px) {
  .top-nav {
    flex-wrap: wrap;
  }

  .hero-title-wrap {
    gap: 8px;
  }

  .hero-decor {
    display: none;
  }

  .hero-title {
    font-size: 34px;
  }

  .search-input-shell {
    min-height: 132px;
    padding: 16px;
  }

  .search-toolbar-shell {
    min-height: 128px;
    padding: 16px;
  }

  .search-icon,
  .search-spark {
    font-size: 26px;
  }

  .search-input {
    font-size: 16px;
  }

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