.pcb-builder {
  --pcb-accent: #d71920;
  --pcb-accent-dark: #a90f15;
  --pcb-text: #151515;
  --pcb-muted: #6d6d6d;
  --pcb-border: #dedede;
  --pcb-surface: #ffffff;
  --pcb-soft: #f6f6f6;
  color: var(--pcb-text);
  font-family: inherit;
  margin: 28px auto;
  max-width: 1440px;
}

.pcb-builder *,
.pcb-builder *::before,
.pcb-builder *::after {
  box-sizing: border-box;
}

.pcb-builder__header {
  margin-bottom: 24px;
  max-width: 820px;
}

.pcb-builder__header h2 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  margin: 0 0 12px;
}

.pcb-builder__header p {
  color: var(--pcb-muted);
  font-size: 17px;
  margin: 0;
}

.pcb-builder__header .pcb-builder__eyebrow {
  color: var(--pcb-accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.pcb-steps {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0 0 26px;
}

.pcb-step {
  align-items: center;
  background: var(--pcb-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  color: #555;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 13px;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  text-align: left;
}

.pcb-step__number {
  align-items: center;
  background: #e5e5e5;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 26px;
  font-weight: 700;
  height: 26px;
  justify-content: center;
}

.pcb-step.is-current {
  background: #fff4f4;
  border-color: var(--pcb-accent);
  color: var(--pcb-text);
}

.pcb-step.is-current .pcb-step__number,
.pcb-step.is-complete .pcb-step__number {
  background: var(--pcb-accent);
  color: #fff;
}

.pcb-layout {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
}

.pcb-main,
.pcb-summary {
  background: var(--pcb-surface);
  border: 1px solid var(--pcb-border);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .05);
}

.pcb-main {
  min-width: 0;
  padding: clamp(18px, 3vw, 30px);
}

.pcb-step-heading p {
  color: var(--pcb-accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.pcb-step-heading h3 {
  font-size: clamp(24px, 3vw, 32px);
  margin: 0 0 22px;
}

.pcb-component-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pcb-component {
  background: #fff;
  border: 2px solid var(--pcb-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.pcb-component:not(.is-disabled):hover {
  border-color: #b5b5b5;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .08);
  transform: translateY(-2px);
}

.pcb-component.is-selected {
  border-color: var(--pcb-accent);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, .1);
}

.pcb-component.is-disabled {
  background: #fafafa;
  opacity: .52;
}

.pcb-component__image {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: #f3f3f3;
  border: 0;
  color: inherit;
  cursor: zoom-in;
  display: flex;
  font: inherit;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 100%;
}

.pcb-component__image img {
  height: 100%;
  object-fit: contain;
  padding: 12px;
  width: 100%;
}

.pcb-component__gallery-hint {
  background: rgba(20, 20, 20, .88);
  border-radius: 999px;
  bottom: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  left: 50%;
  opacity: 0;
  padding: 7px 11px;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, 5px);
  transition: opacity .18s ease, transform .18s ease;
  white-space: nowrap;
}

.pcb-component__image:hover .pcb-component__gallery-hint,
.pcb-component__image:focus-visible .pcb-component__gallery-hint {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pcb-component__image:focus-visible {
  outline: 3px solid rgba(215, 25, 32, .4);
  outline-offset: -3px;
}

.pcb-component__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px;
}

.pcb-component__content h4 {
  font-size: 17px;
  line-height: 1.3;
  margin: 0 0 4px;
}

.pcb-component__id {
  color: #888;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  margin-bottom: 10px;
}

.pcb-component__description {
  color: var(--pcb-muted);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 12px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.pcb-component__price {
  display: block;
  font-size: 18px;
  margin: auto 0 12px;
}

.pcb-component__controls {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: auto;
}

.pcb-select-button,
.pcb-button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 16px;
}

.pcb-select-button {
  background: #242424;
  color: #fff;
  flex: 1;
  font-size: 13px;
}

.pcb-component.is-selected .pcb-select-button,
.pcb-button--primary {
  background: var(--pcb-accent);
  color: #fff;
}

.pcb-select-button:disabled {
  cursor: not-allowed;
}

.pcb-quantity {
  color: var(--pcb-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.pcb-quantity input {
  border: 1px solid var(--pcb-border);
  border-radius: 5px;
  display: block;
  margin-top: 3px;
  max-width: 65px;
  min-height: 38px;
  padding: 6px;
}

.pcb-actions {
  border-top: 1px solid var(--pcb-border);
  display: flex;
  justify-content: space-between;
  margin-top: 26px;
  padding-top: 20px;
}

.pcb-category-explanation {
  background: #f8f8f8;
  border-left: 4px solid var(--pcb-accent);
  border-radius: 8px;
  margin-top: 24px;
  padding: 17px 19px;
}

.pcb-category-explanation__title {
  font-size: 17px;
  margin: 0 0 7px;
}

.pcb-category-explanation__body {
  color: var(--pcb-muted);
  font-size: 14px;
  line-height: 1.6;
}

.pcb-category-explanation__body > :first-child {
  margin-top: 0;
}

.pcb-category-explanation__body > :last-child {
  margin-bottom: 0;
}

.pcb-button--secondary {
  background: #ededed;
  color: var(--pcb-text);
}

.pcb-button--primary {
  margin-left: auto;
}

.pcb-button--primary:hover,
.pcb-component.is-selected .pcb-select-button:hover {
  background: var(--pcb-accent-dark);
}

.pcb-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.pcb-button.is-loading::after {
  animation: pcb-spin .8s linear infinite;
  border: 2px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  border-top-color: #fff;
  content: "";
  display: inline-block;
  height: 14px;
  margin-left: 9px;
  vertical-align: -2px;
  width: 14px;
}

.pcb-summary {
  padding: 22px;
  position: sticky;
  top: 28px;
}

.pcb-summary h3 {
  font-size: 22px;
  margin: 0 0 16px;
}

.pcb-summary__row {
  border-top: 1px solid #ececec;
  display: grid;
  gap: 4px;
  grid-template-columns: 95px minmax(0, 1fr);
  padding: 10px 0;
}

.pcb-summary__row span {
  color: var(--pcb-muted);
  font-size: 12px;
}

.pcb-summary__row strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pcb-summary__row strong.is-empty {
  color: #999;
  font-weight: 400;
}

.pcb-summary__total {
  align-items: center;
  border-top: 2px solid var(--pcb-text);
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 16px;
}

.pcb-summary__total strong {
  color: var(--pcb-accent);
  font-size: 25px;
}

.pcb-summary__tax-note {
  color: #888;
  font-size: 11px;
  line-height: 1.4;
  margin: 12px 0 0;
}

.pcb-alert,
.pcb-empty,
.pcb-no-components {
  background: #fff2f2;
  border: 1px solid #efb7b7;
  border-radius: 8px;
  color: #861016;
  margin: 0 0 18px;
  padding: 12px 14px;
}

.pcb-no-components {
  grid-column: 1 / -1;
}

body.pcb-gallery-open {
  overflow: hidden;
}

.pcb-gallery {
  inset: 0;
  position: fixed;
  z-index: 999999;
}

.pcb-gallery__backdrop {
  background: rgba(0, 0, 0, .78);
  border: 0;
  cursor: zoom-out;
  inset: 0;
  padding: 0;
  position: absolute;
  width: 100%;
}

.pcb-gallery__dialog {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
  left: 50%;
  max-height: calc(100vh - 40px);
  max-width: 980px;
  overflow: auto;
  padding: 24px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 40px);
}

.pcb-gallery__close {
  align-items: center;
  background: #ededed;
  border: 0;
  border-radius: 999px;
  color: #222;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 27px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0 0 3px;
  position: absolute;
  right: 16px;
  top: 15px;
  width: 38px;
  z-index: 2;
}

.pcb-gallery__title {
  font-size: 22px;
  margin: 0 52px 18px 0;
}

.pcb-gallery__stage {
  align-items: center;
  background: #f4f4f4;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  min-height: min(62vh, 650px);
  overflow: hidden;
}

.pcb-gallery__main-image {
  height: min(62vh, 650px);
  object-fit: contain;
  padding: 18px;
  width: 100%;
}

.pcb-gallery__nav {
  align-items: center;
  align-self: stretch;
  background: transparent;
  border: 0;
  color: #222;
  cursor: pointer;
  display: flex;
  font-size: 44px;
  justify-content: center;
  padding: 0;
}

.pcb-gallery__nav:hover {
  background: rgba(0, 0, 0, .07);
}

.pcb-gallery__counter {
  color: var(--pcb-muted);
  font-size: 12px;
  margin: 9px 0;
  text-align: center;
}

.pcb-gallery__thumbnails {
  display: flex;
  gap: 9px;
  justify-content: center;
  overflow-x: auto;
  padding: 2px 2px 5px;
}

.pcb-gallery__thumbnail {
  background: #fff;
  border: 2px solid var(--pcb-border);
  border-radius: 7px;
  cursor: pointer;
  flex: 0 0 78px;
  height: 62px;
  overflow: hidden;
  padding: 3px;
}

.pcb-gallery__thumbnail.is-current {
  border-color: var(--pcb-accent);
}

.pcb-gallery__thumbnail img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

@keyframes pcb-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1050px) {
  .pcb-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .pcb-layout {
    grid-template-columns: 1fr;
  }

  .pcb-summary {
    position: static;
  }
}

@media (max-width: 780px) {
  .pcb-component-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pcb-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .pcb-main,
  .pcb-summary {
    border-radius: 10px;
  }

  .pcb-summary__row {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .pcb-step {
    font-size: 12px;
    padding: 7px 8px;
  }

  .pcb-gallery__dialog {
    max-height: calc(100vh - 20px);
    padding: 18px;
    width: calc(100% - 20px);
  }

  .pcb-gallery__stage {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    min-height: 52vh;
  }

  .pcb-gallery__main-image {
    height: 52vh;
    padding: 8px;
  }
}
.pcb-builder [hidden] {
  display: none !important;
}

.pcb-summary__price-hint {
  margin-top: 20px;
  color: #64748b;
  font-size: 14px;
}
