:root {
  --bg: #f2f5f5;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --line: #e2e8ea;
  --line-strong: #cfd9dd;
  --ink: #1b2529;
  --ink-2: #5c6c73;
  --ink-3: #86959d;
  --accent: #0f766e;
  --accent-dark: #0b5b55;
  --accent-soft: #e7f3f1;
  --blue: #2563eb;
  --blue-soft: #eaf1fe;
  --warn: #a45c0a;
  --warn-soft: #fdf4e3;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #16794c;
  --ok-soft: #e8f5ee;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(22, 36, 42, .05), 0 10px 28px rgba(22, 36, 42, .05);
  --sidebar-w: 224px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.lucide { width: 16px; height: 16px; flex: none; stroke-width: 1.8; }

[hidden] { display: none !important; }

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

.app { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100vh;
  padding: 16px 12px 14px;
  background: #fbfcfc;
  border-right: 1px solid var(--line);
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 118, 110, .22);
}

.brand-mark svg.lucide { width: 18px; height: 18px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: .2px; }
.brand-text small { color: var(--ink-3); font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: #eff3f3; color: var(--ink); }

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

.nav-item span { flex: 1; }

.nav-badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e5eaec;
  color: var(--ink-2);
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.nav-item.is-active .nav-badge { background: #fff; color: var(--accent-dark); }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

.storage-info {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px 10px;
  color: var(--ink-3);
  font-size: 11px;
}

.storage-info svg.lucide { width: 14px; height: 14px; }

.foot-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 62px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.crumb { font-size: 15px; font-weight: 650; }
.crumb-sub { color: var(--ink-3); font-size: 11px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.mobile-menu { display: none; }

.content { padding: 18px 22px 40px; }

.view { display: none; }
.view.is-active { display: block; animation: fade-in .18s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

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

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

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

.panel-head h2 { margin: 0; font-size: 14px; font-weight: 650; }
.panel-sub { margin: 2px 0 0; color: var(--ink-3); font-size: 11px; }
.head-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.btn:hover { background: var(--surface-soft); border-color: #b9c5ca; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg.lucide { width: 15px; height: 15px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

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

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef2f3; border-color: transparent; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
}

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

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { color: var(--ink-2); font-size: 11.5px; font-weight: 550; }

.field input,
.field select,
.field textarea,
.select,
.search-box input {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select:focus,
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .1);
}

.field input[readonly] { background: var(--surface-soft); color: var(--ink-2); }
.field textarea { resize: vertical; min-height: 34px; line-height: 1.5; }
.field-wide { grid-column: 1 / -1; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.badge-teal { background: var(--accent-soft); color: var(--accent-dark); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #eef2f3; color: var(--ink-2); }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(15, 118, 110, .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner-lg { width: 20px; height: 20px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 180px;
  padding: 22px;
  color: var(--ink-3);
  text-align: center;
}

.empty-state svg.lucide { width: 24px; height: 24px; color: #a9b7bd; }
.empty-state strong { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.empty-state span { font-size: 12px; }
.empty-state-tall { min-height: 220px; }
.empty-inline { padding: 16px; color: var(--ink-3); font-size: 12px; text-align: center; }

/* ------------------------------ 上传与队列 ------------------------------ */

.intake-top {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.upload-panel { padding-bottom: 14px; }
.upload-panel .field { margin: 0 16px 12px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 16px;
  padding: 22px 16px;
  border: 1.5px dashed #bfcdd2;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink-2);
  text-align: center;
  outline: none;
  transition: border-color .15s, background .15s, transform .15s;
}

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

.dropzone.is-drag { transform: scale(1.01); }
.dropzone strong { color: var(--ink); font-size: 13px; }
.dropzone small { color: var(--ink-3); font-size: 11.5px; }

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(22, 36, 42, .08);
}

.dropzone-icon svg.lucide { width: 19px; height: 19px; }

.upload-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 16px 0;
  color: var(--ink-3);
  font-size: 11px;
}

.upload-note svg.lucide { width: 14px; height: 14px; color: var(--ok); }

.queue-panel { min-height: 296px; }
.queue-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; padding: 0 10px 12px; overflow: auto; }

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  text-align: left;
  transition: border-color .15s, background .15s;
}

.queue-item:hover { border-color: #b9c5ca; background: var(--surface-soft); }
.queue-item.is-active { border-color: var(--accent); background: var(--accent-soft); }

.queue-item-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #f0f4f5;
  color: var(--ink-2);
  flex: none;
}

.queue-item.is-active .queue-item-icon { background: #fff; color: var(--accent-dark); }

.queue-item-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.queue-item-title { overflow: hidden; font-weight: 620; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-sub { overflow: hidden; color: var(--ink-2); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-file { overflow: hidden; color: var(--ink-3); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-side { display: flex; align-items: center; gap: 4px; color: var(--ink-3); flex: none; }
.queue-item-side svg.lucide { width: 14px; height: 14px; }

/* ------------------------------ 编辑器 ------------------------------ */

.editor-panel { margin-top: 16px; }
.editor-body { padding: 0 16px 18px; }

.warn-strip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 16px 12px;
  padding: 9px 11px;
  border: 1px solid #f3d9a6;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
}

.warn-strip svg.lucide { width: 15px; height: 15px; margin-top: 1px; }
.warn-strip div { display: flex; flex-direction: column; gap: 2px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 4px 0 14px;
}

.mapping-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.mapping-panel summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 550;
  list-style: none;
  cursor: pointer;
}

.mapping-panel summary::-webkit-details-marker { display: none; }
.mapping-panel summary svg.lucide { width: 15px; height: 15px; }
.mapping-panel summary em { margin-left: 2px; color: var(--ink-3); font-size: 11px; font-style: normal; font-weight: 400; }
.mapping-panel summary svg.lucide:last-child { margin-left: auto; transition: transform .15s; }
.mapping-panel[open] summary svg.lucide:last-child { transform: rotate(180deg); }

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 2px 11px 12px;
}

.field-compact input,
.field-compact select { padding: 6px 8px; font-size: 12px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 9px;
}

.section-head h3 { display: inline; margin: 0; font-size: 13.5px; font-weight: 650; }
.section-head-tight { padding-top: 4px; }
.section-sub { margin-left: 7px; color: var(--ink-3); font-size: 11.5px; }

.items-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.items-table, .mini-table, .data-table { width: 100%; border-collapse: separate; border-spacing: 0; }

.items-table th,
.mini-table th,
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 9px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.items-table td,
.mini-table td {
  padding: 5px 7px;
  border-bottom: 1px solid #edf1f2;
  vertical-align: top;
}

.items-table tfoot td,
.mini-table tfoot td {
  border-top: 1px solid var(--line-strong);
  background: var(--surface-soft);
  font-weight: 650;
}

.items-table tr:last-child td,
.mini-table tr:last-child td { border-bottom: 0; }

.items-table input,
.items-table textarea,
.items-table select {
  width: 100%;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  outline: none;
  resize: none;
  line-height: 1.45;
}

.items-table input:hover,
.items-table textarea:hover,
.items-table select:hover { background: var(--surface-soft); }
.items-table input:focus,
.items-table textarea:focus,
.items-table select:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 2px rgba(15, 118, 110, .09); }
.items-table textarea { overflow: hidden; }

.col-seq { width: 42px; }
.col-image { width: 56px; }
.col-factory { width: 118px; min-width: 100px; }
.col-customer { width: 106px; min-width: 92px; }
.col-kind { width: 78px; }
.col-spec { width: 122px; min-width: 108px; }
.col-qty { width: 78px; }
.col-cut { width: 92px; }
.col-req { width: 126px; min-width: 106px; }
.col-remark { width: 112px; min-width: 96px; }
.col-attention { width: 126px; min-width: 106px; }
.col-op { width: 36px; text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.items-table { table-layout: fixed; min-width: 1100px; }
.items-table td.col-attention[rowspan],
.mini-table td:last-child[rowspan] { vertical-align: middle; }

.image-cell {
  position: relative;
  width: 46px;
  height: 46px;
  margin: 0 auto;
}

.image-empty { color: var(--ink-3); text-align: center; }

.thumb-btn {
  display: block;
  width: 46px;
  height: 46px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.thumb-btn:hover { border-color: var(--accent); }
.thumb-btn img { display: block; width: 100%; height: 100%; object-fit: cover; }

.image-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 46px;
  height: 46px;
  margin: 0 auto;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-3);
  font-size: 9px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}

.image-add:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.image-add svg.lucide { width: 14px; height: 14px; }

.image-actions {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: flex;
  gap: 2px;
}

.thumb-action {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}

.thumb-action:hover { border-color: var(--accent); color: var(--accent-dark); }
.thumb-action-danger:hover { border-color: #eeb4ae; color: var(--danger); }
.thumb-action svg.lucide { width: 10px; height: 10px; }

.notes-field { margin-top: 14px; }

/* ------------------------------ 订单列表 ------------------------------ */

.stats-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }

.stat-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-dark);
  flex: none;
}

.stat-card strong { display: block; font-size: 19px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-card span:not(.stat-icon) { display: block; color: var(--ink-2); font-size: 12px; }
.stat-card small { display: block; color: var(--ink-3); font-size: 10.5px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.toolbar-spacer { flex: 1; }
.select { width: auto; min-width: 128px; padding: 6px 9px; font-size: 12px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  width: min(320px, 34vw);
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-3);
}

.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .1); }
.search-box svg.lucide { width: 15px; height: 15px; }
.search-box input { padding: 7px 0; border: 0; box-shadow: none !important; background: transparent; }

.table-wrap { overflow: auto; }
.data-table { min-width: 940px; }
.production-table { min-width: 1680px; }
.production-table td { vertical-align: top; }
.production-status-select { min-width: 96px; }
.production-qty-input,
.production-note-input {
  width: 100%;
  padding: 6px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}
.production-qty-input { min-width: 90px; text-align: right; }
.production-note-input { min-width: 160px; }
.production-order-row td {
  padding: 0 !important;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.production-order-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 8px 10px;
}
.production-order-main { display: flex; align-items: baseline; gap: 8px; min-width: 220px; }
.production-order-main strong { font-size: 13px; }
.production-order-main span { color: var(--ink-2); font-size: 11.5px; }
.production-order-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--ink-2); font-size: 11.5px; }
.production-order-progress {
  flex: 1;
  min-width: 120px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7e9;
}
.production-order-progress span { display: block; height: 100%; background: var(--accent); }

.data-table th { padding: 9px 12px; }

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #edf1f2;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody tr { cursor: pointer; transition: background .12s; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .col-op { width: 48px; }

.cell-strong { display: block; font-weight: 620; }
.cell-sub { display: block; max-width: 210px; overflow: hidden; color: var(--ink-3); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }

.table-foot { padding: 9px 14px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 11.5px; }

/* ------------------------------ 数据概览 ------------------------------ */

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }

.kpi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-dark);
  flex: none;
}

.kpi strong { display: block; font-size: 20px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span:not(.kpi-icon) { display: block; color: var(--ink-2); font-size: 12px; }
.kpi small { display: block; color: var(--ink-3); font-size: 10.5px; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-panel { min-height: 260px; }

.bars { display: flex; flex-direction: column; gap: 11px; padding: 4px 16px 18px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(70px, 1.5fr) 62px; align-items: center; gap: 9px; }
.bar-label { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.bar-label span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bar-label small { color: var(--ink-3); font-size: 10.5px; white-space: nowrap; }
.bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: #edf1f2; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #149087, #0f766e); }
.bar-value { color: var(--ink-2); font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; }

.recent-list { display: flex; flex-direction: column; gap: 4px; padding: 2px 10px 12px; }

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
}

.recent-item:hover { background: var(--surface-soft); }
.recent-main { display: flex; flex-direction: column; min-width: 0; }
.recent-main strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.recent-main small, .recent-side small { color: var(--ink-3); font-size: 11px; }
.recent-side { display: flex; flex-direction: column; align-items: flex-end; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------ 抽屉 ------------------------------ */

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 32, 37, .34);
  opacity: 0;
  transition: opacity .18s;
}

.drawer-mask.is-open { opacity: 1; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: min(1120px, 96vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 36px rgba(20, 32, 37, .14);
  transform: translateX(100%);
  transition: transform .2s ease;
}

.drawer.is-open { transform: none; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 12px; }

.drawer-body { flex: 1; padding: 15px 18px 18px; overflow: auto; }

.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.detail-item { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.detail-item span { display: block; color: var(--ink-3); font-size: 10.5px; }
.detail-item strong { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 600; }

.mini-table { table-layout: fixed; min-width: 1060px; }
.mini-table td { font-size: 12px; }
.mini-table th { padding: 7px 9px; }

.notes-block { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.notes-block p { margin: 4px 0 0; color: var(--ink); font-size: 12.5px; line-height: 1.65; }

.source-line { display: flex; align-items: center; gap: 6px; margin-top: 14px; color: var(--ink-3); font-size: 11px; }
.source-line svg.lucide { width: 14px; height: 14px; }

.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.foot-spacer { flex: 1; }
.meta-grid-drawer { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 16px; }

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

.toast-wrap {
  position: fixed;
  left: calc(var(--sidebar-w) + 18px);
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  max-width: 360px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 10px 30px rgba(20, 32, 37, .14);
  color: var(--ink);
  font-size: 12.5px;
  animation: toast-in .18s ease;
}

.toast svg.lucide { color: var(--ok); }
.toast-error svg.lucide { color: var(--danger); }
.toast.is-out { opacity: 0; transform: translateY(5px); transition: opacity .4s, transform .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 20, 24, .74);
  opacity: 0;
  transition: opacity .18s;
}

.lightbox.is-open { opacity: 1; }
.lightbox img {
  max-width: min(760px, 92vw);
  max-height: 84vh;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.lightbox-close:hover { background: rgba(255, 255, 255, .24); color: #fff; }

/* ------------------------------ 内网共享版 ------------------------------ */

.shared-login {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 28, 33, .46);
  backdrop-filter: blur(5px);
}

.shared-login-card {
  width: min(380px, 94vw);
  padding: 26px 24px 20px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(10, 22, 27, .24);
}

.shared-login-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}

.shared-login-mark svg.lucide { width: 20px; height: 20px; }
.shared-login-card h1 { margin: 0; font-size: 19px; line-height: 1.3; }
.shared-login-card > p { margin: 5px 0 18px; color: var(--ink-2); font-size: 12px; }

.shared-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.shared-field span,
.shared-user-form label span { color: var(--ink-2); font-size: 11.5px; font-weight: 550; }

.shared-field input,
.shared-user-form input,
.shared-user-form select {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
}

.shared-field input:focus,
.shared-user-form input:focus,
.shared-user-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .1);
}

.shared-login-error {
  min-height: 18px;
  margin: 2px 0 8px;
  color: var(--danger);
  font-size: 12px;
}

.shared-login-submit { width: 100%; justify-content: center; }
.shared-login-foot { margin-top: 14px; color: var(--ink-3); font-size: 11px; text-align: center; }

.shared-userbar {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

.shared-user-name {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-user-actions { display: flex; flex-wrap: wrap; gap: 5px; }

.shared-modal {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 28, 33, .42);
}

.shared-modal-card {
  width: min(620px, 95vw);
  max-height: min(720px, 88vh);
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(10, 22, 27, .24);
}

.shared-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.shared-modal-head h2 { margin: 0; font-size: 15px; }
.shared-modal-body { max-height: calc(88vh - 62px); overflow: auto; padding: 16px; }

.shared-user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.shared-user-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.shared-user-list { display: flex; flex-direction: column; gap: 6px; }

.shared-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.shared-user-row span { display: flex; flex-direction: column; min-width: 0; }
.shared-user-row strong { font-size: 12.5px; }
.shared-user-row small { color: var(--ink-3); font-size: 11px; }
.shared-user-row em { color: var(--ink-2); font-size: 11.5px; font-style: normal; }
.shared-user-row-actions { flex-direction: row !important; align-items: center; gap: 8px; }

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

@media (max-width: 1180px) {
  .meta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mapping-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-strip, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .intake-top { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .search-box { width: 100%; order: 3; }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 12px 0 36px rgba(20, 32, 37, .14);
  }

  .app.nav-open .sidebar { transform: none; }

  .sidebar-mask {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: none;
    background: rgba(20, 32, 37, .3);
  }

  .app.nav-open .sidebar-mask { display: block; }
  .mobile-menu { display: inline-flex; }
  .content { padding: 14px 14px 32px; }
  .topbar { padding: 0 14px; }
  .toast-wrap { left: 14px; right: 14px; align-items: stretch; }
  .toast { max-width: none; }
  .meta-grid, .mapping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .crumb-sub { display: none; }
  .topbar-actions .btn span { display: none; }
  .stats-strip, .kpi-grid, .meta-grid, .mapping-grid { grid-template-columns: 1fr; }
  .toolbar-spacer { display: none; }
  .search-box { order: 0; width: 100%; flex: 1 1 100%; }
  .toolbar .select { order: 1; width: auto; min-width: 0; flex: 1 1 calc(50% - 4px); }
  #exportCsvBtn { order: 1; flex: 1 1 calc(50% - 4px); }
  .drawer-body { padding: 13px 13px 16px; }
  .drawer-head, .drawer-foot { padding-left: 13px; padding-right: 13px; }
  .detail-grid { grid-template-columns: 1fr; }
  .shared-user-form { grid-template-columns: 1fr; }
  .shared-user-form .btn { width: 100%; justify-content: center; }
}
