:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --bg: #f5f7fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --teal: #0f766e;
  --green: #15803d;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --slate-soft: #f1f5f9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --sidebar: 236px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------- 布局 */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: #0f172a;
  color: #cbd5e1;
  padding: 18px 14px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand { padding: 4px 8px 18px; }
.brand-mark {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .3px;
}
.brand-mark .dot {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  display: grid; place-items: center; font-size: 13px; color: #fff; font-weight: 800;
}
.brand-sub { font-size: 11px; color: #64748b; margin-top: 6px; padding-left: 35px; line-height: 1.5; }

.nav-label {
  font-size: 11px; letter-spacing: .12em; color: #475569;
  padding: 16px 10px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px; color: #cbd5e1;
  font-size: 13.5px; transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: #1e293b; color: #fff; text-decoration: none; }
.nav-item.active { background: #1d4ed8; color: #fff; font-weight: 600; }
.nav-item .ico { width: 16px; height: 16px; flex: 0 0 16px; opacity: .85; }

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #1e293b; }
.who { display: flex; align-items: center; gap: 9px; padding: 6px 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #1e293b; color: #93c5fd;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.who-name { font-size: 13px; color: #e2e8f0; line-height: 1.2; }
.who-role { font-size: 11px; color: #64748b; }
.logout { margin-left: auto; color: #64748b; font-size: 12px; }
.logout:hover { color: #f87171; }

.main { flex: 1; min-width: 0; padding: 26px 34px 60px; }
.main-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 22px;
}
.main-head h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.main-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------- 组件 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 14.5px; margin: 0; font-weight: 650; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .12s ease; white-space: nowrap;
  font-family: inherit;
}
.btn:hover { border-color: var(--muted-2); background: #fbfdff; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); border-color: #bbf7d0; }
.badge.blue { background: var(--primary-soft); color: #1d4ed8; border-color: #bfdbfe; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: #fde68a; }
.badge.slate { background: var(--slate-soft); color: var(--muted); border-color: var(--line); }
.badge.muted { background: #f8fafc; color: var(--muted-2); border-color: var(--line); }
.badge.red { background: var(--red-soft); color: var(--red); border-color: #fecaca; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-1 { grid-template-columns: minmax(0, 360px); }
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 27px; font-weight: 680; letter-spacing: -.5px; line-height: 1.25; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }

.bar { height: 6px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.bar > span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #3b82f6, #0ea5e9);
}
.bar.green > span { background: linear-gradient(90deg, #16a34a, #22c55e); }
.bar.amber > span { background: linear-gradient(90deg, #d97706, #f59e0b); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe;
  white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fcfdff; }
table.tbl td.num { font-variant-numeric: tabular-nums; }

.flash {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 13px;
}
.flash.ok { background: var(--green-soft); border: 1px solid #bbf7d0; color: #166534; }
.flash.err { background: var(--red-soft); border: 1px solid #fecaca; color: #991b1b; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 30px; opacity: .35; margin-bottom: 8px; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink-2); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.field .req { color: var(--red); margin-left: 2px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; color: var(--ink); background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; line-height: 1.65; }
.hint { color: var(--muted); font-size: 12px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: auto; }

/* ---------------------------------------------------------- 台账条目 */
.group-block { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 14px; overflow: hidden; }
.group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; background: #f8fafc; border-bottom: 1px solid var(--line);
}
.group-head .part { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.group-head h3 { margin: 0; font-size: 13.5px; font-weight: 650; }

.item-row {
  display: grid; grid-template-columns: 52px 1fr auto auto; gap: 12px;
  align-items: center; padding: 11px 16px; border-bottom: 1px solid #f1f5f9;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: #fbfdff; }
.item-row.na { opacity: .55; }
.item-code {
  font-family: "SF Mono", ui-monospace, monospace; font-size: 11.5px;
  color: var(--muted); background: var(--slate-soft); border-radius: 5px;
  padding: 2px 6px; text-align: center; letter-spacing: .02em;
}
.item-title { font-size: 13.5px; color: var(--ink); }
.item-title:hover { color: var(--primary); }
.item-rule { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.item-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }

.check-row {
  display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
  align-items: flex-start;
}
.check-row:last-child { border-bottom: none; }
.check-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: 0 0 8px;
}
.check-dot.pass { background: #22c55e; }
.check-dot.warn { background: #f59e0b; }
.check-dot.error { background: #ef4444; }
.check-title { font-size: 13px; font-weight: 600; }
.check-detail { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* 建账参数：默认折叠，只保留状态摘要，避免右栏把校验和文档区推离视野 */
.ledger-params > summary { list-style: none; }
.ledger-params > summary::-webkit-details-marker { display: none; }
.ledger-params-summary {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; user-select: none; background: var(--card);
}
.ledger-params-summary > div:first-child {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.ledger-params-meta {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.ledger-params-toggle::after { content: "展开"; color: var(--primary); font-weight: 600; }
.ledger-params[open] .ledger-params-toggle::after { content: "收起"; }
.ledger-params-chevron {
  display: inline-block; color: var(--muted-2); font-size: 18px; line-height: 1;
  transform: rotate(0deg); transition: transform .15s ease;
}
.ledger-params[open] .ledger-params-chevron { transform: rotate(90deg); }
.ledger-policy-sync {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 8px; padding: 9px 12px; border: 1px solid #fde68a;
  border-radius: 10px; background: #fffbeb; color: #92400e; font-size: 12px;
}
.ledger-policy-sync b { color: #78350f; }

/* ---------------------------------------------------------- 编辑器 */
.block-editor { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.block-editor .block-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted-2); margin-bottom: 6px;
}
.block-editor.heading { border-left: 3px solid #93c5fd; }
.block-editor textarea { border-color: #e8eef6; background: #fdfefe; }
.block-editor textarea:focus { background: #fff; }

.tbl-edit { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12.5px; }
.tbl-edit td { border: 1px solid var(--line); padding: 0; }
.tbl-edit td input {
  border: none; border-radius: 0; padding: 6px 8px; font-size: 12.5px; width: 100%;
}
.tbl-edit td input.hdr { font-weight: 600; background: #f8fafc; }
.tbl-edit td input:focus { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .25); }
.tbl-edit tr:first-child td { background: #f8fafc; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 14px; }
.pager a, .pager span {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px;
  color: var(--ink-2);
}
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

.version-list { font-size: 13px; }
.version-row {
  display: grid; grid-template-columns: 62px 1fr auto auto; gap: 12px;
  align-items: center; padding: 11px 16px; border-bottom: 1px solid #f1f5f9;
}
.version-row:last-child { border-bottom: none; }
.vno {
  font-family: "SF Mono", ui-monospace, monospace; font-size: 12px; font-weight: 700;
  color: #1d4ed8;
}

.diff-add { background: var(--green-soft); }
.diff-del { background: var(--red-soft); }
.diff-mod { background: var(--amber-soft); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  padding: 9px 14px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1180px) { .split { grid-template-columns: 1fr; } }

.mono { font-family: "SF Mono", ui-monospace, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------------------------------------------------- 登录 */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(800px 360px at 50% -10%, #e8f0ff 0, rgba(232, 240, 255, 0) 72%),
    #f6f8fc;
}
.login-shell {
  min-height: 100vh; display: grid; place-items: center;
  padding: 28px 20px; box-sizing: border-box;
}
.login-box {
  width: min(100%, 390px); box-sizing: border-box;
  padding: 30px; background: #fff;
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 70px -36px rgba(15, 23, 42, .32);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 28px; }
.login-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .8);
}
.login-brand strong { display: block; color: var(--ink); font-size: 15px; line-height: 1.3; }
.login-brand span:not(.login-logo) { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.login-heading { margin-bottom: 22px; }
.login-heading h1 { margin: 0 0 5px; color: var(--ink); font-size: 24px; font-weight: 650; }
.login-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.login-box .field { margin-bottom: 15px; }
.login-box .field label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 12.5px; }
.login-box .field input { width: 100%; box-sizing: border-box; }
.login-submit {
  width: 100%; justify-content: center; margin-top: 4px;
  padding: 10px 16px; font-size: 13.5px;
}
.login-foot {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  color: var(--muted-2); font-size: 11.5px; line-height: 1.6; text-align: center;
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 18px; }
}

/* ---------------------------------------------------------- 模板编辑器 */
.editor-grid {
  display: grid; grid-template-columns: 216px minmax(0, 1fr) 398px;
  gap: 14px; align-items: start;
}
.editor-pane {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.editor-pane .card-head { padding: 11px 14px; margin: 0; border-bottom: 1px solid var(--line); }
.editor-outline { max-height: 72vh; overflow: auto; padding: 8px 8px 14px; }
.outline-part { font-size: 11.5px; font-weight: 650; color: var(--ink-2); margin: 10px 8px 3px; }
.outline-group { font-size: 11.5px; color: var(--muted); margin: 7px 8px 2px; }
.outline-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 9px; border-radius: 7px; font-size: 12.5px; color: var(--ink-2);
}
.outline-item:hover { background: var(--slate-soft); text-decoration: none; }
.outline-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.outline-item .n { font-size: 11px; color: var(--muted-2); }
.outline-item.active .n { color: var(--primary); }
.outline-item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px; align-items: start;
}
.outline-item-row + .outline-item-row { margin-top: 2px; }
.item-policy {
  border: 1px solid #bfdbfe; border-radius: 999px; padding: 2px 7px;
  background: var(--primary-soft); color: #1d4ed8;
  font: inherit; font-size: 10.5px; line-height: 1.5; cursor: pointer;
  white-space: nowrap;
}
.item-policy.optional {
  border-color: #fde68a; background: #fffbeb; color: #b45309;
}
.item-policy:hover { border-color: currentColor; }
.editor-doc { max-height: 72vh; overflow: auto; padding: 14px 18px 20px; }
.doc-head { font-size: 13px; font-weight: 650; margin: 12px 0 6px; color: var(--ink); }
.doc-para { font-size: 12.5px; line-height: 1.9; margin: 0 0 7px; color: var(--ink-2); }
.doc-vertical-title {
  width: max-content; min-height: 150px; box-sizing: border-box;
  margin: 16px auto; padding: 14px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbfdff;
  color: var(--ink); font-size: 20px; font-weight: 650; letter-spacing: .16em;
  line-height: 1; text-align: center;
  writing-mode: vertical-rl; text-orientation: upright;
}
.doc-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin: 8px 0 12px; table-layout: fixed; }
.doc-table td { border: 1px solid var(--line); padding: 4px 6px; vertical-align: top; word-break: break-word; }
.editor-side { max-height: 72vh; overflow: auto; }
.editor-side .tabs { margin: 0; padding: 0 10px; }
.field-card {
  display: flex; flex-direction: column; gap: 4px;
  height: 96px; box-sizing: border-box; overflow: hidden;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 12px; margin: 8px 10px;
  background: var(--card);
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
.field-card-head { align-items: flex-start; gap: 10px; }
.field-card-title { min-width: 0; flex: 1; }
.field-card-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 650;
}
.field-card-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.field-card .sub { font-size: 11.5px; color: var(--muted); margin: 0; }
.field-samples {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
}
@media (max-width: 1280px) {
  .editor-grid { grid-template-columns: 200px minmax(0, 1fr); }
  .editor-grid > .editor-pane:nth-child(3) { grid-column: 1 / -1; }
  .editor-side { max-height: none; }
}

mark.hl {
  background: transparent; color: inherit; padding: 0 1px; border-radius: 3px;
  transition: background .12s, box-shadow .12s;
}
mark.hl.active, mark.hl.pinned { background: #fde68a; box-shadow: 0 0 0 2px #fde68a; }
.field-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
tr[data-field-card]:hover { background: var(--primary-soft); }

td.field-cell { transition: background .12s, box-shadow .12s; }
td.field-cell.active, td.field-cell.pinned { background: #fef3c7; box-shadow: inset 0 0 0 2px #f59e0b; }

.field-card { cursor: pointer; }
.field-card.pinned {
  background: #fde68a; border-color: #f59e0b;
  box-shadow: 0 0 0 1px #f59e0b;
}
tr[data-field-card].pinned { background: var(--primary-soft); }

.doc-frame { width: 100%; height: 72vh; border: 0; background: #fff; border-radius: 6px; }

/* ---------------------------------------------------------- 布局刷新 */
:root {
  --sidebar: 252px;
  --page-max: 1500px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .03), 0 12px 32px -26px rgba(15, 23, 42, .28);
}

body {
  background:
    radial-gradient(1100px 420px at 14% -8%, #eaf1ff 0, rgba(234, 241, 255, 0) 62%),
    var(--bg);
}

.sidebar {
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 46%, #0b1526 100%);
  border-right: 1px solid rgba(148, 163, 184, .12);
  padding: 20px 14px 20px;
}

.brand { padding: 4px 8px 20px; }
.brand-mark { font-size: 16.5px; letter-spacing: .2px; }
.brand-mark .dot {
  width: 28px; height: 28px; border-radius: 9px;
  box-shadow: 0 8px 18px -10px rgba(59, 130, 246, .8);
}
.brand-sub { padding-left: 37px; }

.nav-label { padding: 18px 10px 6px; }
.nav-item {
  position: relative;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
}
.nav-item.active {
  background: rgba(37, 99, 235, .18);
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, .16);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #60a5fa;
}
.nav-item .ico { width: 17px; height: 17px; flex-basis: 17px; }
.who { padding: 8px; border-radius: 10px; }
.who:hover { background: rgba(148, 163, 184, .08); }

.main { padding: 30px clamp(20px, 3vw, 42px) 64px; }
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; }

.main-head {
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}
.main-head h1 {
  font-size: 24px;
  line-height: 1.35;
  font-weight: 680;
  letter-spacing: -.25px;
}
.main-head .sub {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.7;
}
.main-head .sub .badge { vertical-align: 1px; }
.head-actions { align-items: center; }

.card {
  border-color: #e4e9f2;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head {
  min-height: 54px;
  padding: 15px 20px;
}
.card-head h2 { font-size: 15px; letter-spacing: -.1px; }
.card-body { padding: 20px; overflow-x: auto; }
.card-body.tight { overflow-x: auto; }

.grid { gap: 18px; }
.stat {
  position: relative;
  min-height: 110px;
  padding: 18px 20px;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  opacity: .7;
}
.stat .k { font-size: 12.5px; letter-spacing: .01em; }
.stat .v { font-size: 29px; line-height: 1.2; }
.bar { height: 7px; }

.btn {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 9px;
  font-weight: 550;
  box-shadow: 0 1px 1px rgba(15, 23, 42, .02);
}
.btn.sm { min-height: 28px; padding: 4px 10px; }
.btn.primary { box-shadow: 0 7px 16px -12px rgba(37, 99, 235, .85); }
.btn:focus-visible, .nav-item:focus-visible, .choice:focus-within {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 9px;
}
.field { margin-bottom: 16px; }
.field label { margin-bottom: 6px; }

table.tbl { min-width: 680px; }
table.tbl .entity-cell { min-width: 180px; }
table.tbl.tbl-wide { min-width: 900px; }
table.tbl th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(251, 252, 254, .96);
  backdrop-filter: blur(8px);
  padding: 11px 16px;
}
table.tbl td { padding: 12px 16px; }

.split {
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 18px;
}

@media (min-width: 1181px) {
  .split > .rail {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }
  .split > .rail > .card:first-child {
    position: sticky;
    top: 0;
    z-index: 2;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 10px 28px -24px rgba(15, 23, 42, .55);
  }
}

.flash {
  box-shadow: 0 6px 18px -18px rgba(15, 23, 42, .45);
}
.empty { padding: 48px 20px; }

/* 建账参数：每个画像/清单一块，选项用可点的胶囊，而不是挤成一片小方框 */
.param-block {
  background: #f8fafc;
  border: 1px solid #e8eef6;
  border-radius: 12px;
  padding: 14px 14px 12px;
  margin-bottom: 12px !important;
}
.param-block:last-child { margin-bottom: 0 !important; }
.param-block .param-toggle,
.param-block > label { font-size: 13px; }
.param-options { margin-top: 10px !important; }
.choice-group + .choice-group { margin-top: 10px; }
.choice-label {
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .03em;
  color: var(--muted);
}
.choice-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.choice:hover { border-color: #93c5fd; background: #f8fbff; }
.choice input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--primary);
}
.choice:has(input:checked),
.choice.is-checked {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: #1d4ed8;
  font-weight: 600;
}
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.equipment-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.equipment-pair:has(.equipment-choice input:checked) {
  gap: 0;
  padding: 2px;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  background: #eff6ff;
}
.equipment-pair:has(.equipment-choice input:checked) .equipment-choice {
  border: 0;
  border-radius: 7px 0 0 7px;
  background: transparent;
  padding-right: 8px;
}
.equipment-pair:has(.equipment-choice input:checked) .role-choice {
  border: 0;
  border-left: 1px solid #bfdbfe;
  border-radius: 0 7px 7px 0;
  background: transparent;
  padding-left: 9px;
}
.equipment-roles {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.role-choice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}
.role-choice input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--primary);
}
.role-choice:has(input:checked) {
  border-color: #93c5fd;
  background: #dbeafe;
  font-weight: 600;
}

.area-matrix {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow-x: auto;
}
.area-matrix-row {
  display: grid;
  grid-template-columns: minmax(116px, 1fr) repeat(3, 54px);
  align-items: center;
  min-width: 0;
  border-top: 1px solid #eef2f7;
}
.area-matrix-row:first-child { border-top: 0; }
.area-matrix-head {
  min-height: 34px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}
.area-matrix-head > div,
.area-matrix-row > .area-name,
.area-choice {
  padding: 7px 10px;
}
.area-matrix-head > div:not(:first-child),
.area-choice {
  text-align: center;
  border-left: 1px solid #eef2f7;
}
.area-name {
  color: var(--ink-2);
  font-size: 12.5px;
}
.area-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  cursor: pointer;
}
.area-choice:hover { background: #f8fbff; }
.area-choice input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

/* 基础设置：一行一个选项，但把编辑、排序、状态分开，避免一长串同权重按钮 */
.settings-list { border-top: 1px solid #eef2f7; }
.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.settings-row:last-child { border-bottom: none; }
.settings-main {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(110px, 140px) auto auto;
  gap: 8px;
  align-items: center;
}
.settings-main .settings-label { min-width: 0; }
.settings-main .settings-category { min-width: 0; }
.settings-actions { display: flex; align-items: center; gap: 6px; }
.settings-move { display: inline-flex; gap: 4px; }
.settings-move .btn { min-width: 30px; justify-content: center; padding: 4px 7px; }

/* 窄屏导航：桌面侧栏改为抽屉，页面不再直接失去导航 */
.mobile-bar { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .settings-main {
    grid-template-columns: minmax(150px, 1fr) minmax(100px, 120px) auto auto;
  }
}

@media (max-width: 960px) {
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }
  .nav-toggle {
    display: grid;
    gap: 4px;
    width: 34px;
    height: 34px;
    place-content: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    width: 15px;
    height: 1.5px;
    border-radius: 2px;
    background: var(--ink-2);
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
  }
  .mobile-brand .dot {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
  }
  .mobile-user {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-left: auto;
    border-radius: 50%;
    background: var(--slate-soft);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 700;
  }
  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: block;
    background: rgba(15, 23, 42, .48);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    width: min(84vw, 300px);
    height: 100dvh;
    padding: 20px 16px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 24px 0 54px -32px rgba(15, 23, 42, .8);
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .main { padding: 20px 16px 48px; }
  .main-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }
  .main-head h1 { font-size: 21px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; justify-content: center; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .stat { min-height: 96px; padding: 15px 16px; }
  .stat .v { font-size: 26px; }
  .card-head { padding: 13px 16px; }
  .card-body { padding: 16px; }
  .item-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 12px 14px;
  }
  .item-code { grid-row: 1 / span 2; }
  .item-row > .badge { grid-column: 3; grid-row: 1; justify-self: end; }
  .item-row > .btn { grid-column: 3; grid-row: 2; justify-self: end; }
  .settings-row { grid-template-columns: 1fr; gap: 8px; }
  .settings-main {
    grid-template-columns: minmax(0, 1fr) minmax(90px, 110px) auto auto;
  }
  .settings-actions { justify-content: flex-end; flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .v { font-size: 24px; }
  .card-head { flex-wrap: wrap; }
  .card-head .hint { flex-basis: 100%; }
  .settings-main {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .settings-main .settings-category { grid-column: 1 / -1; }
  .settings-main .btn { grid-column: 2; grid-row: 1; }
  .login-shell { padding: 18px 14px; }
  .login-box { padding: 24px 20px; border-radius: 14px; }
}

/* 工作台：一屏内操作，只有左侧台账记录和右侧动态内容滚动 */
@media (min-width: 1181px) {
  .dashboard-mode .main {
    height: 100vh;
    overflow: hidden;
    padding-bottom: 24px;
  }
  .dashboard-mode .page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .dashboard-mode .dashboard {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .dashboard-mode .dashboard > .main-head,
  .dashboard-mode .dashboard > .grid {
    flex: 0 0 auto;
  }
  .dashboard-mode .dashboard > .split {
    flex: 1;
    align-items: stretch;
    min-height: 0;
  }
  .dashboard-mode .dashboard > .split > div {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .dashboard-mode .dashboard > .split > div > .card {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .dashboard-mode .dashboard > .split .card-head {
    flex: 0 0 auto;
  }
  .dashboard-mode .dashboard > .split .card-body.tight {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* 企业台账：一屏内查看，右侧操作列与表头固定，只有记录滚动 */
@media (min-width: 1181px) {
  .companies-mode .main {
    height: 100vh;
    overflow: hidden;
    padding-bottom: 24px;
  }
  .companies-mode .page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .companies-mode .main-head {
    flex: 0 0 auto;
  }
  .companies-mode .page > .card {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .companies-mode .page > .card > .card-body.tight {
    flex: 1;
    min-height: 0;
    overflow: auto;
  }
  .companies-mode table.tbl th.actions-cell,
  .companies-mode table.tbl td.actions-cell {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -10px 0 16px -18px rgba(15, 23, 42, .5);
  }
  .companies-mode table.tbl th.actions-cell {
    z-index: 3;
    background: #fbfcfe;
  }
  .companies-mode table.tbl td.actions-cell {
    z-index: 2;
  }
}

/* 企业详情：标题与操作固定在顶部，内容在其下滚动 */
@media (min-width: 961px) {
  .company-detail-mode .main { padding-top: 0; }
  .company-detail-mode .company-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 20px;
    align-items: center;
    margin-bottom: 16px;
    padding: 20px 0 12px;
    background: rgba(244, 246, 250, .94);
    border-bottom: 1px solid rgba(226, 232, 240, .72);
    backdrop-filter: blur(12px);
  }
  .company-detail-mode .split > .rail {
    top: 152px;
    max-height: calc(100vh - 172px);
  }
}

/* 企业详情页签：整页一屏，只有左侧内容滚动 */
@media (min-width: 961px) {
  .company-detail-mode .main {
    height: 100vh;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 24px;
  }
  .company-detail-mode .page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .company-detail-mode .company-nav {
    flex: 0 0 auto;
  }
  .company-detail-mode .split {
    display: grid;
    flex: 1;
    min-height: 0;
    align-items: stretch;
  }
  .company-detail-mode .split > div {
    min-height: 0;
  }
  .company-detail-mode .split > div:first-child {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .company-detail-mode #ledger-list,
  .company-detail-mode #profile {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
.company-detail-mode [data-tab-panel][hidden] { display: none !important; }
  .company-detail-mode #ledger-list .card-body.tight,
  .company-detail-mode #profile > .card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
  .company-detail-mode .split > .rail {
    position: static;
    top: auto;
    max-height: none;
    height: 100%;
    overflow-y: auto;
  }
  .company-detail-mode .split > .rail > .card:first-child {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

.company-nav-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.company-nav-back {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1;
}
.company-nav-back:hover { border-color: #93c5fd; background: #f8fbff; text-decoration: none; }
.company-nav-title { min-width: 0; }
.company-nav-crumb {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: .02em;
}
.company-nav-crumb a { color: var(--muted); }
.company-nav-crumb a:hover { color: var(--primary); text-decoration: none; }
.company-nav-crumb span:last-child {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-2);
}
.company-nav-title h1 {
  margin: 4px 0 0;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 680;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.company-nav-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.company-nav-actions { display: flex; gap: 8px; justify-self: end; }
.company-nav-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef2f7;
  overflow-x: auto;
  scrollbar-width: none;
}
.company-nav-tabs::-webkit-scrollbar { display: none; }
.company-nav-tab {
  padding: 7px 14px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}
.company-nav-tab:hover { background: rgba(255,255,255,.7); color: var(--ink-2); text-decoration: none; }
.company-nav-tab.is-active {
  background: #fff;
  color: var(--primary);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), inset 0 0 0 1px #dbeafe;
}

/* 新增企业：固定页头、步骤导航、表单滚动和右侧操作栏 */
.company-create-steps {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.company-create-steps::-webkit-scrollbar { display: none; }
.company-create-steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.company-create-steps li b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--ink-2);
  font-size: 10.5px;
}
.company-create-steps li.on {
  background: #fff;
  color: var(--primary);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px #dbeafe;
}
.company-create-steps li.on b { background: var(--primary); color: #fff; }
.company-create-steps li.done b { background: #dcfce7; color: #15803d; }

.company-create-mode #company-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.company-create-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 18px;
  flex: 1;
  min-height: 0;
}
.company-create-main {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 24px;
}
.company-create-rail {
  min-height: 0;
  overflow-y: auto;
}
.company-create-rail .card + .card { margin-top: 14px; }
.company-step + .company-step { margin-top: 16px; }
.step-eyebrow {
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.company-step .card-head h2 { margin: 0; }
.form-subsection + .form-subsection {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.form-subsection h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
}
.selection-group-title {
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
}
.selection-group-title:first-child { margin-top: 0; }
.confined-guardian-field {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
}
.create-current {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
}
.create-current b { color: var(--ink); }
.create-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.create-actions .btn { justify-content: center; }
#wizard-submit { grid-column: 1 / -1; }
.create-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.create-secondary .btn { justify-content: center; }

.risk-subnav {
  margin-bottom: 12px;
}
.risk-subnav h2 {
  margin: 0 0 2px;
  font-size: 17px;
  line-height: 1.3;
}

.build-scope {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #e8eef6;
  border-radius: 10px;
  background: #f8fafc;
}

.field-code {
  display: none;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
}

[hidden] { display: none !important; }

.org-chart-upload {
  display: grid;
  gap: 8px;
}
.org-chart-preview {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.org-chart-preview img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}
.org-chart-paste {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px dashed #bfdbfe;
  border-radius: 10px;
  background: #f8fbff;
  cursor: text;
  outline: none;
}
.org-chart-paste:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.org-chart-paste-title {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
}
.org-chart-paste input[type="file"] {
  margin-top: 4px;
  font-size: 12px;
}

.document-preview {
  max-width: 940px;
  margin: 0 auto;
  padding: 34px 42px 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 50px -42px rgba(15, 23, 42, .5);
}
.preview-heading {
  margin: 22px 0 10px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}
.preview-heading:first-child { margin-top: 0; }
.preview-para {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.preview-table-wrap {
  margin: 12px 0 18px;
  overflow-x: auto;
}
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.preview-table td {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  color: var(--ink-2);
  line-height: 1.65;
  white-space: pre-wrap;
  vertical-align: top;
}
.preview-table-head td {
  background: #f8fafc;
  color: var(--ink);
  font-weight: 650;
}
.preview-org-chart {
  margin: 16px 0;
  text-align: center;
}
.preview-org-chart img {
  max-width: 100%;
  max-height: 560px;
  object-fit: contain;
}
.preview-image-empty {
  margin: 18px 0;
  padding: 50px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.field label:focus-within .field-code,
.field label.show-field-code .field-code {
  display: inline-flex;
  animation: field-code-in .12s ease-out;
}

@keyframes field-code-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.company-detail-mode #ledger-list,
.company-detail-mode #profile,
.company-detail-mode #create-ledger {
  scroll-margin-top: 146px;
}

@media (max-width: 960px) {
  .company-nav {
    margin-bottom: 16px;
    padding: 2px 0 10px;
    border-bottom: 1px solid var(--line);
  }
  .company-nav-title h1 { font-size: 20px; white-space: normal; }
  .company-nav-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
  }
  .company-nav-actions .btn { flex: 1; justify-content: center; }
  .company-nav-tabs { margin-top: 8px; }
  .company-create-mode .company-nav-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
  }
  .company-create-mode .company-nav-actions .btn { flex: 1; justify-content: center; }
  .company-create-steps { margin-top: 8px; }
  .company-create-body { display: block; }
  .company-create-rail { margin-top: 14px; }
  .company-create-main { overflow: visible; padding-right: 0; }
}

/* 风险档案：复用企业页头，只有风险内容滚动 */
@media (min-width: 961px) {
  .risk-mode .risk-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 4px 24px 0;
  }
  .risk-mode .risk-subnav {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding: 10px 0 8px;
    background: rgba(244, 246, 250, .94);
    border-bottom: 1px solid rgba(226, 232, 240, .72);
    backdrop-filter: blur(12px);
  }
  .risk-mode .risk-subnav h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
  }
  .risk-mode .risk-subnav .tabs { margin: 0; }
  .risk-mode .split > .rail {
    position: static;
    max-height: none;
  }
}
