:root {
  color-scheme: light;
  --color-primary: #475569;
  --color-secondary: #64748b;
  --color-accent: #2563eb;
  --project-accent: #2563eb;
  --color-background: #f7f9fc;
  --color-surface: #ffffff;
  --color-foreground: #172033;
  --color-muted: #eef2f6;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-success: #138a63;
  --color-warning: #b46216;
  --color-danger: #dc2626;
  --sidebar-width: 286px;
  --topbar-height: 76px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 28px rgba(43, 57, 81, 0.07);
  --shadow-lg: 0 20px 60px rgba(43, 57, 81, 0.11);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--color-background);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--color-foreground);
  background:
    radial-gradient(circle at 88% 2%, rgba(37, 99, 235, 0.045), transparent 24rem),
    var(--color-background);
  -webkit-font-smoothing: antialiased;
}

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

button,
a,
select,
summary {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
}

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

button {
  border: 0;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: #172033;
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  grid-template-columns: auto auto;
  gap: 14px;
  color: #334155;
}

.boot-screen > span:last-child {
  display: grid;
  gap: 2px;
}

.boot-screen strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.boot-screen small {
  color: #7b8799;
  font-size: 13px;
}

.boot-mark,
.brand-mark,
.mobile-brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(145deg, #25344c, #475569);
  box-shadow: 0 7px 18px rgba(30, 41, 59, 0.16);
}

.boot-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  animation: boot-pulse 1.4s ease-in-out infinite;
}

.boot-mark svg,
.brand-mark svg {
  width: 23px;
  height: 23px;
}

@keyframes boot-pulse {
  50% { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(30, 41, 59, 0.23); }
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  color: #dbe4ef;
  background:
    radial-gradient(circle at 22% 8%, rgba(96, 126, 165, 0.21), transparent 17rem),
    linear-gradient(180deg, #1d293b 0%, #182334 52%, #152031 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

.brand:focus-visible {
  outline-color: rgba(255, 255, 255, 0.48);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #f8fafc, #cbd5e1);
  color: #233149;
  box-shadow: 0 8px 20px rgba(4, 9, 18, 0.25);
}

.brand > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.brand strong {
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand small {
  color: #8190a5;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.project-switcher {
  margin: 27px 5px 15px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}

.project-switcher label {
  display: block;
  margin-bottom: 9px;
  color: #8998ac;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.select-shell {
  min-height: 44px;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.project-dot {
  width: 8px;
  height: 8px;
  background: #55d6a6;
  border: 2px solid rgba(85, 214, 166, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(85, 214, 166, 0.09);
}

.select-shell select {
  width: 100%;
  min-height: 30px;
  padding: 0;
  overflow: hidden;
  color: #f8fafc;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
  appearance: none;
}

.select-shell svg {
  width: 17px;
  height: 17px;
  color: #8b9aaf;
}

.project-switcher p {
  margin: 7px 0 0 16px;
  color: #8090a5;
  font-size: 11px;
}

.new-question {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 2px 5px 22px;
  color: #172033;
  background: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 7px 20px rgba(2, 6, 23, 0.16);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.new-question:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22);
}

.new-question svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.side-nav {
  min-height: 0;
  overflow-y: auto;
}

.nav-caption {
  margin: 0 11px 8px;
  color: #708096;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.nav-caption:not(:first-child) {
  margin-top: 22px;
}

.side-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  padding: 0 12px;
  color: #9eacbd;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 560;
  transition: color 180ms ease, background 180ms ease;
}

.side-nav a:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.side-nav a.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.095);
  box-shadow: inset 3px 0 #7ea7ea;
}

.side-nav a svg {
  width: 19px;
  height: 19px;
}

.nav-count {
  min-width: 23px;
  height: 21px;
  display: grid;
  place-items: center;
  margin-left: auto;
  padding: 0 6px;
  color: #f4d5b6;
  background: rgba(180, 98, 22, 0.2);
  border: 1px solid rgba(224, 151, 81, 0.17);
  border-radius: 7px;
  font-size: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 15px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.public-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
}

.public-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #83d3b5;
  background: rgba(85, 214, 166, 0.09);
  border-radius: 10px;
}

.public-icon svg {
  width: 17px;
  height: 17px;
}

.public-card > span:last-child {
  display: grid;
  gap: 2px;
}

.public-card strong {
  color: #dce5ee;
  font-size: 12px;
}

.public-card small {
  color: #78889d;
  font-size: 10px;
}

.app-content {
  min-width: 0;
  grid-column: 2;
}

.topbar {
  position: fixed;
  z-index: 15;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(24px, 3.5vw, 52px);
  background: rgba(247, 249, 252, 0.88);
  border-bottom: 1px solid rgba(203, 213, 225, 0.7);
  backdrop-filter: blur(16px);
}

.topbar-title,
.topbar-title > span:last-child {
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbar-title > span:last-child {
  display: grid;
  gap: 3px;
}

.topbar-title strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.topbar-title small {
  color: #7a8799;
  font-size: 11px;
}

.mobile-brand-mark {
  display: none;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-project-select-shell {
  display: none;
}

.status-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: #64748b;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
}

.status-online .status-dot {
  background: #18a474;
  box-shadow: 0 0 0 3px rgba(24, 164, 116, 0.11);
}

.status-online {
  color: #147455;
}

.status-fallback .status-dot {
  background: #d58a35;
}

.status-fallback {
  color: #9a5f1f;
}

.version-label {
  max-width: 200px;
  overflow: hidden;
  color: #7d8a9c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#main-content {
  min-height: 100vh;
  padding-top: var(--topbar-height);
  outline: none;
}

.page {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  padding: 42px 0 70px;
  animation: page-in 240ms ease-out both;
}

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

.eyebrow {
  margin: 0 0 9px;
  color: #718096;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.page-heading h1 {
  margin: 0;
  color: #182235;
  font-size: clamp(27px, 3.2vw, 40px);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.page-description {
  max-width: 720px;
  margin: 12px 0 0;
  color: #65748a;
  font-size: 14px;
  line-height: 1.75;
}

.chat-page {
  padding-top: 34px;
}

.chat-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.68fr) minmax(230px, 0.68fr);
  gap: 28px;
  padding: clamp(28px, 4vw, 48px);
  color: #fff;
  background:
    radial-gradient(circle at 92% 12%, rgba(120, 154, 201, 0.19), transparent 19rem),
    radial-gradient(circle at 5% 100%, rgba(65, 105, 170, 0.1), transparent 21rem),
    linear-gradient(137deg, #1a2739 0%, #24334a 58%, #1c293b 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-xl);
  box-shadow: 0 22px 58px rgba(38, 52, 74, 0.17);
}

.chat-hero::after {
  position: absolute;
  right: -90px;
  bottom: -130px;
  width: 320px;
  height: 320px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255, 255, 255, 0.018), 0 0 0 88px rgba(255, 255, 255, 0.012);
  pointer-events: none;
}

.hero-main,
.hero-metrics {
  position: relative;
  z-index: 1;
}

.context-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 19px;
  color: #b8c5d7;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.035em;
}

.context-pulse {
  width: 7px;
  height: 7px;
  background: #65d8ad;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(101, 216, 173, 0.11);
}

.hero-title {
  max-width: 660px;
  margin: 0;
  font-size: clamp(29px, 3.5vw, 45px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.14;
}

.hero-description {
  max-width: 650px;
  margin: 15px 0 27px;
  color: #aebdd0;
  font-size: 13px;
  line-height: 1.75;
}

.ask-composer {
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 15px;
  box-shadow: 0 16px 38px rgba(5, 11, 22, 0.23);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.ask-composer:focus-within {
  border-color: #9fbee9;
  box-shadow: 0 17px 42px rgba(5, 11, 22, 0.27), 0 0 0 3px rgba(126, 167, 234, 0.16);
}

.question-input {
  width: 100%;
  min-height: 96px;
  max-height: 180px;
  display: block;
  padding: 20px 21px 10px;
  resize: none;
  color: #1e293b;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
  line-height: 1.65;
}

.question-input::placeholder {
  color: #91a0b3;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 11px 11px 20px;
  border-top: 1px solid #edf1f5;
}

.composer-helper {
  color: #8b97a7;
  font-size: 10.5px;
}

.send-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  color: #fff;
  background: var(--project-accent);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 7px 16px rgba(37, 99, 235, 0.2);
  transition: filter 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.send-button:hover:not(:disabled) {
  filter: brightness(0.94);
  transform: translateY(-1px);
  box-shadow: 0 9px 19px rgba(37, 99, 235, 0.25);
}

.send-button:disabled {
  opacity: 0.65;
}

.send-button svg {
  width: 16px;
  height: 16px;
}

.hero-metrics {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.042);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}

.metric-caption {
  margin: 0 5px 7px;
  color: #718197;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.15em;
}

.stat-tile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 11px;
}

.hero-metrics .stat-tile {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #8eb4ef;
  background: rgba(126, 167, 234, 0.11);
  border-radius: 10px;
}

.stat-icon svg {
  width: 17px;
  height: 17px;
}

.stat-tile > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.stat-tile strong {
  color: inherit;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.stat-tile small {
  color: #8fa0b5;
  font-size: 10px;
}

.working-card {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  color: #64748b;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}

.working-spinner {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
  border: 2px solid #dce3ed;
  border-top-color: var(--project-accent);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.answer-card {
  scroll-margin-top: calc(var(--topbar-height) + 18px);
  margin-top: 24px;
  padding: 24px 26px 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.answer-warning {
  border-color: #ecd9c3;
  box-shadow: 0 8px 28px rgba(180, 98, 22, 0.07);
}

.answer-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.answer-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--project-accent);
  background: color-mix(in srgb, var(--project-accent) 9%, white);
  border-radius: 11px;
}

.answer-warning .answer-mark {
  color: var(--color-warning);
  background: #fff6eb;
}

.answer-mark svg {
  width: 18px;
  height: 18px;
}

.answer-identity > span:last-child {
  display: grid;
  gap: 2px;
}

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

.answer-identity small {
  color: #8a96a7;
  font-size: 10px;
}

.copy-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  font-size: 11px;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.copy-button:hover {
  color: #253247;
  background: #fff;
  border-color: #cbd5e1;
}

.copy-button svg {
  width: 15px;
  height: 15px;
}

.answer-question {
  margin: 21px 0 17px;
  padding: 12px 15px;
  color: #475569;
  background: #f6f8fb;
  border-left: 3px solid #aebbd0;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}

.answer-content {
  color: #293548;
  font-size: 14px;
  line-height: 1.85;
}

.answer-content p {
  margin: 0 0 12px;
  white-space: pre-wrap;
}

.answer-content .answer-point {
  padding-left: 3px;
}

.answer-content .answer-bullet {
  position: relative;
  padding-left: 18px;
}

.answer-content .answer-bullet::before {
  position: absolute;
  top: 0.74em;
  left: 3px;
  width: 5px;
  height: 5px;
  content: "";
  background: #8190a4;
  border-radius: 50%;
}

.citation-section {
  margin: 21px -26px 0;
  border-top: 1px solid #e9eef4;
}

.citation-section summary {
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 26px;
  color: #526177;
  list-style: none;
  font-size: 11px;
  font-weight: 650;
  transition: color 180ms ease, background 180ms ease;
}

.citation-section summary::-webkit-details-marker { display: none; }

.citation-section summary:hover {
  color: #253247;
  background: #fafbfd;
}

.citation-section summary > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.citation-section summary svg {
  width: 15px;
  height: 15px;
}

.summary-arrow {
  transform: rotate(90deg);
  transition: transform 180ms ease;
}

.citation-section[open] .summary-arrow { transform: rotate(-90deg); }

.citation-list {
  display: grid;
  gap: 10px;
  padding: 4px 26px 24px;
}

.citation-item {
  padding: 15px;
  background: #f8fafc;
  border: 1px solid #e8edf3;
  border-radius: 11px;
}

.citation-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.citation-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.citation-index {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: #52647c;
  border-radius: 7px;
  font-size: 9px;
}

.citation-head .authority-tag {
  margin-left: auto;
}

.citation-item p {
  margin: 11px 0 8px;
  color: #526177;
  font-size: 11.5px;
  line-height: 1.7;
}

.citation-path {
  display: block;
  overflow: hidden;
  color: #93a0b0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.authority-tag {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 8px;
  color: #63738a;
  background: #edf2f7;
  border: 1px solid #e0e7ef;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.chat-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(270px, 0.7fr);
  gap: 20px;
  margin-top: 24px;
}

.content-panel {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.recommended-panel,
.recent-panel {
  min-width: 0;
  padding: 21px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.panel-title > span {
  display: grid;
  gap: 3px;
}

.panel-title strong {
  font-size: 13px;
}

.panel-title small {
  color: #8b98a9;
  font-size: 10px;
}

.panel-title > svg {
  width: 18px;
  height: 18px;
  color: #8493a8;
}

.recommended-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.question-suggestion {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: #435168;
  text-align: left;
  background: #f8fafc;
  border: 1px solid #e8edf3;
  border-radius: 11px;
  font-size: 11px;
  line-height: 1.55;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.question-suggestion:hover {
  color: #1f2d42;
  background: #fff;
  border-color: #cdd8e6;
  box-shadow: 0 6px 14px rgba(43, 57, 81, 0.06);
}

.question-suggestion svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: #8392a6;
}

.recent-list {
  display: grid;
  gap: 4px;
}

.recent-item {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  color: #536178;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.recent-item:hover,
.recent-item.is-current {
  color: #263449;
  background: #f8fafc;
  border-color: #e8edf3;
}

.recent-item span {
  overflow: hidden;
  font-size: 10.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.recent-item small {
  color: #9aa6b5;
  font-size: 9px;
}

.empty-inline {
  margin: 10px 4px;
  color: #98a4b3;
  font-size: 11px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
}

.section-title h2 {
  margin: 0;
  font-size: 15px;
}

.section-title > span {
  margin-left: auto;
  color: #8c99aa;
  font-size: 10px;
}

.section-number {
  color: #98a7b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 34px;
}

.topic-card {
  min-height: 154px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.topic-card:hover {
  border-color: #c9d5e3;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.topic-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topic-card-top svg {
  width: 16px;
  height: 16px;
  color: #b1bdca;
}

.topic-count {
  color: #9aa8b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.topic-card h3 {
  margin: 21px 0 7px;
  font-size: 13px;
}

.topic-card p {
  margin: 0;
  color: #7b899b;
  font-size: 10px;
  line-height: 1.65;
}

.source-section {
  overflow: hidden;
}

.source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 21px 23px;
  border-bottom: 1px solid #e8edf3;
}

.source-head h2 {
  margin: 0;
  font-size: 14px;
}

.source-result {
  margin: 4px 0 0;
  color: #919dad;
  font-size: 10px;
}

.source-search {
  width: min(330px, 46%);
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.source-search:focus-within {
  background: #fff;
  border-color: #95add0;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.09);
}

.source-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #8a98a9;
}

.source-search input {
  min-width: 0;
  width: 100%;
  height: 38px;
  color: #273549;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 11px;
}

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

.source-list {
  max-height: 630px;
  overflow-y: auto;
}

.source-row {
  min-height: 67px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 10px 23px;
  border-bottom: 1px solid #edf1f5;
  transition: background 160ms ease;
}

.source-row:last-child { border-bottom: 0; }
.source-row:hover { background: #fafbfd; }

.source-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #6c7d94;
  background: #eef2f7;
  border-radius: 10px;
}

.source-icon svg {
  width: 16px;
  height: 16px;
}

.source-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.source-copy strong,
.source-copy small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.source-copy strong {
  font-size: 11.5px;
}

.source-copy small {
  color: #929eae;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8.5px;
}

.pending-overview {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px 22px;
  color: #6b553c;
  background: #fffaf4;
  border: 1px solid #eadbc9;
  border-radius: 14px;
}

.pending-overview .stat-tile {
  padding: 0;
}

.pending-overview .stat-icon {
  color: #b46216;
  background: #fff0dc;
}

.pending-overview .stat-tile small { color: #9b7148; }

.pending-overview > p {
  margin: 0;
  padding-left: 20px;
  color: #826d57;
  border-left: 1px solid #eadbc9;
  font-size: 11px;
  line-height: 1.7;
}

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

.pending-card {
  position: relative;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.pending-card:hover {
  border-color: #dec8ae;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pending-index {
  color: #b29372;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.pending-card h2 {
  max-width: 88%;
  margin: 22px 0 10px;
  font-size: 14px;
  line-height: 1.45;
}

.pending-card p {
  margin: 0 0 18px;
  color: #748197;
  font-size: 11px;
  line-height: 1.7;
}

.pending-ask {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  margin-top: auto;
  padding: 0;
  color: #88531d;
  background: transparent;
  font-size: 10.5px;
  font-weight: 700;
}

.pending-ask:hover { color: #5f3510; }
.pending-ask svg { width: 14px; height: 14px; }

.empty-state {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.empty-visual {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #17835f;
  background: #e9f8f2;
  border-radius: 16px;
}

.empty-state h2 { margin: 19px 0 7px; font-size: 17px; }
.empty-state p { margin: 0; color: #7f8c9d; font-size: 12px; }

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.status-panel,
.principles-panel {
  padding: 24px;
}

.status-panel h2,
.principles-panel h2 {
  margin: 0 0 18px;
  font-size: 14px;
}

.status-row {
  min-height: 65px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #edf1f5;
}

.status-row-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  color: #71839a;
  background: #f1f4f8;
  border-radius: 10px;
}

.status-row-icon svg { width: 16px; height: 16px; }

.status-row-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.status-row-copy strong { font-size: 11.5px; }
.status-row-copy small { overflow: hidden; color: #8b98a8; font-size: 9.5px; white-space: nowrap; text-overflow: ellipsis; }

.status-value {
  padding: 5px 8px;
  color: #69798e;
  background: #f2f5f8;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.status-value.good { color: #167455; background: #eaf7f2; }

.principle-row {
  min-height: 65px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-top: 1px solid #edf1f5;
}

.principle-row > span:first-child {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #187c5c;
  background: #ecf8f4;
  border-radius: 8px;
}

.principle-row svg { width: 14px; height: 14px; stroke-width: 2; }
.principle-row > span:last-child { display: grid; gap: 3px; }
.principle-row strong { font-size: 11px; }
.principle-row small { color: #8b98a8; font-size: 9.5px; }

.project-registry {
  overflow: hidden;
  margin-top: 18px;
}

.registry-head {
  min-height: 61px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 23px;
  border-bottom: 1px solid #e8edf3;
  font-size: 13px;
  font-weight: 650;
}

.registry-head span {
  color: #8996a7;
  font-size: 9.5px;
  font-weight: 500;
}

.registry-row {
  min-height: 75px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 23px;
  border-bottom: 1px solid #edf1f5;
}

.registry-row:last-child { border-bottom: 0; }
.registry-row.is-current { background: #fafbfd; }

.registry-mark {
  width: 9px;
  height: 38px;
  border-radius: 999px;
}

.registry-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.registry-copy strong { font-size: 12px; }
.registry-copy small { overflow: hidden; color: #8491a3; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.registry-count { color: #68788e; font-size: 10px; font-weight: 650; }

.loading-page,
.fatal-page {
  min-height: calc(100vh - var(--topbar-height));
  min-height: calc(100dvh - var(--topbar-height));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #6b788b;
  font-size: 13px;
}

.fatal-page {
  flex-direction: column;
  padding: 40px;
  text-align: center;
}

.fatal-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #b46216;
  background: #fff4e7;
  border-radius: 17px;
}

.fatal-page h1 { margin: 12px 0 0; font-size: 22px; }
.fatal-page p { max-width: 500px; margin: 0 0 12px; color: #788699; line-height: 1.6; }

.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 15px;
  color: #fff;
  background: #1f2b3e;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  animation: toast-in 180ms ease-out both;
}

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

.bottom-nav {
  display: none;
}

@media (max-width: 1180px) {
  :root { --sidebar-width: 254px; }
  .page { width: min(100% - 44px, 1060px); }
  .chat-hero { grid-template-columns: minmax(0, 1.5fr) 220px; gap: 20px; padding: 32px; }
  .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .version-label { display: none; }
}

@media (max-width: 900px) {
  :root { --topbar-height: 68px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .app-content { grid-column: 1; }
  .topbar { left: 0; padding: 0 22px; }
  .mobile-brand-mark {
    width: 37px;
    height: 37px;
    display: grid;
    margin-right: 11px;
    border-radius: 11px;
  }
  .mobile-brand-mark svg { width: 19px; height: 19px; }
  .mobile-project-select-shell {
    min-width: 145px;
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    padding: 0 9px 0 11px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
  }
  .mobile-project-select-shell select {
    min-width: 0;
    width: 100%;
    color: #334155;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 11px;
    font-weight: 650;
    appearance: none;
  }
  .mobile-project-select-shell svg {
    width: 15px;
    height: 15px;
    color: #8290a3;
  }
  .page { width: min(100% - 40px, 820px); padding-bottom: 104px; }
  .chat-hero { grid-template-columns: 1fr; }
  .hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px; }
  .metric-caption { display: none; }
  .hero-metrics .stat-tile { padding: 9px; }
  .chat-lower-grid { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: 1fr; }
  .bottom-nav {
    position: fixed;
    z-index: 30;
    right: 14px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 14px;
    height: 65px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 5px;
    background: rgba(24, 35, 52, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(16px);
  }
  .bottom-nav a {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #8796aa;
    border-radius: 13px;
    font-size: 9px;
    transition: color 180ms ease, background 180ms ease;
  }
  .bottom-nav a.is-active { color: #fff; background: rgba(255, 255, 255, 0.09); }
  .bottom-nav svg { width: 18px; height: 18px; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 15px; }
  .topbar-title small { display: none; }
  .topbar-title strong { max-width: 128px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .status-pill { display: none; }
  .mobile-project-select-shell { min-width: 138px; max-width: 155px; }
  .page { width: calc(100% - 28px); padding-top: 25px; }
  .page-heading { margin-bottom: 25px; }
  .page-heading h1 { font-size: 27px; }
  .page-description { font-size: 12px; }
  .chat-page { padding-top: 14px; }
  .chat-hero { gap: 20px; padding: 24px 18px 18px; border-radius: 19px; }
  .hero-title { font-size: 29px; }
  .hero-description { margin-bottom: 20px; font-size: 12px; }
  .question-input { min-height: 104px; padding: 17px 16px 9px; font-size: 16px; }
  .composer-footer { align-items: stretch; flex-direction: column; gap: 9px; padding: 9px; }
  .composer-helper { padding: 0 7px; line-height: 1.5; }
  .send-button { width: 100%; min-height: 46px; }
  .hero-metrics { grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 7px; }
  .hero-metrics .stat-tile { flex-direction: column; align-items: flex-start; gap: 7px; padding: 9px 7px; }
  .hero-metrics .stat-icon { width: 30px; height: 30px; }
  .hero-metrics .stat-tile strong { font-size: 15px; }
  .hero-metrics .stat-tile small { font-size: 8.5px; }
  .answer-card { padding: 19px 17px 0; border-radius: 15px; }
  .copy-button span { display: none; }
  .copy-button { width: 44px; padding: 0; justify-content: center; }
  .answer-question { margin-top: 17px; }
  .answer-content { font-size: 13px; }
  .citation-section { margin-right: -17px; margin-left: -17px; }
  .citation-section summary { padding: 0 17px; }
  .citation-list { padding: 4px 12px 18px; }
  .citation-head { flex-wrap: wrap; }
  .citation-head .authority-tag { margin-left: 31px; }
  .recommended-panel, .recent-panel { padding: 17px; }
  .recommended-list { grid-template-columns: 1fr; }
  .question-suggestion { min-height: 58px; }
  .topic-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .topic-card { min-height: 143px; padding: 15px; }
  .source-head { align-items: stretch; flex-direction: column; padding: 18px; }
  .source-search { width: 100%; }
  .source-row { grid-template-columns: auto minmax(0, 1fr); padding: 10px 16px; }
  .source-row > .authority-tag { grid-column: 2; justify-self: start; }
  .pending-overview { grid-template-columns: 1fr; padding: 18px; }
  .pending-overview > p { padding: 15px 0 0; border-top: 1px solid #eadbc9; border-left: 0; }
  .pending-grid { grid-template-columns: 1fr; }
  .pending-card { min-height: 190px; }
  .status-panel, .principles-panel { padding: 18px; }
  .status-row { grid-template-columns: auto minmax(0, 1fr); padding: 8px 0; }
  .status-value { grid-column: 2; justify-self: start; }
  .registry-row { grid-template-columns: auto minmax(0, 1fr); padding: 13px 17px; }
  .registry-count { grid-column: 2; }
  .registry-copy small { white-space: normal; line-height: 1.5; }
  .toast { right: 16px; bottom: 92px; left: 16px; text-align: center; }
}

@media (max-width: 390px) {
  .mobile-brand-mark { display: none; }
  .topbar-title strong { max-width: 112px; }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 125px; }
}

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