/* ============================================================
   元器件选型系统 · HTML 功能原型 样式
   ============================================================ */
:root {
  --bg: #f1f4f9;
  --panel: #ffffff;
  --sidebar: #1e2a44;
  --sidebar-2: #172036;
  --sidebar-text: #c7d2e4;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #e8f0fe;
  --text: #1f2937;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #e5e7eb;
  --border-2: #d1d5db;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --orange: #ea580c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd5e1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aeb9c9; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 布局骨架 ---------------- */
#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 214px;
  flex: 0 0 214px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #fff; font-size: 14px; letter-spacing: .5px; }
.brand-text span { font-size: 11px; color: #8fa3c4; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--sidebar-text); font-size: 13.5px; text-align: left;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { opacity: .85; flex: 0 0 auto; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .35); }
.nav-item.active svg { opacity: 1; }
.nav-dot {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, .25);
}

.sidebar-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .08); }
.hint { font-size: 11px; color: #7f92b2; line-height: 1.7; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 64px; flex: 0 0 64px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  gap: 16px;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 17px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.topbar-title p { font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 640px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.content { flex: 1; overflow: auto; padding: 20px 22px 40px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-2); border-radius: 8px;
  background: #fff; color: var(--text);
  font-size: 13px; font-weight: 500; line-height: 1;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #b6c2d4; background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { flex: 0 0 auto; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .28); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { background: #fff; border-color: #f3c1c1; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #eaa; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #eef2f7; border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 30px; height: 30px; padding: 0; border-radius: 7px; }
.btn-link { border: 0; background: transparent; color: var(--accent); padding: 0 4px; height: 24px; font-size: 12.5px; }
.btn-link:hover { text-decoration: underline; background: transparent; }
.btn-link.danger { color: var(--danger); }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: #4b5563; font-weight: 500; }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-2); border-radius: 8px;
  background: #fff; outline: none; font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 66px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .1); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.error-text { font-size: 12px; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-row-full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-box .input { padding-left: 32px; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-row .select { width: auto; min-width: 116px; }

/* ---------------- 卡片 / 工具栏 ---------------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.card-body { padding: 16px; }
.card-body.no-pad { padding: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; color: #475569;
  font-size: 12px; font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:hover { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table .nowrap { white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-strong { font-weight: 600; color: #111827; }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cell-ellipsis { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 8px; border: 1px solid var(--border);
  object-fit: cover; background: #f1f5f9;
}
.thumb-lg { width: 100%; max-width: 220px; height: 220px; border-radius: 12px; object-fit: contain; background: #f8fafc; border: 1px solid var(--border); }
.thumb-sm { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); object-fit: cover; background: #f1f5f9; }
.row-actions { display: flex; gap: 2px; white-space: nowrap; }
.link-url { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }

/* ---------------- 徽标 / 状态 ---------------- */
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-me { background: #fff1e6; color: #c2410c; }
.badge-el { background: var(--accent-soft); color: #1d4ed8; }
.badge-soft { background: #f1f5f9; color: #475569; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 5px; font-size: 11px; background: #eef2f7; color: #64748b; }
.tag-p0 { background: var(--accent-soft); color: #1d4ed8; }
.tag-p1 { background: var(--warn-soft); color: #b45309; }
.tag-p2 { background: #f3e8ff; color: #7e22ce; }
.status-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.status-ok { color: var(--success); }
.status-warn { color: var(--warn); }
.status-err { color: var(--danger); }
.dot-unsaved { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; margin-right: 5px; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { font-size: 12px; color: var(--muted); }
.pager-btns { display: flex; align-items: center; gap: 4px; }
.pager-btns button {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--border-2); border-radius: 7px; background: #fff;
  font-size: 12.5px; color: #4b5563;
}
.pager-btns button:hover:not(:disabled) { border-color: #b6c2d4; background: #f8fafc; }
.pager-btns button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager-btns button:disabled { opacity: .45; cursor: not-allowed; }
.pager-size { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.pager-size .select { width: auto; height: 30px; }

/* ---------------- 空状态 ---------------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 52px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #94a3b8; margin-bottom: 14px; }
.empty-title { font-size: 14px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.empty-sub { font-size: 12.5px; color: var(--muted-2); margin-bottom: 16px; max-width: 420px; }

/* ---------------- 弹窗 ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .14s ease;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 560px; max-width: 100%; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  animation: popIn .16s ease;
}
.modal-lg { width: 760px; }
.modal-xl { width: 980px; }
.modal-sm { width: 420px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 12px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-close { border: 0; background: #f1f5f9; color: #64748b; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.modal-close:hover { background: #e2e8f0; color: #0f172a; }
.modal-body { padding: 8px 22px 20px; overflow: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: #fafbfd; border-radius: 0 0 14px 14px; }
.modal-foot .left { margin-right: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------------- Toast ---------------- */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  background: #111827; color: #fff; font-size: 13px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
  animation: toastIn .2s ease;
  max-width: 560px;
}
.toast-success { background: #065f46; }
.toast-error { background: #991b1b; }
.toast-info { background: #1e3a8a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------- 选型工作台 ---------------- */
.workbench { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.workbench-side { position: sticky; top: 0; }
.picker-panel { display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.picker-toolbar { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.picker-list { overflow: auto; flex: 1; padding: 6px; }
.picker-item {
  display: flex; gap: 10px; align-items: center;
  padding: 8px; border-radius: 9px; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  cursor: default;
}
.picker-item:hover { background: #f8fbff; border-color: #e3ebf7; }
.picker-item-info { flex: 1; min-width: 0; }
.picker-item-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.picker-item-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-add { flex: 0 0 auto; }
.sel-panel { min-width: 0; }
.sel-name-input { width: 230px; }
.sel-list-wrap { overflow: auto; max-height: calc(100vh - 330px); }
.sel-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sel-table th {
  position: sticky; top: 0; z-index: 2; background: #f8fafc; color: #475569;
  font-size: 11.5px; font-weight: 600; text-align: left; padding: 8px 8px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.sel-table td { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.sel-table tr:hover td { background: #f8fbff; }
.sel-table .col-name { max-width: 150px; }
.sel-table .col-name .cell-strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qty-input { width: 66px; height: 28px; padding: 0 6px; text-align: right; border: 1px solid var(--border-2); border-radius: 6px; font-size: 12.5px; }
.qty-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.remark-input { width: 100%; min-width: 80px; height: 28px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; font-size: 12.5px; background: transparent; }
.remark-input:hover { border-color: var(--border); background: #fff; }
.remark-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .1); }
.money-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { display: flex; gap: 28px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.kpi { display: flex; flex-direction: column; gap: 1px; }
.kpi-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-value.accent { color: var(--accent); }
.kpi-label { font-size: 11.5px; color: var(--muted); }
.totals .spacer { flex: 1; }

/* ---------------- 设置页 ---------------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 880px; }
.form-section { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px 18px; align-items: start; }
.form-section > .label { font-size: 13px; color: #374151; font-weight: 500; padding-top: 9px; }
.form-section .desc { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.settings-note { font-size: 12px; color: var(--muted); }
.radio-row { display: flex; gap: 18px; padding-top: 8px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.danger-zone { border-color: #f3d4d4 !important; }
.danger-zone .card-head { border-bottom-color: #fbe3e3; }
.danger-zone .card-title { color: #b91c1c; }

/* ---------------- 原型说明 ---------------- */
.about-page { max-width: 940px; display: flex; flex-direction: column; gap: 16px; }
.doc-block h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.doc-block p { font-size: 13px; color: #374151; margin-bottom: 8px; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.feature-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 6px 0; }
.feature-item .tag { flex: 0 0 auto; margin-top: 1px; }
.confirm-list { margin: 0; padding-left: 18px; font-size: 13px; color: #374151; }
.confirm-list li { margin: 6px 0; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.65; }
.callout-warn { background: var(--warn-soft); color: #92400e; border: 1px solid #fde68a; }
.callout-info { background: var(--accent-soft); color: #1e40af; border: 1px solid #dbeafe; }
.callout svg { flex: 0 0 auto; margin-top: 1px; }

/* ---------------- 导入向导 ---------------- */
.import-steps { display: flex; flex-direction: column; gap: 16px; }
.step-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.step-no { width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-name { font-size: 12.5px; color: var(--muted); }
.preview-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.summary-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 7px; font-size: 12px; background: #f1f5f9; color: #475569; }
.summary-pill strong { font-size: 13px; }
.summary-ok { background: var(--success-soft); color: #047857; }
.summary-warn { background: var(--warn-soft); color: #b45309; }
.summary-err { background: var(--danger-soft); color: #b91c1c; }
.import-preview-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table th { position: sticky; top: 0; background: #f8fafc; padding: 7px 10px; text-align: left; font-size: 11.5px; color: #475569; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.mini-table td { padding: 6px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.mini-table .status-ok, .mini-table .status-warn, .mini-table .status-err { white-space: nowrap; font-size: 12px; }
.mini-table .select { height: 28px; font-size: 12px; padding: 0 6px; }
.mini-table .input { height: 28px; font-size: 12px; }
.match-actions { display: flex; gap: 6px; align-items: center; }

/* ---------------- 详情 / 图片选择 ---------------- */
.detail-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; }
.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eef2f7; font-size: 13px; }
.detail-row:last-child { border-bottom: 0; }
.detail-label { color: var(--muted); font-size: 12.5px; }
.img-picker { display: flex; gap: 14px; align-items: flex-start; }
.img-preview-box { width: 108px; height: 108px; border: 1px dashed var(--border-2); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #fafbfd; overflow: hidden; flex: 0 0 auto; }
.img-preview-box img { width: 100%; height: 100%; object-fit: contain; }
.img-picker-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.img-picker-tip { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------------- 其他 ---------------- */
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; color: #475569; background: #f8fafc; }
.loading { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.spinner { width: 16px; height: 16px; border: 2px solid #dbeafe; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 页面切换过渡 */
.page-enter { animation: pageIn .18s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 窄屏适配（原型以桌面为主） */
@media (max-width: 1180px) {
  .workbench { grid-template-columns: 330px minmax(0, 1fr); }
  .feature-list { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { width: 180px; flex: 0 0 180px; }
  .workbench { grid-template-columns: 1fr; }
  .workbench-side { position: static; }
  .picker-panel { max-height: 460px; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-section { grid-template-columns: 1fr; }
  .form-section > .label { padding-top: 0; }
}


/* ============================================================
   元器件库：左侧目录 + 右侧参数
   ============================================================ */
.lib-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.lib-tree-panel { display: flex; flex-direction: column; max-height: calc(100vh - 150px); overflow: hidden; }
.lib-tree-search { padding: 0 12px 10px; }
.lib-tree { overflow: auto; flex: 1; padding: 2px 8px 8px; }
.lib-tree-foot { padding: 8px 14px; border-top: 1px solid var(--border); background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); }
.tree-group-row, .tree-cat-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: #334155; }
.tree-group-row { font-weight: 600; margin-top: 4px; }
.tree-cat-row { padding-left: 20px; color: #475569; font-size: 12.5px; }
.tree-group-row:hover, .tree-cat-row:hover { background: #f1f7ff; }
.tree-arrow { width: 14px; color: #94a3b8; font-size: 11px; text-align: center; }
.tree-group-name { flex: 1; }
.tree-count { margin-left: auto; font-size: 11px; color: #64748b; background: #f1f5f9; border-radius: 10px; padding: 0 7px; }
.tree-comp-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 34px; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: #374151; }
.tree-comp-row:hover { background: #f1f7ff; }
.tree-comp-row.active { background: var(--accent-soft); color: #1d4ed8; font-weight: 600; }
.tree-comp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-comp-model { color: #94a3b8; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 96px; }
.lib-detail-panel { min-height: calc(100vh - 150px); }
.lib-detail-inner { padding: 22px; }
.detail-head { display: flex; gap: 20px; align-items: flex-start; }
.detail-img-big { width: 200px; height: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; flex: 0 0 auto; }
.detail-name { font-size: 19px; font-weight: 700; color: #111827; }
.detail-model { font-size: 14px; color: #334155; margin-top: 6px; font-family: "Consolas", "Courier New", monospace; }
.detail-meta { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.8; }
.detail-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.detail-fields { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 6px; }
.detail-field-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px dashed #eef2f7; font-size: 13px; }
.field-label { color: var(--muted); font-size: 12.5px; }

/* ============================================================
   选型工作台：元器件目录树
   ============================================================ */
.picker-dir { padding: 0 12px 8px; }
.dir-toggle { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 8px; background: #fff; font-size: 12.5px; color: #374151; }
.dir-toggle:hover { border-color: #b6c2d4; background: #f8fafc; }
.dir-toggle-label { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }
.dir-toggle-current { font-weight: 600; color: #1d4ed8; flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-arrow { color: #94a3b8; font-size: 11px; transition: transform .15s; }
.dir-toggle.open .dir-arrow { transform: rotate(180deg); }
.dir-tree { margin-top: 6px; border: 1px solid var(--border); border-radius: 9px; max-height: 260px; overflow: auto; padding: 4px; background: #fafbfd; }
.dir-row { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 6px; font-size: 12.5px; color: #374151; cursor: pointer; }
.dir-row:hover { background: #eef4ff; }
.dir-row.active { background: var(--accent-soft); color: #1d4ed8; font-weight: 600; }
.dir-l1 { font-weight: 600; color: #334155; margin-top: 2px; }
.dir-l2 { padding-left: 22px; color: #475569; }
.dir-count { margin-left: auto; font-size: 11px; color: #64748b; background: #f1f5f9; border-radius: 10px; padding: 0 7px; }

@media (max-width: 960px) {
  .lib-layout { grid-template-columns: 1fr; }
  .lib-tree-panel { max-height: 420px; }
  .detail-head { flex-direction: column; }
}


/* ============================================================
   元器件库：右侧参数编辑器
   ============================================================ */
.editor-head { display: flex; gap: 20px; align-items: flex-start; }
.img-preview-lg { width: 180px; height: 180px; }
.editor-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.editor-name { font-size: 17px; font-weight: 700; height: 40px; max-width: 430px; }
.editor-meta { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.7; }

/* 参数编辑：底部固定操作栏 */
.lib-detail-panel { display: flex; flex-direction: column; }
.lib-detail-inner { display: flex; flex-direction: column; flex: 1; }
.editor-foot {
  margin-top: auto;
  padding-top: 16px;
  margin-bottom: 2px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.editor-foot .spacer { flex: 1; }

@media (max-width: 960px) {
  .editor-head { flex-direction: column; }
  .editor-foot { margin-top: 16px; }
}

