:root {
  --bg: #0b1017; --panel: #111823; --panel2: #151f2c; --panel3: #1a2534;
  --border: #243044; --border2: #33425a;
  --text: #e6edf5; --muted: #8b9bb0; --dim: #64748b;
  --accent: #4aa8ff; --accent-soft: rgba(74,168,255,.14);
  --ok: #4ade80; --warn: #fbbf24; --fail: #f87171; --info: #38bdf8;
  --front: #ffb454; --wide: #facc15; --surround: #4ade80; --top: #a78bfa; --sub: #f472b6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 13px/1.55 "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  overflow: hidden;
}
button, input, select { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b3a50; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3d5372; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: linear-gradient(90deg, #101925, #0d141e);
  border-bottom: 1px solid var(--border); gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { flex: none; display: flex; align-items: center; }
.logo a { display: block; line-height: 0; text-decoration: none; }
.logo img { display: block; height: 44px; width: auto; border: 0; }
.brand h1 { font-size: 15px; letter-spacing: 1.4px; font-weight: 700; white-space: nowrap; }
.brand p { font-size: 11px; color: var(--dim); letter-spacing: .3px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.std-badge {
  font-size: 11px; color: var(--accent); background: var(--accent-soft);
  border: 1px solid rgba(74,168,255,.3); padding: 5px 10px; border-radius: 20px; white-space: nowrap;
}
.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--border2);
  padding: 7px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: #1e2c3e; border-color: #4a6285; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: #1d4ed8; border-color: #3b82f6; color: #fff; }
.btn.primary:hover { background: #2563eb; }
.btn.ghost { background: transparent; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: 38px; min-width: 190px; z-index: 40;
  background: var(--panel3); border: 1px solid var(--border2); border-radius: 9px;
  box-shadow: 0 12px 34px rgba(0,0,0,.55); padding: 6px; display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.dropdown-menu button:hover { background: #24344a; }

/* ---------- 主布局 ---------- */
.layout {
  display: grid; grid-template-columns: 306px minmax(420px, 1fr) 348px;
  height: calc(100vh - 62px); gap: 0;
}
.panel { background: var(--panel); overflow-y: auto; overflow-x: hidden; }
.panel.left { border-right: 1px solid var(--border); }
.panel.right { border-left: 1px solid var(--border); }
.center { overflow-y: auto; padding: 14px 16px 40px; background: #0c121b; }

/* ---------- 输入面板 ---------- */
.section { border-bottom: 1px solid var(--border); padding: 14px 16px 16px; }
.section h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.3px; color: var(--accent);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.section h2::before { content: ''; width: 3px; height: 12px; background: var(--accent); border-radius: 2px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.field label { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; }
.field .hint { display: block; font-size: 10px; color: var(--dim); }
.field input[type=number], .field select {
  width: 96px; flex: none; background: var(--panel2); border: 1px solid var(--border2);
  color: var(--text); padding: 5px 7px; border-radius: 6px; font-size: 12px; outline: none;
}
.field select { width: 128px; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.field .unit { color: var(--dim); font-size: 11px; width: 22px; flex: none; }
.field.check { justify-content: flex-start; gap: 8px; }
.field.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.field.check label { flex: none; color: var(--text); font-size: 12px; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.preset-row .btn { padding: 5px 9px; font-size: 11px; }
.note { font-size: 10.5px; color: var(--dim); line-height: 1.6; margin-top: 10px; }
.note b { color: var(--muted); font-weight: 600; }
.action-row { display: flex; gap: 8px; margin-top: 12px; }
.action-row .btn { flex: 1; text-align: center; }

/* ---------- 视图区 ---------- */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--panel2); border: 1px solid var(--border); padding: 3px; border-radius: 9px; }
.tab {
  background: transparent; border: 0; color: var(--muted); padding: 6px 13px; border-radius: 6px;
  font-size: 12px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: #234066; color: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.3); }
.view-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted);
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; cursor: pointer;
}
.toggle input { accent-color: var(--accent); width: 13px; height: 13px; margin: 0; }
.canvas {
  width: 100%; aspect-ratio: 1000 / 620; min-height: 300px; background: #0f151d;
  border: 1px solid var(--border2); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.35); touch-action: none;
}
.canvas svg { display: block; width: 100%; height: 100%; }
.canvas.dragging { cursor: grabbing; }
.view-caption { font-size: 11px; color: var(--dim); margin: 8px 2px 14px; line-height: 1.6; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; margin-bottom: 16px; }
.metric {
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
}
.metric .k { font-size: 10.5px; color: var(--dim); letter-spacing: .3px; }
.metric .v { font-size: 18px; font-weight: 650; margin-top: 2px; letter-spacing: .3px; }
.metric .v small { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.metric .s { font-size: 10px; color: var(--dim); margin-top: 2px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
.card h3 { font-size: 13px; font-weight: 650; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card h3 small { color: var(--dim); font-weight: 400; font-size: 11px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
th { text-align: left; color: var(--dim); font-weight: 500; padding: 7px 6px; border-bottom: 1px solid var(--border2); white-space: nowrap; }
td { padding: 5px 6px; border-bottom: 1px solid rgba(36,48,68,.55); color: var(--muted); white-space: nowrap; }
tr:hover td { background: rgba(74,168,255,.05); }
td.name { color: var(--text); }
td input.coord {
  width: 62px; background: #0e1622; border: 1px solid var(--border); color: var(--text);
  padding: 3px 5px; border-radius: 4px; font-size: 11px; outline: none;
}
td input.coord:focus { border-color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.badge-mini { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--panel3); color: var(--muted); }

/* ---------- 右侧报告 ---------- */
.level-card {
  margin: 14px 14px 0; padding: 16px; border-radius: 12px;
  background: linear-gradient(140deg, #17273e, #131c2a); border: 1px solid #2b4a70;
}
.level-top { display: flex; justify-content: space-between; align-items: flex-start; }
.level-card .eyebrow { font-size: 10.5px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.level-card .big { font-size: 27px; font-weight: 700; line-height: 1.15; margin-top: 4px; }
.level-card .big em { font-style: normal; color: var(--accent); }
.level-card .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.score-ring {
  width: 70px; height: 70px; border-radius: 50%; flex: none;
  display: grid; place-items: center; position: relative;
}
.score-ring .inner {
  width: 54px; height: 54px; border-radius: 50%; background: #121c2b;
  display: grid; place-items: center; font-size: 17px; font-weight: 700;
}
.level-bar { height: 7px; background: #0d1724; border-radius: 5px; margin-top: 14px; overflow: hidden; display: flex; gap: 2px; }
.level-bar span { flex: 1; border-radius: 3px; background: #24354c; }
.level-bar span.on { background: linear-gradient(90deg, #2563eb, #4aa8ff); }
.level-legend { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: 5px; }

.report-head {
  font-size: 11px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--accent);
  margin: 18px 16px 8px; display: flex; justify-content: space-between;
}
.check {
  margin: 0 14px 8px; padding: 10px 12px; border-radius: 9px;
  background: var(--panel2); border: 1px solid var(--border); border-left-width: 3px;
}
.check.pass { border-left-color: var(--ok); }
.check.warn { border-left-color: var(--warn); }
.check.fail { border-left-color: var(--fail); }
.check.na { border-left-color: #3c4a5f; opacity: .7; }
.check-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.check-name { font-size: 12px; color: var(--text); }
.check-no { font-size: 10px; color: var(--dim); margin-right: 5px; }
.check-val { font-size: 12px; font-weight: 650; white-space: nowrap; }
.check-val small { color: var(--dim); font-weight: 400; }
.check-meta { font-size: 10.5px; color: var(--dim); margin-top: 3px; }
.check-advice { font-size: 10.5px; color: #d3b676; margin-top: 6px; line-height: 1.55; }
.check.pass .check-val { color: var(--ok); }
.check.warn .check-val { color: var(--warn); }
.check.fail .check-val { color: var(--fail); }
.status-pill { font-size: 9.5px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.status-pill.pass { background: rgba(74,222,128,.15); color: var(--ok); }
.status-pill.warn { background: rgba(251,191,36,.15); color: var(--warn); }
.status-pill.fail { background: rgba(248,113,113,.15); color: var(--fail); }
.status-pill.na { background: #243044; color: var(--dim); }

.diag { margin: 0 14px 6px; padding: 8px 11px; border-radius: 8px; background: rgba(21,31,44,.7); border: 1px solid var(--border); }
.diag-title { font-size: 11.5px; color: var(--text); display: flex; gap: 7px; align-items: center; }
.diag-detail { font-size: 10.5px; color: var(--dim); margin-top: 3px; line-height: 1.55; }
.diag.pass .diag-title::before { content: '●'; color: var(--ok); font-size: 8px; }
.diag.warn .diag-title::before { content: '●'; color: var(--warn); font-size: 8px; }
.diag.fail .diag-title::before { content: '●'; color: var(--fail); font-size: 8px; }
.diag.info .diag-title::before { content: '●'; color: var(--info); font-size: 8px; }

.std-table { margin: 0 14px 16px; font-size: 10.5px; }
.std-table table { font-size: 10.5px; }
.std-table th, .std-table td { padding: 4px 5px; }
.std-table td.actual { color: var(--accent); }
.source-note { margin: 0 14px 24px; font-size: 10px; color: var(--dim); line-height: 1.7; border-top: 1px dashed var(--border2); padding-top: 10px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4,8,14,.72); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  width: min(440px, 100%); background: var(--panel2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal h3 { font-size: 15px; margin-bottom: 12px; }
.modal input[type=text] {
  width: 100%; background: #0d1622; border: 1px solid var(--border2); color: var(--text);
  padding: 8px 10px; border-radius: 7px; outline: none; font-size: 12px;
}
.modal .scheme-list { max-height: 260px; overflow-y: auto; margin-bottom: 12px; }
.scheme-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px; margin-bottom: 6px; cursor: pointer;
}
.scheme-item:hover { background: #1e2c3e; }
.scheme-item span { font-size: 12px; }
.scheme-item small { color: var(--dim); font-size: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1d2b3f; border: 1px solid var(--border2); color: var(--text);
  padding: 9px 18px; border-radius: 8px; font-size: 12px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1380px) {
  .layout { grid-template-columns: 268px minmax(360px, 1fr) 300px; }
  .field select { width: 112px; }
  .field input[type=number] { width: 84px; }
}
@media (max-width: 1100px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .panel { max-height: none; }
  .panel.left, .panel.right { border: 0; border-top: 1px solid var(--border); }
  .center { order: -1; }
  .topbar { height: auto; min-height: 62px; flex-wrap: wrap; padding: 10px 14px; }
}
.page-footer {
  text-align: center; padding: 14px 0 20px; font-size: 12px;
  color: var(--dim); letter-spacing: .3px;
}
.page-footer a { color: #e8442e; text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

@media print {
  body { overflow: visible; background: #fff; color: #111; }
  .topbar, .panel.left, .view-head, .view-caption, .action-row, .preset-row, .toast, .modal-mask, .canvas { display: none; }
  .layout { display: block; height: auto; }
  .center { padding: 0; background: #fff; color: #111; overflow: visible; }
  .panel.right { border: 0; background: #fff; }
  .card, .metric, .check, .diag, .level-card { background: #fff !important; color: #111 !important; border-color: #bbb !important; }
  .check-name, .diag-title, .check-val, .metric .v { color: #111 !important; }
  .canvas { display: block; border: 1px solid #999; background: #0f151d; }
  table { color: #111; }
  th, td { color: #333 !important; }
  .page-footer { color: #555; }
  .page-footer a { color: #c22a17 !important; }
  @page { size: A4 landscape; margin: 12mm; }
}
