:root {
  --ink: #17212b;
  --muted: #687583;
  --line: #dce3e8;
  --soft-line: #e9eef1;
  --paper: #f5f7f7;
  --card: #ffffff;
  --navy: #122a32;
  --navy-2: #183943;
  --teal: #0d7c72;
  --teal-dark: #08655d;
  --teal-soft: #e4f3f0;
  --lime: #b6d77a;
  --amber: #bb7b16;
  --amber-soft: #fff3db;
  --red: #a6403b;
  --red-soft: #fbe8e7;
  --shadow: 0 10px 32px rgba(26, 47, 55, 0.08);
  --radius: 16px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; color: #e9f2f2;
  background: linear-gradient(165deg, var(--navy), #0e242b 68%, #102d34);
  padding: 26px 18px 20px; display: flex; flex-direction: column; overflow: hidden;
}
.sidebar::after {
  content: ""; position: absolute; width: 220px; height: 220px; border: 1px solid rgba(182,215,122,.16);
  border-radius: 50%; bottom: -115px; right: -105px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 28px; position: relative; z-index: 1; }
.brand strong { display: block; letter-spacing: .3px; font-size: 17px; }
.brand small { display: block; color: #91aeb3; margin-top: 3px; font-size: 11px; }
.brand-mark { position: relative; width: 36px; height: 36px; transform: rotate(45deg); }
.brand-mark span { position: absolute; inset: 2px 18px 18px 2px; background: var(--lime); border-radius: 3px; }
.brand-mark span:last-child { inset: 18px 2px 2px 18px; background: #41aaa0; }

.nav { display: grid; gap: 7px; position: relative; z-index: 1; }
.nav-item {
  appearance: none; border: 0; background: transparent; color: #a9bec2; padding: 12px 13px;
  border-radius: 11px; text-align: left; display: flex; gap: 12px; align-items: center; transition: .18s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: rgba(182,215,122,.14); color: #f5fbec; box-shadow: inset 3px 0 var(--lime); }
.nav-icon { width: 22px; text-align: center; color: var(--lime); font-size: 17px; }
.sidebar-bottom { margin-top: auto; padding: 18px 8px 4px; position: relative; z-index: 1; }
.sidebar-bottom p { color: #6f9298; font-size: 11px; line-height: 1.6; }
.status-chip { display: inline-flex; gap: 8px; align-items: center; color: #bdd1d4; font-size: 12px; }
.status-chip i { width: 8px; height: 8px; border-radius: 50%; background: #8da0a4; box-shadow: 0 0 0 4px rgba(141,160,164,.12); }
.status-chip.ready i { background: #8fc565; box-shadow: 0 0 0 4px rgba(143,197,101,.15); }
.status-chip.warn i { background: #e0a645; box-shadow: 0 0 0 4px rgba(224,166,69,.15); }

.main { min-width: 0; }
.topbar {
  height: 104px; padding: 24px 38px 20px; display: flex; align-items: flex-end; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: rgba(245,247,247,.92); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 4px 0 0; font-size: 27px; letter-spacing: -.5px; }
.eyebrow { color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: 1.8px; }
.topbar-actions { display: flex; gap: 10px; }
.content { padding: 28px 38px 60px; max-width: 1480px; margin: 0 auto; }

.button {
  border: 1px solid transparent; border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: .18s ease; text-decoration: none;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { color: white; background: var(--teal); box-shadow: 0 6px 16px rgba(13,124,114,.18); }
.button.primary:hover:not(:disabled) { background: var(--teal-dark); }
.button.secondary { color: var(--teal-dark); background: var(--teal-soft); border-color: #c6e4df; }
.button.ghost { color: #53636e; background: white; border-color: var(--line); }
.button.danger { color: var(--red); background: var(--red-soft); border-color: #f0cfcd; }
.button.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.button.wide { width: 100%; }

.hero {
  position: relative; overflow: hidden; color: white; border-radius: 22px; padding: 34px 36px;
  background: linear-gradient(120deg, #173b43, #0e6b65); box-shadow: var(--shadow); min-height: 210px;
}
.hero::after {
  content: ""; position: absolute; width: 300px; height: 300px; border: 52px solid rgba(182,215,122,.13);
  border-radius: 50%; right: -80px; top: -95px;
}
.hero-copy { max-width: 720px; position: relative; z-index: 1; }
.hero .kicker { color: var(--lime); font-size: 11px; font-weight: 800; letter-spacing: 1.6px; }
.hero h2 { font-size: 30px; margin: 12px 0 10px; letter-spacing: -.7px; }
.hero p { margin: 0; color: #c4d9db; line-height: 1.7; font-size: 14px; max-width: 630px; }
.hero-actions { margin-top: 22px; display: flex; gap: 10px; }
.hero .button.primary { background: var(--lime); color: #17333a; box-shadow: none; }
.hero .button.ghost { background: rgba(255,255,255,.08); color: white; border-color: rgba(255,255,255,.16); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--soft-line); border-radius: var(--radius); padding: 18px; box-shadow: 0 4px 16px rgba(30,51,58,.04); }
.stat-card small { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; font-size: 25px; margin-top: 7px; letter-spacing: -.5px; }
.stat-card span { display: block; margin-top: 5px; color: #8a969e; font-size: 11px; }

.section { margin-top: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 12px; }
.section-head h2, .section-head h3 { margin: 0; font-size: 17px; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--soft-line); border-radius: var(--radius); box-shadow: 0 4px 20px rgba(30,51,58,.045); }
.card-body { padding: 20px; }
.card-header { padding: 17px 20px; border-bottom: 1px solid var(--soft-line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.card-header h3 { margin: 0; font-size: 15px; }
.card-header small { color: var(--muted); }

.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pipeline-stage { position: relative; background: white; border: 1px solid var(--soft-line); border-radius: 13px; padding: 15px; min-height: 130px; }
.pipeline-stage:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 50%; z-index: 2; color: #9cacb2; background: var(--paper); width: 20px; text-align: center; }
.pipeline-stage .stage-no { color: var(--teal); font-weight: 800; font-size: 10px; letter-spacing: 1px; }
.pipeline-stage h4 { margin: 9px 0 7px; font-size: 14px; }
.pipeline-stage p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: #7d8b93; font-size: 10px; letter-spacing: .7px; text-transform: uppercase; padding: 11px 14px; border-bottom: 1px solid var(--soft-line); }
td { padding: 13px 14px; border-bottom: 1px solid var(--soft-line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable:hover td { background: #f7fbfa; }
.project-name { font-weight: 750; color: var(--ink); }
.subtle { color: var(--muted); font-size: 12px; }
.empty { text-align: center; padding: 38px 20px; color: var(--muted); }
.empty .empty-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; font-size: 22px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge.success { color: #176c54; background: #e5f5ee; }
.badge.pending { color: #6c7780; background: #eef1f2; }
.badge.warning { color: #8f5b0b; background: var(--amber-soft); }
.badge.danger { color: var(--red); background: var(--red-soft); }
.badge.info { color: #236270; background: #e3f1f4; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: #52616b; font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid #d5dde2; border-radius: 9px; background: white; color: var(--ink); padding: 10px 11px; outline: 0; transition: .15s;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #58a9a1; box-shadow: 0 0 0 3px rgba(13,124,114,.1); }
.field small { color: #89959c; }

.project-hero { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.project-hero h2 { margin: 0; font-size: 24px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 18px; }
.step-card { background: white; border: 1px solid var(--soft-line); border-radius: 14px; padding: 14px; min-height: 122px; position: relative; }
.step-card.complete { border-color: #bfe2d7; box-shadow: inset 0 3px #3da285; }
.step-card.active { border-color: #8bc9c0; box-shadow: inset 0 3px var(--teal); }
.step-card h4 { margin: 8px 0 5px; font-size: 13px; }
.step-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.step-state { font-size: 10px; font-weight: 800; color: #849197; }
.step-card.complete .step-state { color: var(--teal); }

.material-list { display: grid; gap: 9px; }
.material-item { border: 1px solid var(--soft-line); background: #fbfcfc; border-radius: 10px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; }
.file-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; font-weight: 800; font-size: 10px; }
.material-info { min-width: 0; flex: 1; }
.material-info strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.material-info small { color: var(--muted); font-size: 10px; }
.icon-button { border: 0; width: 28px; height: 28px; border-radius: 7px; background: transparent; color: #87939a; }
.icon-button:hover { background: var(--red-soft); color: var(--red); }
.upload-zone { border: 1px dashed #b9c8cd; border-radius: 12px; padding: 16px; background: #f9fbfb; text-align: center; }
.upload-zone input { max-width: 100%; }
.upload-zone p { color: var(--muted); font-size: 11px; margin: 7px 0 0; }

.stage-actions { display: grid; gap: 10px; }
.action-row { border: 1px solid var(--soft-line); border-radius: 12px; padding: 13px; display: flex; gap: 12px; align-items: center; }
.action-index { width: 34px; height: 34px; flex: none; border-radius: 50%; background: #edf3f2; color: var(--teal); display: grid; place-items: center; font-weight: 850; font-size: 12px; }
.action-copy { flex: 1; min-width: 0; }
.action-copy strong { display: block; font-size: 12px; }
.action-copy small { color: var(--muted); font-size: 10px; line-height: 1.45; }

.interview { background: linear-gradient(180deg, #fbfdfd, #f4f8f7); }
.chat-log { max-height: 470px; overflow: auto; padding: 18px; display: grid; gap: 12px; }
.message { max-width: 82%; border-radius: 13px; padding: 11px 13px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.message.ai { justify-self: start; background: white; border: 1px solid var(--soft-line); border-top-left-radius: 4px; }
.message.user { justify-self: end; background: var(--teal); color: white; border-top-right-radius: 4px; }
.message-meta { font-size: 9px; opacity: .65; margin-bottom: 4px; }
.chat-compose { border-top: 1px solid var(--soft-line); padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.chat-compose textarea { min-height: 56px; max-height: 150px; resize: vertical; border: 1px solid #d5dde2; border-radius: 10px; padding: 10px; }

.output-list { display: grid; gap: 8px; }
.output-item { border: 1px solid var(--soft-line); border-radius: 11px; padding: 12px; display: flex; align-items: center; gap: 11px; }
.output-item .output-label { flex: 1; }
.output-item strong { font-size: 12px; display: block; }
.output-item small { color: var(--muted); font-size: 10px; }

.prompt-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; }
.prompt-tabs { padding: 9px; display: grid; align-content: start; gap: 6px; }
.prompt-tab { border: 0; background: transparent; border-radius: 9px; padding: 11px; text-align: left; color: #586771; }
.prompt-tab strong { display: block; font-size: 12px; }
.prompt-tab small { font-size: 10px; opacity: .75; }
.prompt-tab.active { background: var(--teal-soft); color: var(--teal-dark); }
.prompt-editor { width: 100%; min-height: 590px; border: 0; outline: 0; resize: vertical; padding: 19px; line-height: 1.65; font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; color: #22323b; }
.version-list { display: grid; gap: 7px; max-height: 290px; overflow: auto; }
.version-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--soft-line); border-radius: 9px; }
.version-item.active { border-color: #a9d7cd; background: #f2faf7; }
.version-item .version-copy { flex: 1; min-width: 0; }
.version-item strong { display: block; font-size: 11px; }
.version-item small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 9px; }

.code-box { background: #13252b; color: #c8dbdb; border-radius: 11px; padding: 14px; overflow: auto; max-height: 370px; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.markdown { color: #2f3e46; line-height: 1.72; font-size: 13px; }
.markdown h1 { font-size: 22px; margin-top: 26px; }
.markdown h2 { font-size: 18px; margin-top: 24px; }
.markdown h3 { font-size: 15px; margin-top: 20px; }
.markdown blockquote { margin: 12px 0; border-left: 3px solid var(--teal); padding: 8px 13px; background: #f2f8f6; color: #4e6268; }
.markdown code { background: #edf1f2; border-radius: 4px; padding: 2px 4px; font-size: .9em; }
.markdown pre { background: #14262d; color: #d5e4e4; border-radius: 10px; padding: 13px; overflow: auto; }
.markdown pre code { background: transparent; color: inherit; padding: 0; border-radius: 0; }
.output-notice { margin-bottom: 12px; }
.id-glossary { margin: 0 0 18px; border: 1px solid #cfe0dd; border-radius: 11px; background: #f4faf8; color: #29464a; }
.id-glossary summary { cursor: pointer; padding: 11px 13px; font-weight: 750; color: var(--teal-dark); }
.id-glossary > p { margin: 0; padding: 0 13px 10px; color: #587076; font-size: 11px; line-height: 1.6; }
.glossary-grid { border-top: 1px solid #dbe9e6; }
.glossary-row { display: grid; grid-template-columns: 86px 112px 1fr; gap: 10px; align-items: start; padding: 9px 13px; border-bottom: 1px solid #e4eeec; font-size: 11px; line-height: 1.5; }
.glossary-row:last-child { border-bottom: 0; }
.glossary-row code { color: #075f58; background: #dff1ed; padding: 2px 5px; border-radius: 4px; justify-self: start; }
.glossary-row span { color: #556970; }

.score-grid { display: grid; gap: 7px; }
.score-row { display: grid; grid-template-columns: 50px 1fr 150px; gap: 12px; align-items: center; border-bottom: 1px solid var(--soft-line); padding: 9px 0; }
.score-row:last-child { border-bottom: 0; }
.score-id { font-weight: 850; color: var(--teal); font-size: 11px; }
.score-name { font-size: 12px; }
.score-row select { border: 1px solid var(--line); border-radius: 8px; padding: 7px; }

.callout { border-radius: 12px; padding: 13px 15px; font-size: 12px; line-height: 1.6; }
.callout.info { background: #e8f4f5; color: #245c66; border: 1px solid #cce4e7; }
.callout.warning { background: var(--amber-soft); color: #79500f; border: 1px solid #efdcae; }
.callout.danger { background: var(--red-soft); color: #823d39; border: 1px solid #edcdcb; }
.callout.success { background: #e8f6ef; color: #29684f; border: 1px solid #cde8db; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(7,21,26,.54); z-index: 80; display: grid; place-items: center; padding: 24px; }
.modal { width: min(960px, 96vw); max-height: 90vh; overflow: hidden; background: white; border-radius: 18px; box-shadow: 0 28px 80px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.modal.small { width: min(580px, 96vw); }
.modal-header { padding: 17px 20px; border-bottom: 1px solid var(--soft-line); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; overflow: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--soft-line); display: flex; justify-content: flex-end; gap: 8px; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; gap: 9px; }
.toast { min-width: 280px; max-width: 420px; background: #17333a; color: white; padding: 12px 14px; border-radius: 11px; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease; }
.toast.error { background: #883c38; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }

.busy-overlay { position: fixed; inset: 0; z-index: 110; background: rgba(245,247,247,.82); backdrop-filter: blur(4px); display: grid; place-items: center; }
.busy-overlay.hidden { display: none; }
.busy-card { background: white; border: 1px solid var(--soft-line); box-shadow: var(--shadow); border-radius: 16px; padding: 24px 30px; display: grid; justify-items: center; gap: 9px; }
.busy-card small { color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid #d8e5e3; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }
.mt-18 { margin-top: 18px; }
.text-right { text-align: right; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 82px minmax(0, 1fr); }
  .sidebar { padding: 22px 12px; }
  .brand > div:last-child, .nav-item span:last-child, .sidebar-bottom p, .status-chip span { display: none; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .nav-item { justify-content: center; }
  .nav-icon { width: auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline, .stepper { grid-template-columns: repeat(3, 1fr); }
  .pipeline-stage::after { display: none; }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 50; height: 64px; width: 100%; bottom: 0; top: auto; padding: 7px 12px; flex-direction: row; }
  .brand, .sidebar-bottom { display: none; }
  .nav { width: 100%; grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .nav-item { padding: 8px; }
  .topbar { position: static; padding: 18px 18px 14px; height: auto; align-items: center; }
  .topbar-actions .ghost { display: none; }
  .glossary-row { grid-template-columns: 74px 1fr; }
  .glossary-row span { grid-column: 1 / -1; }
  .topbar h1 { font-size: 22px; }
  .content { padding: 18px 14px 90px; }
  .hero { padding: 25px 22px; }
  .hero h2 { font-size: 25px; }
  .stat-grid, .grid-2, .grid-equal, .form-grid, .prompt-layout { grid-template-columns: 1fr; }
  .pipeline, .stepper { grid-template-columns: 1fr; }
  .project-hero { display: grid; }
  .prompt-tabs { grid-template-columns: repeat(2, 1fr); }
  .score-row { grid-template-columns: 42px 1fr; }
  .score-row select { grid-column: 2; }
  .message { max-width: 93%; }
}
