:root {
  --blue: #1769d2;
  --blue-strong: #0f56b6;
  --blue-soft: #eaf3ff;
  --navy: #14243c;
  --navy-2: #1d3352;
  --page: #f3f6fa;
  --surface: #ffffff;
  --line: #dce3ec;
  --line-soft: #e9eef4;
  --text: #1d2b3d;
  --muted: #64748b;
  --muted-2: #8b98aa;
  --danger: #c93f4b;
  --success: #2f855a;
  --warning: #a66a12;
  --radius: 6px;
  --shadow: 0 4px 14px rgba(34, 59, 91, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background: var(--page);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { min-width: 1180px; background: var(--page); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(23, 105, 210, 0.35);
  outline-offset: 1px;
}

.app-shell { min-height: 100dvh; }
.topbar {
  height: 58px;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(11, 58, 120, 0.2);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; white-space: nowrap; }
.brand-mark {
  width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.75); border-radius: 50%;
  display: grid; place-items: center; font-size: 17px; font-weight: 800;
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.top-action { color: rgba(255,255,255,.92); border: 0; background: transparent; padding: 7px 8px; border-radius: 4px; }
.top-action:hover { background: rgba(255,255,255,.12); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--blue); display: grid; place-items: center; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 8px; }

.body-shell { display: flex; min-height: calc(100dvh - 58px); }
.sidebar {
  width: 226px; background: #fff; border-right: 1px solid var(--line); flex: 0 0 auto;
  padding: 14px 10px 90px; position: sticky; top: 58px; height: calc(100dvh - 58px); overflow: auto;
}
.menu-search { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; margin-bottom: 14px; color: var(--text); }
.menu-group { margin: 8px 0 14px; }
.menu-title { padding: 8px 10px; font-weight: 700; color: #34465e; display: flex; gap: 8px; align-items: center; }
.menu-title::before { content: "□"; color: var(--blue); font-weight: 700; }
.menu-item {
  width: 100%; border: 0; background: transparent; text-align: left; padding: 10px 12px 10px 34px;
  color: #53647b; border-radius: 4px; margin: 1px 0; white-space: nowrap;
}
.menu-item:hover { background: #f3f7fc; color: var(--blue); }
.menu-item.active { color: var(--blue); background: var(--blue-soft); font-weight: 600; box-shadow: inset 3px 0 var(--blue); }

.main { flex: 1; min-width: 0; padding: 0 18px 96px; }
.breadcrumb { height: 52px; display: flex; align-items: center; color: var(--muted); gap: 8px; }
.breadcrumb strong { color: var(--text); }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.content-header h1 { font-size: 20px; margin: 0; }
.content-header p { margin: 4px 0 0; color: var(--muted); }

.card { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-card { padding: 18px; margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; gap: 14px 18px; align-items: end; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label { color: #3d4c61; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid #cfd8e4; border-radius: var(--radius); background: #fff;
  padding: 9px 10px; color: var(--text); min-height: 38px;
}
.field textarea { resize: vertical; min-height: 82px; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: #8c99a9; }
.helper { color: var(--muted); font-size: 12px; line-height: 1.5; }
.required::after { content: " *"; color: var(--danger); }

.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn {
  min-height: 36px; border: 1px solid #cbd5e1; background: #fff; color: #324258;
  padding: 7px 14px; border-radius: var(--radius); white-space: nowrap;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn:active { transform: translateY(1px); }
.btn.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-strong); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e3aab0; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue); padding-inline: 6px; }
.btn.small { min-height: 30px; padding: 4px 9px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { background: #f7f9fc; color: #38475a; font-weight: 700; text-align: left; padding: 12px 11px; border-bottom: 1px solid var(--line); }
td { padding: 12px 11px; border-bottom: 1px solid var(--line-soft); color: #3b4a5d; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbff; }
.actions { display: flex; gap: 10px; align-items: center; }
.link-btn { color: var(--blue); border: 0; background: transparent; padding: 0; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 4px; background: #eef3f8; color: #516176; font-size: 12px; }
.tag.blue { color: #155aae; background: #e8f2ff; }
.tag.green { color: #25724b; background: #eaf7f0; }
.tag.orange { color: #935f12; background: #fff5df; }
.tag.gray { color: #657286; background: #eff2f6; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 14px 2px; color: var(--muted); }
.page-box { border: 1px solid var(--line); background: #fff; min-width: 30px; height: 30px; border-radius: 4px; display: grid; place-items: center; }
.page-box.current { color: #fff; background: var(--blue); border-color: var(--blue); }

.split-panel { display: grid; grid-template-columns: 270px 1fr; gap: 14px; }
.tree-panel { padding: 14px; min-height: 520px; }
.tree-title { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); font-weight: 700; }
.tree { padding: 8px 0; }
.tree-node { width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 8px; border-radius: 4px; color: #45556b; }
.tree-node:hover, .tree-node.active { background: var(--blue-soft); color: var(--blue); }
.tree-node.level-1 { padding-left: 24px; }
.tree-node.level-2 { padding-left: 42px; }
.detail-panel { min-width: 0; }

.knowledge-search-card { padding: 22px; margin-bottom: 16px; }
.knowledge-search-field { max-width: 980px; margin: 0 auto; }
.knowledge-search-field > label { font-size: 17px; color: #263a53; }
.knowledge-search-row { display: grid; grid-template-columns: minmax(420px, 1fr) auto auto; gap: 10px; }
.knowledge-search-row input { height: 44px; font-size: 15px; }
.knowledge-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 16px 0 12px; }
.knowledge-toolbar select { height: 34px; border: 1px solid #cfd8e4; border-radius: var(--radius); color: #44556c; background: #fff; padding: 0 28px 0 9px; }
.result-count { color: var(--muted); margin-left: 12px; font-size: 13px; }
.knowledge-results { display: grid; gap: 12px; }
.knowledge-tabs { display: flex; align-items: flex-end; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.knowledge-tab { border: 0; border-bottom: 3px solid transparent; background: transparent; color: #596b82; padding: 11px 4px 10px; font-weight: 700; }
.knowledge-tab:hover { color: var(--blue); }
.knowledge-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.knowledge-tab span { display: inline-grid; place-items: center; min-width: 23px; height: 21px; margin-left: 6px; padding: 0 6px; border-radius: 10px; color: #66758a; background: #edf1f6; font-size: 12px; }
.knowledge-tab.active span { color: #155aae; background: #e5f0ff; }
.knowledge-group-title { display: flex; align-items: center; gap: 8px; color: #263a53; font-size: 15px; font-weight: 700; padding: 5px 2px 1px; }
.knowledge-group-title span { color: var(--muted); font-size: 13px; font-weight: 500; }
.knowledge-result { padding: 16px 18px; }
.knowledge-result-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.knowledge-result-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.knowledge-result h2 { margin: 0 0 8px; font-size: 16px; }
.knowledge-result p { margin: 0; color: #526176; line-height: 1.7; }
.knowledge-result .image-grid { max-width: 520px; }
.knowledge-note { margin-top: 10px; padding: 9px 11px; border-left: 3px solid #8eb9ed; background: #f5f9ff; color: #4c6078; line-height: 1.6; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 31, 51, .48); display: grid; place-items: center; z-index: 60; padding: 28px; }
.modal { width: min(1000px, calc(100vw - 64px)); max-height: calc(100dvh - 56px); display: flex; flex-direction: column; background: #fff; border-radius: 8px; box-shadow: 0 24px 70px rgba(15, 35, 61, .28); overflow: hidden; }
.modal.wide { width: min(1160px, calc(100vw - 64px)); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { margin: 0; font-size: 18px; }
.icon-close { border: 0; background: transparent; font-size: 22px; color: var(--muted); }
.modal-body { padding: 20px; overflow: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: #fafbfd; }

.steps { display: grid; grid-template-columns: repeat(6, 1fr); margin-bottom: 24px; position: relative; }
.steps::before { content: ""; position: absolute; left: 8%; right: 8%; top: 14px; height: 1px; background: #cfd8e4; }
.step { position: relative; z-index: 1; text-align: center; color: var(--muted); }
.step-num { width: 28px; height: 28px; border: 1px solid #bdc8d6; border-radius: 50%; background: #fff; display: grid; place-items: center; margin: 0 auto 7px; font-weight: 700; }
.step.active, .step.done { color: var(--blue); font-weight: 700; }
.step.active .step-num, .step.done .step-num { color: #fff; border-color: var(--blue); background: var(--blue); }
.step.done .step-num::after { content: "✓"; }
.step.done .step-num span { display: none; }
.step-content { min-height: 360px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.element-list { display: grid; gap: 10px; }
.element-row { display: grid; grid-template-columns: 34px 220px 1fr 70px; gap: 10px; align-items: start; }
.element-index { width: 30px; height: 38px; display: grid; place-items: center; background: #eef4fb; color: var(--blue); border-radius: 4px; font-weight: 700; }
.element-row input, .element-row textarea { width: 100%; border: 1px solid #cfd8e4; border-radius: 5px; padding: 9px 10px; min-height: 38px; }
.standard-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.standard-option { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; background: #fff; }
.standard-option:hover { border-color: #8eb9ed; }
.standard-option.selected { border: 2px solid var(--blue); background: #f5f9ff; padding: 13px; }
.standard-option h3 { margin: 0 0 8px; font-size: 15px; }
.standard-option p { margin: 4px 0; color: var(--muted); }
.preview-element-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.preview-element-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; }
.preview-element-card h3 { margin: 0 0 5px; font-size: 15px; color: #263a53; }
.preview-element-card > p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.preview-element-line { display: grid; gap: 4px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.preview-element-line strong { color: #40536a; }
.preview-element-line span { color: var(--muted); font-size: 13px; line-height: 1.55; }
.checklist-preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.check-group-title { padding: 11px 14px; font-weight: 700; background: #f4f7fb; border-bottom: 1px solid var(--line); }
.check-item { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.check-item:last-child { border-bottom: 0; }
.check-code { color: var(--blue); font-weight: 700; }
.check-text strong { display: block; margin-bottom: 5px; }
.check-text p { margin: 0; color: var(--muted); line-height: 1.55; white-space: normal; }
.attachment-block { margin-top: 12px; }
.attachment-label { color: #526176; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.image-card { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fafc; overflow: hidden; }
.image-card button.image-open { display: block; width: 100%; border: 0; padding: 0; background: #eef3f8; }
.image-card img { display: block; width: 100%; height: 104px; object-fit: cover; }
.image-name { padding: 7px 9px; color: #526176; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-remove { position: absolute; right: 6px; top: 6px; border: 0; border-radius: 4px; background: rgba(24,38,57,.84); color: #fff; width: 26px; height: 26px; }
.upload-tile { min-height: 142px; border: 1px dashed #8eb9ed; border-radius: var(--radius); background: #f5f9ff; color: var(--blue); display: grid; place-items: center; text-align: center; cursor: pointer; padding: 12px; }
.upload-tile:hover { background: #eaf3ff; }
.upload-tile input { display: none; }
.clause-editor-list { display: grid; gap: 14px; }
.clause-editor { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 14px; }
.clause-editor-head { display: grid; grid-template-columns: 110px 1fr; gap: 12px; margin-bottom: 12px; }
.clause-editor textarea { min-height: 76px; }
.preview-modal-image { display: block; max-width: 100%; max-height: 66dvh; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--radius); background: #f5f7fa; }

.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.review-list { display: grid; gap: 10px; }
.review-item { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.review-item-head { padding: 12px 14px; display: flex; justify-content: space-between; gap: 14px; background: #f8fafc; border-bottom: 1px solid var(--line-soft); }
.review-item-body { padding: 14px; }
.review-item-body p { margin: 0 0 12px; color: #526176; line-height: 1.65; }
.review-item textarea { width: 100%; min-height: 84px; border: 1px solid #cfd8e4; border-radius: var(--radius); padding: 10px; resize: vertical; }
.task-aside { padding: 16px; align-self: start; position: sticky; top: 74px; }
.aside-title { font-weight: 700; margin-bottom: 12px; }
.meta-list { display: grid; gap: 10px; }
.meta-line { display: grid; grid-template-columns: 80px 1fr; gap: 8px; color: var(--muted); }
.meta-line span:last-child { color: var(--text); }
.progress-num { font-size: 28px; color: var(--blue); font-weight: 700; margin: 16px 0 4px; }
.progress-note { color: var(--muted); }

.empty { padding: 58px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 7px; }
.notice { border: 1px solid #b8d7fb; background: #f0f7ff; color: #315f92; border-radius: var(--radius); padding: 11px 13px; line-height: 1.6; margin-bottom: 14px; }
.notice.warn { border-color: #efd7a7; background: #fff9ec; color: #79551d; }
.toast { position: fixed; right: 24px; top: 72px; z-index: 100; background: #23364e; color: #fff; padding: 11px 16px; border-radius: 5px; box-shadow: 0 10px 30px rgba(15,32,52,.22); opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translateY(0); }

.prototype-switcher { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 6px; background: #172335; color: #fff; padding: 7px; border-radius: 30px; box-shadow: 0 10px 30px rgba(9,22,40,.32); }
.prototype-switcher button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.12); font-size: 17px; }
.prototype-switcher button:hover { background: rgba(255,255,255,.22); }
.variant-label { min-width: 210px; text-align: center; font-size: 13px; }
.prototype-flag { color: #92c4ff; font-weight: 700; margin-right: 6px; }

/* Variant B: dark main rail with contextual sub-navigation */
.variant-b .topbar { background: #fff; color: var(--text); border-bottom: 1px solid var(--line); box-shadow: none; }
.variant-b .brand-mark { border-color: var(--blue); color: var(--blue); }
.variant-b .top-action { color: #53647b; }
.variant-b .avatar { background: var(--blue); color: #fff; }
.variant-b .body-shell { padding-left: 76px; }
.variant-b .primary-rail { position: fixed; left: 0; top: 58px; bottom: 0; width: 76px; background: var(--navy); z-index: 14; padding: 12px 8px 90px; }
.rail-btn { width: 60px; min-height: 58px; border: 0; background: transparent; color: #aebbd0; border-radius: 6px; margin-bottom: 6px; font-size: 12px; line-height: 1.35; }
.rail-btn b { display: block; font-size: 17px; margin-bottom: 4px; color: #dce6f5; }
.rail-btn.active { color: #fff; background: var(--blue); }
.variant-b .sidebar { width: 196px; top: 58px; }
.variant-b .menu-title { font-size: 12px; color: var(--muted); }
.variant-b .menu-title::before { display: none; }
.variant-b .menu-item { padding-left: 14px; }
.variant-b .menu-item.active { box-shadow: none; border-left: 3px solid var(--blue); }

/* Variant C: wide content with top module navigation */
.variant-c .topbar { height: 64px; background: var(--navy); }
.variant-c .module-tabs { display: flex; align-items: stretch; height: 64px; margin-left: 42px; }
.module-tab { border: 0; background: transparent; color: #c6d2e2; padding: 0 20px; border-bottom: 3px solid transparent; }
.module-tab.active, .module-tab:hover { color: #fff; border-bottom-color: #56a5ff; background: rgba(255,255,255,.04); }
.variant-c .body-shell { display: block; }
.variant-c .sidebar { display: none; }
.variant-c .main { max-width: 1480px; margin: 0 auto; padding-top: 0; }
.variant-c .breadcrumb { height: 46px; }
.variant-c .subnav { display: flex; gap: 8px; padding: 11px 0; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.subnav-btn { border: 0; background: transparent; color: #56677d; padding: 8px 13px; border-radius: 4px; }
.subnav-btn.active { color: var(--blue); background: var(--blue-soft); font-weight: 700; }

@media (max-width: 1240px) {
  body { min-width: 1024px; }
  .sidebar { width: 204px; }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-grid .btn-row { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
