/* =========================================================================
   VAULT7 3D STUDIO PANEL — TACTILE CONFIGURATOR & PRODUCT ICON SYSTEM
   ========================================================================= */
body.studio-mode .builder-panel {
  --p-bg: #11161e;
  --p-surface: #171e28;
  --p-surface-hi: #1f2937;
  --p-border: #2a3444;
  --p-border-hi: #425268;
  --p-text: #f1f5f9;
  --p-muted: #94a3b8;
  --p-ice: #7dd3fc;
  --p-orange: #f97316;
  --p-orange-hi: #fb923c;
  --p-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  width: 326px;
  right: 16px;
  top: 16px;
  bottom: 16px;
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  border-radius: 10px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.55);
  color: var(--p-text);
}

body.studio-mode #scene {
  inset: 0 342px 0 0;
}

body.studio-mode .view-tools {
  right: 356px;
}

body.studio-mode .paint-swatches {
  left: calc((100% - 342px) / 2);
}

body.studio-mode .scene-loading {
  left: calc((100% - 342px) / 2);
}

body.studio-mode .builder-panel :where(button, input, select, summary, a):focus-visible {
  outline: 2px solid var(--p-orange);
  outline-offset: 2px;
}

/* Compact Top History Bar — Fixes "6 components" edge clipping */
body.studio-mode .studio-history {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--p-border);
  background: #0d1219;
}
body.studio-mode .studio-history button {
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-text);
}
body.studio-mode .studio-history button:hover:not(:disabled) {
  border-color: var(--p-border-hi);
}
body.studio-mode .studio-history span {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid rgba(125, 211, 252, 0.3);
  background: rgba(30, 58, 95, 0.35);
  color: var(--p-ice);
  font: 700 10px var(--p-mono);
  white-space: nowrap;
}

/* Workspace Tabs */
body.studio-mode .studio-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--p-border);
  background: #0f141c;
}
body.studio-mode .studio-tabs button {
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--p-muted);
}
body.studio-mode .studio-tabs button:hover {
  color: var(--p-text);
  background: rgba(255, 255, 255, 0.04);
}
body.studio-mode .studio-tabs [aria-pressed="true"] {
  background: var(--p-orange);
  border-color: var(--p-orange);
  color: #140e08;
}

/* Compact Integrated Search */
body.studio-mode .option-search {
  padding: 6px 10px 5px;
  border-bottom: 0;
  background: var(--p-bg);
}
body.studio-mode .option-search input {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--p-border);
  background: #0b0f15;
  color: var(--p-text);
  font-size: 11px;
}
body.studio-mode .option-search input::placeholder {
  color: #64748b;
}

/* Quick-Start Presets Row */
body.studio-mode .builder-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 0 10px 7px;
  border-bottom: 1px solid var(--p-border);
}
body.studio-mode .builder-presets button {
  padding: 5px 4px;
  border-radius: 5px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
}
body.studio-mode .builder-presets button:hover:not(:disabled) {
  border-color: var(--p-ice);
  color: var(--p-ice);
}

/* Scrollable Config Body */
body.studio-mode .panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

/* 6-Category Visual Icon Quick-Jump Bar */
.v7-quick-nav {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  padding: 7px 8px;
  background: rgba(13, 18, 25, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--p-border);
}
.v7-quick-nav.v7-quick-nav-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.v7-quick-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  padding: 5px 2px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--p-muted);
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.v7-quick-btn:hover {
  background: var(--p-surface);
  color: var(--p-text);
}
.v7-quick-btn[aria-pressed="true"] {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.6);
  color: #fdba74;
}
.v7-quick-icon {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
}
.v7-quick-icon svg {
  width: 19px;
  height: 19px;
}
.v7-quick-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
}
.v7-quick-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--p-ice);
}

/* Accordion Sections with Product Icons + Live Selection Summary */
.v7-sections-wrap {
  padding-bottom: 8px;
}
body.studio-mode .config-section.v7-section {
  border-bottom: 1px solid var(--p-border);
}
body.studio-mode .config-section.v7-section > summary.v7-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.14s;
}
body.studio-mode .config-section.v7-section > summary.v7-summary:hover {
  background: rgba(255, 255, 255, 0.03);
}
body.studio-mode .config-section.v7-section[open] > summary.v7-summary {
  background: rgba(23, 30, 40, 0.72);
  border-bottom: 1px solid var(--p-border);
}

.v7-sec-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-muted);
}
.v7-sec-icon svg {
  width: 18px;
  height: 18px;
}
.v7-sec-icon.is-active {
  border-color: rgba(125, 211, 252, 0.4);
  background: rgba(30, 58, 95, 0.32);
  color: var(--p-ice);
}
.v7-section[open] .v7-sec-icon {
  border-color: rgba(249, 115, 22, 0.6);
  background: rgba(249, 115, 22, 0.15);
  color: #fdba74;
}

.v7-sec-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.v7-sec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--p-text);
  line-height: 1.2;
}
.v7-sec-status {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v7-sec-status.is-active {
  color: var(--p-ice);
}

.v7-chevron {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--p-muted);
  flex: none;
}
.v7-chevron svg {
  width: 14px;
  height: 14px;
}
.v7-section[open] > summary .v7-chevron {
  rotate: 180deg;
  color: var(--p-orange);
}
@media (prefers-reduced-motion: no-preference) {
  .v7-chevron {
    transition: rotate 0.18s ease;
  }
  .v7-section::details-content {
    interpolate-size: allow-keywords;
    overflow: clip;
    contain: layout;
    transition: block-size 0.18s ease, content-visibility 0.18s allow-discrete, display 0.18s allow-discrete;
  }
  .v7-section:not([open])::details-content {
    block-size: 0;
  }
  .v7-sections-wrap.is-jumping .v7-section::details-content,
  .v7-sections-wrap.is-jumping .v7-chevron {
    transition: none;
  }
}

/* Section Inner Controls */
body.studio-mode .config-body.v7-body {
  display: grid;
  gap: 11px;
  padding: 12px;
  background: #0d1218;
}

.v7-vehicle-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 7px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
}
.v7-vehicle-title {
  display: block;
  font-size: 13px;
  color: var(--p-text);
}
.v7-vehicle-cab {
  display: block;
  font-size: 11px;
  color: var(--p-muted);
}
.v7-mini-action {
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--p-border-hi);
  background: #0f141c;
  color: var(--p-ice);
  font-size: 11px;
  font-weight: 700;
}
.v7-mini-action:hover {
  border-color: var(--p-ice);
}

.v7-field {
  display: grid;
  gap: 6px;
}
.v7-field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
}
.v7-field-label em {
  font-style: normal;
  font: 700 10px var(--p-mono);
  color: var(--p-ice);
}

/* Tactile Segmented Controls */
.v7-seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 7px;
  border: 1px solid var(--p-border);
  background: #090d12;
}
.v7-seg-btn {
  flex: 1;
  min-height: 32px;
  padding: 5px 6px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--p-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.v7-seg-btn:hover:not(:disabled) {
  color: var(--p-text);
  background: rgba(255, 255, 255, 0.04);
}
.v7-seg-btn[aria-pressed="true"] {
  background: rgba(249, 115, 22, 0.16);
  border-color: var(--p-orange);
  color: #ffcf9f;
}

/* Visual 2x2 Canopy Selector Cards */
.v7-visual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.v7-visual-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 7px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  text-align: center;
  transition: border-color 0.14s, background-color 0.14s;
}
.v7-visual-card:hover {
  border-color: var(--p-border-hi);
  background: var(--p-surface-hi);
}
.v7-visual-card[aria-pressed="true"] {
  border-color: var(--p-orange);
  background: rgba(249, 115, 22, 0.14);
}
.v7-visual-svg {
  width: 56px;
  height: 26px;
  color: #94a3b8;
}
.v7-visual-card[aria-pressed="true"] .v7-visual-svg {
  color: var(--p-orange-hi);
}
.v7-visual-card strong {
  font-size: 11px;
  font-weight: 700;
  color: var(--p-text);
}
.v7-visual-card small {
  font-size: 9px;
  color: var(--p-muted);
}

/* Multi-Size Chips (Canopy Sizes) */
.v7-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.v7-size-chip {
  min-width: 46px;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-muted);
  font: 700 11px var(--p-mono);
}
.v7-size-chip:hover {
  border-color: var(--p-border-hi);
  color: var(--p-text);
}
.v7-size-chip[aria-pressed="true"] {
  border-color: var(--p-ice);
  background: rgba(30, 58, 95, 0.5);
  color: #e0f2fe;
}

/* Accessible Toggle Switch Cards */
body.studio-mode .panel-scroll .v7-toggle-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  cursor: pointer;
}
.v7-toggle-card.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.v7-toggle-copy {
  flex: 1;
  min-width: 0;
}
.v7-toggle-copy strong {
  display: block;
  font-size: 12px;
  color: var(--p-text);
}
.v7-toggle-copy small {
  display: block;
  font-size: 10px;
  color: var(--p-muted);
  margin-top: 2px;
}
.v7-switch-wrap {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
}
.v7-switch-input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: inherit;
  z-index: 2;
}
.v7-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  border: 1px solid var(--p-border-hi);
  background: #0b0f15;
  transition: background-color 0.16s, border-color 0.16s;
}
.v7-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #94a3b8;
  transition: transform 0.16s, background-color 0.16s;
}
.v7-switch-input:checked + .v7-switch-track {
  background: rgba(249, 115, 22, 0.28);
  border-color: var(--p-orange);
}
.v7-switch-input:checked + .v7-switch-track::after {
  transform: translateX(16px);
  background: var(--p-orange);
}
.v7-switch-input:focus-visible + .v7-switch-track {
  outline: 2px solid var(--p-orange);
  outline-offset: 2px;
}

/* 3-Column Rear Wall Slot Matrix (L / MID / R) */
.v7-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
body.studio-mode .config-body .v7-slot-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
}
.v7-slot-cell.is-filled {
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(30, 58, 95, 0.3);
}
.v7-slot-cell > span {
  font: 700 9px var(--p-mono);
  letter-spacing: 0.08em;
  color: var(--p-muted);
  text-align: center;
}
.v7-slot-cell.is-filled > span {
  color: var(--p-ice);
}
body.studio-mode .config-body .v7-slot-cell select {
  padding: 5px 4px;
  font-size: 10px;
  border-radius: 4px;
  border: 1px solid var(--p-border-hi);
  background: #0c1117;
  color: var(--p-text);
}

/* Compact Selects & Subcards */
.v7-subcard {
  display: grid;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid var(--p-border);
  background: rgba(23, 30, 40, 0.55);
}
body.studio-mode .config-body .v7-select-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
}
body.studio-mode .config-body .v7-select-label select {
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--p-border-hi);
  background: #0c1117;
  color: var(--p-text);
}
.v7-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

/* Trade & Overland 1-Click Kit Cards */
.v7-kit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.v7-kit-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  text-align: left;
}
.v7-kit-card:hover:not(:disabled) {
  border-color: var(--p-orange);
  background: rgba(249, 115, 22, 0.12);
}
.v7-kit-card strong {
  font-size: 11px;
  color: var(--p-text);
}
.v7-kit-card span {
  font: 700 10px var(--p-mono);
  color: var(--p-ice);
}

/* Helper Notes & Banners */
.v7-inline-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--p-muted);
}
.v7-inline-note a {
  color: var(--p-ice);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.v7-lock-banner {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
  font-size: 11px;
  line-height: 1.45;
  color: #fed7aa;
}

/* Raptor Panel Refresh */
.v7-raptor-head {
  margin-bottom: 12px;
}
.v7-raptor-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.14);
  color: #fdba74;
  font: 700 9px var(--p-mono);
  letter-spacing: 0.08em;
}
.v7-raptor-head h2 {
  margin: 6px 0 4px;
  font-size: 20px;
}
.v7-raptor-grid {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.v7-change-vehicle-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--p-border-hi);
  background: var(--p-surface);
  color: var(--p-ice);
  font-size: 12px;
  font-weight: 700;
}
.v7-change-vehicle-btn:hover {
  border-color: var(--p-ice);
}

/* Unified Bottom Panel Actions (Replace leftover mint green with VAULT7 orange) */
body.studio-mode .panel-actions {
  border-top: 1px solid var(--p-border);
  padding: 12px 14px;
  background: #0d1219;
}
body.studio-mode .panel-actions [data-preview] {
  background: var(--p-surface);
  border: 1px solid var(--p-border-hi);
  color: var(--p-text);
  font-size: 13px;
  font-weight: 700;
  min-height: 40px;
}
body.studio-mode .panel-actions [data-preview] span {
  color: var(--p-ice);
}
body.studio-mode .panel-actions .mint {
  background: linear-gradient(180deg, #fb7c24, #ea650c);
  border-color: var(--p-orange);
  color: #140e08;
  font-size: 13px;
  font-weight: 800;
  min-height: 40px;
}
body.studio-mode .panel-actions .mint:hover:not(:disabled) {
  background: linear-gradient(180deg, #fd8f3f, #f97316);
}
body.studio-mode .reset-build {
  margin: 10px auto 0;
  font-size: 11px;
  color: #64748b;
}
body.studio-mode .reset-build:hover {
  color: #cbd5e1;
}
body.studio-mode .show-controls {
  background: var(--p-orange);
  border-color: var(--p-orange);
  color: #140e08;
  font-weight: 800;
}

@media (forced-colors: active) {
  .v7-quick-btn[aria-pressed="true"],
  .v7-seg-btn[aria-pressed="true"],
  .v7-visual-card[aria-pressed="true"],
  .v7-size-chip[aria-pressed="true"] {
    outline: 2px solid Highlight;
  }
}

@media (max-width: 700px) {
  body.studio-mode .builder-panel {
    width: 100%;
    right: 0;
    left: 0;
    top: 53%;
    bottom: 0;
    border-radius: 14px 14px 0 0;
  }
  body.studio-mode #scene {
    inset: 76px 0 47% 0;
  }
  body.studio-mode .view-tools {
    left: 8px;
    right: 8px;
  }
  body.studio-mode .paint-swatches {
    left: 50%;
  }
}
