:root {
  --ink-900: #18201f;
  --ink-700: #2f3b39;
  --ink-500: #4d5a58;
  --ink-300: #8a9997;
  --ink-200: #b9c4c2;
  --paper: #f6f2ea;
  --paper-2: #fbf8f2;
  --paper-3: #ffffff;
  --paper-inset: #efe9dd;
  --accent: #0f6b5f;
  --accent-700: #0b4c44;
  --accent-soft: #d4ebe5;
  --copper: #b6583c;
  --copper-soft: #f4ddd2;
  --border: rgba(24, 32, 31, 0.12);
  --border-strong: rgba(24, 32, 31, 0.22);
  --shadow-soft: 0 12px 32px rgba(12, 38, 35, 0.08);
  --shadow-card: 0 18px 44px rgba(12, 38, 35, 0.09);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink-900);
  font-family: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

body {
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(15, 107, 95, 0.18), transparent 70%),
    radial-gradient(900px 520px at 100% 110%, rgba(182, 88, 60, 0.14), transparent 70%),
    linear-gradient(180deg, var(--paper) 0%, #efe9dd 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  padding: 28px 32px;
  max-width: 1480px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ── Side panel ───────────────────────────────────────── */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 28px;
  align-self: flex-start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding-right: 4px;
}

.brand-block {
  background: linear-gradient(160deg, #132c29 0%, #0b4c44 80%);
  color: var(--paper-2);
  border-radius: var(--radius-lg);
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-card);
}

.brand-block .eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(246, 242, 234, 0.7);
  margin: 0 0 12px;
}

.brand-block h1 {
  font-family: "Fraunces", "IBM Plex Serif", serif;
  font-weight: 700;
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.brand-block .lede {
  font-size: 13.5px;
  color: rgba(246, 242, 234, 0.78);
  margin: 0 0 18px;
}

.signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.signal-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(246, 242, 234, 0.14);
  color: var(--paper-2);
  border: 1px solid rgba(246, 242, 234, 0.22);
}

.mode-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-tab {
  text-align: left;
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  color: var(--ink-700);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-tab:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.mode-tab.is-active {
  background: linear-gradient(135deg, #0f6b5f 0%, #0b4c44 100%);
  color: var(--paper-2);
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}

.mode-tab-title {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.2;
}

.mode-tab-sub {
  font-size: 12.5px;
  color: var(--ink-500);
}

.mode-tab.is-active .mode-tab-sub { color: rgba(246, 242, 234, 0.78); }

.nav-group {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin: 12px 0 2px 2px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.overview-card {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.overview-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

.overview-card h3 {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.01em;
}

.overview-card p {
  margin: 0;
  color: var(--ink-500);
  font-size: 13.5px;
  line-height: 1.6;
}

.overview-card .overview-cta {
  margin-top: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-700);
}

.overview-card-accent {
  background: linear-gradient(155deg, #f4ddd2 0%, #fbf8f2 65%);
  border-color: rgba(182, 88, 60, 0.25);
}
.overview-card-accent .overview-cta { color: var(--copper); }

.mode-switch-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mode-switch.is-active {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(15, 107, 95, 0.25);
}

.control-card {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.card-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin: 0 0 4px;
}

.card-head h2 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 18px;
  margin: 0;
}

.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-700);
  border: 1px solid rgba(15, 107, 95, 0.25);
}

.pill-muted {
  background: #eef1ef;
  color: var(--ink-500);
  border-color: var(--border);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.status-tile {
  background: var(--paper-inset);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.tile-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-300);
  display: block;
  margin-bottom: 4px;
}

.status-value {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-900);
}

.status-meta {
  font-size: 12.5px;
  color: var(--ink-500);
  margin: 0;
}

.tips-card .tip-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-500);
}

/* ── Workspace panel ─────────────────────────────────── */
.workspace-panel {
  position: relative;
  min-width: 0;
}

.view {
  display: none;
  flex-direction: column;
  gap: 22px;
}

.view.is-active { display: flex; }

.view-header {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  box-shadow: var(--shadow-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.view-header .eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin: 0 0 6px;
}

.view-header h2 {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 26px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.header-copy {
  margin: 0;
  color: var(--ink-500);
  max-width: 56ch;
  font-size: 14px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, auto));
  gap: 12px;
}

.hero-stat {
  background: var(--paper-inset);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 100px;
}

.hero-stat span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-300);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.hero-stat strong {
  font-family: "Fraunces", serif;
  font-size: 17px;
  color: var(--ink-900);
}

/* ── Chat grid ───────────────────────────────────────── */
.chat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
}

.chat-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 360px;
  max-height: 62vh;
  overflow-y: auto;
  box-shadow: var(--shadow-soft);
}

.message-item {
  background: var(--paper-2);
  border-radius: var(--radius-md);
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-item.is-user {
  background: linear-gradient(135deg, #0f6b5f 0%, #0b4c44 100%);
  color: var(--paper-2);
  border-color: transparent;
}

.message-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-300);
}

.message-item.is-user .message-top { color: rgba(246, 242, 234, 0.7); }

.message-action {
  background: transparent;
  border: 1px solid var(--border);
  color: inherit;
  border-radius: 999px;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.message-item.is-user .message-action { border-color: rgba(246, 242, 234, 0.32); }
.message-action:hover { border-color: var(--border-strong); }

.message-bubble {
  font-size: 14.5px;
  line-height: 1.65;
  white-space: normal;
  word-break: break-word;
}

.message-bubble p { margin: 0 0 10px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 8px 0 10px 20px; }
.message-bubble code {
  font-family: "IBM Plex Mono", monospace;
  background: rgba(24, 32, 31, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.message-item.is-user .message-bubble code { background: rgba(246, 242, 234, 0.18); }
.message-bubble pre {
  background: #0b1817;
  color: #eef4f1;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12.5px;
}
.message-bubble h2, .message-bubble h3 {
  font-family: "Fraunces", serif;
  margin: 14px 0 6px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
  color: var(--ink-500);
  font-size: 13px;
}
.typing-indicator.is-hidden { display: none; }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.1s infinite ease-in-out both;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ── Composer ───────────────────────────────────────── */
.composer {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
}

.composer-label, .field-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin: 0;
}

.composer-input {
  width: 100%;
  resize: vertical;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--paper-2);
  padding: 14px 16px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink-900);
  min-height: 92px;
  transition: border-color 0.15s ease;
}

.composer-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.15);
}

.composer-input-small { min-height: 74px; }

.composer-toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-cluster { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-cluster-right { justify-content: flex-end; }

.meta-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper-inset);
  color: var(--ink-500);
  border: 1px solid var(--border);
}

.meta-chip-accent {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(15, 107, 95, 0.25);
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.composer-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-500);
  max-width: 46ch;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-700) 100%);
  color: var(--paper-2);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(11, 76, 68, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(11, 76, 68, 0.3); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.ghost-btn {
  background: var(--paper-3);
  color: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ghost-btn:hover { border-color: var(--border-strong); }
.ghost-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(15, 107, 95, 0.25);
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.output-tabs { margin-left: auto; }

/* ── Chat aside ─────────────────────────────────────── */
.chat-aside { display: flex; flex-direction: column; gap: 18px; }
.control-stack { display: flex; flex-direction: column; gap: 6px; }
.control-stack.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.select-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--paper-2);
  font: inherit;
  font-size: 14px;
  color: var(--ink-900);
}
.select-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.15);
}

.range-input {
  width: 100%;
  accent-color: var(--accent);
}

.hint { font-size: 12px; color: var(--ink-500); }

.status-copy { font-size: 12.5px; color: var(--ink-500); margin: 4px 0 0; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-500);
}

.check-row input { margin-top: 3px; accent-color: var(--accent); }

.query-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-500);
  background: var(--paper-inset);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 0;
  word-break: break-word;
}

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

.source-card {
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.source-card a {
  color: var(--accent-700);
  font-weight: 600;
  text-decoration: none;
  font-size: 13.5px;
}
.source-card a:hover { text-decoration: underline; }

.source-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-300);
}

.empty-note { margin: 0; font-size: 12.5px; color: var(--ink-300); }

.prompt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.prompt-chip {
  background: var(--paper-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-700);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.prompt-chip:hover { border-color: var(--border-strong); transform: translateY(-1px); }

/* ── Workspace grid (Review / Article) ──────────────── */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
}

.workspace-form, .workspace-log, .workspace-output { min-width: 0; }

.pipeline-shell-card {
  min-height: 72vh;
}

.pipeline-frame-wrap {
  position: relative;
  min-height: 64vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #f3ede2 0%, #fbf8f2 100%);
}

.pipeline-frame {
  width: 100%;
  min-height: 64vh;
  border: 0;
  display: block;
  background: #fff;
}

.log-stream {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--ink-500);
  background: #0f1a19;
  color: #d7e5e2;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.rich-output {
  background: var(--paper-2);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-900);
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.rich-output h1, .rich-output h2, .rich-output h3 {
  font-family: "Fraunces", serif;
  margin: 18px 0 8px;
}
.rich-output h1 { font-size: 24px; }
.rich-output h2 { font-size: 19px; }
.rich-output h3 { font-size: 16px; }
.rich-output p { margin: 0 0 10px; }
.rich-output ul, .rich-output ol { margin: 8px 0 12px 22px; }
.rich-output code {
  font-family: "IBM Plex Mono", monospace;
  background: rgba(24, 32, 31, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.rich-output pre {
  background: #0b1817;
  color: #eef4f1;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12.5px;
}
.rich-output blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--paper-inset);
  color: var(--ink-500);
}

/* ── Toast ─────────────────────────────────────────── */
.optimization-json {
  min-height: 420px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}

.optimization-csv {
  min-height: 220px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre;
}

.optimization-analysis {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--ink-500);
}

.optimization-analysis p { margin: 0; }

.best-observation {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}

.best-observation span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-300);
}

.best-observation code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-500);
}

.optimization-note-grid {
  display: grid;
  gap: 8px;
}

.optimization-note-grid span {
  display: block;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--copper-soft);
  color: var(--copper);
  font-size: 12.5px;
}

.optimization-notes {
  margin: 0 0 0 18px;
  padding: 0;
  color: var(--ink-500);
  font-size: 13px;
}

.optimization-chart {
  display: grid;
  gap: 10px;
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.score-row {
  display: grid;
  grid-template-columns: 42px minmax(140px, 1fr) 74px;
  gap: 12px;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-500);
}

.score-track {
  height: 12px;
  border-radius: 999px;
  background: var(--paper-inset);
  overflow: hidden;
  border: 1px solid var(--border);
}

.score-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--copper));
}

.optimization-output { margin-top: 16px; }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--paper-3);
}

.optimization-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
  font-size: 13px;
}

.optimization-table th,
.optimization-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.optimization-table th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-300);
  background: var(--paper-2);
}

.optimization-table td {
  color: var(--ink-700);
  word-break: break-word;
}

/* ============================================================
   Theme override · AI for Science minimalist
   Final pass: keeps all upstream class names, retones the palette
   to a clean lab/dashboard look (cool slate + electric blue).
   ============================================================ */

:root {
  --ink-900: #0b1020;
  --ink-700: #1f2937;
  --ink-500: #4b5563;
  --ink-300: #94a3b8;
  --ink-200: #cbd5e1;
  --paper:    #fafbfc;
  --paper-2:  #f4f6f9;
  --paper-3:  #ffffff;
  --paper-inset: #f1f4f8;
  --accent:        #2563eb;
  --accent-700:    #1d4ed8;
  --accent-soft:   #eaf1ff;
  --copper:        #0891b2;
  --copper-soft:   #e0f2fe;
  --border:        #e5e7eb;
  --border-strong: #cbd5e1;
  --shadow-soft:  0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card:  0 4px 14px rgba(15, 23, 42, 0.06);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
}

html, body {
  font-family: "Inter", "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 14.5px;
  color: var(--ink-900);
}

body {
  background:
    radial-gradient(1px 1px at 20px 20px, rgba(15, 23, 42, 0.06) 1px, transparent 0),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  background-size: 28px 28px, auto;
  background-attachment: fixed, fixed;
}

.app-shell {
  grid-template-columns: 264px 1fr;
  gap: 24px;
  padding: 22px 28px;
  max-width: 1440px;
}

/* Sidebar ─────────────────────────────────────────── */
.brand-block {
  background: var(--paper-3);
  color: var(--ink-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.brand-block::before {
  content: "";
  position: absolute; inset: -1px -1px auto auto;
  width: 64px; height: 64px;
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 70%);
}
.brand-block .eyebrow,
.brand-block .lede {
  color: var(--ink-500);
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
}
.brand-block .eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; letter-spacing: 0.18em;
  color: var(--accent-700);
}
.brand-block .eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.brand-block h1 {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 8px 0 6px;
  color: var(--ink-900);
}
.brand-block .lede {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.55;
  margin: 0 0 12px;
}
.signal-strip { gap: 6px; }
.signal-pill {
  background: var(--paper-inset);
  color: var(--ink-700);
  border: 1px solid var(--border);
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 4px 8px;
}

.mode-nav { gap: 4px; }
.mode-tab {
  border-radius: 8px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  gap: 2px;
  color: var(--ink-700);
}
.mode-tab:hover { transform: none; background: var(--paper-2); border-color: var(--border); }
.mode-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(37, 99, 235, 0.18);
  box-shadow: none;
}
.mode-tab.is-active .mode-tab-sub { color: rgba(29, 78, 216, 0.78); }
.mode-tab-title {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0;
}
.mode-tab-sub {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11.5px;
  color: var(--ink-500);
}
.nav-group {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-300);
  margin: 14px 0 4px 4px;
}

/* Cards / surfaces ───────────────────────────────── */
.control-card,
.view-header,
.overview-card,
.tool-card,
.message-list,
.composer,
.rich-output,
.optimization-chart,
.table-scroll,
.hero-stat,
.status-tile,
.source-card,
.message-item {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.control-card { padding: 16px; gap: 12px; }
.view-header {
  padding: 22px 24px;
  border-radius: var(--radius-lg);
}
.view-header .eyebrow {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  color: var(--accent-700);
  letter-spacing: 0.16em;
  font-size: 10.5px;
}
.view-header h2 {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 4px 0 6px;
}
.header-copy { font-size: 13.5px; color: var(--ink-500); max-width: 64ch; }

.card-head h2 {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}
.card-eyebrow {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  color: var(--ink-300);
  letter-spacing: 0.16em;
  font-size: 10px;
}

.hero-stat { padding: 8px 12px; min-width: 88px; }
.hero-stat span {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.16em;
  font-size: 9.5px;
  color: var(--ink-300);
}
.hero-stat strong {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-900);
}
.status-tile { background: var(--paper-2); border: 1px solid var(--border); padding: 9px 11px; }
.status-value {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14.5px;
}

.pill {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  background: var(--accent-soft);
  color: var(--accent-700);
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  padding: 3px 9px;
}
.pill-muted {
  background: var(--paper-inset);
  color: var(--ink-500);
  border-color: var(--border);
}

/* Buttons ───────────────────────────────────────── */
.primary-btn {
  background: var(--ink-900);
  color: #fff;
  border-radius: 8px;
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0;
  padding: 9px 18px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background 0.15s ease, transform 0.12s ease;
}
.primary-btn:hover { background: #1e293b; transform: none; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18); }
.primary-btn:disabled { opacity: 0.45; }

.ghost-btn {
  background: var(--paper-3);
  color: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12.5px;
  padding: 6px 12px;
}
.ghost-btn:hover { background: var(--paper-2); border-color: var(--border-strong); }
.ghost-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(37, 99, 235, 0.25);
}

.meta-chip {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  background: var(--paper-inset);
  color: var(--ink-500);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
}
.meta-chip-accent {
  background: var(--accent-soft);
  color: var(--accent-700);
  border-color: rgba(37, 99, 235, 0.2);
}

/* Inputs ───────────────────────────────────────── */
.composer-input,
.select-input {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink-900);
}
.composer-input:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.composer-label, .field-label {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-300);
}

/* Messages ─────────────────────────────────────── */
.message-item {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.message-item.is-user {
  background: var(--ink-900);
  color: #f8fafc;
  border-color: transparent;
}
.message-item.is-user .message-bubble code { background: rgba(248, 250, 252, 0.12); }
.message-bubble code {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  background: var(--paper-inset);
  border: 1px solid var(--border);
}
.message-bubble pre {
  background: #0b1020;
  color: #e2e8f0;
}
.message-bubble h2, .message-bubble h3,
.rich-output h1, .rich-output h2, .rich-output h3 {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.typing-dots span { background: var(--accent); }

/* Sources / chips ──────────────────────────────── */
.source-card { background: var(--paper-2); }
.source-card a { color: var(--accent-700); }
.source-meta {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  color: var(--ink-300);
}
.query-chip {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  background: var(--paper-inset);
  border: 1px solid var(--border);
}
.prompt-chip {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink-700);
  font-size: 12.5px;
}
.prompt-chip:hover { background: var(--accent-soft); border-color: rgba(37, 99, 235, 0.25); color: var(--accent-700); transform: none; }

/* Overview catalog ─────────────────────────────── */
.overview-catalog { gap: 18px; }
.category-row {
  background: var(--paper-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 22px;
  align-items: start;
  box-shadow: var(--shadow-soft);
}
.category-row:first-child { background: var(--paper-3); }
.category-intro {
  position: relative;
  padding-left: 12px;
}
.category-intro::before {
  content: "";
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), #60a5fa);
}
.category-intro .card-eyebrow { color: var(--accent-700); }
.category-intro h3 {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0;
  margin: 4px 0 6px;
}
.category-intro p {
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.55;
}
.category-actions {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.tool-card {
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  box-shadow: none;
}
.tool-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
  background: var(--paper-3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.tool-card span {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent-700);
}
.tool-card strong {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-900);
}
.tool-card-primary {
  background: var(--ink-900);
  border-color: transparent;
}
.tool-card-primary span { color: #93c5fd; }
.tool-card-primary strong { color: #f8fafc; }
.tool-card-primary:hover { background: #1e293b; }

/* Preview / disabled tool slot */
.tool-card-preview {
  position: relative;
  cursor: not-allowed;
  background: repeating-linear-gradient(
    135deg,
    var(--paper-2) 0 10px,
    var(--paper-3) 10px 20px
  );
  border-style: dashed;
  border-color: var(--border-strong);
}
.tool-card-preview::after {
  content: "PREVIEW";
  position: absolute; top: 8px; right: 10px;
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px; letter-spacing: 0.18em;
  padding: 2px 6px; border-radius: 4px;
  background: var(--copper-soft); color: var(--copper);
  border: 1px solid rgba(8, 145, 178, 0.25);
}
.tool-card-preview:hover { transform: none; box-shadow: none; border-color: var(--border-strong); }
.tool-card-preview span { color: var(--ink-300); }
.tool-card-preview strong { color: var(--ink-500); }

/* Misc ─────────────────────────────────────────── */
.log-stream {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  background: #0b1020;
  color: #cbd5e1;
  border-radius: 8px;
}
.optimization-json,
.optimization-csv {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
}
.score-track i {
  background: linear-gradient(90deg, var(--accent), #60a5fa);
}
.optimization-note-grid span {
  background: var(--copper-soft);
  color: var(--copper);
  border: 1px solid rgba(8, 145, 178, 0.2);
  font-family: "Inter", system-ui, sans-serif;
}
.optimization-table th {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  background: var(--paper-2);
}
.toast {
  background: var(--ink-900);
  color: #f8fafc;
  border-radius: 10px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

/* Side panel scrollbar */
.side-panel::-webkit-scrollbar { width: 6px; }
.side-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-panel { position: static; max-height: none; }
  .category-row { grid-template-columns: 1fr; }
}

.mode-tab-title {
  font-size: 15px;
}

.mode-tab-sub {
  font-size: 12px;
}

.nav-group {
  margin: 14px 0 4px 2px;
  letter-spacing: 0.12em;
}

.control-card,
.view-header,
.overview-card,
.hero-stat,
.status-tile {
  border-radius: 10px;
  box-shadow: none;
}

.view-header {
  padding: 24px;
}

.view-header h2 {
  font-size: 25px;
}

.header-copy {
  max-width: 760px;
}

.overview-catalog {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.6fr);
  gap: 18px;
  padding: 20px 0 24px;
  border-top: 1px solid var(--border);
}

.category-row:first-child {
  border-top: 0;
  padding-top: 4px;
}

.category-intro h3 {
  margin: 4px 0 8px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.category-intro p {
  margin: 0;
  color: var(--ink-500);
}

.category-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  align-content: start;
}

.category-actions-two {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.category-actions-one {
  grid-template-columns: minmax(240px, 0.65fr);
}

.tool-card {
  min-height: 96px;
  padding: 16px;
  border-radius: 10px;
  background: var(--paper-3);
  gap: 8px;
}

.tool-card:hover {
  transform: none;
  background: var(--paper-2);
  box-shadow: none;
}

.tool-card span {
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink-300);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tool-card strong {
  color: var(--ink-900);
  font-size: 16px;
  font-weight: 600;
}

.tool-card-primary {
  border-color: rgba(15, 107, 95, 0.28);
  background: var(--accent-soft);
}

.overview-card-accent {
  background: var(--paper-3);
  border-color: var(--border);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink-900);
  color: var(--paper-2);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-card);
  z-index: 100;
}
.toast[hidden] { display: none; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; padding: 20px; gap: 20px; }
  .side-panel { position: static; max-height: none; overflow: visible; }
  .chat-grid, .workspace-grid { grid-template-columns: 1fr; }
  .category-row { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 780px) {
  .view-header { padding: 20px; }
  .view-header h2 { font-size: 22px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .category-actions,
  .category-actions-two,
  .category-actions-one { grid-template-columns: 1fr; }
  .tool-card { min-height: 82px; }
  .prompt-grid { grid-template-columns: 1fr; }
  .control-stack.two-col { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: 34px minmax(90px, 1fr) 58px; gap: 8px; }
}

/* placeholder-anchor */

/* ============================================================
   FINAL THEME PASS · ideal_UI mock
   White surface · indigo accents · sidebar + 2x2 task board
   ============================================================ */

:root {
  --ink-900: #0f1733;
  --ink-700: #2c3454;
  --ink-500: #5b6478;
  --ink-300: #93a0bd;
  --ink-200: #c8d0e2;
  --paper:    #ffffff;
  --paper-2:  #f6f7fb;
  --paper-3:  #ffffff;
  --paper-inset: #eef0f8;
  --accent:        #5b6deb;
  --accent-700:    #4453d8;
  --accent-soft:   #e8ecff;
  --accent-fade:   #f3f5ff;
  --copper:        #6e54f6;
  --copper-soft:   #efe9ff;
  --border:        #e7eaf3;
  --border-strong: #d3d8e8;
  --shadow-soft:  0 1px 2px rgba(15, 23, 51, 0.04);
  --shadow-card:  0 8px 24px rgba(67, 75, 178, 0.08);
}

html, body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink-900);
  background: #f4f6fb;
}

body {
  background:
    radial-gradient(1px 1px at 16px 16px, rgba(91, 109, 235, 0.08) 1px, transparent 0),
    linear-gradient(180deg, #f7f9fd 0%, #eef1f8 100%);
  background-size: 24px 24px, auto;
  background-attachment: fixed, fixed;
}

.app-shell {
  grid-template-columns: 248px 1fr;
  gap: 0;
  padding: 0;
  max-width: none;
  min-height: 100vh;
}

.hidden-status { display: none !important; }

/* ── Sidebar ─────────────────────────────────────── */
.side-panel {
  position: sticky;
  top: 0;
  align-self: stretch;
  height: 100vh;
  max-height: 100vh;
  padding: 22px 16px 16px;
  background: var(--paper);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.brand-block {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0 4px 8px;
  margin: 0;
}
.brand-block::before { display: none; }
.brand-logo { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #5b6deb 0%, #8a5cf5 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(91, 109, 235, 0.35);
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-name {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--ink-300);
  text-transform: uppercase;
}
.brand-name strong { color: var(--ink-900); font-weight: 700; }

.mode-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  margin: 0;
  flex: 1;
}
.nav-group {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-300);
  text-transform: none;
  margin: 14px 8px 6px;
}
.nav-group:first-child { margin-top: 6px; }

.mode-tab {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  color: var(--ink-700);
  transition: background 0.15s ease, color 0.15s ease;
  box-shadow: none;
}
.mode-tab .nav-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink-500);
  font-size: 13px;
  border: 1px solid var(--border);
}
.mode-tab .nav-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mode-tab .mode-tab-title {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: 0;
}
.mode-tab .mode-tab-sub {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-size: 11.5px;
  color: var(--ink-300);
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mode-tab:hover {
  background: var(--paper-2);
  border-color: var(--border);
}
.mode-tab.is-active {
  background: linear-gradient(135deg, #eef1ff 0%, #f4eeff 100%);
  border-color: rgba(91, 109, 235, 0.18);
  box-shadow: 0 1px 0 rgba(91, 109, 235, 0.06);
}
.mode-tab.is-active .mode-tab-title { color: var(--accent-700); }
.mode-tab.is-active .nav-icon {
  background: #fff;
  color: var(--accent);
  border-color: rgba(91, 109, 235, 0.25);
  box-shadow: 0 2px 4px rgba(91, 109, 235, 0.15);
}

/* User pill */
.user-pill {
  display: grid;
  grid-template-columns: 32px 1fr 16px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: auto;
  cursor: default;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5b6deb 0%, #8a5cf5 100%);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-meta strong { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.user-meta span { font-size: 11.5px; color: var(--ink-300); }
.user-caret { color: var(--ink-300); font-size: 12px; }

/* ── Workspace panel ─────────────────────────────── */
.workspace-panel {
  padding: 32px 44px 36px;
  min-width: 0;
  background:
    radial-gradient(900px 360px at 80% 0%, rgba(91, 109, 235, 0.08), transparent 70%),
    transparent;
}

.view { gap: 22px; }

/* Hero ──────────────────────────── */
.platform-hero {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 12px 4px 4px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  flex-wrap: nowrap;
  position: relative;
  min-height: 220px;
}
.hero-copy-block { display: flex; flex-direction: column; gap: 14px; }
.platform-hero h2 {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-weight: 700;
  font-size: 38px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink-900);
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-spark {
  font-style: normal;
  background: linear-gradient(135deg, #5b6deb, #8a5cf5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 26px;
  font-weight: 400;
  transform: translateY(-6px);
}
.platform-hero .header-copy {
  font-size: 14.5px;
  color: var(--ink-500);
  margin: 0;
  max-width: 56ch;
  line-height: 1.7;
}
.platform-hero .header-copy-muted { color: var(--ink-300); }

.platform-hero .hero-stats {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.platform-hero .hero-stat {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-soft);
  min-width: auto;
}
.hero-stat-icon {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-fade);
  color: var(--accent);
  font-size: 13px;
}
.platform-hero .hero-stat div { display: flex; flex-direction: column; line-height: 1.2; }
.platform-hero .hero-stat span {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-size: 10.5px;
  letter-spacing: 0;
  color: var(--ink-300);
  text-transform: none;
  margin: 0;
}
.platform-hero .hero-stat strong {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
}
.hero-stat-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #5cd3a3;
  box-shadow: 0 0 0 3px rgba(92, 211, 163, 0.18);
  font-style: normal;
}

/* Hero visual */
.hero-visual {
  position: relative;
  height: 220px;
  width: 100%;
}
.science-cube {
  position: absolute;
  top: 50%; left: 50%;
  width: 130px; height: 130px;
  transform: translate(-50%, -50%) rotate(18deg);
  background:
    linear-gradient(135deg, rgba(91, 109, 235, 0.55), rgba(138, 92, 245, 0.35)),
    linear-gradient(180deg, #fff, #e3e8ff);
  border-radius: 22px;
  box-shadow:
    0 30px 60px rgba(91, 109, 235, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -20px 40px rgba(91, 109, 235, 0.25);
  filter: blur(0.4px);
}
.science-cube::after {
  content: "";
  position: absolute; inset: 18% 18% auto auto;
  width: 30px; height: 30px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  filter: blur(2px);
}
.orbit {
  position: absolute;
  top: 50%; left: 50%;
  border: 1px dashed rgba(91, 109, 235, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.orbit-one { width: 280px; height: 280px; transform: translate(-50%, -50%) rotate(-12deg); border-style: dashed; }
.orbit-two { width: 200px; height: 200px; transform: translate(-50%, -50%) rotate(24deg); border-color: rgba(138, 92, 245, 0.28); }
.node {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(91, 109, 235, 0.18);
}
.node-a { top: 18%; right: 14%; }
.node-b { bottom: 22%; left: 12%; background: #8a5cf5; box-shadow: 0 0 0 4px rgba(138, 92, 245, 0.2); }
.node-c { top: 56%; right: 6%; background: #4dd2c4; box-shadow: 0 0 0 4px rgba(77, 210, 196, 0.18); }

/* Task board ──────────────────────── */
.task-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.task-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  gap: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  min-height: 200px;
}
.task-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: rgba(91, 109, 235, 0.25);
}
.task-card-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
  z-index: 1;
}
.task-index {
  font-family: "JetBrains Mono", "Inter", monospace;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-fade);
  border: 1px solid rgba(91, 109, 235, 0.15);
  width: 36px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.task-card h3 {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 4px 0 0;
  color: var(--ink-900);
}
.task-sub {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-size: 13px;
  color: var(--ink-500);
  margin: 0;
}
.task-desc {
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.7;
  margin: 4px 0 0;
  max-width: 36ch;
}
.task-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}
.task-tags span {
  background: var(--paper-2);
  border: 1px solid var(--border);
  color: var(--ink-700);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 500;
}
.task-arrow {
  position: absolute;
  top: 22px; right: 22px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1px solid var(--border);
  color: var(--ink-500);
  font-size: 14px;
  z-index: 2;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.task-card:hover .task-arrow {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Decorative right-side abstract art */
.task-decor {
  position: absolute;
  right: -20px; top: -20px;
  width: 220px; height: 220px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.85;
  pointer-events: none;
}
.task-decor-01 {
  background-image:
    radial-gradient(circle at 70% 50%, rgba(91, 109, 235, 0.18), transparent 60%),
    radial-gradient(circle at 80% 75%, rgba(138, 92, 245, 0.12), transparent 60%);
}
.task-decor-01::after {
  content: "";
  position: absolute; inset: 30% 6% 18% 30%;
  background:
    repeating-linear-gradient(75deg, rgba(91, 109, 235, 0.18) 0 1px, transparent 1px 6px);
  mask: radial-gradient(circle at 60% 50%, black 0, transparent 70%);
  border-radius: 50%;
}
.task-decor-02 {
  background:
    linear-gradient(135deg, rgba(91, 109, 235, 0.15), transparent 65%),
    radial-gradient(circle at 75% 30%, rgba(138, 92, 245, 0.18), transparent 60%);
}
.task-decor-02::before {
  content: "Aa";
  position: absolute; right: 24px; top: 70px;
  font-family: "Fraunces", "Inter", serif;
  font-style: italic;
  font-size: 96px;
  font-weight: 600;
  color: rgba(91, 109, 235, 0.18);
  letter-spacing: -0.04em;
}
.task-decor-03 {
  background:
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.25), transparent 60%);
}
.task-decor-04 {
  background:
    radial-gradient(circle at 70% 60%, rgba(91, 109, 235, 0.14), transparent 70%);
}
.task-decor-04::after {
  content: "";
  position: absolute; right: 18px; top: 50px;
  width: 150px; height: 150px;
  background:
    radial-gradient(circle at 50% 50%, #8a5cf5 0 5px, transparent 6px),
    radial-gradient(circle at 25% 35%, #5b6deb 0 4px, transparent 5px),
    radial-gradient(circle at 75% 35%, #5b6deb 0 4px, transparent 5px),
    radial-gradient(circle at 25% 70%, #4dd2c4 0 4px, transparent 5px),
    radial-gradient(circle at 75% 70%, #4dd2c4 0 4px, transparent 5px),
    radial-gradient(circle at 50% 95%, #8a5cf5 0 4px, transparent 5px);
  filter: drop-shadow(0 4px 12px rgba(91, 109, 235, 0.18));
}

/* Featured (03) card */
.task-card-featured {
  background: linear-gradient(135deg, #eef0ff 0%, #f6f0ff 100%);
  border-color: rgba(91, 109, 235, 0.35);
  box-shadow: 0 12px 30px rgba(91, 109, 235, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.task-card-featured .task-index {
  background: rgba(91, 109, 235, 0.18);
  color: var(--accent-700);
  border-color: rgba(91, 109, 235, 0.3);
}
.primary-task-cta {
  margin-top: 10px;
  align-self: flex-start;
  background: linear-gradient(135deg, #5b6deb 0%, #4453d8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 20px rgba(91, 109, 235, 0.35);
}
.primary-task-cta span { font-weight: 400; }
.task-card-featured .task-arrow {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

/* Preview card */
.task-card-preview { cursor: pointer; }
.task-card-preview::after {
  content: "PREVIEW";
  position: absolute;
  top: 22px; right: 64px;
  font-family: "JetBrains Mono", "Inter", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--copper-soft);
  color: var(--copper);
  border: 1px solid rgba(110, 84, 246, 0.2);
}

/* Feature strip ─────────────────── */
.platform-feature-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4px 4px 12px;
}
.platform-feature-strip article {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
}
.feat-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--accent-fade);
  color: var(--accent);
  font-size: 16px;
}
.platform-feature-strip article div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.platform-feature-strip strong {
  font-family: "Inter", "PingFang SC", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-900);
}
.platform-feature-strip span {
  font-size: 12px;
  color: var(--ink-300);
  letter-spacing: 0;
  text-transform: none;
}

/* ── Other views: keep look but refresh palette ─── */
.view:not(.view-overview) .view-header {
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.control-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}
.primary-btn {
  background: linear-gradient(135deg, #5b6deb 0%, #4453d8 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(91, 109, 235, 0.28);
}
.primary-btn:hover { background: linear-gradient(135deg, #4f60e3 0%, #3b48c4 100%); box-shadow: 0 10px 22px rgba(91, 109, 235, 0.38); }
.ghost-btn.is-active, .pill, .meta-chip-accent {
  background: var(--accent-fade);
  color: var(--accent-700);
  border-color: rgba(91, 109, 235, 0.2);
}
.composer-input:focus, .select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 109, 235, 0.18);
}
.message-item.is-user {
  background: linear-gradient(135deg, #5b6deb 0%, #4453d8 100%);
}
.score-track i { background: linear-gradient(90deg, #5b6deb, #8a5cf5); }
.tool-card span, .tool-card-preview::after,
.brand-block .eyebrow, .view-header .eyebrow,
.card-eyebrow { letter-spacing: 0.08em; }

.toast {
  background: var(--ink-900);
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(15, 23, 51, 0.25);
}

/* Scrollbar */
.side-panel::-webkit-scrollbar,
.message-list::-webkit-scrollbar,
.rich-output::-webkit-scrollbar { width: 6px; height: 6px; }
.side-panel::-webkit-scrollbar-thumb,
.message-list::-webkit-scrollbar-thumb,
.rich-output::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }

@media (max-width: 1180px) {
  .platform-hero { grid-template-columns: 1fr; }
  .hero-visual { height: 160px; }
  .task-board { grid-template-columns: 1fr; }
  .platform-feature-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-panel { position: static; height: auto; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .workspace-panel { padding: 22px; }
  .platform-hero h2 { font-size: 28px; }
  .platform-feature-strip { grid-template-columns: 1fr; }
}

/* ── Reasoning trace (chain-of-thought) ─────────────── */
.reasoning-trace {
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid rgba(91, 109, 235, 0.22);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(91, 109, 235, 0.06), rgba(138, 92, 245, 0.04));
}
.reasoning-trace > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5bd6;
  user-select: none;
}
.reasoning-trace > summary::-webkit-details-marker { display: none; }
.reasoning-trace > summary::after {
  content: "▾";
  margin-left: auto;
  transition: transform 0.18s ease;
  color: #8a5cf5;
}
.reasoning-trace[open] > summary::after { transform: rotate(180deg); }
.reasoning-trace .reasoning-icon { font-size: 15px; }
.reasoning-trace .reasoning-hint { font-size: 12px; font-weight: 500; color: #8a8fae; margin-left: 4px; }
.reasoning-trace[open] .reasoning-hint::before { content: "已展开 · "; }
.reasoning-body {
  padding: 4px 14px 12px;
  border-top: 1px dashed rgba(91, 109, 235, 0.2);
  color: #545771;
  font-size: 13.5px;
  line-height: 1.65;
  max-height: 360px;
  overflow-y: auto;
}
.reasoning-body p { margin: 8px 0; }
.message-item.is-user .reasoning-trace { display: none; }
.message-answer { margin-top: 2px; }

/* ── Thinking bubble (pre-response) ─────────────────── */
.message-item.is-pending-assistant .message-bubble.thinking-bubble {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  color: #6c6f87;
  font-size: 13.5px;
  background: linear-gradient(180deg, #ffffff, #f5f6ff);
  border: 1px dashed rgba(91, 109, 235, 0.35);
}
.thinking-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.thinking-dots { display: inline-flex; gap: 4px; }
.thinking-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8a5cf5;
  animation: thinkingPulse 1.1s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.18s; background: #6b7cf0; }
.thinking-dots span:nth-child(3) { animation-delay: 0.36s; background: #5b6deb; }
@keyframes thinkingPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}
.thinking-progress-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.thinking-progress-list span {
  border: 1px solid rgba(91, 109, 235, 0.16);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(255, 255, 255, 0.72);
  color: #8a8fae;
  font-size: 12px;
  line-height: 1.2;
}
.thinking-progress-list span.is-active {
  color: #4b5bd6;
  border-color: rgba(91, 109, 235, 0.38);
  background: #eef0ff;
  font-weight: 700;
}
.thinking-progress-list span.is-done {
  color: #3f8b62;
  border-color: rgba(63, 139, 98, 0.22);
  background: #effaf3;
}

/* ── Code / data cards (JSON, CSV, generic code) ───── */
.code-card, .data-card {
  margin: 10px 0;
  border: 1px solid #e1e4f5;
  border-radius: 12px;
  background: #fafbff;
  overflow: hidden;
}
.code-card-head, .data-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: linear-gradient(180deg, #f1f3ff, #e9ecff);
  border-bottom: 1px solid #e1e4f5;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5b6deb;
}
.code-lang, .data-card-tag {
  background: rgba(91, 109, 235, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
  color: #4b5bd6;
}
.code-copy {
  background: transparent;
  border: 1px solid rgba(91, 109, 235, 0.4);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 11px;
  color: #5b6deb;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.code-copy:hover { background: #5b6deb; color: #fff; }
.code-card pre, .json-pre {
  margin: 0;
  padding: 12px 14px;
  background: #ffffff !important;
  color: #2d2f3f;
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}
.json-pre code { background: transparent !important; padding: 0; color: inherit; }
.json-key { color: #5b6deb; font-weight: 600; }
.json-str { color: #1f9d55; }
.json-num { color: #b65300; }
.json-bool { color: #d6336c; font-weight: 600; }
.json-null { color: #888; font-style: italic; }

/* CSV table */
.csv-scroll {
  max-height: 420px;
  overflow: auto;
  background: #fff;
}
.csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
.csv-table thead th {
  position: sticky;
  top: 0;
  background: #eef0ff;
  color: #3a3f5c;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #d6dafc;
  white-space: nowrap;
}
.csv-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid #f0f2fb;
  color: #2d2f3f;
  white-space: nowrap;
}
.csv-table tbody tr:nth-child(odd) { background: #fafbff; }
.csv-table tbody tr:hover { background: #eef0ff; }

/* Make the assistant bubble in user-side colors keep readable on its dark variant */
.message-item.is-user .code-card,
.message-item.is-user .data-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.message-item.is-user .code-card-head,
.message-item.is-user .data-card-head { background: rgba(255, 255, 255, 0.06); color: #f6f2ea; border-bottom-color: rgba(255,255,255,0.12); }
.message-item.is-user .code-card pre,
.message-item.is-user .json-pre { background: rgba(0, 0, 0, 0.18) !important; color: #f6f2ea; }
.message-item.is-user .csv-table thead th { background: rgba(255,255,255,0.1); color: #f6f2ea; }
.message-item.is-user .csv-table tbody td { color: #f6f2ea; border-bottom-color: rgba(255,255,255,0.08); }
.message-item.is-user .csv-table tbody tr:nth-child(odd) { background: rgba(255,255,255,0.04); }

/* Pilot extracted-data sample */
.view-pilot {
  display: none;
  gap: 18px;
}
.view-pilot.is-active { display: flex; flex-direction: column; }
.pilot-hero {
  background: linear-gradient(135deg, #fffaf2 0%, #f2f8f7 54%, #f8efe9 100%) !important;
}
.pilot-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}
.pilot-summary-card { grid-row: span 2; }
.pilot-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.pilot-metric {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px;
  min-width: 0;
}
.pilot-metric span,
.pilot-file-card span {
  display: block;
  color: var(--ink-300);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pilot-metric strong {
  display: block;
  margin-top: 4px;
  color: var(--accent-700);
  font-size: 24px;
  line-height: 1.15;
}
.pilot-metric small {
  display: block;
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 12px;
}
.pilot-actions { margin-top: 14px; }
.pilot-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.pilot-bar-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-700);
  font-size: 12.5px;
}
.pilot-bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pilot-bar-label strong { color: var(--accent-700); }
.pilot-bar-track {
  height: 9px;
  border-radius: 999px;
  background: #eee6d8;
  overflow: hidden;
  margin-top: 5px;
}
.pilot-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--copper));
}
.pilot-data-card,
.pilot-files-card,
.pilot-dashboard-details { margin-top: 0; }
.pilot-table-wrap { max-height: 460px; overflow: auto; }
.pilot-table { min-width: 1120px; }
.pilot-table td:last-child {
  min-width: 360px;
  white-space: normal;
  line-height: 1.45;
}
.pilot-file-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.pilot-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  min-width: 0;
}
.pilot-file-card strong {
  display: block;
  color: var(--ink-900);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pilot-file-card nav {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.pilot-file-card a {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 5px 7px;
  color: var(--accent-700);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.external-db-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.external-db-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}
.external-db-item strong,
.external-db-item span {
  display: block;
}
.external-db-item strong {
  color: var(--ink-900);
  font-size: 15px;
}
.external-db-item span {
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
}
.external-db-item p {
  margin: 8px 0 10px;
  color: var(--ink-700);
  font-size: 13px;
  line-height: 1.45;
}
.external-db-item a {
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--accent-700);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}
.pilot-frame-wrap { min-height: 720px; }
.pilot-frame { min-height: 720px; }

@media (max-width: 1180px) {
  .pilot-grid { grid-template-columns: 1fr; }
  .pilot-summary-card { grid-row: auto; }
  .pilot-file-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .external-db-list { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .pilot-metric-grid,
  .pilot-file-list { grid-template-columns: 1fr; }
}

/* ── Markdown tables: research-answer friendly ─────── */
.markdown-table-card {
  border-color: rgba(91, 109, 235, 0.24);
  box-shadow: 0 10px 26px rgba(36, 45, 110, 0.08);
}
.markdown-table-card .data-card-head {
  background: linear-gradient(180deg, #f6f7ff 0%, #edf0ff 100%);
}
.markdown-table {
  table-layout: auto;
  min-width: 720px;
}
.markdown-table th,
.markdown-table td {
  vertical-align: top;
  line-height: 1.55;
}
.markdown-table th:first-child,
.markdown-table td:first-child {
  min-width: 110px;
  font-weight: 700;
  color: #25305f;
}
.markdown-table td {
  white-space: normal;
  min-width: 180px;
  max-width: 460px;
}
.markdown-table td a { color: #4f60e3; font-weight: 600; }
.markdown-table em { color: #29314f; }

/* ── Attachments ───────────────────────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.composer.is-dragging {
  border-color: rgba(91, 109, 235, 0.75);
  box-shadow: 0 0 0 4px rgba(91, 109, 235, 0.14), var(--shadow-soft);
}
.composer-attach-btn { padding: 7px 12px; }
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}
.attachment-pill,
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid rgba(91, 109, 235, 0.24);
  background: #f7f8ff;
  color: #2f365c;
  border-radius: 10px;
}
.attachment-pill {
  cursor: pointer;
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
}
.attachment-pill:hover { border-color: rgba(91, 109, 235, 0.5); background: #eef0ff; }
.attachment-pill span,
.attachment-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.attachment-pill small,
.attachment-chip small { color: #727796; font-size: 11px; }
.attachment-pill b { color: #8a5cf5; font-size: 14px; line-height: 1; }
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.attachment-chip { padding: 7px 10px; font-size: 12px; }
.attachment-chip { flex-direction: column; align-items: flex-start; gap: 2px; }
.message-item.is-user .attachment-chip {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.message-item.is-user .attachment-chip small { color: rgba(255, 255, 255, 0.72); }

/* ── Pipeline Console native panel ─────────────────── */
.pipeline-console-native {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
}
.pipeline-command-card,
.pipeline-guide-card {
  min-width: 0;
}
.pipeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.pipeline-open-link { text-decoration: none; display: inline-flex; align-items: center; }
.pipeline-facts {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}
.pipeline-facts div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper-2);
}
.pipeline-facts dt {
  color: var(--ink-300);
  font-size: 12px;
  font-weight: 700;
}
.pipeline-facts dd {
  margin: 0;
  color: var(--ink-700);
  word-break: break-word;
}
.pipeline-step-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}
.pipeline-step-list span {
  padding: 10px 12px;
  border: 1px solid rgba(91, 109, 235, 0.18);
  border-radius: 10px;
  background: #f7f8ff;
  color: #323a66;
  font-size: 13px;
}
.pipeline-dashboard-details {
  margin-top: 18px;
  padding: 0;
  overflow: hidden;
}
.pipeline-dashboard-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
.pipeline-dashboard-details > summary::-webkit-details-marker { display: none; }
.pipeline-dashboard-details > summary::after {
  content: "▾";
  color: var(--accent);
  transition: transform 0.16s ease;
}
.pipeline-dashboard-details[open] > summary::after { transform: rotate(180deg); }
.pipeline-dashboard-details small {
  font-weight: 500;
  color: var(--ink-300);
}
.pipeline-dashboard-details .pipeline-frame-wrap {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}
.catmaster-install-card,
.autoplanner-install-card {
  margin-top: 18px;
}
.runtime-command {
  margin: 12px 0 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111827;
  color: #f8fafc;
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
}
.pipeline-open-link.is-disabled {
  pointer-events: none;
  opacity: 0.55;
}

@media (max-width: 960px) {
  .pipeline-console-native { grid-template-columns: 1fr; }
  .pipeline-facts div { grid-template-columns: 1fr; }
  .markdown-table { min-width: 640px; }
}

/* ── Categorized workspace catalog ─────────────────── */
.task-board.overview-catalog {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.task-board.overview-catalog .category-row {
  display: grid;
  grid-template-columns: minmax(210px, 0.34fr) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.task-board.overview-catalog .category-row:first-child { border-top: 0; padding-top: 0; }
.category-intro h3 {
  margin: 4px 0 8px;
  font-size: 18px;
  letter-spacing: 0;
}
.category-intro p {
  margin: 0;
  color: var(--ink-500);
  line-height: 1.65;
}
.task-board.overview-catalog .category-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}
.task-board.overview-catalog .tool-card {
  min-height: 146px;
  padding: 16px;
  gap: 6px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}
.task-board.overview-catalog .tool-card:hover {
  transform: translateY(-1px);
  border-color: rgba(91, 109, 235, 0.24);
}
.task-board.overview-catalog .tool-card > span {
  width: auto;
  height: auto;
  justify-content: flex-start;
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.task-board.overview-catalog .tool-card strong {
  font-size: 16px;
  color: var(--ink-900);
}
.task-board.overview-catalog .tool-card .task-sub,
.task-board.overview-catalog .tool-card .task-desc {
  margin: 0;
  max-width: none;
}
.task-board.overview-catalog .tool-card .task-tags {
  margin-top: auto;
  padding-top: 8px;
}
.task-board.overview-catalog .tool-card .task-tags em {
  font-style: normal;
  background: var(--paper-2);
  border: 1px solid var(--border);
  color: var(--ink-700);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
}

/* ── Chat conversation sidebar ─────────────────────── */
.chat-grid {
  grid-template-columns: 268px minmax(0, 1fr) 340px;
  align-items: start;
}
.chat-history-panel {
  min-width: 0;
  position: sticky;
  top: 18px;
}
.conversation-card {
  padding: 16px;
  gap: 12px;
}
.conversation-head { align-items: center; }
.conversation-user-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--paper-2);
  border: 1px solid var(--border);
}
.conversation-user-line strong {
  display: block;
  color: var(--ink-900);
  font-size: 13px;
}
.conversation-user-line span:not(.user-avatar) {
  display: block;
  color: var(--ink-300);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.conversation-filter {
  border: 1px solid var(--border);
  background: var(--paper-2);
  color: var(--ink-500);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11.5px;
  cursor: pointer;
}
.conversation-filter.is-active {
  background: var(--accent-fade);
  border-color: rgba(91, 109, 235, 0.24);
  color: var(--accent-700);
  font-weight: 700;
}
.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 2px;
}
.conversation-group { display: flex; flex-direction: column; gap: 6px; }
.conversation-group > p {
  margin: 0 0 2px;
  color: var(--ink-300);
  font-size: 11px;
  font-weight: 700;
}
.conversation-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conversation-item:hover {
  background: var(--paper-2);
  border-color: var(--border);
}
.conversation-item.is-active {
  background: linear-gradient(135deg, #eef1ff 0%, #f5efff 100%);
  border-color: rgba(91, 109, 235, 0.22);
}
.conversation-item strong {
  color: var(--ink-900);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-item span {
  color: var(--ink-500);
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.conversation-item small {
  color: var(--ink-300);
  font-size: 11px;
}

@media (max-width: 1320px) {
  .chat-grid { grid-template-columns: 240px minmax(0, 1fr); }
  .chat-aside { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .chat-grid { grid-template-columns: 1fr; }
  .chat-history-panel { position: static; }
  .conversation-list { max-height: 260px; }
  .task-board.overview-catalog .category-row { grid-template-columns: 1fr; }
  .task-board.overview-catalog .category-actions { grid-template-columns: 1fr; }
}
