:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e5e7eb;
  --line-strong: #d5d8de;
  --text: #14181f;
  --text-2: #4b5563;
  --muted: #8b93a1;
  --brand: #2f6df6;
  --brand-600: #1f57d8;
  --brand-soft: #eef3ff;
  --danger: #dc2f45;
  --danger-soft: #fdeef0;
  --ok: #12945a;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.16);
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------- 顶栏 ------------------------------- */
.topbar {
  height: 62px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #3b7bff, #2154d8);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(47, 109, 246, 0.28);
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-text h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }
.brand-text p { margin: 1px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.db-pill {
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; color: var(--text-2);
}
.db-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 148, 90, 0.12); }
.db-pill .sep { width: 1px; height: 12px; background: var(--line-strong); }
.db-pill .mono { color: var(--text); font-size: 12px; }

/* ------------------------------- 页面 ------------------------------- */
.page { padding: 20px 22px 40px; max-width: 1680px; margin: 0 auto; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand);
  opacity: 0;
  transition: opacity 0.2s;
}
.stat:hover::after { opacity: 1; }
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: 0.3px; }
.stat-value { font-size: 25px; font-weight: 600; margin-top: 6px; letter-spacing: -0.5px; }
.stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ------------------------------- 工具栏 ------------------------------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.spacer { flex: 1; }

.search {
  position: relative; display: flex; align-items: center;
  width: 288px;
}
.search svg {
  position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.search input {
  width: 100%; height: 34px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12); }
.search input::placeholder { color: #a8aebb; }

.select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  max-width: 170px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12); }
.select-sm { height: 30px; font-size: 12px; }

.daterange { display: flex; align-items: center; gap: 5px; }
.daterange input[type="date"] { width: 142px; font-size: 12.5px; }
.tilde { color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px; font-family: inherit; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.06s;
  white-space: nowrap;
  background: none;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(0.5px); }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(47,109,246,.3); }
.btn-primary:hover { background: var(--brand-600); }

.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: #c2c7d1; color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c02438; }

.btn-danger-ghost { background: var(--danger-soft); color: var(--danger); border-color: #f6ccd3; }
.btn-danger-ghost:hover { background: #fbe0e4; }

.btn-text { color: var(--muted); }
.btn-text:hover { color: var(--text); background: var(--surface-2); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: none; background: none; cursor: pointer;
  border-radius: 8px; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* 下拉 */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow-md);
  padding: 5px;
  display: none;
  z-index: 50;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border: none; background: none;
  font-size: 13px; font-family: inherit; color: var(--text-2);
  border-radius: 7px; cursor: pointer;
}
.dropdown-menu button:hover { background: var(--surface-2); color: var(--text); }
.menu-note { font-size: 11px; color: var(--muted); padding: 6px 10px 3px; border-top: 1px solid var(--line); margin-top: 4px; }

/* ------------------------------- 批量条 ------------------------------- */
.bulkbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  height: 0; padding: 0 16px; overflow: hidden;
  background: var(--brand-soft);
  border-bottom: 1px solid transparent;
  transition: height 0.18s ease, padding 0.18s ease;
}
.bulkbar.active { height: 46px; border-bottom-color: #dbe5ff; }
.bulk-info { font-size: 13px; color: #1c3fa8; }
.bulk-info b { font-family: var(--mono); }
.bulk-actions { display: flex; gap: 8px; }
.bulkbar .btn-sm { background: var(--surface); border: 1px solid #cddafc; color: #1c3fa8; }
.bulkbar .btn-sm:hover { background: #fff; border-color: #a9c0fa; }
.bulkbar .btn-danger-ghost { color: var(--danger); border-color: #f3c6ce; background: #fff; }
.bulkbar .btn-text { border-color: transparent; background: transparent; }

/* ------------------------------- 表格 ------------------------------- */
.table-wrap { position: relative; overflow: auto; max-height: calc(100vh - 330px); min-height: 320px; }

.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  white-space: nowrap;
}

.grid thead th {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-weight: 500;
  font-size: 12px;
  text-align: left;
  padding: 0 12px;
  height: 38px;
  letter-spacing: 0.2px;
  user-select: none;
}
.grid thead th.sortable { cursor: pointer; }
.grid thead th.sortable:hover { color: var(--text); background: #f2f4f7; }
.grid thead th .sort-ind { margin-left: 3px; font-size: 9px; color: #c0c5cf; }
.grid thead th.sorted .sort-ind { color: var(--brand); }

.grid tbody td {
  padding: 0 12px;
  height: 42px;
  border-bottom: 1px solid #f1f2f5;
  color: var(--text);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid tbody tr:hover td { background: #f8fafd; }
.grid tbody tr.selected td { background: #eef4ff; }

/* 粘性列 */
.col-check { position: sticky; left: 0; z-index: 12; width: 44px; min-width: 44px; padding-left: 14px !important; }
.col-waybill { position: sticky; left: 44px; z-index: 12; }
.grid thead .col-check, .grid thead .col-waybill { z-index: 20; }
.grid tbody .col-check, .grid tbody .col-waybill { background: inherit; }

.grid tbody tr:hover .col-check, .grid tbody tr:hover .col-waybill { background: #f8fafd; }
.grid tbody tr.selected .col-check, .grid tbody tr.selected .col-waybill { background: #eef4ff; }
.grid tbody td.col-check, .grid tbody td.col-waybill { background: var(--surface); }

.col-actions {
  position: sticky; right: 0; z-index: 12;
  width: 108px; min-width: 108px;
  background: var(--surface);
  box-shadow: -8px 0 12px -10px rgba(16, 24, 40, 0.25);
}
.grid thead .col-actions { z-index: 20; }
.grid tbody tr:hover .col-actions { background: #f8fafd; }
.grid tbody tr.selected .col-actions { background: #eef4ff; }

.cell-empty { color: #c3c8d2; }
.cell-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  background: #f1f3f7;
  color: var(--text-2);
  border: 1px solid #e8eaef;
}
.badge-blue { background: var(--brand-soft); color: #2350b8; border-color: #dde7ff; }

.row-actions { display: flex; gap: 2px; opacity: 0.5; transition: opacity 0.12s; }
.grid tbody tr:hover .row-actions { opacity: 1; }
.link-btn {
  border: none; background: none; cursor: pointer;
  font-size: 12.5px; color: var(--brand); padding: 4px 6px; border-radius: 6px; font-family: inherit;
}
.link-btn:hover { background: var(--brand-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-soft); }

input[type="checkbox"] {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--brand);
  vertical-align: middle;
}

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 70px 0; color: var(--muted); gap: 4px;
}
.empty svg { width: 42px; height: 42px; color: #cfd4dd; margin-bottom: 6px; }
.empty p { margin: 0; font-size: 14px; color: var(--text-2); }
.empty span { font-size: 12.5px; }

.loading {
  position: absolute; inset: 0;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(1px);
  display: grid; place-items: center;
  z-index: 25;
}
.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid #e3e7ef;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------- 分页 ------------------------------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-info b { color: var(--text-2); font-family: var(--mono); }
.pager-controls { display: flex; align-items: center; gap: 6px; }
.pg-btn {
  min-width: 30px; height: 30px;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 8px; cursor: pointer; color: var(--text-2);
  font-size: 14px; font-family: inherit;
}
.pg-btn:hover:not(:disabled) { background: var(--surface-2); border-color: #c2c7d1; }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-pages { display: flex; gap: 4px; }
.pg-pages button {
  min-width: 30px; height: 30px; padding: 0 6px;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 8px; cursor: pointer; color: var(--text-2);
  font-size: 12.5px; font-family: var(--mono);
}
.pg-pages button:hover { background: var(--surface-2); }
.pg-pages button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pg-pages .dots { min-width: 22px; text-align: center; color: var(--muted); font-size: 12px; line-height: 30px; }

/* ------------------------------- 抽屉 ------------------------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 60;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 520px; max-width: 94vw;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(101%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 70;
  display: flex; flex-direction: column;
}
.drawer.show { transform: none; }

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 15.5px; font-weight: 600; }
.drawer-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.drawer-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 13px 12px;
  align-content: start;
}
.field { display: flex; flex-direction: column; gap: 5px; align-self: start; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 3px; min-height: 16px; line-height: 16px; }
.field label .req { color: var(--danger); }
.field label .type { color: #c2c7d1; font-size: 9.5px; font-family: var(--mono); margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field input {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  font-size: 13px; font-family: inherit; color: var(--text);
  outline: none; background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field .hint { font-size: 11px; color: var(--muted); }

.drawer-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* ------------------------------- 弹窗 ------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.36);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px;
  max-height: 86vh;
  overflow: auto;
  transform: translateY(8px) scale(0.99);
  transition: transform 0.2s;
}
.modal.show .modal-card { transform: none; }
.modal-card.wide { max-width: 780px; }

.modal-head { padding: 18px 20px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-head p { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.modal-body { padding: 4px 20px 18px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}

.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-row label { font-size: 12px; color: var(--text-2); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  font-size: 13px; font-family: inherit; color: var(--text);
  outline: none; background: var(--surface);
}
.form-row textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

/* API 文档 */
.api-doc h4 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.api-doc h4:first-child { margin-top: 0; }
.api-doc p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.api-doc code { font-family: var(--mono); font-size: 11.5px; background: #f3f4f7; padding: 1.5px 5px; border-radius: 5px; color: #b3324a; }
.api-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 6px;
  font-size: 12.5px;
}
.method {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px;
  padding: 2px 6px; border-radius: 5px; min-width: 44px; text-align: center;
}
.m-get { background: #e8f4ff; color: #1064c4; }
.m-post { background: #e6f7ee; color: #0e7a49; }
.m-put { background: #fff4e0; color: #a36208; }
.m-del { background: #fdecef; color: #b32238; }
.api-row .path { font-family: var(--mono); font-size: 12px; color: var(--text); }
.api-row .desc { margin-left: auto; color: var(--muted); font-size: 11.5px; }

pre.code {
  margin: 8px 0 0; padding: 12px 14px;
  background: #151a23; color: #d7dde8;
  border-radius: 10px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  overflow: auto;
  white-space: pre;
}
pre.code .k { color: #7fb3ff; }
pre.code .s { color: #9be3a8; }
pre.code .c { color: #6b7686; }

/* toast */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  min-width: 220px; max-width: 380px;
  padding: 11px 14px;
  background: #1b222c; color: #fff;
  border-radius: 10px;
  font-size: 13px; line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  animation: toastIn 0.22s ease;
  display: flex; gap: 8px; align-items: flex-start;
}
.toast.err { background: #b3243a; }
.toast.ok { background: #10714a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* 拖拽上传态 */
.drag-over .table-wrap { outline: 2px dashed var(--brand); outline-offset: -8px; background: var(--brand-soft); }

/* 响应式 */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .search { width: 200px; }
}
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  /* 窄屏取消粘性列，避免遮挡中间内容 */
  .grid .col-check,
  .grid .col-waybill,
  .grid .col-actions,
  .grid thead .col-check,
  .grid thead .col-waybill,
  .grid thead .col-actions,
  .grid tbody .col-check,
  .grid tbody .col-waybill,
  .grid tbody .col-actions {
    position: static;
    box-shadow: none;
    z-index: auto;
  }
  .grid { min-width: max-content; }
}

@media (max-width: 720px) {
  .page { padding: 14px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 20px; }
  .search { width: 100%; order: -1; }
  .toolbar { padding: 12px; }
  .drawer-body { grid-template-columns: 1fr; }
  .topbar { height: 56px; padding: 0 14px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-text h1 { font-size: 13.5px; white-space: nowrap; }
  .brand-text p { display: none; }
  .db-pill { display: none; }
  .table-wrap { max-height: calc(100vh - 300px); }
  .pager { flex-direction: column; gap: 10px; align-items: stretch; }
  .pager-controls { justify-content: space-between; }
  .pager-info { text-align: center; }
}

/* --------------------------- 列设置下拉 --------------------------- */
.cols-menu { width: 236px; max-height: 400px; overflow-y: auto; padding: 8px 6px; }
.cols-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 2px 6px 8px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.cols-head > span:last-child { display: flex; gap: 2px; flex-shrink: 0; }
.cols-head button {
  border: none; white-space: nowrap; background: none; color: var(--brand);
  font-size: 11.5px; cursor: pointer; padding: 2px 4px; border-radius: 5px; font-family: inherit;
}
.cols-head button:hover { background: var(--brand-soft); }
.col-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 7px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
}
.col-item:hover { background: var(--surface-2); }
.col-item input { accent-color: var(--brand); }

/* ======================= 多级路由：面包屑 & 视图 ======================= */
.crumbs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}
.crumbs a {
  color: var(--text-2); text-decoration: none;
  padding: 4px 8px; border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.crumbs a:hover { background: var(--surface); color: var(--brand); }
.crumbs .crumb-sep { color: #c8ccd4; font-size: 11px; }
.crumbs .crumb-current {
  color: var(--text); font-weight: 600;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.crumbs .crumb-static { padding: 4px 6px; }

.view { animation: viewIn 0.18s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin: 22px 2px 12px;
}
.section-title h2 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: 0.2px; }
.section-title p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

/* 结算对象卡片 */
.obj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.obj-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 15px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
  overflow: hidden;
}
.obj-card:hover {
  border-color: #c9d6f7;
  box-shadow: 0 6px 20px rgba(16, 24, 40, 0.08);
  transform: translateY(-2px);
}
.obj-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, #4a83ff, #2154d8);
  opacity: 0; transition: opacity 0.16s;
}
.obj-card:hover::before { opacity: 1; }

.obj-card-top { display: flex; align-items: center; gap: 10px; }
.obj-avatar {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.obj-name { font-size: 14.5px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-arrow { color: #c3c8d2; font-size: 15px; transition: transform 0.16s, color 0.16s; }
.obj-card:hover .obj-arrow { color: var(--brand); transform: translateX(3px); }

.obj-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin: 15px 0 12px;
  padding: 11px 0;
  border-top: 1px solid #f2f4f7;
  border-bottom: 1px solid #f2f4f7;
}
.obj-metric .m-label { font-size: 11px; color: var(--muted); }
.obj-metric .m-value {
  font-size: 16px; font-weight: 600; margin-top: 3px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.obj-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.obj-foot .days { display: inline-flex; align-items: center; gap: 4px; }

/* 二级：对象概览条 */
.obj-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.obj-hero-main { flex: 1; min-width: 200px; }
.obj-hero-main .name { font-size: 18px; font-weight: 600; letter-spacing: -0.2px; }
.obj-hero-main .sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.obj-hero-metrics { display: flex; gap: 26px; flex-wrap: wrap; }
.obj-hero-metrics .m-label { font-size: 11px; color: var(--muted); }
.obj-hero-metrics .m-value { font-size: 17px; font-weight: 600; font-family: var(--mono); margin-top: 3px; }

/* 面板头 */
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-head-hint { font-size: 12px; color: var(--muted); }

.table-wrap-sm { max-height: none; min-height: 0; }
.grid-sm tbody td { height: 50px; }
.grid-sm tbody tr { cursor: pointer; }
.grid-sm tbody tr:hover td { background: #f7faff; }
.date-main { font-family: var(--mono); font-size: 13.5px; font-weight: 500; }
.date-week { color: var(--muted); font-size: 11.5px; margin-left: 6px; font-family: inherit; }

/* 三级：上下文芯片 */
.context-chips {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.context-chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 6px 0 11px;
  background: var(--brand-soft);
  border: 1px solid #d9e4ff;
  border-radius: 999px;
  font-size: 12.5px; color: #1c3fa8;
}
.chip .chip-key { color: #6b83bd; }
.chip button {
  width: 18px; height: 18px; border: none; background: rgba(28,63,168,0.1);
  border-radius: 50%; color: #1c3fa8; cursor: pointer;
  display: grid; place-items: center; font-size: 13px; line-height: 1;
  padding: 0;
}
.chip button:hover { background: rgba(28,63,168,0.2); }

@media (max-width: 720px) {
  .obj-grid { grid-template-columns: 1fr; }
  .obj-hero { gap: 14px; padding: 15px 16px; }
  .obj-hero-metrics { gap: 18px; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

/* 一级：发货日期分布 */
.trend-panel { margin-top: 18px; }
.trend {
  display: flex; align-items: flex-end; justify-content: center; gap: 10px;
  padding: 18px 20px 14px;
  height: 208px;
}
.trend-item {
  flex: 1 1 0; min-width: 0; max-width: 132px;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  gap: 7px; height: 100%;
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.trend-val {
  font-size: 11px; color: var(--text-2);
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  opacity: .75;
}
.trend-bar {
  width: 100%; max-width: 78px;
  background: linear-gradient(180deg, #7ba2ff 0%, #2f6df6 100%);
  border-radius: 6px 6px 2px 2px;
  min-height: 5px;
  transition: opacity .15s, filter .15s;
}
.trend-item:hover .trend-bar { filter: brightness(1.08); }
.trend-item:hover .trend-val { opacity: 1; color: var(--brand); }
.trend-date {
  font-size: 10.5px; color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.trend-empty { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
  .trend { gap: 4px; padding: 14px 12px 10px; height: 180px; }
  .trend-date { font-size: 9px; transform: rotate(-45deg); }
}

/* ------------------------- 保存确认：变更摘要 ------------------------- */
.diff-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}
.diff-head {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
.diff-row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid #f2f4f7;
  align-items: center;
}
.diff-row:last-child { border-bottom: none; }
.diff-row .dk { color: var(--text-2); font-weight: 500; }
.diff-row .dold, .diff-row .dnew {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
  line-height: 1.5;
}
.diff-row .dold { color: #a5a9b3; text-decoration: line-through; text-decoration-color: #d4d7de; }
.diff-row .dold.empty::after { content: "（空）"; text-decoration: none; display: inline-block; }
.diff-row .dnew { color: #1a7f37; font-weight: 500; }
.diff-row .dnew.empty { color: #c0392b; font-weight: 400; }
.diff-row .dnew.empty::after { content: "（清空）"; }
.diff-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 12px;
  font-size: 12px; color: var(--muted); line-height: 1.6;
}
.diff-note svg { flex-shrink: 0; margin-top: 1px; }
.diff-unchanged { padding: 18px 4px; text-align: center; color: var(--muted); font-size: 13px; }
.diff-create .diff-head { grid-template-columns: 150px 1fr; }
.diff-create .diff-row { grid-template-columns: 150px 1fr; }

/* ------------------------- 待审核 ------------------------- */
.stat.stat-link { position: relative; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.stat.stat-link:hover { border-color: #c9d6f7; box-shadow: 0 4px 14px rgba(16, 24, 40, 0.07); }
.stat.stat-link.has-items { border-color: #f0b269; background: #fffaf2; }
.stat.stat-link.has-items .stat-value { color: #b26a00; }
.stat-arrow {
  position: absolute; right: 14px; top: 18px;
  width: 14px; height: 14px; color: #c3c8d2;
  transition: transform 0.15s, color 0.15s;
}
.stat.stat-link:hover .stat-arrow { color: var(--brand); transform: translateX(2px); }
.pend-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #f59e0b; vertical-align: middle; margin-left: 2px;
  animation: pendPulse 1.6s ease infinite;
}
@keyframes pendPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.badge-gray  { background: #f1f3f5; color: #667085; }
.badge-orange { background: #fef4e6; color: #b26a00; }
.grid tbody tr.selected td { background: #eef4ff; }
.pager-num { font-size: 12.5px; color: var(--muted); font-family: var(--mono); min-width: 52px; text-align: center; }

/* ------------------------- 清空数据（测试用） ------------------------- */
.danger-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #f5c9ce;
  background: var(--danger-soft);
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #8c1b2b;
  margin-bottom: 14px;
}
.danger-note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.danger-note strong { font-weight: 600; }

.clear-list { list-style: none; margin: 0 0 14px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.clear-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; font-size: 12.5px; color: var(--text-2);
}
.clear-list li + li { border-top: 1px solid var(--line); }
.clear-list li b { font-size: 13.5px; color: var(--text); font-weight: 600; }
.clear-list code {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; margin-left: 4px;
}

.modal-body .chk {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; cursor: pointer;
}
.modal-body .chk input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.modal-body .fld { display: flex; flex-direction: column; gap: 6px; }
.modal-body .fld > span { font-size: 12px; color: var(--muted); }
.modal-body .fld input {
  height: 36px; padding: 0 12px; font-size: 13px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal-body .fld input:focus { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
