:root {
  --primary: #2563eb;
  --green: #059669;
  --red: #dc2626;
  --orange: #d97706;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

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

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover { background: #f1f5f9; }

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

.btn-primary:hover { background: #1d4ed8; }

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

.btn-secondary:hover { background: #eff6ff; }

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-compact {
  padding: 14px;
}

.panel-compact h2 {
  margin-bottom: 10px;
}

.panel h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.params-core {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  align-items: start;
}

.params-hint-bar {
  grid-column: 1 / -1;
  margin-top: -2px;
}

@media (max-width: 900px) {
  .params-core { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .params-core { grid-template-columns: 1fr; }
}

.params-more {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #f8fafc;
}

.params-more summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.params-more summary::-webkit-details-marker { display: none; }

.params-more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  align-items: start;
}

@media (max-width: 1100px) {
  .params-more-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .params-more-grid { grid-template-columns: 1fr; }
}

.params-more-group {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  min-height: 100%;
}

.params-more-group h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-compact { margin-bottom: 6px; }

.field-compact input,
.field-compact select {
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.param-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
  min-height: 1em;
}

.param-hint.warn { color: var(--orange); }

.field { margin-bottom: 12px; }

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
  color: var(--text);
}

.field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.field-check input { width: auto; min-height: auto; }
.field-check label { margin: 0; font-size: 0.9rem; color: var(--text); }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

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

th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
tbody tr.active { background: #eff6ff; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.num.warn { color: var(--orange); font-weight: 600; }

.row-sub {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
  white-space: normal;
  line-height: 1.35;
}

.compare-intro {
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 12px;
}

.compare-note {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 8px;
}

.compare-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.compare-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.compare-legend-hint {
  margin-left: auto;
  color: #94a3b8;
}

.compare-src {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 4px;
  vertical-align: middle;
}

.compare-src.src-high { background: var(--green); }
.compare-src.src-mid { background: #94a3b8; }
.compare-src.src-warn { background: var(--orange); }
.compare-src.src-unknown { background: #cbd5e1; }

.compare-table .compare-head-group {
  text-align: center;
  background: #e2e8f0;
  font-size: 0.72rem;
  border-bottom: 1px solid var(--border);
}

.compare-table .compare-head-secondary {
  background: #f1f5f9;
  color: #94a3b8;
}

.compare-table .compare-head-sub th {
  font-size: 0.72rem;
  font-weight: 500;
  background: #f8fafc;
}

.compare-table .compare-head-secondary + th,
.compare-table .compare-head-sub th:nth-child(n+8) {
  color: #94a3b8;
}

.compare-table td.compare-model {
  white-space: normal;
  min-width: 140px;
  max-width: 180px;
}

.compare-model-name {
  font-weight: 600;
  font-size: 0.84rem;
  line-height: 1.35;
}

.compare-model-sub {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

.compare-table td.compare-market {
  font-weight: 600;
  white-space: nowrap;
}

.compare-table td.compare-key {
  font-weight: 700;
  font-size: 0.9rem;
}

.compare-table td.compare-extra {
  color: #64748b;
  font-size: 0.82rem;
}

.compare-table td.compare-verdict {
  text-align: center;
}

.verdict-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.verdict-pill.ok {
  background: #ecfdf5;
  color: var(--green);
}

.verdict-pill.warn {
  background: #fffbeb;
  color: var(--orange);
}

.verdict-pill.bad {
  background: #fef2f2;
  color: var(--red);
}

.compare-panel .table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
}

.compare-panel tbody tr.active {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.tag-legend {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--muted);
  margin: 0 2px;
}

.tag-legend.positive { background: #ecfdf5; color: var(--green); }
.tag-legend.warn { background: #fffbeb; color: var(--orange); }

.tag-mini {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 600;
}

.tag-mini.positive { background: #ecfdf5; color: var(--green); }
.tag-mini.warn { background: #fffbeb; color: var(--orange); }

.compare-table td.num {
  white-space: normal;
  vertical-align: top;
}

.compare-table td.num > div:first-child {
  font-weight: 600;
}

.verdict {
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.verdict.ok { background: #ecfdf5; border: 1px solid #a7f3d0; }
.verdict.late { background: #fffbeb; border: 1px solid #fde68a; }
.verdict.no_recovery { background: #fef2f2; border: 1px solid #fecaca; }

.verdict h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.verdict.ok h3 { color: var(--green); }
.verdict.late h3 { color: var(--orange); }
.verdict.no_recovery h3 { color: var(--red); }

.gap-hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 8px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.metric {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.metric-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 2px;
}

.metric-hint {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
  margin-bottom: 6px;
}

.results-caliber-intro {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #334155;
}

.results-caliber-intro p {
  margin: 0;
}

.results-caliber-intro p + p {
  margin-top: 8px;
}

.caliber-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  margin-bottom: 16px;
  align-items: stretch;
}

.caliber-col {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.caliber-dcf {
  background: #eff6ff;
  border-color: #93c5fd;
}

.caliber-conservative {
  background: #fffbeb;
  border-color: #fde68a;
}

.caliber-col-head h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: #1e293b;
}

.caliber-col-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.4;
}

.caliber-rows {
  margin: 0;
  flex: 1;
}

.caliber-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.caliber-row:last-child {
  border-bottom: none;
}

.caliber-row dt {
  font-size: 0.78rem;
  color: #475569;
  font-weight: 500;
  margin: 0;
}

.caliber-v {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  margin: 0;
}

.caliber-v.positive { color: var(--green); }
.caliber-v.negative { color: var(--red); }
.caliber-v.warn { color: var(--orange); }

.caliber-col-verdict {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.caliber-col-verdict.ok {
  background: #ecfdf5;
  color: var(--green);
  border: 1px solid #a7f3d0;
}

.caliber-col-verdict.late {
  background: #fffbeb;
  color: var(--orange);
  border: 1px solid #fde68a;
}

.caliber-col-verdict.no_recovery {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
}

.caliber-col-verdict.warn {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.caliber-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.caliber-divider span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.caliber-divergence {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #713f12;
}

.caliber-divergence strong {
  display: block;
  margin-bottom: 4px;
  color: #854d0e;
}

@media (max-width: 768px) {
  .caliber-compare {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .caliber-divider {
    padding: 0;
  }

  .caliber-divider span {
    width: 100%;
    height: auto;
    border-radius: 6px;
    padding: 4px 0;
  }
}

.metrics-group-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.metrics-group-conservative {
  color: #b45309;
  border-bottom-color: #fde68a;
}

.metrics-conservative .metric {
  background: #fffbeb;
  border-color: #fde68a;
}

.cost-hint {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.metric-value.warn { color: var(--orange); }

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.charts-inline {
  margin-top: 16px;
}

@media (max-width: 768px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.chart-box canvas {
  width: 100%;
  height: 260px;
  display: block;
}

.ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .ref-grid { grid-template-columns: 1fr; }
}

.ref-block h3 {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.ref-block ul {
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--muted);
}

.ref-block li { margin-bottom: 4px; }

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.post-contract-metrics {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.hidden { display: none !important; }

.positive { color: var(--green); }
.negative { color: var(--red); }

.advanced-params summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 12px;
  list-style: none;
}

.advanced-params summary::-webkit-details-marker { display: none; }

.cost-breakdown {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.panel-bom {
  background: #fff;
}

/* —— 左侧 BOM 侧边栏 —— */
.bom-sidebar {
  --bom-drawer-width: min(920px, 96vw);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  height: 100vh;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}

.bom-sidebar.open {
  pointer-events: auto;
}

.bom-tab {
  position: absolute;
  top: 42%;
  left: 0;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-height: 96px;
  padding: 12px 6px;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--surface);
  color: #059669;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06);
  transition: background 0.15s, color 0.15s, left 0.25s ease;
}

.bom-tab:hover {
  background: #ecfdf5;
}

.bom-tab-text {
  writing-mode: vertical-rl;
  letter-spacing: 0.12em;
}

.bom-sidebar.open .bom-tab {
  left: var(--bom-drawer-width);
  border-left: 1px solid var(--border);
  color: var(--muted);
}

.bom-drawer {
  width: var(--bom-drawer-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  pointer-events: auto;
}

.bom-sidebar.open .bom-drawer {
  transform: translateX(0);
}

.bom-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
  flex-shrink: 0;
}

.bom-drawer-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

.bom-close {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.bom-close:hover {
  background: #f1f5f9;
  color: var(--text);
}

.bom-drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.bom-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 0 16px 16px;
  min-height: 0;
}

.bom-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1280px) {
  .bom-sidebar {
    --bom-drawer-width: min(980px, calc(100vw - 40px));
  }
}

.bom-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bom-panel-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

.bom-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bom-summary-bar {
  font-size: 0.8rem;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 16px 12px;
  flex-shrink: 0;
  line-height: 1.5;
  word-break: break-word;
}

.bom-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.bom-table col.col-part { width: 15%; }
.bom-table col.col-spec { width: 34%; }
.bom-table col.col-qty { width: 9%; }
.bom-table col.col-price { width: 14%; }
.bom-table col.col-sub { width: 14%; }
.bom-table col.col-src { width: 14%; }

.bom-table th,
.bom-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
}

.bom-table th {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.bom-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bom-table tfoot td {
  font-weight: 600;
  border-bottom: none;
  border-top: 2px solid var(--border);
  white-space: nowrap;
  overflow: visible;
}

.bom-table tfoot td:first-child {
  white-space: normal;
}

.bom-spec {
  color: var(--muted);
  font-size: 0.78rem;
}

.bom-price-input {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bom-source {
  font-size: 0.78rem;
  color: var(--muted);
}

.bom-source a {
  color: var(--primary);
}

.bom-cat {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1.2;
}

.bom-part {
  min-width: 0;
}

.bom-part-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.bom-row-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.bom-act {
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}

.bom-act:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

.bom-act-rm:hover {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fee2e2;
}

.bom-spec-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8125rem;
  background: #fff;
}

.bom-spec-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.bom-part-name {
  font-weight: 500;
  color: var(--text);
  min-width: 0;
  flex: 1;
}

.bom-qty-input {
  width: 100%;
  max-width: 56px;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-size: 0.875rem;
}

.bom-cat-gpu {
  background: #eff6ff;
  color: var(--primary);
}

.bom-cat-cpu {
  background: #fef3c7;
  color: #b45309;
}

.bom-cat-memory {
  background: #ecfdf5;
  color: #059669;
}

.bom-cat-storage {
  background: #f0f9ff;
  color: #0369a1;
}

.bom-cat-motherboard {
  background: #fdf4ff;
  color: #a21caf;
}

.bom-cat-network {
  background: #eef2ff;
  color: #4338ca;
}

.bom-cat-power {
  background: #fff7ed;
  color: #c2410c;
}

.bom-cat-chassis {
  background: #f1f5f9;
  color: #475569;
}

.bom-cat-platform {
  background: #f5f3ff;
  color: #6d28d9;
}

.bom-custom-tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fffbeb;
  color: var(--orange);
}

#bomVsCatalog.ok { color: var(--green); }
#bomVsCatalog.warn { color: var(--orange); }

.bom-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 12px !important;
  font-size: 0.85rem;
}

.cost-breakdown-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}

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

.cost-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.cost-item-total {
  border-color: var(--primary);
  background: #eff6ff;
}

.cost-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.cost-value {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cost-value.positive { color: var(--green); }
.cost-value.warn { color: var(--orange); }

.cost-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.cost-tag.ok { background: #ecfdf5; color: var(--green); }
.cost-tag.late { background: #fffbeb; color: var(--orange); }

.metrics-primary {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .metrics-primary { grid-template-columns: 1fr; }
}

.metric-highlight {
  border-color: var(--primary);
  background: #eff6ff;
}

.metric-highlight .metric-value {
  font-size: 1.2rem;
}

.reference-panel {
  background: #f8fafc;
}

.reference-dynamic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ref-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.ref-card h3 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ref-card dl {
  font-size: 0.85rem;
}

.ref-card dt {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 6px;
}

.ref-card dt:first-child { margin-top: 0; }

.ref-card dd {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: 0;
}

.ref-card dd.positive { color: var(--green); }
.ref-card dd.warn { color: var(--orange); }
.ref-card dd.negative { color: var(--red); }

.reference-appendix summary {
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 8px;
}

abbr[title] {
  text-decoration: underline dotted;
  text-decoration-color: var(--muted);
  cursor: help;
}

.glossary-backdrop,
.side-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(15, 23, 42, 0.25);
}

.glossary-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 200;
  height: 100vh;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}

.glossary-sidebar.open {
  pointer-events: auto;
}

.glossary-tab {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-height: 88px;
  padding: 12px 6px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.06);
  transition: background 0.15s, color 0.15s;
}

.glossary-tab:hover {
  background: #eff6ff;
}

.glossary-tab-text {
  writing-mode: vertical-rl;
  letter-spacing: 0.12em;
}

.glossary-sidebar.open .glossary-tab {
  right: min(360px, 92vw);
  border-right: 1px solid var(--border);
  border-radius: 8px 0 0 8px;
  color: var(--muted);
}

.glossary-drawer {
  width: min(360px, 92vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  pointer-events: auto;
}

.glossary-sidebar.open .glossary-drawer {
  transform: translateX(0);
}

.glossary-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
  flex-shrink: 0;
}

.glossary-drawer-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

.glossary-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.glossary-close:hover {
  background: #f1f5f9;
  color: var(--text);
}

.glossary-intro {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.glossary-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glossary-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.glossary-item h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.glossary-item .term-en {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
}

.glossary-item p {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.glossary-item strong {
  color: var(--text);
  font-weight: 600;
}
