:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --border: rgba(15, 18, 35, .08);
  --border-strong: rgba(15, 18, 35, .14);
  --text: #0b0b0f;
  --text-strong: #060608;
  --muted: #5b6071;
  --faint: #9aa0b0;
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --brand-3: #0ea5e9;
  --brand-soft: #eef0ff;
  --brand-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 52%, #0ea5e9 100%);
  --accent: #16a34a;
  --accent-soft: #e9f8ef;
  --error: #dc2626;
  --error-soft: #fdecec;
  --warning: #d97706;
  --warning-soft: #fdf3e3;
  --info: #2563eb;
  --info-soft: #e8f0fe;
  --radius: 13px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(15, 18, 35, .04);
  --shadow: 0 1px 3px rgba(15, 18, 35, .06), 0 1px 2px rgba(15, 18, 35, .04);
  --shadow-md: 0 6px 20px rgba(15, 18, 35, .08), 0 2px 6px rgba(15, 18, 35, .04);
  --shadow-accent: 0 10px 30px rgba(99, 102, 241, .28);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

/* 作者样式里的 display 会盖掉 UA 的 [hidden]{display:none}，这里统一兜底 */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Dynamic workbook names, IRIs and AI descriptions must wrap inside narrow panels. */
main, section, .meta-main, .modeling-head > div, .section-head > div,
.candidate-review, .workflow-section, .panel {
  min-width: 0;
}
.dz-hint, .meta-main, .modeling-head, .section-head, .candidate-detail,
.candidate-rationale, .candidate-evidence, .finding, .validation-head {
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; background: var(--brand); color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 30px; line-height: 1; opacity: .9; }
.topbar h1 { font-size: 17px; letter-spacing: .5px; }
.topbar p { font-size: 12px; opacity: .78; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-size: 13px; font-family: inherit;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: .15s;
}
.btn:hover { filter: brightness(1.1); }
.topbar .btn.ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.danger-action { color: var(--error); border-color: #f0c5c1; margin-left: auto; }
.btn.danger-action:hover { background: #fdecea; }
.btn.tiny-btn { padding: 4px 10px; font-size: 12px; }
.linklike {
  background: none; border: 0; color: var(--brand); font: inherit;
  cursor: pointer; text-decoration: underline; padding: 0;
}

main { max-width: 1280px; margin: 0 auto; padding: 22px 28px 60px; }

/* ---------------------------------------------------------------- 上传区 */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 34px; text-align: center;
  transition: .18s; position: relative;
}
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.busy .dz-inner { opacity: .35; pointer-events: none; }
.dz-icon { font-size: 30px; color: var(--brand); opacity: .55; }
.dz-title { font-size: 15px; margin-top: 6px; }
.dz-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dz-loading {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; gap: 10px; font-size: 14px; color: var(--brand);
}
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.errorbox {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius);
  background: #fdecea; border: 1px solid #f5c6c2; color: var(--error);
}

/* --------------------------------------------------------- AI 建模工作流 */
.modeling-workflow {
  margin-top: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); overflow: hidden;
}
.modeling-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
  padding: 18px 20px 14px;
}
.modeling-head h2 { font-size: 18px; }
.modeling-head .tag, .candidate-head .tag { border-radius: 12px; padding: 3px 9px; }
.model-uploaded, .model-profiling, .model-modeling, .model-reviewing, .model-validating {
  background: #e7f0fa; color: var(--info);
}
.model-awaiting_answers, .model-draft_ready { background: #fdf3e0; color: var(--warning); }
.model-publishable, .model-published { background: #e3f5ef; color: var(--accent); }
.model-failed, .model-cancelled { background: #fdecea; color: var(--error); }
.workflow-guide {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.guide-step {
  position: relative; min-width: 0; padding: 11px 12px 11px 34px; border: 0;
  border-right: 1px solid var(--border); background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; text-align: left; cursor: default;
}
.guide-step:last-child { border-right: 0; }
.guide-step i {
  position: absolute; left: 11px; top: 11px; display: grid; place-items: center;
  width: 17px; height: 17px; border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--muted); font-size: 10px; font-style: normal;
}
.guide-step.completed { color: var(--accent); cursor: pointer; }
.guide-step.completed i { border-color: var(--accent); background: var(--accent); color: #fff; }
.guide-step.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.guide-step.active i { border-color: var(--brand); color: var(--brand); }
.modeling-progress-panel {
  padding: 14px 20px 16px; border-top: 1px solid var(--border); background: #fbfcfe;
}
.progress-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.progress-current { display: flex; align-items: center; gap: 9px; min-width: 0; flex-wrap: wrap; }
.progress-current strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.progress-percent { color: var(--brand); font-size: 20px; line-height: 1.2; }
.live-state {
  display: inline-flex; align-items: center; gap: 6px; color: var(--accent);
  font-size: 12px; white-space: nowrap;
}
.live-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: live-pulse 1.4s ease-out infinite; }
.live-state.paused { color: var(--warning); }
.live-state.paused i, .live-state.stopped i { animation: none; }
.live-state.stopped { color: var(--error); }
.live-state.done { color: var(--accent); }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(15, 123, 108, .35); } 70% { box-shadow: 0 0 0 6px rgba(15, 123, 108, 0); } }
.progress-track { height: 8px; margin-top: 12px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.progress-step-scroll { overflow-x: auto; padding: 14px 0 4px; scrollbar-width: thin; }
.progress-steps {
  display: grid; grid-template-columns: repeat(9, minmax(104px, 1fr)); min-width: 940px;
  margin: 0; padding: 0; list-style: none;
}
.progress-step { position: relative; padding: 19px 7px 0; text-align: center; color: var(--muted); font-size: 12px; }
.progress-step::before {
  content: ""; position: absolute; top: 7px; left: 0; width: 100%; height: 2px; background: var(--border);
}
.progress-step:first-child::before { left: 50%; width: 50%; }
.progress-step:last-child::before { width: 50%; }
.progress-step-dot {
  position: absolute; z-index: 1; top: 2px; left: calc(50% - 6px); width: 12px; height: 12px;
  border: 2px solid var(--border); border-radius: 50%; background: #fbfcfe;
}
.progress-step.completed { color: var(--accent); }
.progress-step.completed::before { background: var(--accent); }
.progress-step.completed .progress-step-dot { border-color: var(--accent); background: var(--accent); }
.progress-step.active { color: var(--brand); font-weight: 600; }
.progress-step.active .progress-step-dot { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.progress-step.stopped { color: var(--error); }
.progress-step.stopped .progress-step-dot { border-color: var(--error); background: #fff; box-shadow: 0 0 0 4px #fdecea; }
.activity-strip { display: flex; align-items: flex-start; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.activity-strip > span { flex: 0 0 auto; padding-top: 2px; }
.activity-list { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.activity-item { display: flex; gap: 8px; align-items: baseline; min-width: 0; font-size: 12px; }
.activity-item time { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-item span { overflow-wrap: anywhere; }
.activity-item:first-child span { color: var(--text); font-weight: 500; }
.modeling-actions { padding: 10px 20px 0; justify-content: flex-end; }
.workflow-section { padding: 20px; margin-top: 12px; border-top: 1px solid var(--border); }
.workflow-details { margin: 12px 20px 0; padding: 0; border: 1px solid var(--border); border-radius: 7px; }
.workflow-details > summary, .advanced-editor > summary {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 11px 14px; cursor: pointer; font-weight: 600; list-style: none;
}
.workflow-details > summary::-webkit-details-marker, .advanced-editor > summary::-webkit-details-marker { display: none; }
.workflow-details > summary::before, .advanced-editor > summary::before {
  content: "+"; color: var(--brand); font-size: 18px; font-weight: 400;
}
.workflow-details[open] > summary::before, .advanced-editor[open] > summary::before { content: "−"; }
.workflow-details > summary > span:first-child, .advanced-editor > summary > span:first-child { margin-right: auto; }
.workflow-details #profileTable { padding: 0 14px 14px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.section-head h3 { font-size: 16px; }
.review-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.primary-action { background: var(--accent); }
.draft-overview {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px;
  margin-top: 14px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden;
  background: var(--border);
}
.draft-overview-item { min-width: 0; padding: 10px 12px; background: var(--surface); }
.draft-overview-item strong { display: block; color: var(--brand); font-size: 17px; }
.draft-overview-item span { color: var(--muted); font-size: 11px; }
.next-action {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--accent); background: #f4faf8;
}
.next-action .btn { margin-left: auto; }
.issue-center, .model-conformance { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.issue-center-head, .model-conformance-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px;
}
.issue-group { margin-top: 12px; }
.issue-group h4 { margin: 0 0 7px; color: var(--muted); font-size: 12px; }
.model-issue {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  margin-bottom: 7px; border: 1px solid var(--border); border-left: 3px solid var(--warning);
  border-radius: 6px; background: var(--surface);
}
.model-issue.error { border-left-color: var(--error); }
.model-issue .body { flex: 1; min-width: 0; }
.model-issue .message { overflow-wrap: anywhere; }
.model-issue .issue-code { color: var(--muted); font-size: 11px; }
.issue-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.issue-actions select { max-width: 250px; min-width: 150px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 5px; }
.issue-actions .danger { color: var(--error); border-color: #f5c6c2; }
.conformance-summary { display: flex; gap: 7px; flex-wrap: wrap; }
.conformance-notice { margin-top: 8px; color: var(--warning); font-size: 12px; }
.conformance-issues { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 12px; }
.advanced-editor { margin-top: 18px; border-top: 1px solid var(--border); }
.advanced-editor > summary { padding-left: 0; padding-right: 0; }

.question-item { border-top: 1px solid var(--border); padding: 14px 0; }
.question-item:first-child { border-top: 0; padding-top: 0; }
.question-item label { display: flex; align-items: center; gap: 8px; }
.question-item textarea, .question-item select {
  width: min(720px, 100%); margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text); font: inherit;
}
.required-mark { color: var(--error); font-size: 11px; font-weight: 500; }

.review-group { margin-top: 22px; }
.review-group > h4 { margin: 0 0 8px; color: var(--brand); font-size: 14px; }
.candidate-review {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 8px; background: #fff;
}
.candidate-review.rejected { opacity: .55; background: #f4f5f7; }
.candidate-review.attention-flash { outline: 3px solid #f3d8a5; outline-offset: 2px; }
.candidate-head { display: flex; align-items: center; gap: 9px; }
.review-toggle { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 12px; }
.candidate-kind { font-size: 11px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 9px; }
.confidence { margin-left: auto; color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; }
.confidence.low { color: var(--warning); font-weight: 600; }
.review-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 10px; }
.review-field-label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.review-field {
  min-width: 0; width: 100%; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 5px; color: var(--text); background: #fff; font: inherit;
}
.review-field-checkbox { align-content: start; }
.checkbox-control { display: inline-flex; align-items: center; gap: 5px; min-height: 31px; color: var(--text); font-size: 12px; }
.review-field[type="checkbox"] { width: 15px; height: 15px; padding: 0; accent-color: var(--accent); }
.candidate-detail { margin-top: 9px; font-size: 13px; }
.candidate-rationale { margin-top: 6px; color: var(--muted); font-size: 12px; }
.candidate-evidence { margin-top: 5px; color: var(--info); font-size: 11px; }
.object-property-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.object-property-head > span { min-width: 0; overflow-wrap: anywhere; }
.property-review-list { margin: 10px -14px -12px; border-top: 1px solid var(--border); }
.property-review-list .candidate-review {
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; padding: 10px 14px;
  background: transparent;
}
.property-review-list .candidate-review:last-child { border-bottom: 0; }
.empty-property { padding: 12px 14px; }
.mapping-editor { margin-top: 2px; }
.mapping-editor-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 7px; }
.mapping-table-wrap { margin-bottom: 8px; }
.mapping-table { min-width: 680px; }
.mapping-table th, .mapping-table td { padding: 6px 7px; vertical-align: middle; }
.mapping-table th:first-child, .mapping-table td:first-child { width: 28%; }
.mapping-table th:nth-child(2), .mapping-table td:nth-child(2) { width: 31%; }
.mapping-table th:nth-child(3), .mapping-table td:nth-child(3) { width: 29%; }
.mapping-table th:last-child, .mapping-table td:last-child { width: 36px; text-align: center; }
.mapping-field {
  width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 5px; background: #fff; color: var(--text); font: inherit; font-size: 12px;
}
.mapping-field.mapping-missing { border-color: var(--error); color: var(--error); background: #fff8f7; }
.icon-action {
  display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: 5px; background: transparent;
  color: var(--muted); font-size: 19px; line-height: 1; cursor: pointer;
}
.icon-action:hover { border-color: #f5c6c2; background: #fdecea; color: var(--error); }
.finding-list { list-style: none; padding: 0; margin: 0; }
.finding { padding: 8px 10px; border-left: 3px solid var(--info); background: #f7f9fc; margin-bottom: 5px; }
.finding.error { border-color: var(--error); }
.finding.warning { border-color: var(--warning); }
#modelValidation { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.validation-head { font-weight: 600; padding: 8px 10px; border-radius: 6px; }
.validation-head.valid { color: var(--accent); background: #e3f5ef; }
.validation-head.invalid { color: var(--error); background: #fdecea; }
#modelValidation ul { padding-left: 20px; max-height: 320px; overflow: auto; }
.validation-error { color: var(--error); }
.validation-warning { color: var(--warning); }

/* ------------------------------------------------------------ 元信息条 */
.meta-strip {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  margin-top: 22px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.meta-main { flex: 1; }
.meta-main h2 { font-size: 19px; }
.meta-main p { margin-top: 3px; }
.verdict { text-align: right; font-size: 13px; white-space: nowrap; }
.verdict .tag {
  display: inline-block; padding: 5px 12px; border-radius: 20px;
  font-weight: 600; font-size: 13px;
}
.verdict .tag.ok { background: #e3f5ef; color: var(--accent); }
.verdict .tag.bad { background: #fdecea; color: var(--error); }
.verdict .tag.warn { background: #fdf3e0; color: var(--warning); }
.verdict .sub { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* -------------------------------------------------------------- 统计卡 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.stat .num { font-size: 24px; font-weight: 600; color: var(--brand); line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ 页签 */
.tabs { display: flex; gap: 4px; margin: 20px 0 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  color: var(--muted); cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--error); color: #fff; font-size: 11px; line-height: 17px; text-align: center;
}
.badge.warn { background: var(--warning); }
.badge.ok { background: var(--accent); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.section-title { font-size: 15px; margin: 22px 0 10px; color: var(--brand); }
.section-title:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ 图谱 */
.graph-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.graph-toolbar .spacer { flex: 1; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; }
.graph-wrap { position: relative; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; overflow: hidden; }
#graph { width: 100%; height: 560px; display: block; cursor: grab; }
#graph.dragging { cursor: grabbing; }
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
  margin-top: 10px; padding: 8px 12px; font-size: 12px; color: var(--muted);
  background: var(--surface-2); border-radius: 8px;
}
.legend .row { display: flex; align-items: center; gap: 6px; margin: 0; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.node-card {
  position: absolute; right: 12px; top: 12px; width: 300px; max-height: calc(100% - 24px);
  overflow: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; box-shadow: var(--shadow); font-size: 13px;
}
.node-card h4 { margin: 0 0 4px; font-size: 15px; }
.node-card .close { position: absolute; right: 8px; top: 6px; }
.node-card ul { margin: 6px 0 0; padding-left: 18px; }
.node-card li { margin: 2px 0; }

.n-label { font-size: 12px; pointer-events: none; user-select: none; }
.e-label { font-size: 10px; fill: var(--muted); pointer-events: none; user-select: none; }

/* -------------------------------------------------------------- 过滤条 */
.filterbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filterbar input[type=search], .filterbar select, textarea {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: 13px; background: var(--surface); color: var(--text);
}
.filterbar input[type=search] { flex: 1; min-width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg button {
  border: 0; background: var(--surface); padding: 6px 13px; font-size: 13px;
  font-family: inherit; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------ 对象列表 */
.obj-list { display: flex; flex-direction: column; gap: 10px; }
.obj-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.obj-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface-2); cursor: pointer; flex-wrap: wrap;
}
.obj-head .name { font-weight: 600; }
.obj-head code { font-size: 12px; }
.obj-head .grow { flex: 1; }
.obj-body { padding: 12px 14px; border-top: 1px solid var(--border); }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px;
  background: var(--brand-soft); color: var(--brand);
}
.pill.grey { background: var(--surface-2); color: var(--muted); }
.pill.pk { background: #fdf3e0; color: var(--warning); }
.pill.abs { background: #f0e8f8; color: #6b4fa0; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px;
  background: var(--surface-2); padding: 1px 5px; border-radius: 4px; color: #35495e;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: 12px; white-space: nowrap; }
tbody tr:hover { background: #fafbfd; }
.center { text-align: center; }
.table-scroll { overflow-x: auto; }

/* -------------------------------------------------------------- 枚举 */
.enum-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.enum-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.enum-card h4 { margin: 0 0 8px; font-size: 14px; }
.enum-values { display: flex; flex-wrap: wrap; gap: 6px; }
.enum-values span {
  background: var(--surface-2); border-radius: 5px; padding: 2px 8px; font-size: 12px;
}
.enum-values span b { color: var(--brand); font-weight: 600; }

/* ------------------------------------------------------------- 问题列表 */
.issue {
  display: flex; gap: 12px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; background: var(--surface); align-items: flex-start;
}
.issue.error { border-left: 3px solid var(--error); }
.issue.warning { border-left: 3px solid var(--warning); }
.issue.info { border-left: 3px solid var(--info); }
.issue .ico { font-size: 15px; line-height: 1.4; flex: none; }
.issue.error .ico { color: var(--error); }
.issue.warning .ico { color: var(--warning); }
.issue.info .ico { color: var(--info); }
.issue .body { flex: 1; min-width: 0; }
.issue .msg { word-break: break-word; }
.issue .where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.issue .hint { font-size: 12px; color: var(--accent); margin-top: 3px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- 导出 */
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.export-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.export-card h4 { font-size: 14px; margin: 0; }
.export-card p { font-size: 12px; color: var(--muted); flex: 1; }

.code-block { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; background: var(--surface-2); font-size: 12px; color: var(--muted);
}
pre {
  margin: 0; padding: 12px; overflow: auto; max-height: 340px;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55;
  background: #fbfcfe; color: #35495e;
}
textarea {
  width: 100%; min-height: 150px; resize: vertical;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55;
}
.row { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.result-pre { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; }

/* -------------------------------------------------------- 顶栏视图切换 */
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav button {
  background: none; border: 0; border-radius: 7px; padding: 7px 14px;
  font-size: 14px; font-family: inherit; color: rgba(255,255,255,.7); cursor: pointer;
}
.topnav button:hover { color: #fff; background: rgba(255,255,255,.1); }
.topnav button.active { color: #fff; background: rgba(255,255,255,.18); font-weight: 600; }

/* -------------------------------------------------------- 场景本体库栏目 */
.lib-hero {
  display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap;
  margin-top: 22px; padding: 20px 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.lib-hero > div:first-child { flex: 1 1 420px; }
.lib-hero h2 { font-size: 20px; color: var(--brand); margin-bottom: 6px; }
.lib-hero p { margin-top: 4px; }
.lib-hero-note {
  flex: 0 1 260px; background: var(--brand-soft); border-radius: 8px;
  padding: 12px 14px; font-size: 13px; line-height: 1.9; color: #244a6b;
}
.lib-hero-note b { font-size: 17px; }

.lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(410px, 1fr));
  gap: 14px; margin-top: 14px;
}
.lib-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: .15s; border-top: 3px solid var(--brand);
}
.lib-card:hover { transform: translateY(-2px); box-shadow: 0 4px 18px rgba(20,35,60,.1); }
.lib-card.active { border-color: var(--accent); border-top-color: var(--accent); }
.lib-head { display: flex; align-items: flex-start; gap: 12px; }
.lib-icon {
  flex: none; width: 40px; height: 40px; border-radius: 9px; background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.lib-card.active .lib-icon { background: #e3f5ef; }
.lib-title { flex: 1; min-width: 0; }
.lib-title h3 { font-size: 15px; }
.lib-title .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lib-loaded {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: #e3f5ef; color: var(--accent); white-space: nowrap;
}
.lib-tagline { font-size: 13px; color: var(--text); margin-top: 10px; line-height: 1.7; }
.lib-meta { margin-top: 8px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.lib-conformance {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 11px;
  padding: 8px 10px; background: var(--surface-2); border-radius: 6px; font-size: 12px;
}
.lib-versions { margin-top: 12px; border-top: 1px solid var(--border); }
.lib-versions > summary { padding: 10px 0 2px; cursor: pointer; color: var(--brand); font-size: 12px; }
.version-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
  padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 12px;
}
.version-row:last-child { border-bottom: 0; }
.version-row .version-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.lib-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lib-stats span {
  background: var(--surface-2); border-radius: 5px; padding: 2px 9px;
  font-size: 12px; color: var(--muted);
}
.lib-stats span b { color: var(--brand); font-weight: 600; }

.lib-focus { margin: 12px 0 0; padding: 0; list-style: none; }
.lib-focus li {
  position: relative; padding-left: 16px; margin: 5px 0;
  font-size: 12px; color: var(--muted); line-height: 1.65;
}
.lib-focus li::before { content: "·"; position: absolute; left: 4px; color: var(--brand); font-weight: 700; }

.lib-errors {
  margin-top: 11px; padding: 8px 11px; background: #fffdf8;
  border-left: 3px solid var(--warning); border-radius: 0 6px 6px 0;
  font-size: 12px; color: #7a5c1a; line-height: 1.65;
}
.lib-actions { display: flex; gap: 8px; margin-top: 14px; padding-top: 13px;
  border-top: 1px solid var(--border); flex-wrap: wrap; }
.lib-delete-error { margin-top: 8px; color: var(--error); font-size: 12px; }

/* ------------------------------------------------------------- 发布确认 */
.publish-dialog {
  width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); box-shadow: 0 18px 55px rgba(20, 35, 60, .24);
}
.publish-dialog::backdrop { background: rgba(20, 35, 60, .42); }
.publish-dialog form { padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.dialog-field { display: grid; gap: 5px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.dialog-field input, .dialog-field textarea {
  width: 100%; min-height: auto; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); background: #fff; font: inherit;
}
.publish-conformance { margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--accent); background: #f4faf8; }
.publish-conformance.attention { border-left-color: var(--warning); background: #fffdf8; }
.rename-dialog { width: min(480px, calc(100vw - 32px)); }
.dialog-error {
  margin-top: 10px; padding: 8px 10px; border-left: 3px solid var(--error);
  border-radius: 0 6px 6px 0; background: #fff7f7; color: var(--error); font-size: 12px;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------------------------------------------------------- 方法论栏目 */
.method-view {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 30px 34px;
  margin-top: 22px; max-width: 1000px; margin-left: auto; margin-right: auto;
}
.method-hero {
  display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap;
  padding-bottom: 20px; border-bottom: 2px solid var(--brand-soft);
}
.method-hero h2 { font-size: 22px; color: var(--brand); }
.method-hero > div:first-child { flex: 1 1 340px; }
.method-hero p { margin-top: 5px; }
.hero-note {
  flex: 1 1 300px; background: var(--brand-soft); border-radius: 8px;
  padding: 12px 14px; font-size: 13px; line-height: 1.7; color: #244a6b;
}

.method-section { margin-top: 30px; }
.method-section > h3 {
  font-size: 17px; color: var(--brand); padding-bottom: 7px;
  border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.method-section h4 { font-size: 14px; margin: 16px 0 8px; }
.method-section > p.muted { margin-bottom: 12px; }
.method-section table { margin-top: 4px; }

.clause {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 400; font-family: "SF Mono", Menlo, monospace;
}

/* 七步 */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { display: flex; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.steps li:last-child { border-bottom: 0; }
.step-no {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.steps li > div { flex: 1; }
.steps li p { margin-top: 3px; color: var(--muted); font-size: 13px; }

/* 基本要求卡片 */
.req-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.req {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 12px 14px;
}
.req b { display: inline-block; margin-top: 4px; }
.req .clause { margin-left: 0; }
.req p { margin-top: 4px; font-size: 13px; color: var(--muted); }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; }

ul.tick { list-style: none; padding: 0; margin: 6px 0 0; }
ul.tick li { position: relative; padding-left: 20px; margin: 6px 0; font-size: 13px; }
ul.tick li::before { content: "▸"; position: absolute; left: 3px; color: var(--brand); }

ul.rules { list-style: none; padding: 0; margin: 0; }
ul.rules > li { padding: 11px 0; border-bottom: 1px dashed var(--border); }
ul.rules > li:last-child { border-bottom: 0; }
ul.rules p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.eg, .here { display: block; margin-top: 5px; padding-left: 10px; border-left: 2px solid var(--border); }
.here { border-left-color: var(--accent); color: #0f6b5e; }

.formula {
  background: var(--surface-2); border-radius: 8px; padding: 10px 14px;
  margin-bottom: 14px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.formula code { background: #fff; font-size: 13px; }

.disclaimer {
  margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--border); line-height: 1.8;
}

/* 对标自检 */
.conf-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface-2); border-radius: 8px; margin-bottom: 12px;
}
.conf-score { font-size: 20px; font-weight: 600; color: var(--brand); }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap;
}
.chip.pass { background: #e3f5ef; color: var(--accent); }
.chip.attention { background: #fdf3e0; color: var(--warning); }
.chip.manual { background: var(--surface-2); color: var(--muted); }
.chip.platform { background: #e7f0fa; color: var(--info); }

.conf-group { margin-top: 14px; }
.conf-group > h4 { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.conf-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px;
}
.conf-item.attention { border-left: 3px solid var(--warning); background: #fffdf8; }
.conf-item.pass { border-left: 3px solid var(--accent); }
.conf-item.manual { border-left: 3px solid var(--border); }
.conf-item.platform { border-left: 3px solid var(--info); }
.conf-item .body { flex: 1; min-width: 0; }
.conf-item .title { font-weight: 600; font-size: 13px; }
.conf-item .req-text { font-size: 12px; color: var(--muted); margin-top: 2px; }
.conf-item .detail { font-size: 13px; margin-top: 5px; }
.conf-item .samples { margin: 5px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  .method-view { padding: 16px; }
  .topnav { margin-left: 0; }
  .method-hero { flex-direction: column; }

  main { padding: 16px; }
  .topbar { flex-direction: column; align-items: flex-start; padding: 14px 16px; }
  .brand, .topnav, .topbar-actions { max-width: 100%; }
  .topnav { flex-wrap: wrap; }
  .topnav button { padding: 7px 12px; }
  .dropzone { padding: 28px 16px; }
  .meta-strip { flex-direction: column; }
  .verdict { text-align: left; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { min-width: 0; padding: 11px 12px; }
  #graph { height: 420px; }
  .node-card { position: static; width: auto; margin-top: 10px; }
  .modeling-head, .section-head { flex-direction: column; }
  .modeling-progress-panel { padding-left: 16px; padding-right: 16px; }
  .progress-summary, .activity-strip { align-items: flex-start; }
  .progress-current { align-items: flex-start; flex-direction: column; gap: 4px; }
  .activity-strip { flex-direction: column; gap: 5px; }
  .object-property-head { align-items: flex-start; flex-direction: column; }
  .review-fields { grid-template-columns: 1fr; }
  .workflow-guide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guide-step:nth-child(3) { border-right: 0; }
  .guide-step:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
  .draft-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .draft-overview-item:last-child { grid-column: 1 / -1; }
  .next-action { align-items: flex-start; flex-wrap: wrap; }
  .next-action .btn { margin-left: 0; }
  .lib-grid { grid-template-columns: 1fr; }
  .version-row { grid-template-columns: 1fr; }
  .version-row .version-actions { justify-content: flex-start; }
}

/* ------------------------------------------------ ISIP platform visual alignment */
body {
  background: var(--bg); color: var(--text); line-height: 1.55; letter-spacing: 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(15, 18, 35, .022) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 18, 35, .022) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 82%);
}
::selection { background: rgba(99, 102, 241, .18); }
button, input, select, textarea { letter-spacing: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(99, 102, 241, .26); outline-offset: 2px;
}
h1, h2, h3, h4 { color: var(--text-strong); letter-spacing: 0; }

.topbar {
  min-height: 68px; padding: 0 28px; color: var(--text);
  background: rgba(255, 255, 255, .88); border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  box-shadow: none;
}
.brand { gap: 11px; flex: 0 0 auto; }
.logo {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-accent);
  opacity: 1; overflow: hidden; position: relative;
}
.logo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(140deg, rgba(255, 255, 255, .42), transparent 50%);
}
.logo svg { width: 20px; height: 20px; position: relative; z-index: 1; }
.topbar h1 { font-size: 15px; font-weight: 800; color: var(--text-strong); letter-spacing: 0; line-height: 1.1; }
.topbar p { margin-top: 3px; font-size: 11px; color: var(--faint); opacity: 1; letter-spacing: 0; }
.topnav { align-self: stretch; align-items: center; gap: 3px; margin-left: auto; }
.topnav button {
  position: relative; min-height: 38px; padding: 0 14px; border-radius: 9px;
  color: var(--muted); font-size: 13px; font-weight: 600; transition: all .18s var(--ease);
}
.topnav button:hover { color: var(--text); background: var(--surface-2); }
.topnav button.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.topnav button.active::after {
  content: ""; position: absolute; right: 12px; bottom: -15px; left: 12px;
  height: 2px; border-radius: 2px; background: var(--brand-gradient);
}
.topbar-actions { margin-left: 12px; }
.topbar .btn.ghost {
  background: #fff; border-color: var(--border); color: var(--muted);
}
.topbar .btn.ghost:hover { border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-xs); }

main { position: relative; z-index: 1; max-width: 1180px; padding: 30px 26px 80px; }

.btn {
  min-height: 38px; padding: 0 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; color: var(--text);
  font-size: 13px; font-weight: 600; box-shadow: none; transition: all .18s var(--ease);
}
.btn:hover { filter: none; border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.primary-action,
#retryModeling, #submitAnswers, #validateDraft, #saveDraft, #runValidate,
.lib-actions > .btn:first-child {
  border-color: transparent; color: #fff; background: var(--brand-gradient);
  background-size: 160% 160%; box-shadow: var(--shadow-accent);
}
.btn.primary-action:hover,
#retryModeling:hover, #submitAnswers:hover, #validateDraft:hover, #saveDraft:hover,
#runValidate:hover, .lib-actions > .btn:first-child:hover {
  border-color: transparent; box-shadow: 0 14px 36px rgba(99, 102, 241, .34);
}
.btn.tiny-btn { min-height: 32px; padding: 0 12px; border-radius: 9px; font-size: 12px; }
.btn.danger-action { color: var(--error); border-color: rgba(220, 38, 38, .18); }
.btn.danger-action:hover { background: var(--error-soft); border-color: rgba(220, 38, 38, .28); }
.linklike { color: var(--brand); font-weight: 600; text-decoration: none; }
.linklike:hover { text-decoration: underline; }

.dropzone {
  padding: 46px 34px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .9); box-shadow: var(--shadow); transition: all .2s var(--ease);
}
.dropzone:hover, .dropzone.over {
  border-color: var(--brand); background: rgba(238, 240, 255, .62); box-shadow: var(--shadow-md);
}
.dz-icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 13px;
  border-radius: 14px; background: var(--brand-gradient); color: #fff;
  font-size: 24px; font-weight: 700; opacity: 1; box-shadow: var(--shadow-accent);
}
.dz-title { margin-top: 0; font-size: 15px; font-weight: 600; color: var(--text-strong); }
.dz-hint { max-width: 680px; margin: 7px auto 0; color: var(--muted); font-size: 12.5px; }
.dz-loading { color: var(--brand); font-weight: 600; }
.spinner { border-color: rgba(99, 102, 241, .18); border-top-color: var(--brand); }
.errorbox {
  padding: 13px 16px; border-color: rgba(220, 38, 38, .18); border-radius: var(--radius);
  background: var(--error-soft); color: var(--error);
}

.modeling-workflow, .meta-strip, .panel, .method-view {
  border-color: var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  background: rgba(255, 255, 255, .96);
}
.modeling-workflow { margin-top: 24px; }
.modeling-head { padding: 21px 22px 17px; }
.modeling-head h2 { font-size: 18px; font-weight: 750; }
.modeling-head .tiny, .section-head .tiny, .dialog-head .tiny {
  color: var(--brand); font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.modeling-head .tag, .candidate-head .tag { padding: 4px 10px; border-radius: 999px; border: 0; }
.model-uploaded, .model-profiling, .model-modeling, .model-reviewing, .model-validating { background: var(--info-soft); color: var(--info); }
.model-awaiting_answers, .model-draft_ready { background: var(--warning-soft); color: var(--warning); }
.model-publishable, .model-published { background: var(--accent-soft); color: var(--accent); }
.model-failed, .model-cancelled { background: var(--error-soft); color: var(--error); }
.workflow-guide { background: var(--surface-2); }
.guide-step { padding-top: 13px; padding-bottom: 13px; }
.guide-step i { top: 13px; border-color: var(--border-strong); }
.guide-step.completed { color: var(--accent); }
.guide-step.completed i { border-color: var(--accent); background: var(--accent); }
.guide-step.active { color: var(--brand); background: var(--brand-soft); }
.guide-step.active i { border-color: var(--brand); background: #fff; color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.modeling-progress-panel { padding: 17px 22px 18px; background: var(--surface); }
.progress-percent { color: var(--brand); font-size: 22px; font-weight: 800; }
.progress-track { height: 7px; border-radius: 999px; background: #f1f3f7; }
.progress-track span { border-radius: inherit; background: var(--brand-gradient); }
.progress-step.active { color: var(--brand); }
.progress-step.active .progress-step-dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.activity-strip { background: var(--surface-2); border-radius: var(--radius); }
.activity-item.current { color: var(--brand); }
.modeling-actions { padding-right: 22px; padding-left: 22px; }

.workflow-section { padding: 20px 22px; }
.workflow-details > summary, .advanced-editor > summary {
  padding: 14px 0; color: var(--text-strong); font-weight: 700;
}
.workflow-details > summary::marker, .advanced-editor > summary::marker { color: var(--brand); }
.section-head h3 { font-size: 16px; font-weight: 700; }
.next-action {
  padding: 14px 16px; border: 1px solid rgba(99, 102, 241, .18);
  border-radius: var(--radius); background: var(--brand-soft);
}
.draft-overview-item { border-color: var(--border); border-radius: var(--radius); background: var(--surface-2); }
.draft-overview-item b { color: var(--text-strong); font-size: 20px; font-weight: 800; }
.model-issue, .candidate-review, .finding, .conf-item {
  border-radius: var(--radius); border-color: var(--border); background: #fff;
}
.candidate-review { box-shadow: var(--shadow-xs); }
.candidate-review.rejected { background: var(--surface-2); }
.candidate-review.attention-flash { outline-color: rgba(217, 119, 6, .28); }
.confidence { color: var(--accent); font-weight: 600; }
.review-field, .mapping-field, .issue-actions select,
.question-item textarea, .question-item select,
.filterbar input[type=search], .filterbar select, textarea,
.dialog-field input, .dialog-field textarea {
  border-color: var(--border-strong); border-radius: var(--radius); background: #fff;
  color: var(--text); transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.review-field:focus, .mapping-field:focus, .issue-actions select:focus,
.question-item textarea:focus, .question-item select:focus,
.filterbar input[type=search]:focus, .filterbar select:focus, textarea:focus,
.dialog-field input:focus, .dialog-field textarea:focus {
  border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}
input[type="checkbox"] { accent-color: var(--brand); }
.mapping-field.mapping-missing { border-color: var(--error); background: var(--error-soft); }
.validation-head { border-radius: var(--radius); }
.validation-head.valid { color: var(--accent); background: var(--accent-soft); }
.validation-head.invalid { color: var(--error); background: var(--error-soft); }

.meta-strip { margin-top: 24px; padding: 21px 22px; }
.meta-main h2 { font-size: 21px; font-weight: 800; }
.verdict .tag { border-radius: 999px; border: 0; padding: 5px 11px; }
.verdict .tag.ok { background: var(--accent-soft); color: var(--accent); }
.verdict .tag.bad { background: var(--error-soft); color: var(--error); }
.verdict .tag.warn { background: var(--warning-soft); color: var(--warning); }
.stats { gap: 14px; margin-top: 16px; }
.stat {
  position: relative; overflow: hidden; padding: 17px 18px; border-color: var(--border);
  border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow);
}
.stat::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 2px; background: var(--brand-gradient); opacity: .7; }
.stat .num { color: var(--text-strong); font-size: 28px; font-weight: 800; }
.stat .lbl { margin-top: 5px; font-size: 12.5px; }
.tabs { margin-top: 24px; gap: 4px; }
.tabs button { padding: 11px 14px; color: var(--muted); font-size: 13px; font-weight: 600; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.panel { margin-top: 18px; padding: 20px; }
.section-title { color: var(--text-strong); font-weight: 700; }
.graph-wrap {
  border-color: var(--border); border-radius: var(--radius); background-color: var(--surface-2);
  background-image:
    linear-gradient(to right, rgba(15, 18, 35, .026) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 18, 35, .026) 1px, transparent 1px);
  background-size: 28px 28px;
}
.node-card { border-color: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.legend { border-color: var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.seg { padding: 3px; gap: 2px; border-radius: var(--radius); background: var(--surface-2); overflow: visible; }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 9px; color: var(--muted); }
.seg button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-xs); }
.obj-card, .enum-card, .export-card, .code-block {
  border-color: var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-xs);
}
.obj-head { background: var(--surface-2); }
.pill, .chip {
  padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.pill.grey, .chip.manual { background: #f1f3f7; color: var(--muted); }
.pill.pk, .chip.attention { background: var(--warning-soft); color: var(--warning); }
.chip.pass { background: var(--accent-soft); color: var(--accent); }
.chip.platform { background: var(--info-soft); color: var(--info); }
code { border-color: var(--border); border-radius: 7px; background: var(--surface-2); color: var(--brand); }
.table-scroll { border: 1px solid var(--border); border-radius: var(--radius); }
th { padding: 10px 12px; background: var(--surface-2); color: var(--muted); }
td { padding: 10px 12px; }
tbody tr:hover { background: var(--surface-2); }
.issue { border-color: var(--border); border-radius: var(--radius); background: #fff; }
.issue .hint { color: var(--accent); }
.empty { padding: 44px 20px; color: var(--faint); }
.export-card { padding: 16px; transition: all .18s var(--ease); }
.export-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.code-head { background: var(--surface-2); }
pre { background: #0f1223; color: #e8eaf4; }

.lib-hero {
  margin-top: 0; padding: 4px 0 7px; border: 0; border-radius: 0;
  background: transparent; box-shadow: none;
}
.lib-hero h2 { margin-bottom: 4px; color: var(--text-strong); font-size: 26px; font-weight: 800; }
.lib-hero-note {
  padding: 13px 15px; border: 1px solid rgba(99, 102, 241, .18);
  border-radius: var(--radius); background: var(--brand-soft); color: var(--brand);
}
.lib-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; margin-top: 18px; }
.lib-card {
  padding: 19px 20px; border-color: var(--border); border-top: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); transition: all .2s var(--ease);
}
.lib-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.lib-card.active { border-color: rgba(99, 102, 241, .42); box-shadow: 0 0 0 3px rgba(99, 102, 241, .08), var(--shadow); }
.lib-icon {
  width: 42px; height: 42px; border-radius: 12px; color: var(--brand);
  background: var(--brand-soft); font-size: 18px; font-weight: 800;
}
.lib-card.active .lib-icon { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-accent); }
.lib-loaded { border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.lib-stats span { border-radius: 7px; background: var(--surface-2); }
.lib-stats span b, .lib-versions > summary { color: var(--brand); }
.lib-conformance { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }

.publish-dialog {
  border-color: var(--border); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(15, 18, 35, .2);
}
.publish-dialog::backdrop { background: rgba(15, 18, 35, .38); backdrop-filter: blur(3px); }
.publish-dialog form { padding: 22px; }
.dialog-head h3 { font-size: 18px; font-weight: 750; }
.icon-action { border-radius: 9px; color: var(--muted); }
.icon-action:hover { border-color: rgba(220, 38, 38, .2); background: var(--error-soft); color: var(--error); }
.publish-conformance { border-radius: 0 var(--radius) var(--radius) 0; background: var(--accent-soft); }
.publish-conformance.attention { background: var(--warning-soft); }
.dialog-error { background: var(--error-soft); }

.method-view { max-width: 1000px; margin-top: 0; padding: 28px 30px 36px; }
.method-hero { border-bottom-color: var(--border); }
.method-hero h2 { color: var(--text-strong); font-size: 24px; font-weight: 800; }
.hero-note, .formula { border: 1px solid rgba(99, 102, 241, .16); border-radius: var(--radius); background: var(--brand-soft); color: var(--muted); }
.method-section > h3 { color: var(--text-strong); border-bottom-color: var(--border); }
.clause { border-radius: 6px; background: var(--surface-2); }
.step-no { border-radius: 9px; background: var(--brand-gradient); box-shadow: var(--shadow-accent); }
.req { border-color: var(--border); border-left-color: var(--brand); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-xs); }
.here { border-left-color: var(--brand); color: var(--brand); }
.conf-head { border: 1px solid var(--border); border-radius: var(--radius); }
.conf-score { color: var(--brand); font-weight: 800; }
.conf-item.attention { background: var(--warning-soft); }

@media (max-width: 860px) {
  .topbar { padding: 0 18px; }
  .topnav button { padding: 0 11px; }
  main { padding-right: 18px; padding-left: 18px; }
}

@media (max-width: 720px) {
  body::before { background-size: 30px 30px; }
  .topbar {
    min-height: auto; padding: 11px 16px 0; flex-flow: row wrap; align-items: center; gap: 9px 12px;
  }
  .brand { flex: 1; }
  .logo { width: 34px; height: 34px; border-radius: 10px; }
  .topbar p { display: none; }
  .topbar-actions { margin-left: auto; }
  .topbar-actions .btn { min-height: 34px; padding: 0 11px; }
  .topnav {
    order: 3; flex: 1 0 calc(100% + 32px); width: calc(100% + 32px); margin: 0 -16px;
    padding: 0 10px; overflow-x: auto; border-top: 1px solid var(--border); scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav button { flex: 1 0 auto; min-height: 42px; border-radius: 0; padding: 0 10px; }
  .topnav button.active { background: transparent; }
  .topnav button.active::after { right: 10px; bottom: 0; left: 10px; }
  main { padding: 18px 16px 56px; }
  .dropzone { padding: 34px 18px; }
  .modeling-head, .workflow-section, .meta-strip, .panel { padding-right: 16px; padding-left: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px; }
  .stat .num { font-size: 24px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; }
  .lib-hero h2 { font-size: 23px; }
  .lib-hero-note { flex-basis: 100%; }
  .lib-grid { grid-template-columns: minmax(0, 1fr); }
  .lib-card { padding: 17px 16px; }
  .publish-dialog form { padding: 18px; }
  .method-view { padding: 20px 16px 28px; }
}
