:root {
  --blue: #1e5ca8;
  --blue-dark: #15457e;
  --blue-light: #e6eef7;
  --border: #dfe5ec;
  --text: #1b2633;
  --muted: #66707c;
  --red: #b2402f;
  --green: #2e7d59;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: #f2f5f8;
  min-height: 100vh;
}
header {
  background: linear-gradient(90deg, #1e5ca8, #4c8cc7);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
header h1 { margin: 0; font-size: 20px; }
header .sub { font-size: 13px; opacity: .85; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar .hint { color: var(--muted); font-size: 13px; }
.toolbar .spacer { flex: 1; }
/* 登录弹窗打开时整体隐藏工具栏：未登录用户看不到任何主页内容
   （含功能按钮/提示行），只保留登录框 */
body.login-modal-open .toolbar { display: none; }
/* 登录门禁（服务端按会话注入 auth-gate）：首帧就隐藏主页内容并显示登录框，
   避免刷新页面时主页内容一闪而过 */
body.auth-gate #modal-login { display: flex !important; }
body.auth-gate header,
body.auth-gate .toolbar,
body.auth-gate main { display: none; }
/* 通用显隐工具类（导航按钮、面板等依赖 hidden 控制显示/隐藏） */
.hidden { display: none !important; }
/* 隐藏数字输入框右侧的上下小箭头（微调按钮） */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
button {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: background .15s;
}
button:hover { background: #eef3f8; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:disabled:hover { background: #fff; }
button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
button.primary:hover { background: var(--blue-dark); }
/* 工具栏「登录」按钮：悬停不改变背景色，只加蓝色边框高亮，
   避免浏览器重绘时按钮闪烁/看起来像消失 */
#btn-login:hover { background: #fff; border-color: var(--blue); }
main {
  display: grid;
  grid-template-columns: 280px minmax(560px, 1fr);
  gap: 16px;
  padding: 16px 24px;
  align-items: start;
}
.col-valve { grid-column: 1; grid-row: 1; }
.col-cond { grid-column: 2; grid-row: 1; }
/* 计算结果：横跨整行，6 列对齐表格完整显示 */
.col-result { grid-column: 1 / -1; grid-row: 2; }
@media (max-width: 1180px) {
  main { grid-template-columns: 1fr; }
  .col-valve, .col-cond, .col-result { grid-column: auto; grid-row: auto; }
}
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--blue);
  border-left: 4px solid var(--blue);
  padding-left: 8px;
}
.media-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.media-row label { display: inline-flex; gap: 4px; align-items: center; }
.media-row .lbl { font-weight: 600; }
.media-row .gap { margin-left: 12px; }
.media-row select, .param-row select, .alias-edit input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.field-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.field-grid select,
.field-grid input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 13px;
}
.field-grid input[readonly] {
  background: #f4f6f8;
  color: #334;
}
.custom-valve {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fafbfc;
}
.custom-valve.hidden { display: none; }
.custom-valve label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.custom-valve input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 13px;
}
.custom-valve select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 13px;
}
.curve-preview {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.curve-icon { display: block; }
.curve-icon.hidden { display: none; }
.curve-icon line { stroke: #c9d3dd; stroke-width: 1.2; }
.curve-icon path { stroke: #4c8cc7; stroke-width: 2; fill: none; }
.custom-valve input[readonly] {
  background: #f4f6f8;
  color: #334;
}
.unit-input {
  position: relative;
  display: block;
}
.unit-input input {
  width: 100%;
  padding-right: 34px;
}
.unit-input .unit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
.unit-input select.unit-sel {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  border: none;
  background: transparent;
  outline: none;
  cursor: pointer;
  padding: 0;
  width: 26px;
  appearance: none;
  -webkit-appearance: none;
}
.unit-input select.unit-sel:hover { color: #334; }
.chk { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; }
.cond-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}
.cond-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f4f7fa;
  font-size: 13px;
  cursor: pointer;
}
.cond-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.cond-tab .del {
  margin-left: 6px;
  color: inherit;
  opacity: .7;
  cursor: pointer;
}
.cond-tab.add { border-style: dashed; background: #fff; }
.cond-panel { display: none; }
.cond-panel.active { display: block; overflow-x: auto; }
.fluid-head {
  margin: 4px 0 8px;
  padding: 6px 10px;
  background: #eaf2f9;
  border-left: 4px solid #4c8cc7;
  border-radius: 4px;
  font-size: 13px;
  color: #15457e;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.fluid-title { font-weight: 700; }
.fluid-part {
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: #15457e;
  font-size: 12px;
  background: #fff;
  border: 1px solid #b8d3e8;
  border-radius: 999px;
  padding: 3px 10px;
}
.fluid-part input[type="checkbox"] { width: 15px; height: 15px; margin: 0; }
.param-row {
  display: grid;
  grid-template-columns: 210px 1fr 120px auto;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
}
.param-row .p-label { font-size: 14px; }
.param-row input[type=number] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
.param-row .gauge { font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }
/* 参考风格：每个工况 4 列（Minimum / Normal / Maximum / Other） */
.cond-cols {
  min-width: 1880px;
}
.cond-row {
  display: grid;
  grid-template-columns: 210px repeat(12, minmax(0, 1fr)) 120px;
  gap: 6px 10px;
  align-items: center;
  padding: 3px 0;
}
.cond-cols .col-head {
  text-align: center;
  font-weight: 700;
  color: #15457e;
  font-size: 13px;
}
.cond-cols .col-tip {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}
.cond-cols .p-label { font-size: 14px; align-self: center; }
.cond-cols input[type=number] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  box-sizing: border-box;
}
.cond-cols input[disabled] {
  background: #e9eef4;
  color: #6b7a8a;
  cursor: not-allowed;
}
.cond-cols select {
  width: 100%;
  font-size: 12.5px;
  box-sizing: border-box;
}
.cond-cols .cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cond-cols .gauge {
  font-size: 12px;
  display: inline-flex;
  gap: 3px;
  align-items: center;
  white-space: nowrap;
}
.cond-cols .unit-cell select { width: 100%; }
.cond-cols .unit-cell .unit-fixed {
  width: 100%;
  font-size: 12.5px;
  text-align: center;
  color: #5a6b7a;
  background: #e9eef4;
  border: 1px solid #d7e1ea;
  border-radius: 4px;
  padding: 2px 4px;
  box-sizing: border-box;
}
.tip { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.result-card { min-height: 260px; }
.result-card .placeholder { color: var(--muted); padding: 30px 0; text-align: center; }
.res-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #e3e9ef; }
.res-row .k { color: var(--muted); font-size: 14px; }
.res-row .v { font-weight: 600; color: var(--blue); font-size: 15px; text-align: right; }
.res-row .v.big { font-size: 22px; }
.res-row .v.red { color: var(--red); }
.res-row pre { white-space: pre-wrap; margin: 0; font: inherit; font-size: 13px; }

/* 完整选型 */
.res-row.section { border-bottom: 1px solid #c9d6e2; margin-top: 6px; }
.res-row.section span { font-weight: 700; color: #15457e; font-size: 14px; }
.cond-result { margin: 8px 0; padding: 6px 10px; background: #f7fafc; border-radius: 6px; }
.cond-card { margin: 10px 0; padding: 10px 12px; border: 1px solid #d7e1ea; border-radius: 8px; background: #fbfdff; }
.cond-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cond-head b { color: #15457e; }
/* 工况 4 列结果并排 */
.cond-group { margin: 10px 0; padding: 10px 12px; border: 1px solid #d7e1ea; border-radius: 8px; background: #fbfdff; }
.cond-group + .cond-group { margin-top: 18px; border-top: 2px solid #b7cfe0; }
.cond-group::after { content: ""; display: block; height: 0; }
.cond-cols-result {
  display: grid;
  grid-template-columns: repeat(6, minmax(185px, 1fr));
  gap: 10px;
  overflow-x: auto;
}
.cond-col-result {
  border: 1px solid #e2eaf2;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  min-width: 0;
}
.cond-col-title {
  font-weight: 700;
  color: #15457e;
  font-size: 13px;
  border-bottom: 1px solid #d7e1ea;
  margin-bottom: 6px;
  padding-bottom: 4px;
  text-align: center;
}
/* 计算结果：参考风格对齐表格 */
.res-table-wrap { overflow-x: auto; }
.res-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
  border-bottom: 2px solid #c9d9e8;
}
.res-table th,
.res-table td {
  border: 1px solid #e2eaf2;
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.res-table th {
  background: #f2f6fa;
  color: #15457e;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.res-table td.rk {
  color: #5a6b7a;
  background: #fafcfe;
  font-weight: 600;
  white-space: nowrap;
}
.res-table td.big {
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
}
.res-table td.red { color: var(--red); font-weight: 700; }
.res-table tbody tr:nth-child(even) td { background: #fcfdff; }
.res-table tbody tr.sub td {
  background: #e3eef7;
  font-weight: 700;
  color: #15457e;
  border-top: 3px solid #9db8cf;
  border-bottom: 1px solid #c9d9e8;
  letter-spacing: 0.5px;
}
.res-table tbody tr.total td {
  background: #fdf2e2;
  color: #8a5a12;
  border-top: 3px solid #e0a94e;
}
.res-table tbody tr.total-row td {
  background: #fff8ec;
}
@media (max-width: 1100px) {
  .cond-row { grid-template-columns: 160px repeat(12, minmax(0, 1fr)) 110px; }
}
.cond-del { border: none; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.cond-del:hover { color: var(--red); }
button.primary.small { padding: 6px 12px; font-size: 13px; }
.page-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0 16px; }
.mod-nav {
  display: flex;
  gap: 8px;
  padding: 10px 24px 0;
  flex-wrap: wrap;
}
.mod-tab {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: #eef3f8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mod-tab.active {
  background: #fff;
  color: var(--blue);
  border-color: var(--blue);
}
.view.hidden { display: none; }
.home-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.home-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.home-card {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 18px; background: #fff; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .15s, transform .05s, border-color .15s;
}
.home-card:hover {
  box-shadow: 0 6px 18px rgba(30, 92, 168, .12);
  border-color: var(--blue); transform: translateY(-1px);
}
.home-card-icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, #1e5ca8, #15457e);
  color: #fff; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.home-card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.home-card-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.report-pre {
  background: #f7fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 70vh;
  overflow: auto;
}
.status { margin-top: 10px; min-height: 22px; font-size: 13.5px; }
.status.err { color: var(--red); }
.status.ok { color: var(--green); }
.status.info { color: var(--blue); }
.perm-toast {
  position: fixed; top: 22px; left: 50%;
  transform: translate(-50%, -18px);
  background: rgba(21, 69, 126, .96); color: #fff;
  padding: 11px 24px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 26px rgba(8, 22, 38, .35);
  opacity: 0; pointer-events: none; z-index: 300;
  transition: opacity .22s ease, transform .22s ease;
  max-width: 86vw; text-align: center;
}
.perm-toast.show { opacity: 1; transform: translate(-50%, 0); }
.rec-note { color: var(--muted); font-size: 12px; margin-top: 10px; line-height: 1.6; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 30, 45, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 10px;
  width: min(880px, 94vw);
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .close { font-size: 20px; line-height: 1; padding: 2px 10px; }
.meta { color: var(--muted); font-size: 13px; padding: 8px 16px 0; }
.ocr-table-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 0;
  font-size: 13px;
}
.ocr-table-filter select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
.ocr-table-wrap { overflow: auto; padding: 10px 16px; flex: 1; }
.ocr-table tr.ocr-warn { background: #fff6e5; }
.ocr-table tr.ocr-warn:hover { background: #ffefd0; }
.ocr-table .warn-flag { color: #c07a2e; font-weight: 700; }
.ocr-correct {
  border-top: 1px solid var(--border);
  padding: 8px 16px 10px;
  background: #f5f7fa;
}
.ocr-correct-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #15457e;
  margin-bottom: 6px;
}
.ocr-correct-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.ocr-correct-row textarea {
  flex: 1;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12.5px;
}
.ocr-correct-row button {
  align-self: flex-end;
  white-space: nowrap;
}
.ocr-verify-result { padding: 4px 16px 12px; max-height: 220px; overflow: auto; }
.ocr-verify-result table.grid { font-size: 12.5px; }
.ocr-verify-result td.ok { color: #1a7f37; font-weight: 700; }
.ocr-verify-result td.bad { color: #b2402f; font-weight: 700; }
.mem-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #fff;
}
.mem-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.mem-title { font-weight: 600; font-size: 13px; color: #15457e; }
.mem-preview {
  font-size: 12px;
  color: #57687a;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mem-head-sig {
  font-size: 11px;
  color: #98a5b3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td { border: 1px solid var(--border); padding: 5px 8px; font-size: 13.5px; text-align: left; }
table.grid th { background: var(--blue-light); }
table.grid td.c { text-align: center; }
table.grid select, table.grid input {
  width: 100%; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font: inherit;
}
.raw { margin: 0 16px 8px; }
.raw summary { cursor: pointer; color: var(--blue); font-size: 13px; }
.raw pre { background: #f6f8fa; border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-size: 12px; max-height: 120px; overflow: auto; white-space: pre-wrap; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.modal-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.form-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form-row input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.lang-choose { display: flex; gap: 12px; margin: 8px 0; }
.lang-choose button { flex: 1; padding: 12px 10px; font-size: 15px; }
.history-tabs { display: flex; gap: 8px; padding: 10px 2px 2px; }
.history-tabs .hist-tab {
  border: 1px solid #c8ccd4; background: #f5f6f8; color: #444;
  padding: 5px 14px; border-radius: 14px; cursor: pointer; font-size: 13px;
}
.history-tabs .hist-tab:hover { background: #e9edf2; }
.history-tabs .hist-tab.active {
  background: #1e5ca8; border-color: #1e5ca8; color: #fff;
}
.history-list { max-height: 460px; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.history-count {
  font-size: 12.5px; color: var(--muted);
  padding: 2px 2px 0;
}
.history-item {
  display: flex; align-items: stretch; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 10px; background: #fff;
  transition: box-shadow .15s, border-color .15s;
}
.history-item:hover {
  box-shadow: 0 4px 14px rgba(30, 92, 168, .10);
  border-color: #c6d8e8;
}
.history-info { flex: 1; min-width: 0; }
.history-info { display: flex; flex-direction: column; gap: 5px; }
.history-name-txt {
  font-size: 13.5px; font-weight: 700; color: var(--text);
  padding: 3px 2px 0;
}
.history-name {
  width: 100%; box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid #d7e1ea; border-radius: 7px;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  background: #fbfdff;
}
.history-name:focus {
  border-color: var(--blue); background: #fff; outline: none;
  box-shadow: 0 0 0 3px rgba(30, 92, 168, .12);
}
.history-name::placeholder {
  color: #b7c0ca; font-weight: 400;
}
.history-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
}
.history-time { font-size: 12px; color: var(--muted); }
.history-summary {
  font-size: 12px; color: #4a5b6c;
  background: var(--blue-light);
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-ops {
  display: flex; flex-direction: column; justify-content: center;
  gap: 6px; flex-shrink: 0;
}
.history-ops .ghost { text-align: left; white-space: nowrap; }
.history-preview-ops {
  display: flex; gap: 8px; margin-top: 12px;
  justify-content: flex-end;
}
button.ghost.small.danger { color: #b2402f; border-color: #eec6bd; }
button.small { padding: 4px 10px; font-size: 12px; }
.about-box { width: min(720px, 94vw); }
.about-body { max-height: 72vh; overflow: auto; }
.about-title {
  font-size: 18px; font-weight: 700; color: var(--blue-dark);
  display: flex; align-items: center; gap: 10px;
}
.about-ver {
  font-size: 12.5px; color: var(--blue); font-weight: 600;
  background: var(--blue-light); padding: 2px 10px; border-radius: 999px;
}
.about-sub { font-size: 12.5px; color: var(--muted); margin: 4px 0 14px; }
.about-section h4 {
  margin: 14px 0 6px; font-size: 14px; color: var(--blue-dark);
  border-left: 3px solid var(--blue); padding-left: 8px;
}
.about-section p { margin: 0; font-size: 13px; line-height: 1.8; color: var(--text); }
.about-formula {
  background: #f5f7fa; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.9;
  overflow: auto; margin: 8px 0 0; white-space: pre-wrap;
}
.hp-box { width: min(980px, 96vw); }
.hp-body { overflow: auto; }
.hp-meta {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--muted);
  padding: 2px 2px 8px; border-bottom: 1px solid var(--border);
}
.hp-valve {
  font-size: 13px; color: var(--text);
  padding: 8px 2px 2px;
}
.hp-table {
  width: 100%; border-collapse: collapse; margin-top: 8px;
  font-size: 12.5px; border: 1px solid #dfe5ec;
}
.hp-table th, .hp-table td {
  border: 1px solid #dfe5ec; padding: 5px 7px;
  text-align: center; white-space: nowrap;
}
.hp-table th { background: #f5f7fa; font-weight: 600; color: #66707c; }
.hp-table td:first-child { text-align: left; }
/* 登录页：极光磨砂背景——深蓝渐变底 + 顶部双侧光晕 + 底部加深，
   强模糊保证主页内容不可辨认，观感更精致有层次 */
.login-modal {
  background:
    radial-gradient(900px 620px at 12% 6%, rgba(76, 140, 199, .30),
                    transparent 60%),
    radial-gradient(820px 560px at 90% 10%, rgba(30, 92, 168, .32),
                    transparent 62%),
    radial-gradient(1100px 760px at 50% 112%, rgba(14, 53, 96, .48),
                    transparent 66%),
    linear-gradient(160deg, #15457e 0%, #0e3560 52%, #0a2033 100%);
  -webkit-backdrop-filter: blur(22px) saturate(150%) brightness(.92);
  backdrop-filter: blur(22px) saturate(150%) brightness(.92);
}
.login-card {
  position: relative;
  width: min(400px, 92vw);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(8, 22, 38, .35);
}
.login-brand {
  background: #ffffff;
  color: #1b2633;
  padding: 26px 24px 22px;
  text-align: center;
}
.login-logo {
  width: 78px; height: 78px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 16px rgba(30, 92, 168, .28)); }
.login-brand h2 { font-size: 18px; margin: 0 0 4px; }
.login-brand p { font-size: 12px; opacity: .85; margin: 0; letter-spacing: .3px; }
.login-tabs { display: flex; }
.login-tab {
  flex: 1; padding: 13px 0; border: none; cursor: pointer;
  background: #eef3f8; font-size: 14px; font-weight: 600;
  color: #5a6b7a; transition: background .15s, color .15s;
}
.login-tab:hover { background: #e3ecf4; }
.login-tab.active {
  background: #fff; color: #15457e;
  box-shadow: inset 0 -2px 0 #1e5ca8;
}
.login-fields {
  padding: 22px 24px 4px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-fields label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: #5a6b7a;
}
.login-fields input {
  padding: 11px 12px; border: 1px solid #d7e1ea; border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-fields input:focus {
  border-color: #1e5ca8; box-shadow: 0 0 0 3px rgba(30, 92, 168, .15);
}
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 40px; box-sizing: border-box; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer; font-size: 16px;
  opacity: .65; padding: 4px;
}
.pw-toggle:hover { opacity: 1; }
.cap-row {
  display: flex; align-items: center; gap: 8px;
}
.cap-q {
  flex: 1; background: #e9eef4; border: 1px solid #dfe5ec;
  border-radius: 8px; padding: 10px 10px; font-size: 13.5px;
  color: #15457e; font-weight: 600; text-align: center;
}
#login-captcha-row {
  border: 1px dashed #c9d9e8; border-radius: 10px;
  padding: 10px 12px; background: #f5f7fa;
}
.login-error {
  min-height: 18px; margin: 10px 24px 0; font-size: 12.5px; color: var(--red);
}
.login-submit {
  margin: 12px 24px 8px; width: calc(100% - 48px); padding: 12px;
  border: none; border-radius: 8px; font-size: 15px; font-weight: 600;
  color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #15457e, #1e5ca8);
  transition: filter .15s, transform .05s;
}
.login-submit:hover {
  background: linear-gradient(135deg, #0e3560, #1e5ca8);
}
.login-submit:active { transform: translateY(1px); }
.login-tip {
  text-align: center; font-size: 12px; color: #8a919c;
  padding: 6px 24px 20px;
}
.login-copyright {
  text-align: center; font-size: 11px; color: #a4adb7;
  padding: 0 24px 16px; line-height: 1.6;
  border-top: 1px solid #e9eef4; margin: 0 24px;
}
.print-box { width: min(1180px, 96vw); }
.print-body { display: grid; grid-template-columns: 240px 1fr; gap: 12px; padding: 12px 16px; }
.print-list { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.pdf-select-list { max-height: 380px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.print-item { display: flex; align-items: center; gap: 6px; padding: 3px 4px; font-size: 12.5px; cursor: pointer; }
.print-item:hover { background: var(--blue-light); }
.print-group { margin: 8px 0 2px; }
.print-group-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; padding: 5px 6px; background: var(--blue-light); border-radius: 5px; cursor: pointer; user-select: none; }
.print-group-items { padding: 2px 0 2px 16px; margin-left: 9px; border-left: 1px solid var(--border); }
.print-preview-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 10px; background: #fff; }
.no-print { display: none !important; }
@media print {
  body * { visibility: hidden; }
  #print-preview, #print-preview * { visibility: visible; }
  #print-preview { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; }
}
.alias-box { width: min(720px, 94vw); }
.alias-body { display: grid; grid-template-columns: 220px 1fr; gap: 12px; padding: 10px 16px; flex: 1; min-height: 260px; }
.alias-left select, .alias-right select { width: 100%; font: inherit; }
.alias-edit { display: flex; gap: 6px; margin-top: 8px; }
.alias-edit input { flex: 1; }
.admin-users-wrap { max-height: 460px; overflow: auto; padding: 4px; }
.admin-users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-users-table th, .admin-users-table td {
  border: 1px solid var(--border); padding: 6px 8px; text-align: left;
}
.admin-users-table th { background: var(--blue-light); }
.admin-users-table select { font: inherit; padding: 2px 4px; }
.admin-users-table .ghost.small.danger { color: #b2402f; border-color: #eec6bd; }
.perms-box { width: min(560px, 94vw); }
.perms-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
  max-height: 380px; overflow: auto; padding: 4px;
}
.perm-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 13.5px; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 7px;
  cursor: pointer; background: #fff;
}
.perm-item:hover { background: var(--blue-light); }
.perm-item input { accent-color: var(--blue); }
.perm-key { margin-left: auto; font-size: 11px; color: var(--muted); }
button.dim { opacity: .45; cursor: not-allowed; }
.drop-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(30, 92, 168, .15);
  border: 3px dashed var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--blue); font-weight: 600;
}
.drop-overlay.hidden { display: none; }

/* =====================================================================
   v3.13 界面现代化升级：统一设计语言（与主页/登录页一致）
   ------------------------------------------------------------------ */
:root {
  --accent: #1e5ca8;
  --accent-2: #15457e;
  --grad-main: linear-gradient(135deg, #1e5ca8, #15457e);
  --grad-header: linear-gradient(100deg, #0e3560 0%, #15457e 48%, #1e5ca8 100%);
  --bg-page: url('/blueprint.svg');
  --shadow-sm: 0 1px 3px rgba(18, 45, 74, .08), 0 1px 2px rgba(18, 45, 74, .05);
  --shadow-md: 0 4px 14px rgba(18, 45, 74, .10), 0 2px 6px rgba(18, 45, 74, .06);
  --shadow-lg: 0 18px 50px rgba(8, 22, 38, .28);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body {
  background-color: #f1f4f8;
  background-image: var(--bg-page);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: #1b2633;
}

header {
  background: #ffffff;
  color: #1b2633;
  padding: 20px 26px 16px;
  border-bottom: 1px solid #dfe5ec;
  position: relative;
  z-index: 5;
}
header::before {
  content: "";
  align-self: center;
  width: 4px; height: 24px;
  background: var(--accent);
  flex: none;
}
header h1 { letter-spacing: .2px; color: #1b2633; }
header .sub { color: #66707c; }

.toolbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 0 rgba(18, 45, 74, .06);
}

main { gap: 18px; padding: 20px 24px 28px; }
.panel {
  border: 1px solid rgba(21, 69, 126, .10);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-md);
}
.panel h2 {
  color: var(--accent-2);
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}

.cond-card {
  border-radius: var(--radius-md);
  border-color: rgba(21, 69, 126, .10);
  box-shadow: var(--shadow-sm);
}
.cond-panel.active {
  box-shadow: inset 0 0 0 1px rgba(30, 92, 168, .55), var(--shadow-sm);
}

.cond-tabs { gap: 6px; }
.cond-tab {
  border-radius: 999px;
  border-color: #c9d3dd;
  background: #fff;
  color: #35414f;
  transition: all .18s;
}
.cond-tab:hover { border-color: var(--accent); color: var(--accent); background: #fff; }
.cond-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px -1px rgba(30, 92, 168, .30);
}

.mod-tab {
  border-radius: 10px 10px 0 0;
  border-color: #c9d3dd;
  border-bottom: none;
  background: #e9eef4;
  color: #35414f;
  transition: all .18s;
}
.mod-tab:hover { background: #fff; color: var(--accent); }
.mod-tab.active {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 2px 0 var(--accent);
}

button {
  border-radius: var(--radius-sm);
  border-color: #c9d3dd;
  color: #24425f;
  transition: all .16s ease;
}
button:hover { background: #eef5fc; border-color: #bcd4e8; }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 6px -1px rgba(30, 92, 168, .30);
}
button.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
button.ghost:hover { background: #f0f6fc; }

input[type="text"], input[type="number"], input[type="password"],
input[type="email"], select, textarea {
  border: 1px solid #d3dfe9;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #1e2a38;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 92, 168, .15);
}

.grid thead th, .res-table thead th, table.hp-table thead th,
#ocr-table thead th, .admin-users-table thead th {
  background: #e9eef4;
  color: #35414f;
  border-bottom: 1px solid #dfe5ec;
  font-weight: 600;
}
.grid tbody tr:nth-child(even),
.res-table tbody tr:nth-child(even),
#ocr-table tbody tr:nth-child(even) {
  background: #f5f7fa;
}
.grid tbody tr:hover,
.res-table tbody tr:hover,
#ocr-table tbody tr:hover {
  background: #e6eef7;
}

.modal { backdrop-filter: blur(4px); }
.modal-box, .tool-modal-box {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in .22s ease;
  overflow: hidden;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  background: #ffffff;
  color: #1b2633;
}
.modal-head h3 { color: #1b2633; }
.modal-head .close {
  color: #66707c;
  border-radius: 8px;
  background: transparent;
  border: none;
}
.modal-head .close:hover { background: #e9eef4; color: #1b2633; }

.history-item {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all .16s;
}
.history-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: #bcd4e8;
}

.cond-group {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.cond-head { background: transparent; }
.cond-head b { color: #1b2633; }

.status { padding: 2px 4px; }
.status.ok { color: #2e7d59; }
.status.err { color: #b2402f; }

.page-footer {
  color: #7c8ba0;
  border-top: 1px solid rgba(21, 69, 126, .08);
  background: rgba(255,255,255,.5);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c3d2e2;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #9db6cd; background-clip: content-box; }

.panel { animation: panel-in .3s ease; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   风格库：html[data-theme] 切换主题（theme.js 读取 localStorage）
   ------------------------------------------------------------------ */
html[data-theme="green"] {
  --blue: #2e8b57; --blue-dark: #14532d; --blue-light: #e8f5ee;
  --accent: #2e8b57; --accent-2: #14532d;
  --grad-main: linear-gradient(135deg, #34a06b, #14532d);
  --grad-header: linear-gradient(100deg, #0d3326 0%, #17603f 50%, #2e8b57 100%);
  --bg-page:
    radial-gradient(1200px 500px at 85% -10%, rgba(46, 139, 87, .10), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(20, 83, 45, .08), transparent 55%),
    linear-gradient(180deg, #f5faf7 0%, #ecf4ef 100%);
}
html[data-theme="gold"] {
  --blue: #b97a15; --blue-dark: #7a4d0e; --blue-light: #faf3e3;
  --accent: #b97a15; --accent-2: #7a4d0e;
  --grad-main: linear-gradient(135deg, #d99a2b, #8a5a12);
  --grad-header: linear-gradient(100deg, #5a3b0e 0%, #8a5a12 50%, #b97a15 100%);
  --bg-page:
    radial-gradient(1200px 500px at 85% -10%, rgba(185, 122, 21, .10), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(122, 77, 14, .07), transparent 55%),
    linear-gradient(180deg, #fbf7ef 0%, #f5efe2 100%);
}
html[data-theme="dark"] {
  --blue: #4d9fd8; --blue-dark: #7cc0ea; --blue-light: #142c40;
  --border: #2b3a4c;
  --text: #dbe4ee; --muted: #8fa3b8;
  --red: #e47a70; --green: #58c08b;
  --accent: #4d9fd8; --accent-2: #9ecbed;
  --grad-main: linear-gradient(135deg, #1f5c8a, #0d2b45);
  --grad-header: linear-gradient(100deg, #081420 0%, #12293f 50%, #1c4468 100%);
  --bg-page:
    radial-gradient(1200px 500px at 85% -10%, rgba(77, 159, 216, .08), transparent 60%),
    linear-gradient(180deg, #0f1a26 0%, #0a1119 100%);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .30);
}
html[data-theme="dark"] body { color: var(--text); }
html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .cond-card,
html[data-theme="dark"] .cond-group,
html[data-theme="dark"] .modal-box,
html[data-theme="dark"] .tool-modal-box,
html[data-theme="dark"] .history-item {
  background: #131f2d;
  border-color: var(--border);
}
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0d1621;
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="dark"] .grid thead th,
html[data-theme="dark"] .res-table thead th,
html[data-theme="dark"] #ocr-table thead th {
  background: linear-gradient(180deg, #1a2838, #14202e);
  color: #c6d4e2;
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .grid tbody tr:nth-child(even),
html[data-theme="dark"] .res-table tbody tr:nth-child(even),
html[data-theme="dark"] #ocr-table tbody tr:nth-child(even) {
  background: #16222f;
}
html[data-theme="dark"] .grid tbody tr:hover,
html[data-theme="dark"] .res-table tbody tr:hover,
html[data-theme="dark"] #ocr-table tbody tr:hover {
  background: #1b2c3d;
}
html[data-theme="dark"] .cond-head {
  background: linear-gradient(120deg, #1a2a3a, #16222f);
}
html[data-theme="dark"] .cond-tab {
  background: #1c2a39;
  color: #b7c8da;
}
html[data-theme="dark"] .status,
html[data-theme="dark"] .page-footer { color: var(--muted); }
html[data-theme="dark"] .page-footer { background: rgba(0,0,0,.25); }
html[data-theme="dark"] header {
  background: var(--grad-header);
  color: #dbe4ee;
  border-bottom-color: #2b3a4c;
}
html[data-theme="dark"] header h1 { color: #dbe4ee; }
html[data-theme="dark"] header .sub { color: #8fa3b8; }
html[data-theme="dark"] .modal-head {
  background: #131f2d;
  color: var(--text);
  border-bottom-color: #2b3a4c;
}
html[data-theme="dark"] .modal-head h3 { color: var(--text); }
html[data-theme="dark"] .modal-head .close { color: var(--muted); }
html[data-theme="dark"] .modal-head .close:hover { background: #1c2a39; color: var(--text); }
html[data-theme="dark"] .mod-tab.active {
  background: #1c2a39;
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 2px 0 var(--accent);
}
html[data-theme="dark"] button.primary {
  background: #1f5c8a;
  border-color: #1f5c8a;
}
html[data-theme="dark"] button.primary:hover { background: #256c9e; border-color: #256c9e; }

/* 风格选择器（白底浅色：登录卡片 / 首页顶栏共用） */
.theme-sel {
  border: 1px solid #c9d3dd;
  background: #fff;
  color: #1e5ca8;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  outline: none;
  font-weight: 600;
}
.theme-sel:hover { border-color: #1e5ca8; background: #eef5fc; }
.theme-sel option { color: #1b2633; background: #fff; }

/* =====================================================================
   Logo 涟漪悬停动效（双环明暗起伏，模拟真实水波）
   ------------------------------------------------------------------ */
.w-ripple { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; }
.w-hi  { stroke-opacity: 1; }
.w-lo  { stroke-opacity: .55; }
.home-logo:hover .w-ripple-a,
.login-logo:hover .w-ripple-a { animation: w-ripple 2.4s cubic-bezier(.22,.61,.36,1) infinite; }
.home-logo:hover .w-ripple-b,
.login-logo:hover .w-ripple-b { animation: w-ripple 2.4s cubic-bezier(.22,.61,.36,1) .6s infinite; }
.home-logo:hover .w-ripple-c,
.login-logo:hover .w-ripple-c { animation: w-ripple 2.4s cubic-bezier(.22,.61,.36,1) 1.2s infinite; }
.home-logo:hover .w-ripple-d,
.login-logo:hover .w-ripple-d { animation: w-ripple 2.4s cubic-bezier(.22,.61,.36,1) 1.8s infinite; }
@keyframes w-ripple {
  0%   { opacity: 0; transform: scale(.22); }
  6%   { opacity: .5; }
  45%  { opacity: .16; }
  100% { opacity: 0; transform: scale(5.5); }
}
