:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #182236;
  background: #edf0f3;
  font-synthesis: none;
  --ink: #182236;
  --muted: #5f6e83;
  --border: #e0e5ec;
  --accent: #245fce;
  --soft: #edf3ff;
  --paper: #fff;
  --canvas: #f6f8fa;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 18px; }
a { color: var(--accent); text-underline-offset: .2em; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 2px solid #3876e1; outline-offset: 3px; }
.app-shell {
  width: min(100%, 1680px);
  min-height: calc(100dvh - 36px);
  margin: auto;
  display: grid;
  grid-template-columns: 239px minmax(0, 1fr);
  border: 1px solid #dce2e9;
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 2px 7px #24365508;
}
.sidebar {
  min-width: 0;
  align-self: start;
  position: sticky;
  top: 18px;
  height: calc(100dvh - 38px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 17px 13px 15px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  margin: 0 0 17px;
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.04em;
}
.brand-mark {
  width: 29px;
  height: 29px;
  border: 1px solid #3675d9;
  border-radius: 8px;
  background: linear-gradient(155deg, #66a4f4, #2259ca);
  box-shadow: 0 2px 4px #245fce26;
  display: grid;
  place-items: center;
}
.brand-mark::before {
  content: "";
  height: 11px;
  width: 13px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  background: linear-gradient(135deg, transparent 46%, white 48% 61%, transparent 64%) 4px 0 / 8px 9px no-repeat;
  transform: skewY(-9deg);
  border-radius: 2px;
}
#topic-nav { display: grid; align-content: start; gap: 3px; min-height: 0; overflow: auto; padding: 3px; margin-inline: -3px; }
.sidebar-link, .topic-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  min-height: 38px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}
.sidebar-link:hover, .topic-link:hover { background: #f2f5f9; }
.sidebar-link[aria-current] { background: #edf1f6; font-weight: 680; }
.nav-icon { display: inline-block; width: 14px; height: 14px; color: #596a82; flex: none; }
.icon-chart {
  border-bottom: 1.4px solid currentColor;
  background: linear-gradient(currentColor,currentColor) 1px 100% / 2px 5px no-repeat,
    linear-gradient(currentColor,currentColor) 6px 100% / 2px 10px no-repeat,
    linear-gradient(currentColor,currentColor) 11px 100% / 2px 7px no-repeat;
}
.sidebar-topics { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 6px; padding-bottom: 12px; }
.add-topic { background: #f2f5f9; font-weight: 650; }
.plus { width: 14px; flex: none; text-align: center; font-size: 18px; line-height: 1; font-weight: 500; color: var(--accent); }
.sidebar-footer { border-top: 1px solid #edf0f4; padding-top: 10px; }
.sidebar-empty { padding: 7px 10px; color: var(--muted); font-size: 13px; }
.topic-link { gap: 9px; min-width: 0; color: #37445a; }
.topic-link[aria-current] { background: var(--soft); color: #2156b4; font-weight: 690; }
.topic-link-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topic-link-count {
  margin-left: auto;
  color: #586980;
  background: #f5f7fa;
  border: 1px solid #e5eaf1;
  border-radius: 20px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.topic-link[aria-current] .topic-link-count { background: white; border-color: #dbe6f9; color: #2459ae; }
.topic-mark, .topic-avatar {
  --tint-light: #cfedff;
  --tint: #4b7fe4;
  background: radial-gradient(circle at 30% 20%, #fff9, transparent 52%), linear-gradient(145deg, var(--tint-light), var(--tint));
  flex: none;
}
.tone-1 { --tint-light: #e1d9ff; --tint: #8a6ee6; }
.tone-2 { --tint-light: #d4f4ea; --tint: #3b9f92; }
.tone-3 { --tint-light: #ffecd2; --tint: #df9056; }
.topic-mark { width: 12px; height: 12px; border-radius: 4px; }
.workspace { min-width: 0; border-left: 1px solid var(--border); background: var(--canvas); border-radius: 0 14px 14px 0; }
main { padding: 23px 24px 42px; min-width: 0; }
main:focus { outline: none; }
h1 { margin: 0 0 7px; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.035em; line-height: 1.2; overflow-wrap: anywhere; }
h2 { font-size: 16px; margin: 0 0 14px; letter-spacing: -.01em; }
h3 { font-size: 16px; margin: 0 0 7px; line-height: 1.5; }
p { margin: 0 0 11px; line-height: 1.65; }
p:last-child { margin-bottom: 0; }
small, .muted { color: var(--muted); }
.small { font-size: 12px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.hero > div:first-child { min-width: 0; }
.hero .muted, .topic-title .muted { font-size: 14px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #dbe2ec;
  color: var(--ink);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  text-decoration: none;
  background: var(--paper);
  box-shadow: 0 1px 2px #14244009;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 620;
}
.button:hover { background: #f1f5fb; border-color: #c7d3e6; }
.button:disabled { opacity: .55; cursor: wait; }
.primary { background: #2d67d9; color: white; border-color: #2d67d9; }
.primary:hover { background: #2457bf; border-color: #2457bf; }
.compact { padding: 6px 10px; }
.back { display: inline-block; margin-bottom: 15px; font-size: 13px; }
.stack { display: grid; gap: 12px; }
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: 0 1px 2px #16264506;
  padding: 17px;
  min-width: 0;
}
.empty { padding: 40px 20px; text-align: center; font-size: 14px; }
.empty-workspace { padding: 64px 20px; }
.empty-workspace p { margin-bottom: 16px; }
.empty-mark { display: inline-block; width: 32px; height: 32px; margin-bottom: 12px; border: 1px solid #ccdef9; border-radius: 9px; background: var(--soft); }
.topic-overview { padding: 20px 20px 0; margin-bottom: 16px; }
.topic-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.topic-heading > .actions { flex-shrink: 0; }
.topic-title { display: flex; align-items: flex-start; min-width: 0; gap: 13px; }
.topic-title p { overflow-wrap: anywhere; }
.topic-avatar { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.topic-avatar span { width: 17px; height: 17px; border: 1.5px solid #fff; border-radius: 5px; transform: rotate(-9deg); }
.topic-run { border-top: 1px solid #ebeff4; margin-top: 17px; min-height: 49px; display: flex; justify-content: space-between; align-items: center; gap: 7px 14px; padding-block: 8px; flex-wrap: wrap; }
.topic-run .actions { gap: 9px; }
.topic-run .schedule { margin-left: auto; }
.topic-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, 28%); align-items: start; gap: 16px; }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 13px; }
.panel-title h2 { margin: 0; }
.panel-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.event-list { border: 1px solid #e4eaf1; border-radius: 8px; overflow: clip; }
.event { padding: 15px 15px 15px 13px; display: grid; grid-template-columns: 12px minmax(0,1fr); gap: 11px; font-size: 14px; overflow-wrap: anywhere; }
.event + .event { border-top: 1px dashed #dce4ee; }
.event-mark { margin-top: 5px; width: 9px; height: 9px; border-radius: 50%; background: #d9e9ff; border: 1px solid #5682c9; }
.event .date { margin-bottom: 4px; }
.event-body > p { margin-bottom: 7px; }
.why { border-left: 2px solid #bdd2f2; padding-left: 9px; color: #4e617d; font-size: 13px; }
.focus-panel ul { padding: 0; margin: 0; list-style: none; }
.focus-panel li { padding: 9px 0 9px 13px; position: relative; font-size: 13px; color: #485870; line-height: 1.6; overflow-wrap: anywhere; }
.focus-panel li + li { border-top: 1px dashed #e3e9f0; }
.focus-panel li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #8ba9d8; position: absolute; left: 0; top: 16px; }
.more-events { margin-top: 12px; }
.status { display: inline-block; border-radius: 20px; padding: 3px 8px; background: #eaf3ff; color: #295cb0; font-size: 11px; font-weight: 670; white-space: nowrap; }
.status.complete { background: #e8f6ee; color: #276645; }
.status.partial, .status.queued { background: #fff2df; color: #81501d; }
.status.failed, .error { background: #faebe9; color: #97372d; }
.notice { border-radius: 7px; padding: 8px 11px; margin: 8px 0 12px; background: var(--soft); }
.notice.error { background: #faebe9; }
.notice:empty { display: none; }
.sources { margin: 8px 0 0; padding-left: 17px; line-height: 1.65; }
.quote { margin: 5px 0 7px; color: var(--muted); }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent); overflow-wrap: anywhere; font-size: 13px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 390px; overflow: auto; line-height: 1.45; background: #f3f6fa; padding: 11px; border-radius: 7px; font-size: 12px; }
.form { max-width: 820px; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 620; }
input, textarea, select { border: 1px solid #cfd8e5; border-radius: 7px; padding: 8px 10px; width: 100%; background: var(--paper); color: var(--ink); min-width: 0; }
textarea { resize: vertical; }
label.check { display: flex; align-items: center; }
.check input { width: auto; }
.fields, .metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metrics { grid-template-columns: repeat(auto-fit, minmax(133px, 1fr)); margin-bottom: 16px; }
.metric strong { display: block; font-size: 24px; margin-top: 5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; align-items: end; margin-bottom: 15px; }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.trace-item { border-top: 1px dashed var(--border); padding-top: 9px; }
.trace-list { margin-top: 17px; }
.section { margin-top: 17px; }
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 201px minmax(0, 1fr); }
  .topic-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  body { padding: 0; }
  .app-shell { display: block; border: 0; border-radius: 0; min-height: 100dvh; }
  .sidebar { position: static; height: auto; display: block; padding: 10px 12px 6px; }
  .brand { margin: 0 0 8px; padding: 2px 1px; font-size: 15px; }
  .brand-mark { width: 24px; height: 24px; }
  .sidebar-topics { padding-bottom: 5px; }
  .sidebar-footer { padding-top: 4px; }
  #topic-nav { max-height: 120px; }
  .sidebar-link, .topic-link { min-height: 31px; padding: 5px 8px; font-size: 12px; }
  .sidebar-empty { padding: 3px 6px; }
  .workspace { border: 0; border-top: 1px solid var(--border); border-radius: 0; }
  main { padding: 13px 12px 36px; }
  .topic-overview { padding: 14px 14px 0; }
  .topic-heading, .hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .topic-title { gap: 9px; }
  .topic-avatar { width: 32px; height: 32px; border-radius: 8px; }
  .topic-run .schedule { margin-left: 0; }
  .fields { grid-template-columns: minmax(0, 1fr); }
}

.perspectives { min-width: 0; border: 0; margin: 0; padding: 0; }
.perspectives legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
.perspective-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: 8px; }
.perspective-choice { display: flex; align-items: start; gap: 8px; border: 1px solid var(--border); border-radius: 7px; padding: 9px; cursor: pointer; }
.perspective-choice:has(input:checked) { border-color: #abc4f1; background: var(--soft); }
.perspective-choice input { flex: none; width: auto; margin: 3px 0 0; accent-color: var(--accent); }
.perspective-choice small { display: block; margin-top: 3px; font-size: 11px; font-weight: 400; }
.event-detail { margin: 10px 0; }
.event-detail h4 { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.event-inference { border-radius: 7px; padding: 9px 10px; background: #f3f6fc; }
.event-evidence { margin: 10px 0; }

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.login-card { width: min(100%, 390px); padding: 25px; }
.login-card h1 { margin-bottom: 19px; }
.login-card .notice { margin: 0; }
