﻿.mcr4-app {
  --mcr4-red: #b50000;
  --mcr4-red-dark: #880000;
  --mcr4-ink: #202020;
  --mcr4-muted: #666;
  --mcr4-line: #e1e1e1;
  --mcr4-soft: #f6f6f6;
  --mcr4-warn: #fff7e8;
  color: var(--mcr4-ink);
  max-width: 100%;
  overflow-x: hidden;
}

.mcr4-app * {
  box-sizing: border-box;
}

.mcr4-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(12px, 3vw, 28px);
  background: #fff;
  border-bottom: 4px solid var(--mcr4-red);
}

.mcr4-header .eyebrow {
  margin: 0 0 6px;
  color: var(--mcr4-red);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.mcr4-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.mcr4-header .model-line {
  display: inline-block;
}

.mcr4-contact {
  display: grid;
  gap: 4px;
  align-content: center;
  min-width: 220px;
  font-size: 14px;
}

.mcr4-contact span,
.mcr4-muted {
  color: var(--mcr4-muted);
}

.mcr4-app a {
  color: var(--mcr4-red);
  font-weight: 700;
}

.mcr4-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px clamp(12px, 3vw, 28px);
  background: #fff;
  border-bottom: 1px solid var(--mcr4-line);
}

.mcr4-search span {
  display: block;
  margin-bottom: 6px;
  color: var(--mcr4-muted);
  font-size: 13px;
}

.mcr4-search input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  font-size: 16px;
}

.diagram-tabs {
  display: flex;
  gap: 8px;
  align-items: end;
  overflow-x: auto;
}

.diagram-tabs button,
.diagram-actions button,
.product-actions button,
.product-actions a {
  border: 1px solid var(--mcr4-line);
  border-radius: 6px;
  background: #fff;
  color: var(--mcr4-ink);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.diagram-tabs button {
  min-height: 42px;
  padding: 9px 12px;
  white-space: nowrap;
}

.diagram-tabs button.active {
  border-color: var(--mcr4-red);
  background: var(--mcr4-red);
  color: #fff;
}

.mcr4-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, .8fr);
  gap: 18px;
  padding: 18px clamp(12px, 3vw, 28px);
  min-width: 0;
}

.diagram-panel,
.side-panel {
  background: #fff;
  border: 1px solid var(--mcr4-line);
  border-radius: 8px;
}

.diagram-panel {
  position: relative;
  min-width: 0;
  min-height: 680px;
  overflow: hidden;
}

.diagram-actions {
  position: absolute;
  z-index: 4;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
}

.diagram-actions button {
  width: 44px;
  height: 38px;
}

.diagram-viewport {
  width: 100%;
  height: 680px;
  overflow: hidden;
  cursor: grab;
  background: #f8f8f8;
}

.diagram-viewport.dragging {
  cursor: grabbing;
}

.diagram-stage {
  position: relative;
  width: max-content;
  transform-origin: 0 0;
  will-change: transform;
}

#diagramImage {
  display: block;
  width: 980px;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
}

.marker {
  position: absolute;
  min-width: 36px;
  height: 32px;
  padding: 0 7px;
  transform: translate(-50%, -50%);
  border: 2px solid #111;
  border-radius: 999px;
  background: #ffd400;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 0 0 5px #fff, 0 2px 7px rgba(0,0,0,.28);
}

.marker:hover,
.marker.active {
  border-color: #111;
  background: var(--mcr4-red);
  color: #fff;
  transform: translate(-50%, -50%) scale(1.24);
  box-shadow: 0 0 0 4px rgba(255,212,0,.75), 0 4px 12px rgba(0,0,0,.34);
  z-index: 3;
}

.side-panel {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr);
  align-self: start;
  overflow: visible;
}

.selected-card {
  padding: 16px;
  border-bottom: 1px solid var(--mcr4-line);
  background: var(--mcr4-warn);
  position: relative;
  z-index: 5;
  overflow: visible;
}

.selected-product h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.selected-price {
  margin: 0 0 12px;
  color: var(--mcr4-red);
  font-size: 19px;
  font-weight: 800;
}

.fit-title {
  margin: 0 0 8px;
}

.fit-list {
  margin: 0 0 12px 18px;
  padding: 0;
}

.fit-list li {
  margin: 4px 0;
}

.selected-meta {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  font-size: 13px;
}

.marker-note {
  margin: 0 0 12px;
  padding: 10px;
  background: #fff;
  border-left: 4px solid var(--mcr4-red);
  font-weight: 700;
}

.product-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.product-actions a,
.product-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 14px;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.product-actions .primary {
  border-color: var(--mcr4-red);
  background: var(--mcr4-red);
  color: #fff;
}

.list-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.list-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.list-heading span {
  color: var(--mcr4-muted);
  font-size: 13px;
}

.parts-list {
  height: auto;
  max-height: 520px;
  overflow: auto;
  overflow-x: hidden;
  border-top: 1px solid var(--mcr4-line);
}

.part-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--mcr4-line);
  background: transparent;
  color: var(--mcr4-ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.part-row:hover {
  background: #fff3f3;
}

.part-row.active {
  background: #fff6bf;
  box-shadow: inset 4px 0 0 #ffd400;
}

.ordinal {
  color: var(--mcr4-red);
  font-size: 18px;
  font-weight: 800;
}

.part-row strong {
  display: block;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.part-row small {
  display: block;
  margin-top: 2px;
  color: var(--mcr4-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 980px) {
  .mcr4-header,
  .mcr4-toolbar,
  .mcr4-workspace {
    grid-template-columns: 1fr;
  }

  .mcr4-header {
    display: grid;
  }

  .diagram-panel {
    min-height: 520px;
  }

  .diagram-viewport {
    height: 520px;
  }

  .side-panel {
    max-height: none;
  }

  .parts-list {
    height: auto;
    max-height: 560px;
  }
}

@media (max-width: 440px) {
  .product-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .mcr4-header h1 {
    font-size: 24px;
  }

  .mcr4-header .model-line {
    display: block;
  }

  .mcr4-toolbar,
  .mcr4-workspace,
  .mcr4-header {
    padding-left: 10px;
    padding-right: 10px;
  }

  .diagram-panel,
  .side-panel {
    border-radius: 0;
  }

  .diagram-viewport {
    height: 420px;
  }

  .part-row {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 10px 8px;
  }

  .ordinal {
    font-size: 16px;
  }

  .part-row strong {
    font-size: 13px;
    line-height: 1.25;
  }

  #diagramImage {
    width: 720px;
  }
}

