:root {
  /* 表面与背景 */
  --bg: #eef2f9;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(37, 99, 235, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(15, 118, 110, 0.05), transparent 55%);
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-sunken: #f1f5fa;

  /* 描边 */
  --line: #e3e9f2;
  --line-strong: #cbd5e4;

  /* 文本 */
  --text: #131b2e;
  --text-soft: #3a455c;
  --muted: #707d92;
  --muted-soft: #97a2b5;

  /* 主色阶 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --primary-softer: #f4f8ff;
  --primary-ring: rgba(37, 99, 235, 0.32);

  /* 语义色（前景 / 背景 / 描边 三件套） */
  --teal: #0f766e;
  --teal-bg: #d6f3ee;
  --green: #15803d;
  --green-bg: #dcfce7;
  --green-line: #a7e9bf;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --amber-line: #f6d27a;
  --red: #c0241c;
  --red-bg: #fdecea;
  --red-line: #f6b6b1;

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* 阴影层级 */
  --shadow-xs: 0 1px 2px rgba(19, 27, 46, 0.05);
  --shadow-sm: 0 2px 8px rgba(19, 27, 46, 0.06);
  --shadow: 0 10px 30px rgba(19, 27, 46, 0.08);
  --shadow-lg: 0 20px 48px rgba(19, 27, 46, 0.14);
  --shadow-primary: 0 8px 20px rgba(37, 99, 235, 0.26);

  /* 过渡 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 130ms var(--ease);
  --t-mid: 220ms var(--ease);
}

* {
  box-sizing: border-box;
}

::selection {
  background: var(--primary-ring);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 统一滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: var(--r-pill);
  background-clip: padding-box;
  background-color: var(--line-strong);
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--muted-soft);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 76px;
  padding: 12px 26px;
  background: linear-gradient(120deg, #0f1729 0%, #16213b 55%, #122031 100%);
  color: #f8fafc;
  box-shadow: 0 6px 22px rgba(9, 14, 27, 0.28);
}

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

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--r-md);
  background: linear-gradient(145deg, #2f6df3, #0f766e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 6px 16px rgba(15, 70, 160, 0.4);
  transition: transform var(--t-mid);
}

.brand-block:hover .brand-mark {
  transform: translateY(-1px) rotate(-3deg);
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: block;
}

.icon-sheet {
  fill: rgba(255, 255, 255, 0.96);
}

.icon-fold {
  fill: none;
  stroke: #93c5fd;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-nut {
  fill: #facc15;
  stroke: #172033;
  stroke-width: 1.25;
  stroke-linejoin: round;
}

.icon-hole {
  fill: #172033;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-subtitle {
  margin-top: 3px;
  color: #9fb0cb;
  font-size: 13px;
  line-height: 1.35;
}

.nav-list {
  display: none;
}

.nav-item {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  color: #cbd5e1;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.side-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-md);
  color: #c3cfe2;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
  font-size: 12px;
  line-height: 1.5;
}

.side-note strong {
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #2f6df3, #0f766e);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.4px;
}

.note-label,
.section-label {
  color: var(--muted);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 20px 24px 28px;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: grid;
  gap: 16px;
  animation: viewIn 360ms var(--ease);
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.page-header > * {
  min-width: 0;
}

.page-header.compact {
  max-width: 1080px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: -0.3px;
  font-weight: 800;
}

h2 {
  font-size: 16px;
  letter-spacing: -0.1px;
}

h3 {
  font-size: 15px;
}

.page-header p,
.panel-toolbar p,
.admin-panel p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.header-actions,
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.file-button,
.primary-button,
.secondary-button,
.ghost-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background var(--t-fast),
    border-color var(--t-fast),
    box-shadow var(--t-fast),
    transform var(--t-fast);
}

.file-button:active,
.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: translateY(1px);
}

.file-button input {
  display: none;
}

.file-button,
.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #2f74f5, var(--primary));
  box-shadow: var(--shadow-primary);
}

.file-button:hover,
.primary-button:hover {
  background: linear-gradient(135deg, #2f74f5, var(--primary-dark));
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.34);
  transform: translateY(-1px);
}

.file-button.secondary,
.secondary-button {
  color: var(--primary-dark);
  border-color: #c5dafe;
  background: var(--primary-soft);
  box-shadow: var(--shadow-xs);
}

.file-button.secondary:hover,
.secondary-button:hover {
  border-color: var(--primary);
  background: #e0ebff;
}

.ghost-button {
  color: var(--text-soft);
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

button:disabled:hover {
  transform: none;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

.metric-block {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    transform var(--t-mid),
    box-shadow var(--t-mid);
}

.metric-block::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--line-strong);
  transition: background var(--t-mid);
}

.metric-block:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.metric-block.success::before {
  background: linear-gradient(var(--teal), var(--green));
}

.metric-block.warning::before {
  background: linear-gradient(#f59e0b, var(--amber));
}

.metric-block.primary::before {
  background: linear-gradient(#2f74f5, var(--primary));
}

.metric-block span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.metric-block strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.metric-block.success strong {
  color: var(--teal);
}

.metric-block.warning strong {
  color: var(--amber);
}

/* 匹配率环形进度 */
.metric-rate {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rate-ring {
  --rate: 0;
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background:
    conic-gradient(var(--primary) calc(var(--rate) * 1%), var(--surface-sunken) 0);
  transition: background 600ms var(--ease);
}

.rate-ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface);
}

.rate-ring strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-size: 14px;
  z-index: 1;
  color: var(--primary-dark);
}

.metric-rate .rate-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.metric-rate .rate-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted-soft);
  font-size: 11px;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.sheet-panel,
.review-panel,
.admin-panel,
.import-history {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.sheet-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--surface), var(--surface-soft));
}

.table-wrap {
  position: relative;
  width: 100%;
  min-height: 560px;
  max-height: calc(100vh - 280px);
  overflow: auto;
}

.excel-table {
  width: 100%;
  min-width: 1420px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
}

.excel-table th,
.excel-table td {
  height: 36px;
  padding: 6px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #ffffff;
  font-variant-numeric: tabular-nums;
}

.excel-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--text-soft);
  background: linear-gradient(#eef3fa, #e6edf6);
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: inset 0 -1px 0 var(--line-strong);
}

.excel-table tbody tr {
  transition: background var(--t-fast);
}

.excel-table tbody tr:hover td {
  background: var(--primary-softer);
}

.excel-table .row-number {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 46px;
  max-width: 46px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: right;
  font-weight: 600;
}

.excel-table th.row-number {
  z-index: 3;
}

.excel-table td.editable-cell {
  position: relative;
  outline: 2px solid transparent;
  background: #fffdf3;
  cursor: text;
  transition:
    background var(--t-fast),
    box-shadow var(--t-fast);
}

.excel-table td.editable-cell::after {
  content: "✎";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  color: #d4a017;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.excel-table td.editable-cell:hover {
  background: #fff8df;
}

.excel-table td.editable-cell:hover::after {
  opacity: 0.7;
}

.excel-table td.editable-cell:focus {
  outline-color: #f59e0b;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #f59e0b;
}

.excel-table td.editable-cell:focus::after {
  opacity: 0;
}

.excel-table tr.needs-review td {
  color: #842020;
  background: #fdeeec;
}

.excel-table tr.needs-review:hover td {
  background: #fce3df;
}

.excel-table tr.needs-review td.problem-cell {
  border-color: var(--red-line);
  box-shadow: inset 0 0 0 1px #ef4444;
  background: #fbdbd6;
  font-weight: 700;
}

.excel-table tr.audit-warning-row td,
.excel-table td.warning-cell {
  background: #fffaeb;
}

.excel-table td.warning-cell {
  border-color: var(--amber-line);
  box-shadow: inset 0 0 0 1px #f59e0b;
}

.excel-table tr.resolved-review td {
  background: #f0fbf3;
}

.excel-table tr.resolved-review td.resolved-cell {
  color: var(--green);
  background: #d8f4e1;
  font-weight: 700;
}

.excel-table tr.focus-row td {
  animation: rowFlash 1.3s ease;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  min-height: 420px;
  padding: 32px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  color: var(--text);
  font-size: 17px;
}

.empty-state p {
  max-width: 420px;
}

.empty-illustration {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--primary-soft), var(--surface-sunken));
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--line);
}

.empty-illustration svg {
  width: 38px;
  height: 38px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* 加载遮罩 */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(247, 249, 252, 0.78);
  backdrop-filter: blur(3px);
  color: var(--text-soft);
}

.loading-overlay.show {
  display: flex;
  animation: viewIn 200ms var(--ease);
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-overlay .loading-text {
  font-size: 14px;
  font-weight: 600;
}

.loading-overlay .loading-sub {
  font-size: 12px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 骨架屏 */
.skeleton-table {
  display: grid;
  gap: 9px;
  padding: 18px;
}

.skeleton-row {
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-sunken) 25%, #e9eef6 37%, var(--surface-sunken) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

.skeleton-row.head {
  height: 34px;
  background: linear-gradient(90deg, #e4ebf5 25%, #dde6f2 37%, #e4ebf5 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.review-panel {
  order: -1;
  display: grid;
  grid-template-columns: 92px minmax(170px, 220px) 120px minmax(260px, 1fr) minmax(280px, auto);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
}

.review-panel .review-section:last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.review-section {
  display: grid;
  gap: 6px;
  padding-top: 0;
  border-top: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  color: var(--green);
  background: var(--green-bg);
  font-size: 12px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}

.status-pill.muted {
  color: var(--muted);
  background: var(--surface-sunken);
}

.issue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 88px;
  overflow: auto;
}

.issue-item {
  min-width: 210px;
  padding: 8px 10px;
  border: 1px solid var(--red-line);
  border-left: 3px solid #ef4444;
  border-radius: var(--r-sm);
  background: var(--red-bg);
  color: #842020;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  transition:
    transform var(--t-fast),
    box-shadow var(--t-fast);
}

.issue-item:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}

.issue-item strong {
  color: var(--red);
}

.audit-summary {
  padding: 9px 11px;
  border-radius: var(--r-sm);
  font-size: 12px;
  line-height: 1.55;
}

.audit-ok {
  color: var(--teal);
  background: var(--teal-bg);
}

.audit-warning {
  color: var(--amber);
  background: var(--amber-bg);
}

.audit-error {
  color: var(--red);
  background: var(--red-bg);
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.field-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  min-width: 0;
}

.field-tags span {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #d3e2fe;
  font-size: 12px;
  font-weight: 600;
}

col.row-number {
  width: 42px;
}

col.field-standard,
col.field-productType {
  width: 190px;
}

col.field-size,
col.field-finish,
col.field-material,
col.field-grade,
col.field-unit {
  width: 96px;
}

col.field-quantity,
col.field-taxTonPrice,
col.field-thousandWeight,
col.field-thousandPrice,
col.field-matchStatus {
  width: 106px;
}

col.field-matchIssue {
  width: 130px;
}

@keyframes rowFlash {
  0% {
    box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, 0.2);
  }
  100% {
    box-shadow: inset 0 0 0 9999px transparent;
  }
}

.admin-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
  max-width: 1080px;
}

.admin-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.admin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-title span {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  color: var(--text-soft);
  background: var(--surface-sunken);
  font-size: 12px;
  font-weight: 600;
}

.import-history {
  max-width: 1080px;
}

.history-list {
  display: grid;
  gap: 0;
}

.history-row,
.empty-inline {
  display: grid;
  grid-template-columns: 120px 1fr 90px 170px;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  align-items: center;
  font-size: 13px;
}

.history-row:first-child {
  border-top: 0;
}

.empty-inline {
  display: block;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  max-width: 380px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  color: #ffffff;
  background: linear-gradient(135deg, #1b2536, #0f1729);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  transform: translateY(18px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--t-mid),
    opacity var(--t-mid);
}

.toast::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.28);
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.admin-page {
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
}

.admin-shell {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 24px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(15, 118, 110, 0.05)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-header .ghost-button {
  flex: 0 0 auto;
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.admin-mark {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, #2f6df3, #0f766e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 18px rgba(15, 70, 160, 0.34);
}

.admin-mark .brand-icon {
  width: 30px;
  height: 30px;
}

.admin-header p,
.config-panel p,
.config-panel li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary);
  background: #ffffff;
  text-decoration: none;
}

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

.config-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.config-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.config-title span {
  padding: 5px 11px;
  border-radius: var(--r-pill);
  color: var(--green);
  background: var(--green-bg);
  font-size: 12px;
  font-weight: 700;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.config-panel label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.config-panel .switch-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.config-panel .switch-row input {
  width: auto;
}

.config-panel input,
.config-panel textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 11px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-weight: 400;
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-fast);
}

.config-panel input:focus,
.config-panel textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.field-hint.empty {
  color: var(--amber);
}

.test-result {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.5;
}

.test-result.error {
  border-color: #fecaca;
  color: var(--red);
  background: #fef2f2;
}

.config-panel textarea {
  resize: vertical;
}

.config-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.recommendation ul {
  margin: 0;
  padding-left: 18px;
}

.database-admin {
  max-width: none;
}

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

.admin-toolbar {
  padding-bottom: 2px;
}

.danger-text {
  color: var(--red);
}

.database-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.database-metrics div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  transition:
    transform var(--t-fast),
    box-shadow var(--t-fast);
}

.database-metrics div:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.database-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.database-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.database-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.database-filters,
.database-actions,
.pagination-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.database-filters input,
.database-filters select {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0 11px;
  color: var(--text);
  background: var(--surface);
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-fast);
}

.database-filters input:focus,
.database-filters select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.database-filters input[type="search"] {
  flex: 1 1 260px;
  min-width: 220px;
}

.inline-check {
  display: inline-flex !important;
  align-items: center;
  gap: 7px !important;
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 700;
}

.inline-check input {
  width: auto;
}

.database-actions {
  justify-content: space-between;
}

.database-actions span {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.database-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 12px;
}

.database-table th,
.database-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.database-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(#eef3fa, #e6edf6);
  color: var(--text-soft);
  font-weight: 700;
  box-shadow: inset 0 -1px 0 var(--line-strong);
}

.database-table tbody tr {
  transition: background var(--t-fast);
}

.database-table tbody tr:hover {
  background: var(--primary-softer);
}

.database-table th:first-child,
.database-table td:first-child {
  width: 42px;
  text-align: center;
}

.database-table th:last-child,
.database-table td:last-child {
  width: 64px;
  text-align: center;
}

.text-action {
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 12px;
}

.text-action:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.pagination-row {
  justify-content: flex-end;
}

.pagination-row span {
  min-width: 90px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.record-editor {
  scroll-margin-top: 16px;
}

.record-form-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(37, 99, 235, 0.14), transparent 55%),
    radial-gradient(800px 480px at 85% 90%, rgba(15, 118, 110, 0.13), transparent 55%),
    linear-gradient(135deg, #101a2f, #18243d);
}

.login-shell {
  width: min(440px, 100%);
}

.login-card {
  display: grid;
  gap: 22px;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
}

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

.login-brand h1 {
  font-size: 22px;
}

.login-brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, #2f6df3, #0f766e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 18px rgba(15, 70, 160, 0.4);
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-fast);
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.login-form .primary-button {
  margin-top: 4px;
  min-height: 44px;
}

.login-message {
  display: none;
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
}

.login-message.show {
  display: block;
}

@media (max-width: 1080px) {
  .review-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .config-grid,
  .form-grid,
  .database-metrics,
  .record-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .side-note {
    align-items: flex-start;
    flex-direction: column;
    margin-left: 0;
    width: 100%;
  }

  .page-header,
  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions,
  .toolbar-group {
    align-items: stretch;
    flex-direction: column;
  }

  .file-button,
  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .status-grid,
  .admin-layout,
  .review-panel {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 16px;
  }

  .table-wrap {
    max-height: 520px;
  }
}

/* ------------------------------- 报价日志面板 ------------------------------- */
.quote-log-admin {
  margin-top: 18px;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 22px 12px;
}

.database-table tr.review-row {
  background: var(--surface-sunken);
}

.quote-log-detail {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
}

.quote-log-detail h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
}

.log-detail-issues {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  color: var(--text-soft);
  font-size: 13px;
}

.issue-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 12px;
}

.issue-chip.ok {
  background: var(--teal-bg);
  border-color: var(--teal-bg);
  color: var(--teal);
}

/* ------------------------------- 导入历史 ------------------------------- */
.import-history {
  margin-top: 16px;
  border-top: 1px dashed var(--line-strong);
  padding-top: 12px;
}

.import-history > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-soft);
  list-style: none;
  user-select: none;
}

.import-history > summary::-webkit-details-marker {
  display: none;
}

.import-history > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.import-history[open] > summary::before {
  transform: rotate(90deg);
}

.import-history .history-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.import-history .database-table-wrap {
  margin-top: 12px;
}

/* ------------------------------- 字段映射编辑器 ------------------------------- */
.mapping-editor {
  margin: 0 0 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.mapping-editor-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mapping-editor-head strong {
  font-size: 15px;
  color: var(--text);
  margin-right: 8px;
}

.mapping-hint {
  color: var(--muted);
  font-size: 12px;
}

.mapping-editor-actions {
  display: flex;
  gap: 8px;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px 14px;
}

.mapping-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.mapping-field select {
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.mapping-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* —— 多租户后台新增元素 —— */
.admin-header-actions { display: flex; align-items: center; gap: 12px; }
.identity-slot {
  font-size: 13px; color: var(--text-soft, #5b6472); background: rgba(0,0,0,0.04);
  padding: 6px 12px; border-radius: 8px; max-width: 260px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.account-list-wrap { margin-top: 14px; }
.account-list-wrap table { width: 100%; }
.recommendation hr { border: none; border-top: 1px solid rgba(0,0,0,0.08); margin: 16px 0; }
#bossForm[hidden] { display: none; }
