:root {
  color-scheme: light;
  --canvas: #f5f5f7;
  --paper: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: rgba(29, 29, 31, 0.10);
  --line-strong: rgba(29, 29, 31, 0.16);
  --blue: #0071e3;
  --blue-pressed: #0068d1;
  --blue-wash: rgba(0, 113, 227, 0.08);
  --green: #248a3d;
  --green-wash: rgba(36, 138, 61, 0.09);
  --amber: #9a6700;
  --amber-wash: rgba(190, 120, 0, 0.10);
  --red: #d70015;
  --chrome: rgba(250, 250, 252, 0.78);
  --sheet: rgba(255, 255, 255, 0.92);
  --shadow-float: 0 14px 44px rgba(0, 0, 0, 0.09), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-sheet: -18px 0 60px rgba(0, 0, 0, 0.10), -1px 0 rgba(0, 0, 0, 0.05);
  --content-width: 760px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-optical-sizing: auto;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, textarea { font: inherit; }

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button, [role="button"] { touch-action: manipulation; }

.app-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(circle at 50% -28%, rgba(255, 255, 255, 0.95), transparent 48%),
    var(--canvas);
}

.chrome {
  background: var(--chrome);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.topbar {
  position: relative;
  z-index: 30;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 18px;
  transform: translateY(100%);
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(245, 245, 247, 0.78), transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  font-size: 17px;
  font-weight: 660;
  letter-spacing: -0.025em;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16);
}

.brand-mark svg { width: 15px; height: 15px; }

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

.pressable {
  border: 0;
  cursor: pointer;
  transition: transform 180ms cubic-bezier(.2, .8, .2, 1), background-color 180ms ease, color 180ms ease;
}

.pressable:active {
  transform: scale(0.97);
  transition: transform 100ms ease-out;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
}

.icon-button:hover { background: rgba(0, 0, 0, 0.045); }
.icon-button svg { width: 19px; height: 19px; }

.asset-control { position: relative; justify-self: center; }

.asset-switcher {
  min-width: 210px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 12px 0 14px;
  border: 1px solid rgba(29, 29, 31, 0.08);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03), inset 0 1px rgba(255, 255, 255, 0.65);
  font-size: 14px;
  font-weight: 580;
  letter-spacing: -0.01em;
}

.asset-switcher:hover { background: rgba(255, 255, 255, 0.9); }
.asset-switcher svg { width: 14px; height: 14px; color: var(--muted); }

.asset-popover {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  width: 288px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: var(--shadow-float);
  transform: translate(-50%, -8px) scale(0.97);
  transform-origin: 50% 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 260ms cubic-bezier(.2, .8, .2, 1);
}

.asset-popover.is-open {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.asset-option {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.asset-option:hover { background: rgba(0, 0, 0, 0.045); }
.asset-option[aria-checked="true"] { background: var(--blue-wash); }

.asset-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  font-size: 12px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.asset-avatar.tencent { background: linear-gradient(145deg, #2f80ed, #1463c7); }
.asset-avatar.moutai { background: linear-gradient(145deg, #c52233, #8d1220); }

.asset-name { display: block; font-size: 14px; font-weight: 620; }
.asset-kind { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.checkmark { color: var(--blue); opacity: 0; }
.asset-option[aria-checked="true"] .checkmark { opacity: 1; }

.popover-divider { height: 1px; margin: 7px 8px; background: var(--line); }

.manage-assets {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--blue);
  text-align: left;
  font-size: 14px;
  font-weight: 560;
}

.manage-assets:hover { background: var(--blue-wash); }

.workspace {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.conversation-scroll {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.conversation {
  width: min(var(--content-width), calc(100% - 48px));
  min-height: 100%;
  margin: 0 auto;
  padding: 74px 0 188px;
}

.context-line {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.005em;
}

.context-line strong { color: var(--ink-soft); font-weight: 620; }
.context-dot { color: #b7b7bc; }

.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -12px 0 38px;
  padding: 11px 13px 11px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.52);
}

.feed-status { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 12px; font-weight: 590; }
.feed-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px var(--blue-wash); }
.simulate-button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 10px; background: var(--blue-wash); color: var(--blue); font-size: 12px; font-weight: 640; cursor: pointer; }

.push-message {
  margin-bottom: 34px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.56);
  animation: materialize 260ms cubic-bezier(.2,.8,.2,1);
}

.push-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }
.push-priority { padding: 3px 7px; border-radius: 999px; background: var(--amber-wash); color: var(--amber); font-weight: 640; }
.push-message h2 { margin-top: 12px; }
.push-summary { margin: 9px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.62; }
.push-reason { margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.5; }

.thinking-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.thinking-dots { display: inline-flex; gap: 3px; }
.thinking-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: thinking 1s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .14s; }
.thinking-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes thinking { 0%, 70%, 100% { opacity: .28; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }

.stream-cursor::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 3px; vertical-align: -.15em; background: var(--blue); animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.stopped-note { margin-top: 10px; color: var(--muted); font-size: 11px; }

.message { position: relative; margin: 0 0 38px; }

.message.assistant { padding-right: 34px; }

.assistant-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 590;
  letter-spacing: 0.035em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-wash);
}

.status-dot.uncertain { background: var(--faint); box-shadow: 0 0 0 4px rgba(110, 110, 115, 0.10); }
.status-dot.support { background: var(--green); box-shadow: 0 0 0 4px var(--green-wash); }

.message h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(29px, 3vw, 38px);
  line-height: 1.17;
  letter-spacing: -0.034em;
  font-weight: 680;
}

.message h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.022em;
  font-weight: 650;
}

.lede {
  max-width: 660px;
  margin: 19px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.006em;
}

.impact-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 23px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.impact-pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--amber);
  background: var(--amber-wash);
  font-size: 12px;
  font-weight: 660;
  letter-spacing: .01em;
}

.impact-pill.uncertain { color: var(--muted); background: rgba(110,110,115,.09); }
.impact-pill.support { color: var(--green); background: var(--green-wash); }

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 27px;
}

.text-button, .prompt-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 570;
}

.prompt-chip { padding: 0 14px; }
.text-button { padding: 0 12px; color: var(--blue); }
.prompt-chip:hover, .text-button:hover { background: white; border-color: var(--line-strong); }

.user-message {
  width: fit-content;
  max-width: 72%;
  margin-left: auto;
  padding: 11px 15px;
  border-radius: 18px 18px 5px 18px;
  background: var(--ink);
  color: white;
  font-size: 15px;
  line-height: 1.55;
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

.answer-copy {
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.72;
}

.answer-copy p { margin: 0 0 14px; }

.analysis {
  max-width: 680px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.analysis[hidden] { display: none; }

.analysis-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.analysis-label { color: var(--muted); font-size: 13px; font-weight: 620; }
.analysis-value { color: var(--ink-soft); font-size: 14px; line-height: 1.65; }

.source-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.source-line button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  cursor: pointer;
}

.composer-dock {
  position: absolute;
  z-index: 20;
  inset: auto 0 0;
  padding: 32px 24px 22px;
  pointer-events: none;
  background: linear-gradient(to top, var(--canvas) 46%, rgba(245,245,247,0.88) 70%, transparent);
}

.composer {
  position: relative;
  width: min(var(--content-width), calc(100% - 48px));
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  margin: 0 auto;
  padding: 10px 10px 10px 18px;
  border: 1px solid rgba(29,29,31,.11);
  border-radius: 22px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-float);
  pointer-events: auto;
}

.composer:focus-within { border-color: rgba(0,113,227,.38); box-shadow: 0 14px 44px rgba(0,0,0,.09), 0 0 0 4px rgba(0,113,227,.08); }

.composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 128px;
  padding: 9px 0 7px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.composer textarea::placeholder { color: #9a9aa0; }

.send-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: var(--blue);
  color: white;
  box-shadow: inset 0 1px rgba(255,255,255,.22);
}

.send-button:hover { background: var(--blue-pressed); }
.send-button svg { width: 17px; height: 17px; }
.send-button.is-generating { background: var(--ink); }
.send-button.is-generating svg { width: 12px; height: 12px; }

.composer-note {
  width: min(var(--content-width), calc(100% - 48px));
  margin: 8px auto 0;
  color: var(--faint);
  text-align: center;
  font-size: 11px;
  letter-spacing: .005em;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  z-index: 50;
  inset: 0 0 0 auto;
  width: min(560px, 96vw);
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  border-left: 1px solid rgba(255,255,255,.7);
  background: var(--sheet);
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  box-shadow: var(--shadow-sheet);
  transform: translate3d(104%, 0, 0);
  opacity: .96;
  visibility: hidden;
  transition: transform 380ms cubic-bezier(.2,.8,.2,1), opacity 260ms ease, visibility 0s linear 380ms;
  will-change: transform;
}

.sheet.is-open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  visibility: visible;
  transition: transform 380ms cubic-bezier(.2,.8,.2,1), opacity 260ms ease;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 16px 18px 10px 24px;
}

.sheet-title { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: -.025em; font-weight: 670; }
.sheet-body { overflow: auto; padding: 10px 24px 40px; }

.sheet-intro { margin: 0 0 25px; color: var(--muted); font-size: 14px; line-height: 1.6; }

.detail-section { padding: 20px 0; border-top: 1px solid var(--line); }
.detail-section:first-of-type { border-top: 0; padding-top: 2px; }
.detail-section h3 { margin: 0 0 9px; font-size: 14px; line-height: 1.4; letter-spacing: -.01em; }
.detail-section p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }

.detail-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.evidence-meta { display: flex; gap: 8px; margin-top: 11px; color: var(--muted); font-size: 12px; }
.evidence-quote { margin-top: 13px !important; padding-left: 13px; border-left: 2px solid var(--line-strong); }
.source-record-relates { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.data-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  margin: -2px -5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.data-link:hover { background: var(--blue-wash); color: var(--blue); }
.data-link::after { content: "↗"; font-size: .72em; color: var(--blue); opacity: .72; }

.conclusion-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 23px;
}

.conclusion-row .impact-line { margin-top: 0; }

.detail-link {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: var(--blue-wash);
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.sheet-heading-group { min-width: 0; }
.sheet-context { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 520; }
.sheet-header-actions { display: flex; align-items: center; gap: 4px; }

.sheet-back {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.sheet-back:hover { background: var(--blue-wash); }
.sheet-back svg { width: 18px; height: 18px; }

.archive-tabs {
  position: sticky;
  z-index: 4;
  top: -10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin: 0 0 24px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(118,118,128,.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.archive-tab {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 610;
  cursor: pointer;
}

.archive-tab[aria-selected="true"] {
  background: rgba(255,255,255,.94);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.archive-panel { animation: materialize 220ms cubic-bezier(.2,.8,.2,1); }

@keyframes materialize {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.archive-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  padding: 18px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.58);
}

.archive-summary strong { display: block; font-size: 16px; line-height: 1.4; }
.archive-summary p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.confidence-value { color: var(--green); font-size: 22px; line-height: 1; font-weight: 680; font-variant-numeric: tabular-nums; }
.confidence-label { display: block; margin-top: 6px; color: var(--muted); text-align: right; font-size: 10px; }

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

.metric-card {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.58);
  text-align: left;
  cursor: pointer;
}

.metric-card:hover { border-color: rgba(0,113,227,.25); background: rgba(255,255,255,.92); }
.metric-card-label { display: block; color: var(--muted); font-size: 11px; font-weight: 620; }
.metric-card-value { display: block; margin-top: 8px; font-size: 20px; font-weight: 670; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric-card-delta { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.metric-card-delta.up { color: var(--red); }
.metric-card-delta.down { color: var(--green); }

.chart-hero { margin-bottom: 18px; }
.chart-hero-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.chart-hero-value { margin-top: 4px; font-size: 30px; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.chart-hero-meta { margin-top: 5px; color: var(--muted); font-size: 12px; }

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.period-control { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(118,118,128,.12); }
.period-button { min-width: 42px; min-height: 29px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 620; cursor: pointer; }
.period-button[aria-pressed="true"] { background: white; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.09); }
.chart-status { color: var(--muted); font-size: 11px; }

.chart-shell {
  position: relative;
  overflow: hidden;
  padding: 10px 8px 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.64);
}

.chart-svg { display: block; width: 100%; height: auto; min-height: 290px; }
.chart-grid-line { stroke: rgba(29,29,31,.075); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.chart-candle-up { fill: var(--red); stroke: var(--red); }
.chart-candle-down { fill: var(--green); stroke: var(--green); }
.chart-volume { fill: rgba(0,113,227,.15); }
.chart-ma { fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-event-line { stroke: var(--amber); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-event-dot { fill: white; stroke: var(--amber); stroke-width: 1.5; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 12px 4px 4px; color: var(--muted); font-size: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 14px; height: 2px; border-radius: 2px; background: var(--blue); }
.legend-swatch.volume { height: 7px; background: rgba(0,113,227,.18); }
.legend-swatch.event { background: var(--amber); }

.event-list { display: grid; gap: 8px; margin-top: 12px; }
.event-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; background: rgba(154,103,0,.07); }
.event-date { color: var(--amber); font-size: 10px; font-weight: 670; }
.event-title { color: var(--ink-soft); font-size: 12px; line-height: 1.45; }

.reasoning-chain { display: grid; gap: 0; }
.reasoning-node { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 0 0 20px; }
.reasoning-node:last-child { padding-bottom: 0; }
.reasoning-rail { position: relative; display: flex; justify-content: center; }
.reasoning-rail::after { content: ""; position: absolute; top: 20px; bottom: -2px; width: 1px; background: var(--line-strong); }
.reasoning-node:last-child .reasoning-rail::after { display: none; }
.reasoning-index { position: relative; z-index: 1; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: rgba(255,255,255,.96); color: var(--muted); font-size: 10px; font-weight: 690; }
.reasoning-content { padding: 2px 0 0; }
.reasoning-kind { color: var(--muted); font-size: 10px; font-weight: 680; letter-spacing: .04em; }
.reasoning-content h3 { margin: 5px 0 6px; font-size: 14px; line-height: 1.42; }
.reasoning-content p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.58; }
.citation-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.citation-button, .source-chip {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.66);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

a.source-chip { display: inline-flex; align-items: center; }
.citation-button:hover, .source-chip:hover { border-color: rgba(0,113,227,.28); background: white; }
.source-chip[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }

.uncertainty-callout { padding: 14px; border-radius: 14px; background: var(--amber-wash); }
.uncertainty-callout strong { display: block; color: var(--amber); font-size: 12px; }
.uncertainty-callout p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }

.source-card { padding: 16px 0; border-top: 1px solid var(--line); }
.source-card:first-child { border-top: 0; padding-top: 0; }
.source-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.source-card h3 { margin: 5px 0 0; font-size: 14px; line-height: 1.45; }
.source-state { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; background: var(--green-wash); color: var(--green); font-size: 10px; font-weight: 650; }
.source-state.offline { background: rgba(110,110,115,.09); color: var(--muted); }
.source-related { margin-top: 9px; color: var(--muted); font-size: 11px; }

.primary-button, .secondary-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 620;
}

.primary-button { display: inline-flex; align-items: center; justify-content: center; border: 0; background: var(--blue); color: white; text-decoration: none; }
.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.7); color: var(--ink-soft); }
.secondary-button:disabled { opacity: .48; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

.sheet-textarea {
  width: 100%;
  min-height: 118px;
  margin-top: 10px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: 0;
  background: rgba(255,255,255,.74);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.sheet-textarea:focus { border-color: rgba(0,113,227,.46); box-shadow: 0 0 0 4px rgba(0,113,227,.08); }

.managed-asset {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.managed-asset:first-child { border-top: 0; }
.managed-asset strong { display: block; font-size: 14px; }
.managed-asset small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  border-top: 1px solid var(--line);
}

.setting-row:first-child { border-top: 0; }
.setting-copy strong { display: block; font-size: 14px; }
.setting-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.switch {
  position: relative;
  width: 42px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d1d1d6;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}

.switch[aria-checked="true"] { background: #34c759; }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 26px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(29,29,31,.88);
  backdrop-filter: blur(16px);
  color: white;
  font-size: 13px;
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: transform 260ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease;
}

.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.tour-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
}

.tour-layer[hidden] { display: none; }

.tour-mask {
  position: fixed;
  z-index: 100;
  background: rgba(0, 0, 0, 0.58);
  pointer-events: auto;
  transition: inset 360ms cubic-bezier(.2,.8,.2,1), width 360ms cubic-bezier(.2,.8,.2,1), height 360ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease;
  will-change: inset, width, height;
}

.tour-focus-ring {
  position: fixed;
  z-index: 101;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.16), 0 9px 32px rgba(0,0,0,.16);
  pointer-events: none;
  transition: inset 360ms cubic-bezier(.2,.8,.2,1), width 360ms cubic-bezier(.2,.8,.2,1), height 360ms cubic-bezier(.2,.8,.2,1), border-radius 260ms ease;
  will-change: inset, width, height;
}

.tour-blocker {
  position: fixed;
  z-index: 102;
  background: transparent;
  pointer-events: auto;
}

.tour-popover {
  position: fixed;
  z-index: 103;
  width: min(324px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 20px 54px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.08);
  pointer-events: auto;
  transform-origin: 50% 50%;
  transition: left 360ms cubic-bezier(.2,.8,.2,1), top 360ms cubic-bezier(.2,.8,.2,1), transform 180ms ease, opacity 180ms ease;
  will-change: left, top;
}

.tour-layer:not(.is-active) .tour-mask,
.tour-layer:not(.is-active) .tour-focus-ring,
.tour-layer:not(.is-active) .tour-popover {
  opacity: 0;
}

.tour-layer:not(.is-active) .tour-popover { transform: translateY(5px) scale(.985); }

.tour-popover::before {
  content: "";
  position: absolute;
  left: var(--tour-arrow-left, 50%);
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,.96);
  border: solid rgba(255,255,255,.82);
  transform: translateX(-50%) rotate(45deg);
}

.tour-popover[data-placement="bottom"]::before {
  top: -8px;
  border-width: 1px 0 0 1px;
}

.tour-popover[data-placement="top"]::before {
  bottom: -8px;
  border-width: 0 1px 1px 0;
}

.tour-step {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
}

.tour-title {
  margin: 8px 0 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -.025em;
  font-weight: 680;
}

.tour-body {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.tour-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.tour-skip, .tour-back, .tour-next {
  min-height: 36px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 620;
}

.tour-skip {
  justify-self: start;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.tour-back { padding: 0 12px; border: 1px solid var(--line); background: rgba(0,0,0,.035); color: var(--ink-soft); }
.tour-next { min-width: 72px; padding: 0 14px; border: 0; background: var(--blue); color: white; }
.tour-next:hover { background: var(--blue-pressed); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 42%, transparent);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .topbar { grid-template-columns: auto 1fr auto; padding: 0 16px; }
  .brand span:last-child { display: none; }
  .asset-switcher { min-width: 0; max-width: 220px; }
  .conversation { width: min(100% - 32px, var(--content-width)); padding-top: 48px; }
  .composer { width: min(100% - 32px, var(--content-width)); }
  .composer-note { width: min(100% - 32px, var(--content-width)); }
  .sheet { width: min(520px, 100vw); }
}

@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr; }
  .archive-summary { grid-template-columns: 1fr; }
  .confidence-label { text-align: left; }
  .feed-toolbar { align-items: flex-start; }
  .chart-svg { min-height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .sheet { transform: none; opacity: 0; }
  .sheet.is-open { opacity: 1; }
  .tour-popover, .tour-focus-ring, .tour-mask {
    transform: none;
    transition-property: opacity;
  }
  .thinking-dots i, .stream-cursor::after { animation: none; }
}

.importance-timeline {
  margin: 24px 0 32px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
}

.importance-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
}

.importance-heading strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.importance-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.importance-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.importance-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.importance-chart-wrap {
  position: relative;
  overflow-x: auto;
}

.importance-chart-wrap svg {
  display: block;
  min-width: 620px;
  width: 100%;
}

.importance-grid {
  stroke: rgba(60, 60, 67, 0.12);
  stroke-width: 1;
}

.importance-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1100;
  animation: importance-draw 280ms ease-out both;
}

.importance-node {
  cursor: pointer;
  stroke: var(--paper);
  stroke-width: 2;
  transition: r 150ms ease, filter 150ms ease;
}

.importance-node:hover,
.importance-node:focus-visible {
  r: 8;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.18));
  outline: none;
}

.importance-node.is-cached {
  fill-opacity: 0.45;
  stroke: currentColor;
}

.importance-tooltip {
  position: absolute;
  z-index: 2;
  left: 24px;
  top: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(29, 29, 31, 0.92);
  color: white;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.16);
}

.importance-tooltip span,
.importance-tooltip small {
  display: block;
  margin-top: 4px;
}

.importance-category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.importance-category-card,
.importance-signal-row,
.importance-evidence-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  padding: 16px;
  text-align: left;
}

.importance-category-card strong {
  display: block;
  margin: 8px 0;
  font-size: 30px;
}

.importance-category-card small,
.importance-signal-row span,
.importance-evidence-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.importance-factor {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.importance-factor small {
  grid-column: 1 / -1;
  color: var(--muted);
}

@keyframes importance-draw {
  from { stroke-dashoffset: 1100; }
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .importance-line { animation: none; stroke-dasharray: none; }
  .importance-node { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .chrome, .asset-popover, .composer, .sheet, .toast {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .tour-popover { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --line: #1d1d1f; --line-strong: #000; }
  .chrome, .asset-popover, .composer, .sheet { background: #fff; }
  .text-button, .prompt-chip, .asset-switcher { border-color: #1d1d1f; }
}
/* Real-data MVP additions */
.empty-state {
  padding: 11vh 0 0;
}
.empty-state h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(29px, 3vw, 38px);
  line-height: 1.17;
  letter-spacing: -0.034em;
  font-weight: 680;
}
.empty-state p {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.65;
}
.empty-state .message-actions {
  margin-top: 24px;
}
.loading-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}
.loading-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-wash);
  animation: thinking 1s ease-in-out infinite;
}
.error-callout {
  margin-top: 18px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--amber-wash);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}
.analysis-conclusion {
  margin: 0;
  padding: 19px 0 17px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 620;
}
.claim-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.claim-list li {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.62;
}
.claim-list button {
  min-height: 24px;
  margin: 6px 6px 0 0;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.66);
  color: var(--blue);
  font-size: 11px;
  cursor: pointer;
}
.claim-list button:hover {
  border-color: rgba(0,113,227,.28);
  background: white;
}
.notice {
  margin-top: 18px;
  padding: 12px 13px;
  border-radius: 13px;
  background: rgba(110,110,115,.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.message-error {
  color: var(--red);
}
.sheet-form {
  display: grid;
  gap: 10px;
}
.sheet-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}
.sheet-form input,
.sheet-form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: 0;
  background: rgba(255,255,255,.74);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.sheet-form input:focus,
.sheet-form textarea:focus {
  border-color: rgba(0,113,227,.46);
  box-shadow: 0 0 0 4px rgba(0,113,227,.08);
}
.sheet-form textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.6;
}
.search-results {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}
.search-result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border-radius: 11px;
  background: rgba(118,118,128,.08);
}
.search-result strong,
.search-result small {
  display: block;
}
.search-result strong {
  font-size: 14px;
}
.search-result small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.asset-avatar.default {
  background: linear-gradient(145deg, #6e6e73, #424245);
}
.history-list {
  display: grid;
  gap: 10px;
}
.history-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}
.history-item:first-child {
  border-top: 0;
  padding-top: 0;
}
.history-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
}
.inline-meta {
  color: var(--muted);
  font-size: 11px;
}
.status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.status-line .feed-pulse {
  flex: 0 0 auto;
}

.thesis-draft-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 28px 0 8px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(0, 113, 227, .07);
}
.thesis-draft-banner span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.thesis-scope-summary {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--muted);
}
.thesis-scope-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.thesis-scope-row input { margin-top: 3px; }
.thesis-scope-row strong { display: block; margin-bottom: 4px; }
.thesis-suggestion {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--blue-wash);
}
.thesis-suggestion span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
}
.thesis-suggestion p { margin: 5px 0 0; white-space: pre-wrap; }
.history-item small, .history-change { color: var(--muted); }
.history-change { display: block; margin-top: 6px; font-size: 12px; }

@media (max-width: 720px) {
  .thesis-draft-banner { align-items: stretch; flex-direction: column; }
}
@media (max-width: 560px) {
  .empty-state {
    padding-top: 8vh;
  }
  .message.assistant {
    padding-right: 0;
  }
  .analysis-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
