:root {
  --bg: #f2f5f2;
  --bg-soft: #e9f0eb;
  --card: #ffffff;
  --card-soft: #f8fbf9;
  --text: #17241e;
  --text-soft: #40544a;
  --muted: #75877e;
  --line: #e1e9e3;
  --line-strong: #cfddd4;
  --primary: #0f6b4f;
  --primary-dark: #0a513c;
  --primary-soft: #e6f3ed;
  --gold: #b88a2e;
  --gold-soft: #f8efd9;
  --danger: #b04242;
  --danger-soft: #fbeaea;
  --shadow-sm: 0 1px 2px rgba(18, 48, 35, .05);
  --shadow: 0 10px 30px -18px rgba(13, 51, 37, .28), 0 2px 8px rgba(13, 51, 37, .04);
  --radius: 16px;
  --radius-sm: 10px;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 12% -8%, #dcece3 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #e9f2ec 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

button { cursor: pointer; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: relative;
  overflow: hidden;
  color: #f4fbf7;
  background:
    radial-gradient(900px 260px at 85% -40%, rgba(185, 218, 195, .25), transparent 60%),
    linear-gradient(115deg, #0b2c22 0%, #0d4937 58%, #0f5a43 100%);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .15;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(255,255,255,.28) 46px 47px),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(255,255,255,.16) 46px 47px);
  mask-image: linear-gradient(90deg, transparent 20%, #000 75%, transparent 100%);
}

.topbar-inner {
  position: relative;
  z-index: 1;
  max-width: 1460px;
  margin: 0 auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.brand-mark {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #0b2c22;
  background: linear-gradient(145deg, #f4e3b6, #d8b56a 58%, #c49a44);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 10px 24px -12px rgba(0,0,0,.7);
}

.brand-text h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: .02em;
}

.brand-text p {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: rgba(232, 247, 239, .68);
  letter-spacing: .02em;
}

.stats { display: flex; gap: 10px; flex: none; }

.stat {
  min-width: 96px;
  padding: 9px 14px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
}

.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.15;
  color: #fff;
}

.stat span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: .06em;
  color: rgba(228, 244, 235, .62);
}

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

.app {
  max-width: 1460px;
  margin: 0 auto;
  padding: 22px 28px 46px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}

.card-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: .01em;
}

.card-head .sub {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  word-break: break-all;
}

.muted-note {
  padding: 4px 2px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 远程文件 ---------- */

.remote-list {
  max-height: 318px;
  overflow: auto;
  padding: 0 10px 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd8d0 transparent;
}

.remote-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease;
}

.remote-item:hover { background: var(--card-soft); }

.remote-item.is-loaded { opacity: .72; }

.remote-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.remote-item.is-loaded input[type="checkbox"] { cursor: not-allowed; }

.remote-main { min-width: 0; }

.remote-date {
  display: block;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .03em;
}

.remote-name {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}

.remote-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfb, #f7faf8);
  border-radius: 0 0 var(--radius) var(--radius);
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}

.check-label input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}

.sel-count { flex: 1; font-size: 11.5px; color: var(--muted); }

/* ---------- 上传 ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 16px 16px;
  padding: 22px 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: #fbfdfb;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}

.dropzone:hover, .dropzone.is-drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone.is-drag { transform: scale(.99); }

.dropzone input[type="file"] { display: none; }

.drop-icon { width: 24px; height: 24px; color: var(--primary); margin-bottom: 2px; }

.dropzone strong { font-size: 13px; font-weight: 600; }

.dropzone span { font-size: 11px; color: var(--muted); }

/* ---------- 已加载文件 ---------- */

.source-list {
  max-height: 260px;
  overflow: auto;
  padding: 0 12px 10px;
  scrollbar-width: thin;
}

.source-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-top: 1px dashed var(--line);
}

.source-item:first-child { border-top: none; }

.source-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.source-info { flex: 1; min-width: 0; }

.source-info strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-info small {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

/* ---------- 搜索 ---------- */

.search-card {
  padding: 14px 16px 11px;
  background:
    linear-gradient(180deg, #ffffff, #fbfdfb);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.search-icon { width: 21px; height: 21px; color: var(--primary); flex: none; }

#searchInput {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 550;
  letter-spacing: .03em;
}

#searchInput::placeholder {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  color: #9bac9f;
}

#searchInput::-webkit-search-cancel-button { display: none; }

.clear-btn {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 11.5px;
  color: var(--text-soft);
}

.clear-btn:hover { border-color: var(--line-strong); background: var(--card-soft); }

.search-hint {
  margin: 2px 0 0 33px;
  font-size: 11px;
  color: var(--muted);
}

kbd {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  color: var(--text-soft);
}

/* ---------- 工具栏 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  flex-wrap: wrap;
}

.filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.field select {
  max-width: 190px;
  padding: 6px 28px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  color: var(--text);
  outline: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #7d8f85 50%), linear-gradient(135deg, #7d8f85 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 10px) 52%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

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

.result-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.result-meta b { color: var(--text); font-weight: 650; }

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

.table-card { overflow: hidden; }

.table-wrap { overflow-x: auto; }

.record-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.record-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 16px;
  background: #f6faf7;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--muted);
  white-space: nowrap;
}

.record-table td {
  padding: 11px 16px;
  border-bottom: 1px solid #eef3ef;
  vertical-align: middle;
}

.record-table tbody tr {
  cursor: pointer;
  transition: background .12s ease;
}

.record-table tbody tr:hover { background: #f8fbf9; }

.record-table tbody tr:last-child td { border-bottom: none; }

.sn-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }

.sn {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .055em;
  white-space: nowrap;
}

.sn mark {
  padding: 0 1px;
  border-radius: 3px;
  background: #f8e8b8;
  color: #6d4c00;
}

.dup-badge {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--gold-soft);
  color: #8a6419;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.time-cell {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-soft);
  white-space: nowrap;
}

.money-cell { white-space: nowrap; }

.money-cell b {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 650;
}

.money-cell small {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.normal { background: var(--primary-soft); color: var(--primary); }
.status-pill.suspect { background: var(--danger-soft); color: var(--danger); }
.status-pill.unknown { background: #f1f4f2; color: var(--muted); }

.machine-cell, .source-cell {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-soft);
}

.machine-cell { font-family: var(--mono); font-size: 11px; }

.source-cell { color: var(--muted); }

.col-action { width: 42px; }

.row-open {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.row-open:hover {
  border-color: var(--line);
  background: #fff;
  color: var(--primary);
}

.row-open svg { width: 16px; height: 16px; }

/* ---------- 分页 ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  background: #fbfdfb;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.page-size { display: inline-flex; align-items: center; gap: 5px; }

.page-size select {
  padding: 4px 20px 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 11.5px;
  outline: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #7d8f85 50%), linear-gradient(135deg, #7d8f85 50%, transparent 50%);
  background-position: calc(100% - 11px) 52%, calc(100% - 7px) 52%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.pager-controls { display: flex; align-items: center; gap: 10px; }

.page-indicator { font-variant-numeric: tabular-nums; }

/* ---------- 空状态 ---------- */

.empty-state {
  padding: 54px 28px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background:
    radial-gradient(500px 200px at 50% 0%, #eef7f1, transparent 70%),
    #fff;
}

.empty-art {
  display: flex;
  gap: 7px;
  margin-bottom: 20px;
  opacity: .85;
}

.empty-art span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 46px;
  border-radius: 7px;
  border: 1px solid #d5e5db;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(15, 107, 79, .08) 3px 4px),
    #f3f9f5;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  color: #1a5a44;
  box-shadow: 0 6px 14px -12px rgba(13, 51, 37, .4);
  transform: translateY(0);
  animation: floaty 3.6s ease-in-out infinite;
}

.empty-art span:nth-child(2) { animation-delay: .15s; }
.empty-art span:nth-child(3) { animation-delay: .3s; }
.empty-art span:nth-child(4) { animation-delay: .45s; }
.empty-art span:nth-child(5) { animation-delay: .6s; }
.empty-art span:nth-child(6) { animation-delay: .75s; }

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.empty-state h3 { margin: 0; font-size: 18px; font-weight: 650; }

.empty-state p {
  max-width: 420px;
  margin: 9px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

.empty-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }

/* ---------- 按钮 ---------- */

.primary-btn {
  padding: 8px 15px;
  border: 1px solid var(--primary-dark);
  border-radius: 9px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 6px 14px -10px rgba(10, 81, 60, .8);
  transition: filter .15s, transform .1s;
}

.primary-btn:hover:not(:disabled) { filter: brightness(1.08); }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 550;
}

.ghost-btn svg { width: 15px; height: 15px; }

.ghost-btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--card-soft); }

.ghost-btn:disabled { opacity: .45; cursor: not-allowed; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}

.icon-btn:hover {
  border-color: var(--line);
  background: var(--card-soft);
  color: var(--primary);
}

.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: #f0d3d3; }

.icon-btn svg { width: 16px; height: 16px; }

button:focus-visible, input:focus-visible, select:focus-visible, label:focus-within {
  outline: 2px solid rgba(15, 107, 79, .45);
  outline-offset: 2px;
}

/* ---------- 加载骨架 ---------- */

.skeleton-list { padding: 6px 8px; display: flex; flex-direction: column; gap: 8px; }

.skeleton {
  height: 42px;
  border-radius: 9px;
  background: linear-gradient(90deg, #f1f5f2 25%, #e8efea 37%, #f1f5f2 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

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

.inline-error {
  margin: 4px 8px 12px;
  padding: 12px 12px;
  border: 1px solid #f0d3d3;
  border-radius: 9px;
  background: var(--danger-soft);
  color: #7e3232;
  font-size: 11.5px;
  line-height: 1.6;
}

.inline-error button { margin-top: 8px; }

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ---------- 详情弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 28, 20, .52);
  backdrop-filter: blur(5px);
  animation: fadein .18s ease;
}

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: min(920px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 22px 24px 20px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 80px -30px rgba(0, 25, 16, .55);
  animation: rise .22s cubic-bezier(.2,.8,.3,1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--primary-dark);
}

.serial-image-panel {
  margin-top: 16px;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    linear-gradient(0deg, rgba(15,107,79,.035) 1px, transparent 1px) 0 0 / 100% 16px,
    linear-gradient(90deg, rgba(15,107,79,.035) 1px, transparent 1px) 0 0 / 16px 100%,
    #fcfefc;
}

.image-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--muted);
}

.serial-image-wrap {
  min-height: 74px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #eef3ef;
}

#serialImage {
  display: block;
  width: min(100%, 760px);
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.no-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px;
  color: var(--muted);
  font-size: 11.5px;
}

.no-image svg { width: 26px; height: 26px; opacity: .55; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 18px 2px 0;
}

.detail-grid > div { min-width: 0; }

.detail-grid .span-2 { grid-column: span 2; }

.detail-grid dt {
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-all;
}

.detail-grid dd.mono { font-family: var(--mono); font-size: 11.5px; }

.modal-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.modal-foot .spacer { flex: 1; }

.modal-pos {
  min-width: 78px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ---------- 提示 ---------- */

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(380px, calc(100vw - 40px));
}

.toast {
  padding: 11px 14px 11px 13px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-left: 3px solid #7fd3ae;
  border-radius: 10px;
  background: rgba(13, 45, 34, .96);
  color: #eef8f2;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 14px 34px -18px rgba(0, 20, 13, .8);
  animation: toast-in .2s ease;
  word-break: break-word;
}

.toast.error { border-left-color: #f0a0a0; }

.toast.warn { border-left-color: #e8c479; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 1120px) {
  .app { grid-template-columns: 300px minmax(0, 1fr); padding: 18px 20px 40px; }
  .topbar-inner { padding: 18px 20px; }
  .brand-text h1 { font-size: 20px; }
  .stat { min-width: 82px; padding: 8px 11px 7px; }
  .stat b { font-size: 18px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .source-card { grid-column: span 2; }
  .col-machine { display: none; }
  .machine-cell { display: none; }
  .topbar-inner { flex-wrap: wrap; }
  .stats { width: 100%; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .app { padding: 14px 12px 34px; gap: 14px; }
  .topbar-inner { padding: 16px 14px; gap: 14px; }
  .brand-mark { width: 46px; height: 46px; font-size: 13px; }
  .brand-text h1 { font-size: 18px; }
  .brand-text p { font-size: 11px; }
  .stats { gap: 7px; }
  .stat { flex: 1; min-width: 0; }
  .sidebar { grid-template-columns: 1fr; }
  .source-card { grid-column: auto; }
  .col-source, .source-cell, .col-time, .time-cell { display: none; }
  .record-table th, .record-table td { padding: 10px 12px; }
  .sn { font-size: 13px; }
  .search-hint { display: none; }
  .toolbar { align-items: flex-start; }
  .result-meta { width: 100%; }
  .modal { padding: 10px; }
  .modal-card { padding: 17px 15px 15px; border-radius: 16px; max-height: calc(100vh - 20px); }
  .modal-head h2 { font-size: 21px; }
  .detail-grid { grid-template-columns: 1fr; gap: 11px; }
  .detail-grid .span-2 { grid-column: auto; }
  .modal-foot .spacer { display: none; }
  .modal-foot { justify-content: space-between; }
  .modal-foot #copySerial { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
