:root {
  --navy: #0b2239;
  --navy-2: #10314f;
  --navy-3: #17405f;
  --blue: #1668dc;
  --blue-dark: #1154b8;
  --blue-soft: #e9f2fe;
  --bg: #eef2f7;
  --card: #ffffff;
  --line: #dfe6ef;
  --line-soft: #edf1f6;
  --text: #1e2c3c;
  --text-2: #46596f;
  --muted: #77899e;
  --green: #0f8a4d;
  --green-soft: #e6f6ed;
  --amber: #b06a00;
  --amber-soft: #fdf3e2;
  --red: #c9362a;
  --red-soft: #fdecea;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(15, 43, 74, 0.06), 0 1px 8px rgba(15, 43, 74, 0.04);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }

/* ---------------- 布局 ---------------- */

.app {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #c9d8e8;
  display: flex;
  flex-direction: column;
  padding: 0 0 14px;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2f7fe0, #1b5ab5);
  color: #fff;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #f2f7fc; font-size: 15px; letter-spacing: 0.6px; }
.brand-text span { font-size: 9px; letter-spacing: 1.2px; color: #7f9ab8; margin-top: 3px; }

.nav-group-label {
  padding: 16px 20px 6px;
  font-size: 10.5px;
  letter-spacing: 1px;
  color: #6d89a6;
}

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 13px;
  color: #b9cbdd;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.nav-item svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: rgba(46, 128, 226, 0.18);
  color: #ffffff;
  border-left-color: #4c9df5;
  font-weight: 500;
}
.nav-item.active svg { opacity: 1; }

.side-foot { margin-top: auto; padding: 12px 16px 0; }
.side-stat {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.side-stat div { display: flex; flex-direction: column; gap: 3px; }
.side-stat span { font-size: 10.5px; color: #8ba6c1; }
.side-stat b { font-family: var(--mono); font-size: 15px; color: #eaf3fc; font-weight: 600; }
.side-ver { margin-top: 10px; font-size: 10.5px; color: #6d89a6; text-align: center; letter-spacing: 0.4px; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(160%) blur(6px);
  border-bottom: 1px solid var(--line);
}
.crumb { font-size: 13px; color: var(--muted); flex: 1; }
.crumb b { color: var(--text); font-weight: 500; }
.top-right { display: flex; align-items: center; gap: 14px; }
.today { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfe;
  font-size: 12px;
}
.avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dbe9fb;
  color: #17549b;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.user-dept { color: var(--muted); font-size: 11.5px; }

.view { padding: 18px 22px 46px; max-width: 1680px; width: 100%; }

/* ---------------- 通用组件 ---------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.page-title { font-size: 19px; letter-spacing: 0.2px; }
.page-sub { margin-top: 5px; font-size: 12px; color: var(--muted); }
.page-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);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: #fcfdfe;
  flex-wrap: wrap;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #233a52;
}
.card-title::before {
  content: "";
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--blue);
}
.card-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 14px 16px; }
.card-body.tight { padding: 0; }

.btn {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: #f6f9fc; border-color: #c4d1e0; }
.btn:active { background: #eef3f9; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-ghost:hover { background: var(--blue-soft); border-color: transparent; }
.btn-danger { color: var(--red); border-color: #f0cbc6; background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: #e4b1ab; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #ad2c22; border-color: #ad2c22; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-icon { width: 26px; height: 26px; padding: 0; }
.btn-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-2);
}
.icon-btn:hover { background: #f1f5fa; }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1;
  background: #f1f4f8;
  color: var(--text-2);
  white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill.shipped { background: var(--green-soft); color: var(--green); }
.pill.pending { background: var(--amber-soft); color: var(--amber); }
.pill.base { background: var(--blue-soft); color: #17549b; }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f4f8;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ---------------- 表格 ---------------- */

.tbl-wrap { width: 100%; overflow: auto; }
.tbl-wrap.scroll-y { max-height: calc(100vh - 268px); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf2f8;
  color: #3d5270;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #d9e2ed;
  white-space: nowrap;
  font-size: 12px;
}
.tbl thead th.num { text-align: right; }
.tbl tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: #2b3d51;
  white-space: nowrap;
  vertical-align: middle;
}
.tbl tbody tr:hover { background: #f6f9fd; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.selected { background: var(--blue-soft); }
.tbl tfoot td {
  padding: 8px 10px;
  background: #f8fafc;
  border-top: 1px solid #d9e2ed;
  font-weight: 600;
  color: #21374d;
  white-space: nowrap;
}
.tbl .empty-row td { text-align: center; color: #9aa9ba; padding: 26px 10px; }
.tbl tr.base-row td { background: #eaf2fe; color: #12467f; font-weight: 600; }
.tbl tr.base-row:hover td { background: #e2edfd; }
.tbl .strong { font-weight: 600; color: #16283c; }
.tbl .link { color: var(--blue); }
.tbl .link:hover { text-decoration: underline; }
.tbl .row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0.78; transition: opacity 0.12s; }
.tbl tbody tr:hover .row-actions { opacity: 1; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--blue); }
th.sortable .arrow { display: inline-block; margin-left: 4px; color: #a9b8c9; font-size: 9px; }
th.sortable.sorted .arrow { color: var(--blue); }

/* ---------------- 筛选与分页 ---------------- */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line-soft);
  align-items: end;
}
.filters .field label { font-size: 11.5px; }
.filters .filter-actions { display: flex; gap: 8px; align-self: end; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--line-soft);
  background: #fdfefe;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pager .pages { display: flex; gap: 4px; align-items: center; }
.pager button {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  font-family: inherit;
}
.pager button:hover:not(:disabled) { border-color: #b9c9db; color: var(--blue); }
.pager button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------- 表单 ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; color: #5c6f85; display: flex; align-items: center; gap: 3px; }
.field .req { color: var(--red); }
.field .help { font-size: 11px; color: #94a4b6; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.field.span-4 { grid-column: span 4; }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid #d3dce7;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea {
  height: auto;
  min-height: 74px;
  padding: 7px 9px;
  line-height: 1.55;
  resize: vertical;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #7c8b9c 50%), linear-gradient(135deg, #7c8b9c 50%, transparent 50%); background-position: calc(100% - 13px) 14px, calc(100% - 8px) 14px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 24px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 104, 220, 0.12);
}
input::placeholder, textarea::placeholder { color: #a9b6c5; }
input:disabled, select:disabled { background: #f6f8fa; color: #7a8a9c; }
input[readonly] { background: #f8fafc; }

.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); background: #fff9f8; }
.field .err-msg { font-size: 11px; color: var(--red); }

.port-field { display: flex; gap: 6px; }
.port-field .port-code { flex: 0 0 78px; width: 78px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.4px; }
.port-field .port-name { flex: 1 1 auto; min-width: 0; }

/* ---------------- Tab ---------------- */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 10px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  padding: 11px 17px;
  font-size: 13px;
  color: #5b6e84;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  white-space: nowrap;
}
.tab:hover { color: var(--blue); }
.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: #fff;
  font-weight: 600;
}
.tab-pane { display: none; padding: 16px; }
.tab-pane.active { display: block; }

/* ---------------- 详情信息网格 ---------------- */

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.info-cell {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  min-width: 0;
}
.info-cell .k {
  padding: 7px 9px;
  background: #f8fafc;
  color: #63758a;
  border-right: 1px solid var(--line-soft);
}
.info-cell .v {
  padding: 7px 9px;
  color: #1d2f43;
  overflow-wrap: anywhere;
  min-width: 0;
}
.info-cell .v.mono { font-family: var(--mono); }
.info-cell.hl .v { color: #0f4c9a; font-weight: 600; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 14px; align-items: start; }

/* ---------------- KPI ---------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(174px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  position: relative;
  padding: 14px 16px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(22, 104, 220, 0.05);
}
.kpi .k-label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { margin-top: 7px; font-size: 22px; font-weight: 600; letter-spacing: -0.3px; font-family: var(--mono); color: #16293d; }
.kpi .k-value small { font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 400; }
.kpi .k-foot { margin-top: 5px; font-size: 11px; color: #93a2b4; }
.kpi.accent { background: linear-gradient(150deg, #0f2f52 0%, #17456f 100%); border-color: #17456f; }
.kpi.accent .k-label { color: #a9c2da; }
.kpi.accent .k-value { color: #fff; }
.kpi.accent .k-foot { color: #8fabc6; }
.kpi.accent::after { background: rgba(255, 255, 255, 0.06); }

/* ---------------- 费用表 ---------------- */

.fee-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line-soft);
}
.fee-head .t { font-size: 12.5px; font-weight: 600; color: #24384e; display: flex; align-items: center; gap: 7px; }
.fee-head .t .cnt { font-size: 11px; font-weight: 400; color: var(--muted); }
.fee-total { display: flex; gap: 16px; align-items: baseline; padding: 9px 14px; background: #fbfcfe; border-top: 1px solid var(--line-soft); font-size: 12px; }
.fee-total .lab { color: var(--muted); }
.fee-total .val { font-family: var(--mono); font-weight: 600; color: #123c69; font-size: 14px; }



/* 左固定关键列（横向滚动时保留委托人与工作号上下文） */
.tbl th.col-customer, .tbl td.col-customer {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  min-width: 132px;
}
.tbl th.col-job, .tbl td.col-job {
  position: sticky;
  left: 132px;
  z-index: 3;
  background: #fff;
  min-width: 196px;
  box-shadow: 8px 0 10px -10px rgba(15, 43, 74, 0.45);
}
.tbl thead th.col-customer, .tbl thead th.col-job { background: #edf2f8; z-index: 4; }
.tbl tbody tr:hover td.col-customer, .tbl tbody tr:hover td.col-job { background: #f6f9fd; }

/* 固定操作列（宽表横向滚动时保持可见） */
.tbl-wrap { scrollbar-width: thin; }

@media (max-width: 1560px) {
  .split.fees { grid-template-columns: 1fr; }
}

/* ---------------- 空状态 / 加载 ---------------- */

.empty {
  padding: 34px 16px;
  text-align: center;
  color: #9aa9ba;
  font-size: 12.5px;
  line-height: 1.9;
}
.empty b { display: block; color: #6b7d92; font-size: 13px; font-weight: 500; }

.skeleton { padding: 20px; }
.skeleton .bar {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite linear;
  margin-bottom: 10px;
}
.skeleton .bar:nth-child(1) { width: 38%; }
.skeleton .bar:nth-child(2) { width: 92%; }
.skeleton .bar:nth-child(3) { width: 76%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------------- Toast ---------------- */

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  min-width: 200px;
  max-width: 380px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #16324e;
  color: #ecf4fc;
  font-size: 12.5px;
  box-shadow: 0 8px 26px rgba(11, 34, 57, 0.28);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.18s ease-out;
}
.toast::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #4c9df5; }
.toast.success::before { background: #3ddc84; }
.toast.error::before { background: #ff7a6e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- Modal ---------------- */

.modal {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(9, 30, 51, 0.3);
  color: var(--text);
  overflow: hidden;
}
.modal::backdrop { background: rgba(11, 30, 50, 0.42); backdrop-filter: blur(2px); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfcfe;
}
.modal-head h3 { font-size: 14px; }
.modal-body { padding: 16px 18px; overflow: auto; max-height: calc(100vh - 230px); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  background: #fbfcfe;
}
.modal .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal .field.span-2 { grid-column: span 2; }
.confirm-text { font-size: 13px; line-height: 1.7; color: var(--text-2); }

/* ---------------- 其它 ---------------- */

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  background: linear-gradient(90deg, #eaf2fe, #f6faff);
  border: 1px solid #d5e5fa;
  font-size: 12px;
  color: #2a5488;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.banner b { color: #0f4c9a; }
.banner .btn { background: #fff; }
.banner .spacer { flex: 1; }

.bar-list { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 58px 1fr 92px; gap: 10px; align-items: center; font-size: 12px; }
.bar-track { height: 8px; border-radius: 4px; background: #eef2f7; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2f7fe0, #6cb0f7); }
.bar-fill.neg { background: linear-gradient(90deg, #d45543, #e88c7d); }
.bar-val { text-align: right; font-family: var(--mono); font-size: 12px; color: #2a3f56; }

.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-2);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.quick-action:hover { border-color: #b9cde5; box-shadow: 0 2px 10px rgba(15, 43, 74, 0.07); }
.quick-action .qa-ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--blue-soft); color: #17549b; font-family: var(--mono); font-size: 12px; font-weight: 700;
}
.quick-action small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.ref-layout { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 14px; align-items: start; }
.ref-menu { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 70px; }
.ref-menu button {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 14px; border: none; background: none; border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--text-2); cursor: pointer; font-family: inherit; text-align: left;
}
.ref-menu button:last-child { border-bottom: none; }
.ref-menu button:hover { background: #f6f9fd; }
.ref-menu button.active { background: var(--blue-soft); color: #12467f; font-weight: 600; box-shadow: inset 3px 0 0 var(--blue); }
.ref-menu .cnt { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(4px);
  z-index: 5;
}
.form-foot-note { margin-right: auto; font-size: 11.5px; color: var(--muted); align-self: center; }

.only-narrow { display: none; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1240px) {
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .split { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 236px;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 0 0 40px rgba(8, 25, 42, 0.4);
  }
  .sidebar.open { transform: none; }
  .only-narrow { display: grid; }
  .view { padding: 14px 14px 40px; }
  .topbar { padding: 0 12px; }
  .today, .user-dept { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2, .field.span-3, .field.span-4 { grid-column: span 1; }
  .info-grid { grid-template-columns: 1fr; }
  .ref-layout { grid-template-columns: 1fr; }
  .ref-menu { position: static; display: flex; overflow-x: auto; }
  .ref-menu button { border-bottom: none; border-right: 1px solid var(--line-soft); white-space: nowrap; }
  .tbl-wrap.scroll-y { max-height: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- 打印 ---------------- */

@media print {
  .sidebar, .topbar, .page-actions, .no-print, .toast-root, .tabs { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; }
  .view { padding: 0; }
  .card { box-shadow: none; border-color: #bbb; page-break-inside: avoid; }
  .split { grid-template-columns: 1fr 1fr; }
}

/* ---------------- 登录页 ---------------- */

.login-body { background: #eef2f7; }
.login-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.login-brand {
  position: relative;
  overflow: hidden;
  padding: 46px 54px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #0a1f35 0%, #12395c 58%, #17456f 100%);
  color: #dbe8f5;
}
.login-brand::after {
  content: "";
  position: absolute;
  right: -150px;
  bottom: -170px;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 157, 245, 0.3), transparent 66%);
}
.login-brand-top { display: flex; align-items: center; gap: 12px; }
.brand-mark.lg { width: 46px; height: 46px; border-radius: 12px; font-size: 16px; }
.login-brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.6px;
}
.login-brand-name span { margin-top: 4px; font-size: 9px; letter-spacing: 1.4px; color: #7f9ab8; font-weight: 400; }

.login-brand-main { margin: auto 0; max-width: 460px; }
.login-brand-main h1 { font-size: 32px; line-height: 1.35; color: #fff; letter-spacing: 1px; }
.login-brand-main p { margin-top: 14px; font-size: 13.5px; line-height: 1.95; color: #a9c2da; }
.login-points { margin: 26px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.login-points li { position: relative; padding-left: 16px; font-size: 12.5px; line-height: 1.7; color: #bdd2e6; }
.login-points li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 2px; background: #4c9df5; }
.login-points b { margin-right: 6px; color: #fff; font-weight: 600; }
.login-brand-foot { font-size: 11px; letter-spacing: 0.5px; color: #7f9ab8; }

.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: #f7f9fc; }
.login-card {
  width: min(392px, 100%);
  padding: 28px 28px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 43, 74, 0.1);
}
.login-card h2 { font-size: 19px; }
.login-sub { margin-top: 7px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.login-card .field { margin-top: 16px; }
.login-card .field label { font-size: 12px; }
.login-card input { height: 38px; font-size: 13.5px; }
.login-btn { width: 100%; height: 40px; margin-top: 20px; font-size: 14px; letter-spacing: 1px; }
.login-error {
  margin-top: 14px;
  padding: 9px 11px;
  border: 1px solid #f3c7c1;
  border-radius: 7px;
  background: var(--red-soft);
  color: #a5281d;
  font-size: 12.5px;
}
.login-tip { margin-top: 18px; font-size: 11.5px; line-height: 1.9; color: #8394a8; }
.login-tip code { padding: 1px 5px; border-radius: 4px; background: #f1f5fa; color: #3c5a7a; font-family: var(--mono); }
.login-copy { margin-top: 18px; font-size: 11px; color: #9aa9ba; }

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; align-content: start; }
  .login-brand { padding: 26px 22px 30px; }
  .login-brand-main { margin: 18px 0 4px; }
  .login-brand-main h1 { font-size: 22px; }
  .login-brand-main p { margin-top: 10px; font-size: 12.5px; }
  .login-points { display: none; }
  .login-brand-foot { display: none; }
  .login-panel { padding: 26px 18px 40px; }
}

/* ---------------- 登录用户 / 审计 ---------------- */

.user-menu { display: flex; align-items: center; gap: 8px; }
.user-menu .btn { height: 27px; padding: 0 9px; font-size: 12px; }

.cell-ellipsis { display: inline-block; max-width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.cell-sub { margin-top: 3px; font-size: 10.5px; color: #93a2b4; font-family: var(--mono); white-space: nowrap; }
.audit-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 9px 16px;
  border-top: 1px dashed var(--line);
  background: #fbfcfe;
  font-size: 11.5px;
  color: #7b8ca0;
}
.audit-line b { color: #4d6074; font-weight: 600; }

.role-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #eef4fd; color: #17549b; font-size: 10.5px; }

/* 强制改密拦截层（不可关闭） */
body.gate-open { overflow: hidden; }
.pwd-gate {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 28, 47, 0.55);
  backdrop-filter: blur(3px);
}
.pwd-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(9, 30, 51, 0.35);
  overflow: hidden;
}
.pwd-tip { margin-bottom: 14px; font-size: 12.5px; line-height: 1.8; color: #5b6d82; }
