.v6-montage-page {
  background: #f3f6f8;
}

.v6-montage-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
}

.v6-montage-shell {
  max-width: 1680px;
  display: grid;
  gap: 16px;
}

.v6-montage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.v6-montage-eyebrow {
  margin: 0 0 6px;
  color: #177865;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.v6-montage-id {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: #edf5f3;
  color: #075f4b;
  font-weight: 900;
}

.v6-montage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.v6-montage-stage-card,
.v6-montage-panel {
  padding: 14px;
}

.v6-montage-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.v6-montage-summary > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d3dde7;
  border-radius: 8px;
  background: #f8fbfb;
}

.v6-montage-summary span {
  display: block;
  color: #51647a;
  font-size: 12px;
  font-weight: 800;
}

.v6-montage-summary strong {
  display: block;
  margin-top: 3px;
  color: #0f1720;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.v6-montage-list {
  display: grid;
  gap: 14px;
}

.v6-montage-item {
  border: 1px solid #cfd8de;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.v6-montage-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #dbe3e7;
  background: #f8fbfb;
}

.v6-montage-item-head strong {
  display: block;
  color: #0f1720;
  font-size: 15px;
}

.v6-montage-item-head span {
  color: #51647a;
  font-size: 12px;
  font-weight: 800;
}

.v6-montage-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.v6-montage-zoom-button {
  min-height: 34px;
  padding: 0 12px;
  border-color: #177865;
  color: #075f4b;
  background: #edf8f5;
}

.v6-montage-stage {
  height: clamp(460px, 46vw, 660px);
  min-height: 420px;
  background:
    linear-gradient(90deg, rgba(31, 41, 51, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31, 41, 51, 0.045) 1px, transparent 1px),
    #f6f9fa;
  background-size: 30px 30px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.v6-montage-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
  transform-origin: center center;
  will-change: transform;
}

.v6-montage-stage.is-touch-zooming {
  touch-action: none;
}

.v6-montage-stage.is-touch-zoomed canvas {
  cursor: grab;
}

.v6-montage-missing {
  padding: 18px;
  color: #7a3b10;
  background: #fff7ed;
  font-weight: 900;
}

.v6-montage-panel {
  display: grid;
  gap: 14px;
}

.v6-tool {
  display: grid;
  gap: 8px;
}

.v6-tool + .v6-tool {
  padding-top: 14px;
  border-top: 1px solid #dbe3e7;
}

.v6-tool h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.v6-color-row,
.v6-range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 10px;
  align-items: center;
  color: #26323d;
  font-weight: 900;
}

.v6-range-row {
  grid-template-columns: minmax(0, 96px) minmax(0, 1fr);
}

.v6-color-row input {
  min-height: 42px;
  padding: 4px;
}

.v6-range-row input {
  min-height: 38px;
  padding: 0;
}

.v6-data-list {
  display: grid;
  gap: 8px;
  color: #354250;
  font-size: 13px;
  line-height: 1.45;
}

.v6-sink-list {
  display: grid;
  gap: 10px;
}

.v6-sink-card,
.v6-sink-empty {
  padding: 10px;
  border: 1px solid #dbe3e7;
  border-radius: 8px;
  background: #f8fbfb;
}

.v6-sink-empty {
  color: #6b7280;
  font-size: 13px;
  font-weight: 800;
}

.v6-sink-card {
  display: grid;
  gap: 9px;
}

.v6-sink-card-head span,
.v6-sink-note {
  display: block;
  color: #51647a;
  font-size: 12px;
  font-weight: 800;
}

.v6-sink-card-head strong {
  display: block;
  margin-top: 2px;
  color: #0f1720;
  line-height: 1.25;
}

.v6-sink-facts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.v6-sink-facts div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
}

.v6-sink-facts dt {
  color: #51647a;
  font-size: 12px;
  font-weight: 900;
}

.v6-sink-facts dd {
  margin: 0;
  color: #26323d;
  font-size: 13px;
  font-weight: 800;
}

.v6-sink-render-button {
  width: 100%;
  justify-content: center;
}

.v6-data-item {
  padding: 9px 10px;
  border: 1px solid #dbe3e7;
  border-radius: 8px;
  background: #f8fbfb;
}

.v6-data-item strong {
  display: block;
  color: #0f1720;
}

body.v6-montage-zoom-open {
  overflow: hidden;
}

.v6-montage-zoom[hidden] {
  display: none;
}

.v6-montage-zoom {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 32, 0.72);
}

.v6-montage-zoom-dialog {
  width: min(96vw, 1500px);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: #f7fafb;
  box-shadow: 0 28px 80px rgba(3, 10, 18, 0.35);
  overflow: hidden;
}

.v6-montage-zoom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #dbe3e7;
  background: #ffffff;
}

.v6-montage-zoom-head span {
  display: block;
  color: #51647a;
  font-size: 12px;
  font-weight: 900;
}

.v6-montage-zoom-head strong {
  display: block;
  color: #0f1720;
  font-size: 16px;
}

.v6-montage-zoom-close {
  min-height: 38px;
  padding: 0 14px;
}

.v6-montage-zoom-stage {
  min-height: min(78vh, 860px);
  background:
    linear-gradient(90deg, rgba(31, 41, 51, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31, 41, 51, 0.045) 1px, transparent 1px),
    #f6f9fa;
  background-size: 34px 34px;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
}

.v6-montage-zoom-stage canvas {
  display: block;
  width: 100%;
  height: min(78vh, 860px);
  transform-origin: center center;
  transition: none;
  will-change: transform;
}

@media (max-width: 1100px) {
  .v6-montage-grid {
    grid-template-columns: 1fr;
  }

  .v6-montage-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .v6-montage-shell {
    gap: 10px;
  }

  .v6-montage-stage-card,
  .v6-montage-panel {
    padding: 10px;
  }

  .v6-montage-head,
  .v6-montage-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .v6-montage-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 8px;
  }

  .v6-montage-summary > div {
    padding: 8px 10px;
  }

  .v6-montage-summary strong {
    font-size: 13px;
  }

  .v6-montage-item-head {
    padding: 9px 10px;
  }

  .v6-montage-stage {
    height: clamp(300px, 76vw, 390px);
    min-height: 300px;
  }

  .v6-montage-stage canvas {
    height: 100%;
  }

  .v6-montage-item-head,
  .v6-montage-zoom-head {
    align-items: stretch;
    flex-direction: column;
  }

  .v6-montage-item-actions {
    justify-content: space-between;
  }

  .v6-montage-zoom {
    padding: 8px;
  }

  .v6-montage-zoom-stage,
  .v6-montage-zoom-stage canvas {
    min-height: 70vh;
    height: 70vh;
  }
}
