:root {
  /* DESIGN.md tokens — Direction A: Obsidian Cockpit (Dark Only) */
  --bg: #0c0c0d;
  --panel: #121213;
  --card: #19191b;
  --card-elevated: #1f1f21;
  --surface-hover: #242428;
  --border: #262628;
  --panel-stroke: #222224;
  --hairline: #2e2e33;

  --text-primary: #ededed;
  --text-secondary: #b8b8be;
  --text-muted: #8f8f8f;
  --text-subtle: #636369;

  --primary: #ededed;
  --primary-hover: #ffffff;
  --primary-fg: #121213;

  --positive: #34d399;
  --positive-bg: #10261e;
  --warning: #f59e0b;
  --warning-bg: #261e10;
  --danger: #f87171;
  --danger-bg: #281517;
  --focus-ring: #6b6b70;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font: 14px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text-primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }

.shell {
  max-width: 1420px;
  margin: 0 auto;
  padding: 20px 24px 104px;
}

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f4f4f5, #d4d4d8);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--hairline); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary {
  background: linear-gradient(180deg, #f4f4f5, #e4e4e7);
  color: var(--primary-fg);
  border-color: #ffffff;
  font-weight: 600;
}
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.btn.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.btn-ghost:hover:not(:disabled) { background: var(--card); color: var(--text-primary); }

/* Direct filter cockpit bar (2-tier structured) */
.filter-bar {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
  overflow: hidden;
}
.fb-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fb-primary {
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-stroke);
  flex-wrap: wrap;
}
.fb-secondary {
  padding: 7px 14px;
  background: rgba(0, 0, 0, 0.22);
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.fb-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.fb-sep {
  width: 1px;
  height: 16px;
  background: var(--panel-stroke);
}
.fb-dot { color: var(--text-subtle); font-size: 12px; }
.fb-muted-lbl { font-size: 11.5px; color: var(--text-muted); }

.cockpit-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.cockpit-btn:hover { background: var(--surface-hover); border-color: #3f3f46; }
.cockpit-btn .chev { font-size: 10px; color: var(--text-muted); margin-left: 1px; }
.cockpit-btn.primary {
  background: linear-gradient(180deg, #f4f4f5, #e4e4e7);
  color: var(--primary-fg);
  border-color: #ffffff;
  font-weight: 600;
}
.cockpit-btn.primary:hover { background: var(--primary-hover); }
.cockpit-btn.filter-active {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.38);
  color: var(--text-primary);
}
.cockpit-btn.filter-exclude {
  background: var(--warning-bg);
  border-color: rgba(245, 158, 11, 0.38);
  color: #fbbf24;
}
.my-car-trigger .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
}
.my-car-trigger.filter-active .status-dot {
  background: var(--positive);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}
.my-car-trigger .cockpit-btn-lbl { color: var(--text-muted); font-weight: 500; }
.my-car-trigger.filter-active .cockpit-btn-lbl { color: var(--positive); }
.my-car-trigger .cockpit-btn-val { font-weight: 600; color: var(--text-primary); }

.inline-input-group {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  gap: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: var(--card);
  transition: border-color 0.14s ease;
}
.inline-input-group:hover { border-color: #3f3f46; }
.inline-input-group:focus-within,
.inline-search:focus-within,
.inline-km:focus-within {
  border-color: var(--text-secondary);
  box-shadow: 0 0 0 1px rgba(237, 237, 237, 0.25);
}
.inline-input:focus-visible,
.inline-search-input:focus-visible,
.inline-km-input:focus-visible {
  outline: none;
}
.inline-input-group label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}
.inline-input {
  width: 50px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  outline: none;
  padding: 0;
}
.inline-input::placeholder { color: var(--text-subtle); font-weight: 400; }
.inline-unit { font-size: 11.5px; color: var(--text-subtle); white-space: nowrap; }

.inline-search {
  display: flex;
  align-items: center;
  flex: 1 1 180px;
  min-width: 150px;
  max-width: 300px;
  height: 36px;
  padding: 0 10px;
  gap: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: var(--card);
  transition: border-color 0.14s ease;
}
.inline-search:hover { border-color: #3f3f46; }
.inline-search:focus-within { border-color: var(--text-secondary); }
.search-ico { font-size: 14px; color: var(--text-subtle); line-height: 1; }
.inline-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
}
.inline-search-input::placeholder { color: var(--text-subtle); }

.inline-select {
  height: 28px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--panel-stroke);
  background: var(--card);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}
.inline-select:hover { border-color: var(--hairline); }
.inline-km {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--panel-stroke);
  background: var(--card);
  font-size: 11.5px;
  color: var(--text-muted);
}
.inline-km:hover { border-color: var(--hairline); }
.inline-km-input {
  width: 36px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  outline: none;
  padding: 0;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.field-sm { width: 98px; }
.field-search { width: 158px; }
.filter-spacer { flex: 1; min-width: 8px; }

.input {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
}
.input:hover { border-color: #3f3f46; }
.input-compact { min-height: 32px; padding: 4px 8px; width: auto; }

.seg {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 2px;
  min-height: 36px;
}
.seg.seg-sm {
  min-height: 28px;
  border-radius: 8px;
  border-color: var(--panel-stroke);
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.seg.seg-sm .seg-btn {
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.on {
  background: #2c2c31;
  color: var(--text-primary);
  font-weight: 600;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.toggle-chip.toggle-chip-sm {
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 8px;
  border-color: var(--panel-stroke);
  font-size: 12px;
}
.toggle-chip[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--hairline);
  color: var(--text-primary);
}
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: rgba(18, 18, 19, 0.14);
  font-size: 11px;
}

/* Config panel */
.config-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px;
  margin-bottom: 20px;
}
.config-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--panel-stroke);
}
.config-head h2 { margin: 0 0 4px; font-size: 16px; }
.config-head p { margin: 0; font-size: 12.5px; }
.config-head-actions { display: flex; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; }
.config-grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}
.config-col-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.vehicle-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.subblock-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* Brand & brand-group filter panel */
.btn.filter-active {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--positive);
}
.btn.filter-exclude {
  background: var(--warning-bg);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
.brands-section + .brands-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-stroke);
}
.brands-section h3 {
  margin: 0 0 10px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.brand-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.brand-group-chip {
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.brand-group-chip:hover { background: var(--surface-hover); border-color: var(--hairline); }
.brand-group-chip.on {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.45);
}
.brand-group-chip.on-exclude {
  background: var(--warning-bg);
  border-color: rgba(245, 158, 11, 0.45);
}
.bg-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.bg-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.brand-group-chip.on .bg-name { color: var(--positive); }
.brand-group-chip.on-exclude .bg-name { color: #fbbf24; }
.bg-cnt { font-size: 11px; color: var(--text-muted); }
.bg-sub { font-size: 11px; color: var(--text-muted); line-height: 1.35; }

.brand-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.brand-chip:hover { background: var(--surface-hover); color: var(--text-primary); }
.brand-chip.on {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--positive);
  font-weight: 600;
}
.brand-chip.via-group {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.25);
  color: #a7f3d0;
}
.brand-chip.on-exclude {
  background: var(--warning-bg);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  font-weight: 600;
}
.brand-chip.via-group-exclude {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fde68a;
}

.brand-ratings-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.brand-ratings-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.brand-ratings-head p {
  margin: 4px 0 0;
  font-size: 12px;
  max-width: 760px;
}
.brand-ratings-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.brand-ratings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 8px;
}
.brand-rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
}
.brand-rate-row.is-rated {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.05);
}
.br-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.br-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.br-meta-val {
  font-size: 11px;
  color: var(--text-muted);
}
.br-meta-val.is-custom {
  color: var(--positive);
}
.w-btn.on-inherited {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.35);
  color: #a7f3d0;
}
.drawer-rate-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.drawer-rate-lbl {
  font-size: 11.5px;
  color: var(--text-muted);
}
.feat-cell.has-note > span:first-child {
  text-decoration: underline dotted rgba(161, 161, 170, 0.5);
  text-underline-offset: 2px;
  cursor: help;
}
.config-block {
  background: var(--card);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.config-block h3 {
  margin: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.scenario-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.ctrl-input-wrap { display: inline-flex; align-items: center; gap: 8px; }
.ctrl-input-wrap input[type="range"] { width: 96px; accent-color: var(--primary); }
.ctrl-input-wrap output { min-width: 44px; text-align: right; color: var(--text-primary); font-size: 12px; }
.switch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.switch-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}
.switch-item input { margin-top: 3px; accent-color: var(--positive); }

.criteria-list { display: flex; flex-direction: column; gap: 7px; }
.crit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--panel-stroke);
}
.crit-row:last-child { border-bottom: none; }
.crit-name { font-size: 12.5px; color: var(--text-primary); }
.crit-controls { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.w-group {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 1px;
}
.w-filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 136px;
  height: 26px;
  border-radius: 7px;
  border: 1px dashed var(--border-strong);
  background: var(--panel);
  color: var(--text-subtle);
  font-size: 11px;
  letter-spacing: 0.01em;
  user-select: none;
  cursor: help;
}
.w-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-subtle);
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
}
.w-btn:hover { color: var(--text-primary); }
.w-btn.on { background: #2c2c31; color: var(--text-primary); font-weight: 700; }
.req-btn {
  height: 24px;
  min-width: 74px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  cursor: pointer;
}
.req-btn.on {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--positive);
  font-weight: 600;
}
.thresh-box {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: 74px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.thresh-box:focus-within {
  border-color: var(--text-secondary);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.thresh-box.on:focus-within {
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.18);
}
.thresh-box.on {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--positive);
}
.thresh-op {
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  opacity: 0.85;
}
.thresh-input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 11px;
  text-align: right;
  padding: 0;
  outline: none;
}
.thresh-input:focus,
.thresh-input:focus-visible {
  outline: none;
  box-shadow: none;
}
.thresh-box.on .thresh-input {
  color: var(--positive);
  font-weight: 600;
}
.thresh-input::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
  font-weight: 400;
}

/* Section header & Top-3 Podium */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.status-meta { font-size: 12px; color: var(--text-muted); }

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.skeleton-card {
  height: 280px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
}
.podium-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.35), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}
.podium-card.rank-1 {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, #1e1e22, #171719);
}
.p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.rank-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.score-box { text-align: right; line-height: 1; }
.score-val { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
.score-sub { font-size: 11px; color: var(--text-subtle); }

.p-title {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gen-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-stroke);
  color: var(--text-secondary);
  vertical-align: 1px;
  white-space: nowrap;
}
.p-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-md);
}
.kpi-grid > div { min-width: 0; }
.kpi-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.kpi-val { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.kpi-hint {
  font-size: 11px;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rating-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  font-size: 11.5px;
}
.rating-star { color: #fbbf24; font-weight: 600; }
.rating-sources { color: var(--text-muted); font-size: 11px; text-align: right; }

.drawer-ratings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.review-digest {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  line-height: 1.32;
  color: var(--text-muted);
  cursor: help;
}
.review-digest .rd-pro,
.review-digest .rd-con {
  display: flex;
  gap: 5px;
  align-items: flex-start;
}
.review-digest .rd-pro span:last-child,
.review-digest .rd-con span:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.review-digest .rd-pro .rd-sign { color: var(--positive); font-weight: 700; flex: 0 0 auto; }
.review-digest .rd-con .rd-sign { color: var(--warning); font-weight: 700; flex: 0 0 auto; }

.ft-digest {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11.5px;
  line-height: 1.35;
  margin: 4px 0;
}
.ft-digest .ft-pro { color: #86efac; }
.ft-digest .ft-con { color: #fcd34d; }

.drawer-pros-cons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.dpc-col {
  padding: 9px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-stroke);
  background: var(--panel);
}
.dpc-col.dpc-pros {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.05);
}
.dpc-col.dpc-cons {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.05);
}
.dpc-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.dpc-pros .dpc-head { color: var(--positive); }
.dpc-cons .dpc-head { color: var(--warning); }
.dpc-col ul {
  margin: 0;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  line-height: 1.38;
  color: var(--text);
}
@media (max-width: 600px) {
  .drawer-pros-cons { grid-template-columns: 1fr; }
}
.dr-rate-card {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  text-decoration: none;
}
a.dr-rate-card:hover { border-color: var(--hairline); background: #17171a; }
.dr-rate-name { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.dr-rate-val { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.spec-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
}
.spec-lbl { font-size: 11px; color: var(--text-muted); }
.spec-val { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.help-dot:hover { color: var(--text-primary); border-color: var(--text-muted); }

.top-crit-box {
  border-top: 1px solid var(--panel-stroke);
  padding-top: 10px;
}
.top-crit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.top-crit-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.inline-link-btn,
.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-family: inherit;
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 2px;
  cursor: pointer;
}
.inline-link-btn:hover,
.link-btn:hover { color: var(--text-primary); text-decoration-color: var(--text-primary); }
.crit-w-tag {
  display: inline-block;
  font-size: 10px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  margin-left: 3px;
  vertical-align: middle;
}
.crit-w-tag.req {
  background: var(--positive-bg);
  color: var(--positive);
}
.top-crit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  font-size: 12px;
}
.top-crit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  color: var(--text-secondary);
}
.top-crit-item.is-gain {
  border-color: rgba(52, 211, 153, 0.32);
  background: rgba(52, 211, 153, 0.06);
}
.top-crit-item.is-loss {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.06);
}
.top-crit-item.is-loss > span:last-child {
  color: var(--danger);
  font-weight: 600;
}
.top-crit-item.is-retrofit {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.06);
}
.top-crit-item > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-crit-item > span:last-child {
  flex-shrink: 0;
}
.st-yes { color: var(--positive); font-weight: 600; }
.st-retrofit { color: var(--warning); font-weight: 600; }
.st-no { color: var(--text-subtle); }
.st-na { color: var(--text-muted); }
.st-unknown { color: var(--text-subtle); }

.warn-strip {
  font-size: 11.5px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}
.custom-badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(237, 237, 237, 0.14);
  color: var(--text-primary);
  margin-left: 6px;
  vertical-align: middle;
}

.p-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--panel-stroke);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.stock-pill { font-size: 12px; font-weight: 500; white-space: nowrap; }
.stock-pill.ok { color: var(--positive); }
.stock-pill.low { color: var(--warning); }
.stock-pill.zero { color: var(--danger); }
.cond-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: baseline;
}
.cond-pill.is-new {
  background: var(--positive-bg);
  color: var(--positive);
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.cond-pill.is-used {
  background: var(--warning-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.28);
}
.p-actions { display: flex; gap: 6px; align-items: center; }

.empty-state {
  grid-column: 1 / -1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
}
.empty-state h3 { margin: 0 0 6px; font-size: 16px; }
.empty-state p { margin: 0 0 14px; color: var(--text-muted); }

/* Pareto 2D map */
.pareto-details {
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}
.pareto-summary {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 13px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
}
.pareto-summary .muted { margin-left: auto; font-weight: 400; font-size: 12px; }
.pareto-summary::-webkit-details-marker { display: none; }
.pareto-summary::before {
  content: "▸";
  margin-right: 6px;
  color: var(--text-muted);
}
.pareto-details[open] .pareto-summary::before { content: "▾"; }
.pareto-wrap { padding: 0 16px 16px; position: relative; }
.pareto-chart { position: relative; width: 100%; }
.pareto-svg { width: 100%; height: auto; display: block; }
.pareto-point { cursor: pointer; transition: r 0.12s ease; }
.pareto-label { pointer-events: none; user-select: none; }
.pareto-tooltip {
  position: absolute;
  pointer-events: none;
  background: #18181b;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 10;
  max-width: 240px;
}

/* Rating table */
.rating-section { margin-bottom: 24px; }
.rating-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.rating-toolbar-left { display: flex; gap: 10px; align-items: center; }
.rating-toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}
table.rating-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.rating-table th, table.rating-table td {
  padding: 7px 5px;
  border-bottom: 1px solid #1c1c1f;
  text-align: left;
  vertical-align: middle;
}
table.rating-table td.col-model {
  min-width: 175px;
  max-width: 222px;
}
.tbl-upgrade-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 5px;
  margin-top: 4px;
}
.tbl-upgrade-price {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.setting-flash {
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 2px var(--positive);
  background: var(--positive-bg);
  transition: box-shadow 0.4s ease, background 0.4s ease;
}
.tbl-crit-grid {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 3px 5px;
  font-size: 11px;
}
.tbl-crit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid #222226;
  white-space: nowrap;
}
table.rating-table td.mono { white-space: nowrap; }
.tbl-crit-lbl { color: var(--text-muted); }
.m-metrics-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-md);
}
table.rating-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: #151517;
  white-space: nowrap;
}
table.rating-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}
table.rating-table tbody tr:hover { background: #19191c; }
table.rating-table tbody tr:last-child td { border-bottom: none; }
.row-title { font-weight: 600; color: var(--text-primary); }
.row-meta { font-size: 11.5px; color: var(--text-muted); }
.score-bar-wrap { display: flex; align-items: center; gap: 8px; min-width: 84px; }
.score-bar { flex: 1; height: 5px; border-radius: 99px; background: #26262a; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 99px; background: var(--text-primary); }

.hidden-bar {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Methodology */
.methodology-box {
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}
.methodology-box summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
}
.methodology-body {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  display: grid;
  gap: 8px;
}
.methodology-body p { margin: 0; max-width: 920px; }

/* Floating compare dock */
.compare-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
  z-index: 30;
}
.compare-dock-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 860px;
  width: 100%;
  padding: 10px 14px;
  background: #18181b;
  border: 1px solid #35353b;
  border-radius: var(--radius-xl);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.72);
}
.compare-dock-items { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  background: var(--card-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
}
.compare-chip button {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}
.compare-dock-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Overlay, Drawer, Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  z-index: 50;
}
#compare-overlay, #custom-overlay {
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.drawer {
  width: min(560px, 100vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer-head, .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--panel-stroke);
}
.drawer-head h2, .modal-head h2 { margin: 0 0 3px; font-size: 17px; }
.drawer-head p { margin: 0; font-size: 12.5px; }
.drawer-body, .modal-body {
  padding: 18px 20px 28px;
  overflow-y: auto;
  flex: 1;
}

.drawer-section {
  background: var(--card);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
}
.drawer-section h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.drawer-sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.drawer-sec-head h3 { margin: 0; }
.drawer-note-text { margin: 6px 0 10px; font-size: 12px; line-height: 1.45; }

.sb-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.sb-summary-card {
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-md);
  padding: 9px 11px;
}
.sb-sum-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.sb-sum-val { font-size: 15px; color: var(--text-primary); }
.sb-sum-sub { font-size: 11px; margin-top: 2px; }

.sb-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 10px 0 6px;
}
.sb-list { display: flex; flex-direction: column; gap: 7px; }
.sb-row {
  padding-bottom: 7px;
  border-bottom: 1px solid #222225;
}
.sb-row:last-child { border-bottom: none; padding-bottom: 0; }
.sb-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}
.sb-name { color: var(--text-primary); }
.sb-pts { font-size: 12px; white-space: nowrap; }
.sb-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 4px;
}
.sb-bar {
  height: 4px;
  border-radius: 99px;
  background: #26262a;
  overflow: hidden;
}
.sb-bar-fill { height: 100%; border-radius: 99px; background: var(--text-primary); }
.sb-bar-fill.good { background: var(--positive); }
.sb-bar-fill.mid { background: #a1a1aa; }
.sb-bar-fill.low { background: var(--warning); }
.sb-zero-details {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #222225;
  font-size: 12px;
  color: var(--text-muted);
}
.sb-zero-details summary { cursor: pointer; }

.formula-pill {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.line-row-block {
  padding: 6px 0;
  border-bottom: 1px solid #222225;
}
.line-row-block .line-row { padding: 0; border-bottom: none; }
.line-sub { font-size: 11.5px; line-height: 1.4; margin-top: 3px; }
.sub-lines {
  margin-top: 5px;
  padding-left: 10px;
  border-left: 2px solid #26262a;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sub-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.line-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #222225;
  font-size: 13px;
}
.line-row:last-child { border-bottom: none; }
.line-row.total {
  padding-top: 9px;
  font-weight: 600;
  color: var(--text-primary);
}
.offer-inline {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.offer-inline .field { flex: 1; min-width: 150px; }

.feat-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 14px;
  font-size: 12.5px;
}
.feat-cell {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #222225;
}
.sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.source-link {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 12px;
  text-decoration: none;
}
.source-link:hover { border-color: var(--text-muted); }

.modal {
  width: min(680px, 100%);
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-wide { width: min(1040px, 100%); }

table.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.compare-table th, table.compare-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #222225;
  text-align: left;
}
table.compare-table th { background: var(--card); font-weight: 600; }
table.compare-table td.winner {
  color: var(--positive);
  font-weight: 600;
  background: rgba(52, 211, 153, 0.06);
}
table.compare-table tr.compare-sec-row td {
  background: #141416;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 7px 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-bottom: 14px;
}
.custom-features-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 0 0 14px;
}
.custom-features-fieldset legend { font-size: 12px; color: var(--text-muted); padding: 0 6px; }
.custom-features-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 12.5px;
}
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: #1f1f24;
  border: 1px solid var(--hairline);
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  z-index: 80;
  white-space: nowrap;
}

/* Floating instant breakdown tooltip */
.has-tip { cursor: help; }
.tip-underline {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: #46464f;
  text-underline-offset: 3px;
}
.floating-tip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  width: 286px;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  background: #18181c;
  border: 1px solid #35353d;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.72);
  font-size: 12px;
  color: var(--text-primary);
}
.ft-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.ft-group-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.ft-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  padding: 1.5px 0;
  font-size: 11.5px;
}
.ft-divider {
  height: 1px;
  background: #27272d;
  margin: 6px 0;
}
.ft-total {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 12.5px;
}
.ft-foot {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Upgrade mode ("Моя машина"), RPG-diff, sidegrade spoiler, stay baseline */
.my-car-grid {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(250px, 1.6fr) minmax(150px, 0.8fr) minmax(200px, 1fr);
  gap: 12px;
  align-items: end;
}
.my-car-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
}
.my-car-range-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}
.my-car-range-row output {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
}
.my-car-summary {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  font-size: 12.5px;
}
.my-car-sum-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.my-car-sum-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
}
.my-car-sum-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.upgrade-card-box {
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upgrade-pair-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 11.5px;
}
.upgrade-pair-prices {
  color: var(--text-primary);
  font-weight: 600;
}
.upgrade-step-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 500;
}
.upgrade-step-pill.is-up {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--positive);
}
.upgrade-step-pill.is-down {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--danger);
}
.diff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.diff-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.3;
  border: 1px solid transparent;
}
.diff-chip.gain {
  background: var(--positive-bg);
  border-color: rgba(52, 211, 153, 0.28);
  color: var(--positive);
}
.diff-chip.retrofit {
  background: var(--warning-bg);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.diff-chip.loss {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

/* Sidegrade spoiler ("шило на мыло") */
.sidegrade-spoiler {
  margin-top: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.sidegrade-spoiler summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidegrade-spoiler summary::-webkit-details-marker { display: none; }
.sidegrade-spoiler summary::before {
  content: "▸";
  color: var(--text-muted);
}
.sidegrade-spoiler[open] summary::before { content: "▾"; }
.sidegrade-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidegrade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--panel-stroke);
}
.sidegrade-item-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-primary);
}
.sidegrade-reason-pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.sidegrade-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stay baseline row & mobile card ("Остаться на своей") */
table.rating-table tbody tr.stay-baseline-row {
  background: rgba(245, 158, 11, 0.07);
}
table.rating-table tbody tr.stay-baseline-row:hover {
  background: rgba(245, 158, 11, 0.12);
}
table.rating-table tbody tr.stay-baseline-row td {
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}
.stay-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  vertical-align: middle;
}
.m-row-card.stay-baseline-card {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, #1d1a14, #171614);
}

/* Drawer reliability / safety & RPG diff blocks */
.rel-safety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.rel-card {
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--panel-stroke);
  min-width: 0;
}
.rel-card-lbl { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.rel-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.rel-card-val { font-size: 13.5px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.rel-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 5px; line-height: 1.38; }
.brand-override-row {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--panel-stroke);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand-override-row label {
  font-size: 10.5px;
  color: var(--text-secondary);
}
.brand-override-row select {
  width: 100%;
  font-size: 12px;
  padding: 5px 8px;
}
.brand-override-details {
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-muted);
}
.brand-override-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  list-style: none;
}
.brand-override-details summary::-webkit-details-marker { display: none; }
.brand-override-details .brand-override-row {
  margin-top: 6px;
}
.diff-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 8px 0 4px;
}

/* Mobile cards for rating list */
.mobile-cards { display: none; flex-direction: column; gap: 10px; }
.m-row-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.m-row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

@media (max-width: 959px) {
  .config-grid-2col, .vehicle-split-grid, .my-car-grid { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; }
  .podium-card .upgrade-card-box { flex: none; }
  .p-title { min-height: 0; }
}

@media (max-width: 767px) {
  .rel-safety-grid { grid-template-columns: 1fr; }
  .shell { padding: 14px 14px 96px; }
  .desktop-only { display: none !important; }
  .brand-sub { display: none; }
  .topbar { margin-bottom: 12px; }
  .topbar .btn { padding: 6px 10px; font-size: 12px; }
  .fb-primary { padding: 10px; gap: 8px; }
  .fb-secondary { padding: 8px 10px; gap: 6px; }
  .fb-sep { display: none; }
  .my-car-trigger { flex: 1 1 100%; }
  .my-car-trigger .chev { margin-left: auto; }
  .inline-input-group { flex: 1 1 100%; }
  .inline-input-group .inline-input { flex: 1; width: auto; }
  .inline-search { flex: 1 1 100%; max-width: none; }
  .fb-actions { width: 100%; margin-left: 0; }
  .fb-actions .cockpit-btn { flex: 1; justify-content: center; }
  .field-sm { width: 106px; }
  .field-search { width: 100%; }
  .config-panel {
    position: fixed;
    inset: 0;
    z-index: 60;
    margin: 0;
    border-radius: 0;
    border: none;
    overflow-y: auto;
    padding: 16px 14px 32px;
  }
  .crit-row { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
  .crit-controls { justify-content: space-between; }
  .w-btn { width: 36px; height: 36px; font-size: 13px; }
  .req-btn { height: 38px; padding: 0 12px; font-size: 12.5px; }
  .podium-card { padding: 14px; }
  .p-foot { flex-wrap: wrap; }
  .p-actions { width: 100%; }
  .p-actions .btn, .m-row-card .btn { min-height: 40px; }
  .p-actions .btn.primary { flex: 1; }
  .table-wrap table.rating-table { display: none; }
  .mobile-cards { display: flex; }
  .table-wrap { background: transparent; border: none; overflow: visible; }
  .feat-matrix, .form-grid, .custom-features-grid { grid-template-columns: 1fr; }
  .compare-dock-inner { flex-direction: column; align-items: stretch; }
  .compare-dock-actions { justify-content: flex-end; }
}
