.market-view,
.market-map-view {
  display: grid;
  gap: 14px;
}

.land-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px;
  gap: 14px;
  align-items: start;
}

.market-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.market-unit-input {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 900;
  color: #334155;
}

.market-unit-input input,
.land-detail-controls input {
  height: 42px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  font-size: 15px;
  font-weight: 900;
}

.land-detail-list {
  display: grid;
  gap: 18px;
}

.land-detail-side {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
}

.land-detail-side h4 {
  margin: 0 0 2px;
  font-size: 12px;
}

.land-detail-nav-btn {
  display: grid;
  gap: 4px;
  min-height: 70px;
  width: 100%;
  border: 1px solid #dbe3ef;
  border-radius: 9px;
  background: #f8fafc;
  color: #172033;
  font-weight: 900;
  cursor: pointer;
}

.land-detail-nav-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
}

.land-detail-delete-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #fecaca;
  border-radius: 50%;
  background: #fff;
  color: #dc2626;
  font-weight: 900;
  cursor: pointer;
}

.land-detail-nav-btn.active {
  background: #1f2f5d;
  color: #fff;
}

.land-detail-nav-btn span {
  font-size: 10px;
  color: inherit;
  opacity: .78;
}

.land-detail-controls {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 8px;
}

.land-detail-controls label {
  display: grid;
  gap: 4px;
  font-size: 14px;
  font-weight: 900;
  color: #334155;
}

.land-detail-page {
  position: relative;
  width: 690px;
  height: 920px;
  background: #fff;
  border: 2px solid #1d4ed8;
  overflow: hidden;
  outline: none;
}

.land-detail-image {
  display: block;
  width: calc(100% - 150px);
  height: 100%;
  object-fit: contain;
  object-position: left top;
}

.land-detail-empty,
.market-map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 900;
  background: #f8fafc;
}

.land-detail-unit {
  position: absolute;
  right: 18px;
  top: 60px;
  width: 128px;
  display: grid;
  gap: 8px;
  color: #f00000;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
}

.market-title-band {
  width: 1200px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #f00000;
  font-size: 16px;
  font-weight: 900;
}

.market-map-canvas {
  position: relative;
  width: 1200px;
  height: 748px;
  border: 1px solid #111;
  background: #fff;
  overflow: hidden;
  outline: none;
}

.market-map-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.market-map-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.market-map-line line,
.market-map-line circle {
  stroke: #0070c0;
  fill: #0070c0;
}

.market-map-line line {
  stroke-width: 1.5;
}

.market-map-line.red line,
.market-map-line.red circle {
  stroke: #f00000;
  fill: #f00000;
}

.market-map-label {
  position: absolute;
  z-index: 3;
  min-width: 118px;
  padding: 8px 11px;
  border: 2px solid #0070c0;
  background: #fff;
  color: #111;
  box-shadow: 4px 4px 0 #111;
  font-size: 17px;
  font-weight: 900;
  cursor: move;
}

.market-map-label.red {
  border-color: #f00000;
  text-align: center;
}

.market-map-label.blue {
  min-width: 220px;
}

.market-label-delete {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid #fecaca;
  border-radius: 50%;
  background: #fff;
  color: #dc2626;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.market-map-label.blue {
  color: #111;
}

.market-map-label .unit-red {
  color: #f00000;
}

.market-yellow-route {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.market-yellow-route line {
  stroke: #facc15;
  opacity: .48;
  mix-blend-mode: normal;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: move;
}

.market-yellow-handle {
  position: absolute;
  z-index: 5;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid #ca8a04;
  border-radius: 50%;
  background: #fff;
  cursor: grab;
}

.market-line-delete {
  position: absolute;
  z-index: 6;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  display: grid;
  place-items: center;
  border: 1px solid #ca8a04;
  border-radius: 50%;
  background: #fff;
  color: #92400e;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.market-anchor {
  position: absolute;
  z-index: 4;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #0070c0;
  cursor: grab;
}

.market-anchor.red {
  background: #f00000;
}

@media print {
  .market-toolbar,
  .land-detail-controls,
  .land-detail-side {
    display: none !important;
  }

  .land-detail-page {
    page: market-a4-portrait;
    width: 210mm !important;
    height: 297mm !important;
    border: none !important;
    page-break-after: always;
    break-after: page;
  }

  .land-detail-item:last-child .land-detail-page {
    page-break-after: auto;
    break-after: auto;
  }
}

@page market-a4-portrait {
  size: A4 portrait;
  margin: 0;
}

/* ===== Larger, cleaner market controls ===== */
@media screen {
  .market-view,
  .market-map-view {
    gap: 18px;
  }

  .market-toolbar {
    gap: 14px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid #d9dee8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(17, 24, 39, .06);
  }

  .market-toolbar button,
  .land-detail-controls button {
    min-height: 54px;
    padding: 0 22px;
    font-size: 17px;
    font-weight: 900;
  }

  .market-unit-input,
  .land-detail-controls label {
    font-size: 16px;
  }

  .market-unit-input input,
  .land-detail-controls input {
    width: 190px;
    height: 56px;
    padding: 10px 16px;
    font-size: 20px;
  }

  .land-detail-layout {
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 20px;
  }

  .land-detail-controls {
    gap: 16px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid #d9dee8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(17, 24, 39, .06);
  }

  .land-detail-item .land-detail-controls {
    align-items: end;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 12px;
    gap: 12px;
    white-space: nowrap;
    scrollbar-width: thin;
  }

  .land-detail-item .land-detail-controls > strong,
  .land-detail-item .land-detail-controls > label,
  .land-detail-item .land-detail-controls > button {
    flex: 0 0 auto;
  }

  .land-detail-item .land-detail-controls .land-detail-add-inline {
    min-width: 92px;
  }

  .land-detail-side {
    width: 150px;
    max-width: 150px;
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 10px 26px rgba(17, 24, 39, .06);
  }

  .land-detail-side h4 {
    margin: 0 0 8px;
    font-size: 13px;
  }

  .land-detail-nav-row {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 8px;
  }

  .land-detail-nav-btn {
    min-height: 58px;
    padding: 10px 9px;
    font-size: 15px;
    border-radius: 14px;
    text-align: center;
  }

  .land-detail-nav-btn span {
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .land-detail-delete-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .market-title-band {
    height: 42px;
    font-size: 20px;
  }
}

@media screen {
  .market-map-view > .market-toolbar {
    display: none !important;
  }

  .market-toolbar.market-floating-tools {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: 10px !important;
    bottom: auto !important;
    z-index: 5000 !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: min(1040px, calc(100vw - 270px)) !important;
    min-height: 42px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    border: 1px solid rgba(148, 163, 184, 0.38) !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, 0.97) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14) !important;
    backdrop-filter: blur(8px);
    scrollbar-width: thin;
  }

  .market-toolbar.market-floating-tools button {
    width: auto !important;
    min-width: 74px !important;
    max-width: none !important;
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 9px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  .market-toolbar.market-floating-tools .market-unit-input {
    flex: 0 0 auto !important;
    gap: 5px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
  }

  .market-toolbar.market-floating-tools .market-unit-input input {
    width: 126px !important;
    height: 32px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
  }

  .land-detail-controls.land-detail-floating-tools {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: 10px !important;
    bottom: auto !important;
    z-index: 5000 !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: min(1040px, calc(100vw - 270px)) !important;
    min-height: 42px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    border: 1px solid rgba(148, 163, 184, 0.38) !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, 0.97) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14) !important;
    backdrop-filter: blur(8px);
    scrollbar-width: thin;
  }

  .land-detail-controls.land-detail-floating-tools > strong,
  .land-detail-controls.land-detail-floating-tools label,
  .land-detail-controls.land-detail-floating-tools button {
    flex: 0 0 auto !important;
  }

  .land-detail-controls.land-detail-floating-tools > strong {
    font-size: 12px !important;
    font-weight: 900 !important;
    color: #172033 !important;
  }

  .land-detail-controls.land-detail-floating-tools label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
  }

  .land-detail-controls.land-detail-floating-tools input {
    width: 126px !important;
    height: 32px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
  }

  .land-detail-controls.land-detail-floating-tools button {
    width: auto !important;
    min-width: 74px !important;
    max-width: none !important;
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 9px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
}
