/* ============================================
   CeraVis - Components & Page-specific
   Modern · Light-first · Subtle depth
   ============================================ */

/* ===== Login Page ===== */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 15% 20%, rgba(37, 99, 235, 0.10), transparent),
    radial-gradient(ellipse 700px 700px at 85% 80%, rgba(124, 58, 237, 0.08), transparent),
    radial-gradient(ellipse 500px 400px at 60% 10%, rgba(8, 145, 178, 0.05), transparent);
  pointer-events: none;
}
[data-theme="dark"] .login-wrap::before {
  background:
    radial-gradient(ellipse 800px 600px at 15% 20%, rgba(59, 130, 246, 0.20), transparent),
    radial-gradient(ellipse 700px 700px at 85% 80%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(ellipse 500px 400px at 60% 10%, rgba(6, 182, 212, 0.10), transparent);
}
.login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  z-index: 1;
}
.login-hero-top { display: flex; align-items: center; gap: var(--s-3); }
.login-hero-mid { max-width: 520px; }
.login-hero-bot { font-size: 12px; color: var(--text-tertiary); }

.login-headline {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-5);
  color: var(--text-primary);
}
.login-headline .grad {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: var(--s-8);
}
.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
.login-feat {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--dur-fast) var(--ease-out);
}
.login-feat:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}
.login-feat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--status-info-bg);
  color: var(--brand-primary);
  flex-shrink: 0;
}
.login-feat-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text-primary);
}
.login-feat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.login-form-side {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 1;
}
.login-form {
  width: 100%;
  max-width: 400px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--r-2xl);
  padding: 40px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}
.login-form h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.login-form .form-sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: var(--s-6);
}
.login-form .field { margin-bottom: var(--s-4); }
.login-form .btn { width: 100%; justify-content: center; margin-top: var(--s-2); }
.login-form .login-divider {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin: var(--s-4) 0;
  position: relative;
}
.login-form .login-divider::before,
.login-form .login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--border-default);
}
.login-form .login-divider::before { left: 0; }
.login-form .login-divider::after { right: 0; }

.login-sso {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.login-sso .sso-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.login-sso .sso-btn:hover {
  background: var(--bg-surface-hi);
  border-color: var(--border-strong);
  color: var(--brand-primary);
}

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}

/* ===== Dashboard Welcome ===== */
.welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-6);
  padding: var(--s-6);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}
.welcome::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08), transparent 70%);
  pointer-events: none;
}
.welcome h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.welcome p {
  color: var(--text-secondary);
  font-size: 13px;
}
.welcome-stats {
  display: flex;
  gap: var(--s-6);
}
.welcome-stat {
  text-align: right;
}
.welcome-stat .v {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--brand-primary);
}

/* Data scale bar (新增) */
.scale-bar {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.scale-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 12px;
}
.scale-item .label {
  color: var(--text-tertiary);
}
.scale-item .value {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.scale-item .sep {
  width: 1px;
  height: 14px;
  background: var(--border-default);
  margin: 0 var(--s-2);
}

/* Quick query templates */
.query-templates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
.query-tpl {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  cursor: pointer;
  transition: all var(--dur-mid) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.query-tpl:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.query-tpl-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--status-info-bg);
  color: var(--brand-primary);
  margin-bottom: var(--s-3);
}
.query-tpl-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.query-tpl-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
}
.query-tpl-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: var(--s-2);
}

/* Knowledge Map - chain flow */
.km-chain {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-4) 0;
  overflow-x: auto;
}
.km-node {
  flex-shrink: 0;
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface-hi);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  min-width: 110px;
  text-align: center;
  transition: all var(--dur-fast) var(--ease-out);
}
.km-node:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}
.km-node .km-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  margin: 0 auto var(--s-2);
  background: var(--status-info-bg);
  color: var(--brand-primary);
}
.km-node .km-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text-primary);
}
.km-node .km-count {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.km-arrow {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 16px;
}

/* Hot tech list */
.hot-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.hot-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  transition: all var(--dur-fast) var(--ease-out);
  cursor: pointer;
}
.hot-item:hover {
  border-color: var(--border-default);
  background: var(--bg-surface-hi);
  transform: translateX(2px);
}
.hot-rank {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}
.hot-rank.top1 { background: var(--grad-amber); color: white; border-color: transparent; }
.hot-rank.top2 { background: linear-gradient(135deg, #94A3B8, #64748B); color: white; border-color: transparent; }
.hot-rank.top3 { background: linear-gradient(135deg, #B45309, #92400E); color: white; border-color: transparent; }
.hot-body { flex: 1; min-width: 0; }
.hot-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.hot-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.hot-delta {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--status-success);
  flex-shrink: 0;
}

/* Update feed */
.feed {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-height: 380px;
  overflow-y: auto;
  padding-right: var(--s-2);
}
.feed-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: all var(--dur-fast) var(--ease-out);
}
.feed-item:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}
.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-cyan);
  margin-top: 6px;
  flex-shrink: 0;
}
.feed-dot.patent { background: var(--brand-purple); }
.feed-dot.company { background: var(--brand-emerald); }
.feed-dot.literature { background: var(--brand-amber); }
.feed-content { flex: 1; min-width: 0; }
.feed-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-primary);
}
.feed-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  gap: var(--s-3);
}

/* ===== AI Assistant (综合式) ===== */
.ai-layout {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: var(--s-4);
  min-height: calc(100vh - var(--topbar-h) - var(--s-12));
}

/* Sessions sidebar */
.ai-side {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.ai-side-head {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.ai-side-body { flex: 1; overflow-y: auto; padding: var(--s-2); }

.session-group {
  margin-bottom: var(--s-3);
}
.session-group-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--s-2) var(--s-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.session-item {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: 2px;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-out);
  position: relative;
}
.session-item:hover { background: var(--bg-surface-hi); color: var(--text-primary); }
.session-item.active { background: var(--status-info-bg); color: var(--brand-primary); font-weight: 500; }
.session-item .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Main chat area - 突出对话框 */
.ai-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  min-width: 0;
}

/* AI Header (title + tag) */
.ai-header {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.ai-header-fields {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 1;
  min-width: 0;
}
.ai-title-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: all var(--dur-fast);
  min-width: 120px;
}
.ai-title-input:focus,
.ai-title-input:hover {
  background: var(--bg-surface-hi);
}
.ai-title-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}
.ai-cat-select {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg-surface-hi);
  border: 1px solid var(--border-default);
  border-radius: var(--r-full);
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
}
.ai-header-actions {
  display: flex;
  gap: var(--s-2);
}

/* Selected tags (active query conditions) */
.ai-active-conds {
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-hi);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 44px;
}
.ai-active-conds .label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-right: var(--s-2);
}
.ai-active-cond {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-full);
  font-size: 11px;
  color: var(--text-secondary);
}
.ai-active-cond .remove {
  cursor: pointer;
  color: var(--text-tertiary);
  margin-left: 2px;
}
.ai-active-cond .remove:hover { color: var(--status-danger); }
.ai-add-cond-btn {
  font-size: 11px;
  padding: 3px 10px;
  background: transparent;
  border: 1px dashed var(--border-default);
  border-radius: var(--r-full);
  color: var(--text-tertiary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ai-add-cond-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Conversation area - 突出 */
.ai-conv {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-6) var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  background: var(--bg-surface);
}

/* Empty state */
.ai-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-8);
  text-align: center;
}
.ai-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-2xl);
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  margin-bottom: var(--s-4);
  color: white;
  box-shadow: var(--shadow-glow);
}
.ai-empty-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: var(--s-2);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.ai-empty-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--s-6);
  max-width: 480px;
}
.ai-suggests {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  max-width: 560px;
  width: 100%;
}
.ai-suggest {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface-hi);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all var(--dur-fast) var(--ease-out);
  color: var(--text-primary);
}
.ai-suggest:hover {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

/* Messages */
.msg { display: flex; gap: var(--s-3); max-width: 800px; }
.msg.user { flex-direction: row-reverse; margin-left: auto; }
.msg.ai { margin-right: auto; }
.msg-av {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.msg.user .msg-av { background: var(--grad-purple); color: white; }
.msg.ai .msg-av { background: var(--grad-brand); color: white; }
.msg-bub {
  max-width: 720px;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 1.65;
}
.msg.user .msg-bub {
  background: var(--status-info-bg);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-top-right-radius: var(--r-sm);
}
.msg.ai .msg-bub {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: var(--r-sm);
}
.msg-bub p { margin-bottom: var(--s-2); }
.msg-bub p:last-child { margin-bottom: 0; }
.msg-bub strong { color: var(--brand-primary); font-weight: 600; }
.msg-bub ul, .msg-bub ol { margin: var(--s-2) 0 var(--s-2) var(--s-4); }
.msg-bub li { list-style: disc; margin-bottom: 4px; }
.msg-bub code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 5px;
  background: var(--code-bg);
  border-radius: var(--r-xs);
  color: var(--brand-primary);
}

/* Tool panel (推理链路) */
.tool-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
  overflow: hidden;
  max-width: 720px;
}
.tool-head {
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.tool-head .tool-status {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-weight: 600;
  font-family: var(--font-mono);
}
.tool-status.running { background: var(--status-info-bg); color: var(--brand-primary); }
.tool-status.done { background: var(--status-success-bg); color: var(--status-success); }
.tool-body {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  background: var(--bg-base);
  margin: 0 var(--s-3) var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
}

/* AI Input - 居中突出 */
.ai-input-area {
  border-top: 1px solid var(--border-subtle);
  padding: var(--s-4) var(--s-5);
  background: var(--bg-elevated);
}
.ai-input-wrap {
  max-width: 800px;
  margin: 0 auto;
}
.ai-input-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  padding: var(--s-3);
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.ai-input-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--status-info-bg);
}
.ai-input-box textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  min-height: 24px;
  max-height: 200px;
  resize: none;
  font-family: var(--font-sans);
}
.ai-input-box textarea::placeholder { color: var(--text-tertiary); }
.ai-input-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
.ai-input-tools { display: flex; gap: 4px; }
.ai-input-tool {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.ai-input-tool:hover { color: var(--text-primary); background: var(--bg-surface-hi); }
.ai-send {
  margin-left: auto;
  background: var(--brand-primary);
  color: white;
  padding: 6px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.ai-send:hover { background: var(--brand-primary-lo); }

/* AI evidence (right sidebar) */
.ai-evidence {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.ai-ev-head {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-primary);
}
.ai-ev-body { flex: 1; overflow-y: auto; padding: var(--s-3); }
.ev-card {
  padding: var(--s-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  margin-bottom: var(--s-2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.ev-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}
.ev-source {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 10px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ev-title {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.4;
  color: var(--text-primary);
}
.ev-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.ev-snippet {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px dashed var(--border-subtle);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ev-snippet mark {
  background: rgba(37, 99, 235, 0.15);
  color: var(--brand-primary);
  padding: 0 2px;
  border-radius: 2px;
}

/* Condition sidebar (folded by default) */
.cond-panel {
  width: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  transition: width var(--dur-mid) var(--ease-out);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.cond-panel.open { width: 280px; }
.cond-panel-head {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cond-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4);
}
.cond-group {
  margin-bottom: var(--s-4);
}
.cond-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s-2);
}
.cond-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cond-option {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--dur-fast);
}
.cond-option:hover { background: var(--bg-surface-hi); color: var(--text-primary); }
.cond-option input[type="checkbox"] { accent-color: var(--brand-primary); }
.cond-option .count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.cond-toggle {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 28px;
  height: 56px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left: none;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  z-index: 5;
  box-shadow: var(--shadow-sm);
}
.cond-toggle:hover { color: var(--brand-primary); }
.ai-layout-full {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--s-4);
  min-height: calc(100vh - var(--topbar-h) - var(--s-12));
}

/* Suggestion chips */
.sugg-chips {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-2);
}
.sugg-chip {
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-full);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  color: var(--text-secondary);
}
.sugg-chip:hover {
  background: var(--bg-surface-hi);
  color: var(--text-primary);
  border-color: var(--brand-primary);
}

/* ===== Knowledge Center ===== */
.kn-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--s-4);
  min-height: calc(100vh - var(--topbar-h) - var(--s-12));
}
.kn-tree {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  overflow-y: auto;
  box-shadow: var(--shadow-xs);
}
.tree-cat {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  margin-bottom: 2px;
  transition: all var(--dur-fast) var(--ease-out);
}
.tree-cat:hover { background: var(--bg-surface-hi); color: var(--text-primary); }
.tree-cat.active { background: var(--status-info-bg); color: var(--brand-primary); font-weight: 600; }
.tree-cat .count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.tree-cat.active .count { color: var(--brand-primary); }
.tree-cat .cat-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  background: var(--bg-surface-hi);
  display: grid;
  place-items: center;
  color: inherit;
}

.kn-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-xs);
}
.kn-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.kn-toolbar .input { max-width: 320px; }
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-full);
  font-size: 11px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-out);
}
.filter-chip:hover { color: var(--text-primary); }
.filter-chip.active { background: var(--status-info-bg); color: var(--brand-primary); border-color: var(--brand-primary); }

/* Knowledge item card */
.k-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-4);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.k-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.k-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.k-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.k-card-formula {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--brand-cyan);
}
.k-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.k-card-props {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2);
  margin-top: var(--s-1);
}
.k-prop {
  background: var(--bg-base);
  border-radius: var(--r-sm);
  padding: 6px 10px;
}
.k-prop-label { font-size: 10px; color: var(--text-tertiary); }
.k-prop-value { font-size: 12px; font-weight: 600; font-family: var(--font-mono); color: var(--text-primary); }
.k-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: var(--s-1);
}

/* ===== Detail Page ===== */
.det-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--s-4);
}
.det-main { min-width: 0; }
.det-side { display: flex; flex-direction: column; gap: var(--s-4); }
.det-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.det-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.06), transparent 70%);
  pointer-events: none;
}
.det-hero-row1 {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.det-breadcrumb {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--s-2);
}
.det-breadcrumb a { color: var(--text-tertiary); }
.det-breadcrumb a:hover { color: var(--text-primary); }
.det-breadcrumb .sep { margin: 0 6px; }

.det-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-2);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-primary);
}
.det-formula {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--brand-cyan);
  margin-bottom: var(--s-3);
}
.det-desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  max-width: 720px;
  margin-bottom: var(--s-4);
}
.det-quick {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.det-qi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.det-qi-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.det-qi-value {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.det-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-xs);
}
.det-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-primary);
}
.det-section-title .accent {
  width: 3px;
  height: 14px;
  background: var(--brand-primary);
  border-radius: var(--r-full);
}

/* Property grid */
.prop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
.prop-cell {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
}
.prop-cell-label { font-size: 11px; color: var(--text-tertiary); margin-bottom: 4px; }
.prop-cell-value { font-size: 16px; font-weight: 600; font-family: var(--font-mono); color: var(--text-primary); }
.prop-cell-unit { font-size: 11px; color: var(--text-tertiary); margin-left: 2px; font-weight: 400; }

/* Recipe composition bars */
.comp-list { display: flex; flex-direction: column; gap: var(--s-3); }
.comp-row { display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; gap: var(--s-3); }
.comp-name { font-size: 13px; font-family: var(--font-mono); color: var(--brand-cyan); }
.comp-pct { text-align: right; font-size: 12px; font-weight: 600; font-family: var(--font-mono); }

/* AI Insight */
.ai-insight {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(124, 58, 237, 0.02) 100%);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: relative;
  box-shadow: var(--shadow-xs);
}
.ai-insight::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--grad-brand);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.ai-insight-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.ai-insight-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-primary);
}
.ai-insight-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
}
.ai-insight-body p { margin-bottom: var(--s-2); }
.ai-insight-body p:last-child { margin-bottom: 0; }

/* Related list */
.rel-list { display: flex; flex-direction: column; gap: var(--s-2); }
.rel-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  transition: all var(--dur-fast) var(--ease-out);
}
.rel-item:hover { background: var(--bg-surface-hi); border-color: var(--border-default); }
.rel-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--status-info-bg);
  color: var(--brand-primary);
  flex-shrink: 0;
}
.rel-body { flex: 1; min-width: 0; }
.rel-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.rel-meta { font-size: 11px; color: var(--text-tertiary); }

/* ===== Agent Pages ===== */
.agent-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  min-height: calc(100vh - var(--topbar-h) - var(--s-12));
}
.agent-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
}
.agent-output {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.agent-out-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.agent-out-body { flex: 1; overflow-y: auto; padding: var(--s-5); }

/* Cause ranking */
.cause-list { display: flex; flex-direction: column; gap: var(--s-3); }
.cause-item {
  padding: var(--s-3) var(--s-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--r-md);
  position: relative;
}
.cause-rank {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background: var(--status-info-bg);
  color: var(--brand-primary);
  padding: 1px 6px;
  border-radius: var(--r-full);
  margin-bottom: 4px;
}
.cause-item.high { border-left-color: var(--status-danger); }
.cause-item.high .cause-rank { background: var(--status-danger-bg); color: var(--status-danger); }
.cause-item.medium { border-left-color: var(--status-warning); }
.cause-item.medium .cause-rank { background: var(--status-warning-bg); color: var(--status-warning); }
.cause-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.cause-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.cause-meta {
  margin-top: var(--s-2);
  display: flex;
  gap: var(--s-3);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ===== Patent Page ===== */
.radar-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: var(--s-4) 0;
}
.legend {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-top: var(--s-3);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Company page */
.company-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-xs);
}
.company-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.06), transparent 70%);
}
.company-head {
  display: flex;
  gap: var(--s-5);
  align-items: flex-start;
  position: relative;
  z-index: 1;
}
.company-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--r-lg);
  background: var(--grad-purple);
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: white;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.company-info { flex: 1; }
.company-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.company-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s-2); }
.company-meta { color: var(--text-secondary); font-size: 13px; }

.rating-row { display: flex; flex-direction: column; gap: 4px; }
.rating-stars { display: flex; gap: 2px; }
.star { color: var(--text-tertiary); font-size: 12px; }
.star.filled { color: var(--brand-amber); }

/* ===== Knowledge Graph ===== */
.graph-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  position: relative;
  min-height: 600px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.graph-canvas {
  width: 100%;
  height: 600px;
  background: radial-gradient(ellipse at center, rgba(37, 99, 235, 0.03) 0%, transparent 70%);
  border-radius: var(--r-md);
  position: relative;
}
.graph-controls {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}
.graph-ctrl {
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.graph-ctrl:hover { color: var(--text-primary); background: var(--bg-surface-hi); }
.graph-legend {
  position: absolute;
  bottom: var(--s-4);
  left: var(--s-4);
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
}
.graph-stats {
  position: absolute;
  top: var(--s-4);
  left: var(--s-4);
  display: flex;
  gap: var(--s-2);
  z-index: 2;
}
.graph-stat {
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 11px;
}
.graph-stat .v { font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); }

/* ===== Data Management ===== */
.dm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.dm-source-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.dm-source {
  display: grid;
  grid-template-columns: 40px 1fr 100px 120px 80px;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  transition: all var(--dur-fast) var(--ease-out);
}
.dm-source:hover { border-color: var(--border-default); }
.dm-source-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--status-info-bg);
  color: var(--brand-primary);
}
.dm-source-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.dm-source-meta { font-size: 11px; color: var(--text-tertiary); }

/* ===== Profile ===== */
.profile-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-xs);
}
.profile-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 80px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(124, 58, 237, 0.04) 100%);
}
.profile-content { display: flex; align-items: center; gap: var(--s-5); position: relative; z-index: 1; padding-top: var(--s-2); }
.profile-av {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--grad-purple);
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
  color: white;
  border: 3px solid var(--bg-surface);
  box-shadow: var(--shadow-md);
}

/* ===== Activity Item ===== */
.act-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--s-2);
  transition: all var(--dur-fast) var(--ease-out);
}
.act-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.act-icon.chat { background: var(--status-info-bg); color: var(--brand-primary); }
.act-icon.search { background: rgba(8, 145, 178, 0.10); color: var(--brand-cyan); }
.act-icon.bookmark { background: rgba(217, 119, 6, 0.10); color: var(--brand-amber); }
.act-body { flex: 1; min-width: 0; }
.act-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.act-meta { font-size: 11px; color: var(--text-tertiary); }
.act-time { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); flex-shrink: 0; }

/* ===== Index page navigation tiles ===== */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-4);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.tile:hover {
  border-color: var(--brand-primary);
  background: var(--bg-surface-hi);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.tile-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--status-info-bg);
  color: var(--brand-primary);
  margin-bottom: var(--s-3);
}
.tile-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; color: var(--text-primary); }
.tile-meta { font-size: 11px; color: var(--text-tertiary); }
.tile-trend { font-size: 11px; color: var(--status-success); margin-top: var(--s-2); font-family: var(--font-mono); }

/* ===== Status Indicator ===== */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-success);
}
.status.idle::before { background: var(--text-tertiary); }
.status.warn::before { background: var(--status-warning); }
.status.err::before { background: var(--status-danger); }

/* ===== Chain / Flow visual ===== */
.flow-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: var(--s-4) 0;
}
.flow-step {
  flex: 1;
  padding: var(--s-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-align: center;
  position: relative;
}
.flow-step:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.flow-step:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.flow-step + .flow-step { border-left: none; }
.flow-step .step-num {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}
.flow-step .step-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.flow-step::after {
  content: '›';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  z-index: 1;
  font-size: 16px;
}
.flow-step:last-child::after { display: none; }

/* ===== Special: bar comparison ===== */
.bar-cmp { display: flex; flex-direction: column; gap: var(--s-3); }
.bar-cmp-row {
  display: grid;
  grid-template-columns: 100px 1fr 60px;
  align-items: center;
  gap: var(--s-3);
  font-size: 12px;
}
.bar-cmp-name { color: var(--text-secondary); }
.bar-cmp-bar {
  height: 8px;
  background: var(--bg-surface-hi);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}
.bar-cmp-fill {
  height: 100%;
  background: var(--grad-brand);
  border-radius: var(--r-full);
}
.bar-cmp-val { font-family: var(--font-mono); font-weight: 600; text-align: right; }

/* ===== Page-side index nav ===== */
.side-index {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  position: sticky;
  top: calc(var(--topbar-h) + var(--s-4));
  box-shadow: var(--shadow-xs);
}
.side-index-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--s-3);
  font-weight: 600;
}
.side-index-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 2px;
  transition: all var(--dur-fast) var(--ease-out);
}
.side-index-item:hover { color: var(--text-primary); background: var(--bg-surface-hi); }
.side-index-item .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  width: 16px;
}

/* ===== Callout ===== */
.callout {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.06) 0%, rgba(220, 38, 38, 0.03) 100%);
  border: 1px solid rgba(217, 119, 6, 0.20);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: var(--s-3) 0;
}
.callout-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: rgba(217, 119, 6, 0.12);
  color: var(--brand-amber);
  flex-shrink: 0;
}
.callout-title { font-weight: 600; color: var(--brand-amber); margin-bottom: 2px; }

/* ===== Lab page (我的实验室) ===== */
.lab-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: var(--s-4);
  min-height: calc(100vh - var(--topbar-h) - var(--s-12));
}
.lab-side {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.lab-side-head {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.lab-side-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4);
}
.filter-group {
  margin-bottom: var(--s-4);
}
.filter-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-group-title .clear {
  font-size: 10px;
  color: var(--brand-primary);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-2);
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
}
.filter-row:hover { background: var(--bg-surface-hi); }
.filter-row input[type="checkbox"] { accent-color: var(--brand-primary); }
.filter-row .count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.lab-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
.lab-toolbar {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.lab-toolbar .input { max-width: 240px; }
.lab-result-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: 12px;
  color: var(--text-tertiary);
}
.lab-result-info .num {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--brand-primary);
}

.lab-table-wrap {
  flex: 1;
  overflow: auto;
}
.lab-pagination {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.lab-side-right {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.lab-side-right-head {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
}
.lab-side-right-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-3);
}

.chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
}
.chart-card-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: var(--s-2);
  color: var(--text-primary);
}

/* Range input */
.range-input {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.range-input input {
  width: 80px;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  text-align: center;
}
.range-input .sep { font-size: 11px; color: var(--text-tertiary); }
.range-input .unit { font-size: 11px; color: var(--text-tertiary); }

/* Range slider */
.range-slider {
  height: 4px;
  background: var(--bg-surface-hi);
  border-radius: var(--r-full);
  position: relative;
  margin: var(--s-2) 0;
}
.range-slider-fill {
  position: absolute;
  left: 0; right: 0;
  top: 0; bottom: 0;
  background: var(--brand-primary);
  border-radius: var(--r-full);
  width: 60%;
}

/* Number input with unit */
.num-with-unit {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.num-with-unit input {
  border: none;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg-elevated);
  width: 70px;
  outline: none;
}
.num-with-unit .unit {
  padding: 4px 8px;
  background: var(--bg-surface-hi);
  border-left: 1px solid var(--border-default);
  font-size: 11px;
  color: var(--text-tertiary);
  display: grid;
  place-items: center;
}