:root {
  --ink: #15231f;
  --muted: #6c7974;
  --line: #dfe6e2;
  --canvas: #f3f6f4;
  --panel: #ffffff;
  --green: #0f6b4f;
  --green-dark: #0a4f3b;
  --green-soft: #e4f3ec;
  --gold: #b78a3f;
  --gold-soft: #f7efe0;
  --blue: #365f8d;
  --blue-soft: #eaf0f7;
  --red: #b54a42;
  --red-soft: #faecea;
  --shadow: 0 12px 35px rgba(18, 47, 38, 0.08);
  --radius: 16px;
  --color-primary: var(--green);
  --color-success: #2f8f68;
  --color-warning: var(--gold);
  --color-danger: var(--red);
  --color-info: var(--blue);
  --space-1: 4px;
  --space-2: 8px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-panel: 0 5px 20px rgba(18,47,38,.035);
  --focus-ring: 0 0 0 3px rgba(15,107,79,.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.skip-link {
  position: fixed; z-index: 200; left: 16px; top: -50px;
  padding: 10px 16px; color: white; background: var(--green);
}
.skip-link:focus { top: 12px; }
.platform-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: 260px;
  display: flex; flex-direction: column; color: #d7e3de;
  background:
    radial-gradient(circle at 10% 0, rgba(69, 140, 111, .22), transparent 30%),
    linear-gradient(180deg, #102b24 0%, #0a201b 100%);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  min-height: 82px; padding: 18px 22px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid rgba(255,255,255,.2); border-radius: 12px;
  color: #183f34; background: linear-gradient(135deg, #f4e7c6, #c8a762);
  font-family: Georgia, serif; font-size: 23px; font-weight: 700;
}
.brand strong { display: block; color: white; letter-spacing: .6px; }
.brand small, .environment small { display: block; margin-top: 3px; color: #8fa59c; font-size: 11px; }
#main-nav { flex: 1; overflow-y: auto; padding: 18px 12px; }
.nav-group { margin-bottom: 18px; }
.nav-label {
  display: block; padding: 0 12px 8px; color: #6f8d82;
  font-size: 11px; font-weight: 700; letter-spacing: 1.4px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; margin: 3px 0;
  padding: 10px 12px; border: 0; border-radius: 10px;
  color: #b9ccc4; background: transparent; text-align: left;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: rgba(68, 145, 113, .3); }
.nav-icon { width: 22px; color: #8db8a7; font-size: 16px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.environment { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.pulse, .state-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #58c395;
  box-shadow: 0 0 0 5px rgba(88,195,149,.12);
}
.app-frame { min-width: 0; width: calc(100% - 260px); margin-left: 260px; }
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: 82px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 30px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92); backdrop-filter: blur(18px);
}
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 11px; letter-spacing: .5px; }
.topbar h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 22px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.service-state {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 12px; background: white;
}
.service-state.offline .state-dot { background: #c65f57; box-shadow: 0 0 0 5px rgba(198,95,87,.12); }

.identity-control { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

.identity-control select { min-height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }

.icon-button {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: white;
}
.menu-button { display: none; }
.user-avatar {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  color: white; background: linear-gradient(135deg, var(--green), #193f35);
}
.workspace { min-height: calc(100vh - 82px); padding: 28px 30px 50px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px;
}
.page-head h2 { margin: 0 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 28px; }
.page-head p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.7; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px;
  border-radius: 999px; color: var(--green-dark); background: var(--green-soft);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge.demo { color: var(--color-info); background: var(--blue-soft); }

.badge.success { color: var(--color-success); background: var(--green-soft); }

.badge.warning, .badge.warn { color: var(--color-warning); background: var(--gold-soft); }

.badge.danger { color: var(--color-danger); background: var(--red-soft); }
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1.3fr .7fr;
  min-height: 270px; margin-bottom: 22px; padding: 36px;
  border-radius: 22px; color: white;
  background: linear-gradient(120deg, #0d3c30 0%, #145c47 58%, #9b793d 130%);
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; width: 380px; height: 380px; right: -90px; top: -160px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 50%;
  box-shadow: 0 0 0 50px rgba(255,255,255,.03), 0 0 0 100px rgba(255,255,255,.025);
}
.hero-content { position: relative; z-index: 2; align-self: center; }
.hero-kicker { color: #e4ce9c; font-size: 12px; letter-spacing: 2px; }
.hero h2 { max-width: 700px; margin: 12px 0; font-family: Georgia, "Songti SC", serif; font-size: 38px; }
.hero p { max-width: 650px; margin: 0 0 22px; color: #c9ddd5; line-height: 1.8; }
.hero-proof { position: relative; z-index: 2; align-self: end; justify-self: end; }
.proof-number { font-family: Georgia, serif; font-size: 62px; line-height: 1; }
.proof-label { color: #d8e3de; font-size: 12px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px;
  color: white; background: var(--green); font-weight: 600;
}
.button:hover { background: var(--green-dark); }

.button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.button:disabled { cursor: not-allowed; opacity: .58; color: var(--muted); }
.button.secondary { color: var(--ink); border-color: var(--line); background: white; }
.button.ghost { color: white; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.panel {
  min-width: 0; padding: 20px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-panel);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel h3 { margin: 0; font-size: 15px; }
.section-title { margin: 30px 0 14px; font-family: Georgia, "Songti SC", serif; font-size: 20px; }
.metric { padding: 18px; border-top: 3px solid var(--green); }
.metric strong { display: block; margin: 9px 0 5px; font-family: Georgia, serif; font-size: 28px; }
.metric small { color: var(--muted); }
.scenario-card { position: relative; min-height: 180px; transition: .2s ease; }
.scenario-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.scenario-card .scenario-icon {
  display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px;
  border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 20px;
}
.scenario-card h3 { margin-bottom: 9px; }
.scenario-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.card-link { color: var(--green); font-size: 12px; font-weight: 700; }
.layer-flow {
  display: grid; grid-template-columns: repeat(7, 1fr); align-items: stretch;
  padding: 22px; border-radius: var(--radius); color: white; background: #112d25;
}
.layer {
  position: relative; padding: 18px 10px; text-align: center;
  border-right: 1px solid rgba(255,255,255,.1);
}
.layer:last-child { border-right: 0; }
.layer strong { display: block; color: #e7d2a5; font-family: Georgia, serif; font-size: 16px; }
.layer small { display: block; margin-top: 7px; color: #93aaa1; font-size: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; color: var(--muted); background: #f7f9f8; text-align: left; font-size: 11px; }
td { padding: 13px 12px; border-bottom: 1px solid #edf1ef; }
tr:last-child td { border-bottom: 0; }
.progress { overflow: hidden; height: 7px; border-radius: 999px; background: #e9eeeb; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.workbench { display: grid; grid-template-columns: 260px minmax(360px, 1fr) 310px; min-height: 690px; }
.workbench > section { min-width: 0; border-right: 1px solid var(--line); }
.workbench > section:last-child { border-right: 0; }
.workbench-column { padding: 18px; }
.conversation-list { padding: 8px; }
.conversation-item {
  width: 100%; padding: 12px; border: 0; border-radius: 10px; background: transparent; text-align: left;
}
.conversation-item.active, .conversation-item:hover { background: #edf5f1; }
.conversation-item strong { display: block; margin-bottom: 5px; }
.conversation-item small { color: var(--muted); }
.chat-column { display: flex; flex-direction: column; min-height: 660px; }
.chat-header { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.chat-header strong, .chat-header small { display: block; }
.chat-header small { margin-top: 3px; color: var(--muted); }
.chat-list { flex: 1; overflow-y: auto; padding: 20px; background: #f7f9f8; }
.message { display: flex; gap: 10px; max-width: 86%; margin: 0 0 16px; }
.message.user { margin-left: auto; flex-direction: row-reverse; }
.message-avatar {
  flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 10px; color: white; background: var(--green);
}
.message.user .message-avatar { color: var(--ink); background: #e4e8e6; }
.bubble {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 4px 14px 14px;
  background: white; line-height: 1.65; white-space: pre-wrap;
}
.message.user .bubble { border-color: #c7e2d6; border-radius: 14px 4px 14px 14px; background: var(--green-soft); }
.chat-composer { padding: 14px; border-top: 1px solid var(--line); }
.demo-question-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.demo-question-list .tab { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-question-card { min-height: 180px; }
.demo-question-card h3 { margin: 14px 0 9px; line-height: 1.6; }
.demo-question-card p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.rag-evidence {
  margin: 6px 0 18px 40px; padding: 16px; border: 1px solid #a8cdbd;
  border-radius: var(--radius-md); background: var(--green-soft);
}
.rag-evidence .panel-head { margin-bottom: 12px; }
.citation-list { display: grid; gap: 10px; margin-top: 14px; }
.citation-card { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; }
.citation-card summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.citation-card summary span:first-child { min-width: 0; }
.citation-card strong, .citation-card small { display: block; }
.citation-card small { margin-top: 4px; color: var(--muted); }
.citation-card p { margin: 12px 0 8px; color: var(--ink); line-height: 1.7; white-space: pre-wrap; }
.citation-body { margin: 12px 0 8px; color: var(--ink); line-height: 1.7; }
.markdown-body { white-space: normal; }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }
.markdown-body .md-paragraph { margin: 8px 0; }
.markdown-body .md-heading { margin: 14px 0 8px; font-weight: 600; line-height: 1.45; }
.markdown-body h3.md-heading { font-size: 1.05rem; }
.markdown-body h4.md-heading { font-size: 1rem; }
.markdown-body h5.md-heading, .markdown-body h6.md-heading { font-size: .94rem; color: var(--muted); }
.markdown-body .md-list { margin: 8px 0; padding-left: 20px; }
.markdown-body .md-list li { margin: 4px 0; }
.markdown-body .md-quote {
  margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--line);
  background: var(--green-soft); color: var(--ink); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown-body .md-code {
  padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px;
  background: #f5f8f6; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em;
}
.markdown-body .md-pre {
  margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #f5f8f6; overflow-x: auto; white-space: pre;
}
.markdown-body .md-pre code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
.markdown-body .md-rule { margin: 12px 0; border: none; border-top: 1px solid var(--line); }
.markdown-body .md-link { color: var(--green); text-decoration: underline; }

.composer-row { display: flex; gap: 10px; }
.chat-composer textarea {
  flex: 1; resize: none; min-height: 74px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; outline: none;
}
.chat-composer textarea:focus, input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,107,79,.08); }
.composer-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }
.timeline { position: relative; margin-left: 9px; padding-left: 22px; border-left: 1px solid var(--line); }
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-item::before {
  content: ""; position: absolute; width: 9px; height: 9px; left: -27px; top: 4px;
  border: 2px solid white; border-radius: 50%; background: #aab7b2; box-shadow: 0 0 0 1px #aab7b2;
}
.timeline-item.active::before, .timeline-item.done::before { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.timeline-item strong { display: block; font-size: 12px; }
.timeline-item small { color: var(--muted); font-size: 10px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; flex: 1; min-width: 150px; }
.field label { color: var(--muted); font-size: 11px; font-weight: 700; }
.field input, .field select {
  width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: white;
}
.detail-list { display: grid; gap: 12px; }
.detail-row { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 10px; border-bottom: 1px solid #edf1ef; }
.detail-row span:first-child { color: var(--muted); font-size: 12px; }
.detail-row span:last-child { text-align: right; font-weight: 600; }
.empty-state { padding: 46px 20px; color: var(--muted); background: var(--panel); text-align: center; }
.error-state { padding: 20px; color: var(--color-danger); background: var(--red-soft); border-radius: var(--radius-sm); }
.loading-state { padding: 20px; color: var(--color-info); background: var(--blue-soft); border-radius: var(--radius-sm); }
.mock-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 14px;
  border: 1px solid #d6e0ec; border-radius: 12px; color: #365b83; background: #f0f5fa; font-size: 12px;
}
.document-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.document {
  min-height: 600px; padding: 40px 50px; border: 1px solid var(--line);
  background: white; box-shadow: var(--shadow); line-height: 2;
}
.document h2 { font-family: "Songti SC", serif; text-align: center; }
.risk-item {
  margin-bottom: 10px; padding: 12px; border-left: 3px solid var(--gold); border-radius: 8px; background: #fbf8f1;
}
.risk-item.high { border-color: var(--red); background: var(--red-soft); }
.transcript-line { padding: 12px; border-left: 3px solid transparent; line-height: 1.7; }
.transcript-line.flagged { border-color: var(--red); background: var(--red-soft); }
.transcript-line time { margin-right: 10px; color: var(--muted); font-size: 11px; }
.channel-tabs, .filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.tab {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: white;
}
.tab.active { color: var(--green); border-color: #a8cdbd; background: var(--green-soft); }
.phone-preview {
  max-width: 330px; min-height: 570px; margin: auto; padding: 14px;
  border: 8px solid #17231f; border-radius: 34px; background: white; box-shadow: var(--shadow);
}
.phone-preview .screen { padding: 20px 14px; border-radius: 20px; background: #f6f3ed; }
.skill-card h3 { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.skill-card p { min-height: 42px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.trace-code {
  padding: 4px 7px; border-radius: 6px; color: #2d5548; background: #edf5f1;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px;
}
.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 10px; }
.toast { max-width: 360px; padding: 13px 16px; border-radius: 10px; color: white; background: #183f34; box-shadow: var(--shadow); }
.sidebar-mask { display: none; }
.skeleton { min-height: 18px; border-radius: 7px; background: linear-gradient(90deg,#edf1ef,#f8faf9,#edf1ef); background-size: 200%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .workbench { grid-template-columns: minmax(380px, 1fr) 300px; }
  .workbench > section:first-child { display: none; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask.open { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); }
  .app-frame { width: 100%; margin-left: 0; }
  .menu-button { display: inline-block; }
  .grid-3, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .hero-proof { display: none; }
  .layer-flow { grid-template-columns: repeat(4, 1fr); }
  .layer { border-bottom: 1px solid rgba(255,255,255,.1); }
  .document-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .service-state { display: none; }
  .workspace { padding: 18px 14px 40px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .hero { min-height: 300px; padding: 26px 22px; }
  .hero h2 { font-size: 29px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .layer-flow { grid-template-columns: repeat(2, 1fr); }
  .workbench { display: block; }
  .workbench > section:last-child { border-top: 1px solid var(--line); }
  .document { padding: 28px 20px; }
  .topbar-actions .icon-button { display: none; }
  .rag-evidence { margin-left: 0; }
  .citation-card summary { align-items: flex-start; flex-direction: column; }
}
