:root {
  --bg: #07130f;
  --surface: #0d1d17;
  --surface-2: #12271f;
  --line: rgba(205, 241, 223, 0.12);
  --text: #eff8f3;
  --muted: #96aca1;
  --accent: #c8ff73;
  --accent-2: #68d7ad;
  --danger: #ff8f7a;
  --warning: #ffc769;
  --sidebar: 242px;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--bg); min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .17;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 28px 20px;
  border-right: 1px solid var(--line); background: rgba(7,19,15,.94); backdrop-filter: blur(18px);
  display: flex; flex-direction: column; z-index: 10;
}
.brand { color: var(--text); text-decoration: none; display: flex; gap: 12px; align-items: center; margin-bottom: 42px; }
.brand-mark {
  width: 42px; height: 42px; border: 1px solid var(--accent); border-radius: 14px;
  display: grid; place-items: center; color: var(--accent); font: 700 12px/1 monospace; letter-spacing: 1px;
  box-shadow: inset 0 0 24px rgba(200,255,115,.08);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .3px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 3px; }
nav { display: grid; gap: 5px; }
nav a {
  color: var(--muted); text-decoration: none; border-radius: 10px; padding: 11px 14px;
  font-size: 14px; transition: .2s ease;
}
nav a:hover, nav a.active { color: var(--text); background: var(--surface-2); }
nav a.active::before { content: "•"; color: var(--accent); margin-right: 9px; }
.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 12px; padding: 12px; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; background: var(--warning); border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.dot.ok { background: var(--accent-2); }
.dot.error { background: var(--danger); }
main { margin-left: var(--sidebar); min-height: 100vh; padding: 0 42px 72px; }
.topbar {
  height: 118px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); margin-bottom: 36px;
}
.topbar h1 { font-size: 24px; margin: 4px 0 0; font-weight: 600; }
.eyebrow, .kicker { font: 600 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1.8px; color: var(--muted); margin: 0; }
.accent { color: var(--accent); }
.page { display: none; animation: rise .28s ease; }
.page.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } }
.hero {
  min-height: 310px; padding: 54px; border-radius: 24px; border: 1px solid var(--line);
  background:
    radial-gradient(circle at 82% 24%, rgba(200,255,115,.17), transparent 26%),
    linear-gradient(135deg, #10271e 0%, #0b1c16 60%, #152b20 100%);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; overflow: hidden;
}
.hero h2 { font-size: clamp(32px, 4.5vw, 64px); max-width: 850px; line-height: 1.02; margin: 18px 0; letter-spacing: -2.2px; }
.hero p:not(.eyebrow) { color: var(--muted); max-width: 620px; line-height: 1.8; }
.button {
  border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 650; font-size: 13px;
  transition: transform .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--accent); color: #102013; }
.button.secondary { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.button.ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.button.danger { color: var(--danger); background: rgba(255,143,122,.09); border: 1px solid rgba(255,143,122,.2); }
.icon-button { display: none; background: transparent; border: 0; color: var(--text); font-size: 23px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stat-card { padding: 21px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.stat-card strong { display: block; font-size: 30px; font-weight: 500; margin-bottom: 8px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 25px; }
.panel h3 { margin: 7px 0 20px; font-size: 19px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-head h3 { margin-bottom: 0; }
.two-columns, .split-action { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.flow-list { display: grid; gap: 7px; }
.flow-list > div { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.flow-list > div:last-child { border-bottom: 0; }
.flow-list span { color: var(--accent); font: 12px monospace; }
.flow-list p { margin: 0; }
.flow-list strong, .flow-list small { display: block; }
.flow-list small { color: var(--muted); margin-top: 4px; }
.readiness { display: grid; gap: 12px; }
.ready-item { display: flex; justify-content: space-between; padding: 16px; border-radius: 12px; background: var(--surface-2); }
.ready-item span { color: var(--muted); }
.ready-item strong.ok { color: var(--accent-2); }
.ready-item strong.warn { color: var(--warning); }
form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
input, textarea {
  width: 100%; border: 1px solid var(--line); background: #091710; color: var(--text);
  border-radius: 10px; padding: 12px 13px; outline: 0; resize: vertical;
}
input:focus, textarea:focus { border-color: rgba(200,255,115,.45); box-shadow: 0 0 0 3px rgba(200,255,115,.06); }
.dropzone {
  min-height: 130px; border: 1px dashed rgba(200,255,115,.35); border-radius: 13px;
  display: grid; place-content: center; text-align: center; gap: 8px; background: rgba(200,255,115,.025);
}
.dropzone input { display: none; }
.dropzone span { color: var(--text); font-weight: 600; }
.dropzone small, .muted { color: var(--muted); line-height: 1.7; }
.table-panel { margin-top: 18px; }
.list { display: grid; }
.list-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px;
  border-top: 1px solid var(--line); padding: 16px 4px;
}
.list-item:first-child { border-top: 0; }
.list-item h4 { margin: 0 0 7px; font-size: 14px; overflow-wrap: anywhere; }
.list-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 8px; background: var(--surface-2); color: var(--muted); font-size: 10px; }
.badge.ready, .badge.approved, .badge.completed { color: var(--accent-2); }
.badge.failed, .badge.rejected { color: var(--danger); }
.badge.processing, .badge.running, .badge.queued { color: var(--warning); }
.actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.ask-shell {
  min-height: 370px; border: 1px solid var(--line); border-radius: 22px; padding: 46px;
  background: linear-gradient(145deg, rgba(18,39,31,.82), rgba(8,22,16,.92));
  display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: 55px;
}
.ask-intro h2 { font-size: 38px; line-height: 1.08; margin: 18px 0; }
.ask-intro p { color: var(--muted); line-height: 1.8; }
.ask-form textarea { min-height: 165px; font-size: 16px; line-height: 1.65; }
.form-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.toggle-label { display: flex; align-items: center; gap: 8px; white-space: nowrap; background: var(--surface-2); border-radius: 10px; padding: 12px; }
.toggle-label input { width: auto; }
.answer-panel { margin-top: 18px; }
.prose { white-space: pre-wrap; line-height: 1.85; color: #dcebe3; }
.sources { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.sources a { color: var(--accent-2); font-size: 12px; }
.hidden { display: none !important; }
.compact .list-item { padding: 13px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); color: var(--muted); background: transparent; padding: 7px 10px; border-radius: 999px; font-size: 11px; }
.chip.active { color: #142014; background: var(--accent); border-color: var(--accent); }
.question-list, .review-list { display: grid; gap: 13px; }
.question-card, .review-card { border: 1px solid var(--line); border-radius: 14px; background: rgba(18,39,31,.48); padding: 20px; }
.question-card h4, .review-card h3 { margin: 8px 0 13px; line-height: 1.55; }
.question-card details, .review-card details { color: var(--muted); line-height: 1.75; }
.question-card details p, .review-card details p { white-space: pre-wrap; }
.question-card summary, .review-card summary { color: var(--accent-2); cursor: pointer; margin-bottom: 10px; }
.question-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.review-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.review-head h2 { font-size: 42px; margin: 8px 0; }
.review-head p { color: var(--muted); }
.review-index { font: 11px monospace; color: var(--accent); }
.feedback { display: flex; gap: 8px; margin-top: 17px; }
.feedback button { flex: 1; }
.key-values { display: grid; gap: 3px; margin-bottom: 20px; }
.key-values div { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 12px 0; font-size: 12px; }
.key-values span { color: var(--muted); }
.switch-row { display: flex; align-items: center; justify-content: space-between; }
.switch-row input { width: auto; }
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 390px;
  color: var(--text); background: #173127; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 17px; box-shadow: 0 18px 55px rgba(0,0,0,.34); transform: translateY(100px);
  opacity: 0; transition: .25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,143,122,.38); color: #ffd5cc; }
.empty { color: var(--muted); text-align: center; padding: 42px 10px; border: 1px dashed var(--line); border-radius: 12px; }
.loading::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 250px; transform: translateX(-100%); transition: .25s ease; }
  .sidebar.open { transform: translateX(0); }
  main { margin-left: 0; padding: 0 20px 55px; }
  .icon-button { display: block; }
  .topbar { height: 92px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-columns, .split-action, .ask-shell { grid-template-columns: 1fr; }
  .hero { padding: 35px 28px; min-height: 360px; align-items: flex-start; flex-direction: column; }
  .ask-shell { padding: 28px; gap: 25px; }
}
@media (max-width: 580px) {
  .topbar .secondary { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card strong { font-size: 25px; }
  .panel { padding: 19px; }
  .hero h2 { font-size: 38px; }
  .ask-intro h2, .review-head h2 { font-size: 31px; }
  .form-row { grid-template-columns: 1fr; }
  .list-item { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .panel-head, .review-head { align-items: flex-start; flex-direction: column; }
  .question-toolbar { align-items: flex-start; flex-direction: column; }
  .feedback { flex-direction: column; }
}
