:root {
  color: #1c2424;
  background: #eef0ed;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 34px;
  border: 1px solid #b8c0ba;
  border-radius: 6px;
  background: #ffffff;
  color: #1c2424;
  padding: 7px 10px;
  cursor: pointer;
}

button:hover,
button.active {
  border-color: #277a68;
  background: #e4f2ee;
}

button.danger:hover {
  border-color: #b84a40;
  background: #fae9e6;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid #c5ccc6;
  border-radius: 6px;
  background: #ffffff;
  color: #1c2424;
  padding: 7px 9px;
}

textarea {
  resize: vertical;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #d0d5d0;
  background: #fbfbf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 180px;
  font-size: 17px;
  font-weight: 750;
}

.brandMark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #26302f;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0;
}

.barForm {
  display: flex;
  align-items: center;
  gap: 8px;
}

.barForm input[type="file"] {
  width: 280px;
}

.barForm #jobIdInput {
  width: 230px;
}

.apiForm #apiBaseInput {
  width: 260px;
}

.statusBadge {
  margin-left: auto;
  border: 1px solid #c5cbc5;
  border-radius: 999px;
  background: #ffffff;
  padding: 6px 12px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  height: calc(100vh - 58px);
}

.sidePanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid #d0d5d0;
  background: #fbfbf8;
  overflow: auto;
}

.jobCard,
.inspector,
.tabPanel {
  padding: 12px;
}

.jobCard {
  border-bottom: 1px solid #e0e3df;
}

.jobTitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.muted {
  color: #69736d;
  font-size: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 12px 0;
}

.tab {
  font-weight: 700;
}

.tabPanel {
  display: none;
  gap: 10px;
  border-bottom: 1px solid #e0e3df;
}

.tabPanel.active {
  display: grid;
}

.panelRow {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.objectList {
  display: grid;
  gap: 7px;
  max-height: 280px;
  overflow: auto;
}

.objectItem {
  display: grid;
  gap: 4px;
  border: 1px solid #d7ddd7;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px;
  cursor: pointer;
}

.objectItem:hover,
.objectItem.active {
  border-color: #277a68;
  background: #eef8f5;
}

.objectItemTitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.objectItemMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #5d6862;
  font-size: 12px;
}

.sectionTitle {
  margin-bottom: 10px;
  font-weight: 750;
}

.objectForm {
  display: grid;
  gap: 9px;
}

.objectForm label {
  display: grid;
  gap: 5px;
  color: #48534d;
  font-size: 12px;
  font-weight: 700;
}

.bboxGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

#planSizeLabel {
  grid-template-columns: repeat(3, 1fr);
}

.scaleControl {
  display: grid;
  gap: 7px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid rgba(31, 143, 95, 0.35);
  border-radius: 8px;
  background: rgba(223, 246, 236, 0.35);
}

.scaleControl .bboxGrid {
  grid-template-columns: repeat(2, 1fr);
}

.hidden {
  display: none !important;
}

.jsonView {
  max-height: 300px;
  overflow: auto;
  margin: 0;
  border: 1px solid #d8ded8;
  border-radius: 6px;
  background: #f4f6f2;
  padding: 10px;
  color: #26302f;
  font-size: 12px;
  white-space: pre-wrap;
}

.packageView {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.packageSummary {
  display: grid;
  gap: 8px;
}

.sectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.packageGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.cropPreview {
  display: grid;
  gap: 6px;
  border: 1px solid #d7ddd7;
  border-radius: 6px;
  background: #ffffff;
  padding: 7px;
  min-width: 0;
}

.cropPreview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #edf0ea;
  border: 1px solid #e0e4df;
  border-radius: 4px;
}

.cropMeta {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #5d6862;
  font-size: 11px;
  line-height: 1.25;
}

.cropMeta strong,
.cropMeta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cropMeta strong {
  color: #26302f;
  font-size: 12px;
}

.symbolReview {
  display: grid;
  gap: 8px;
}

.symbolGrid {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.symbolCard {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid #d7ddd7;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.symbolCard.active {
  border-color: #bf3f37;
  box-shadow: 0 0 0 2px rgba(191, 63, 55, 0.14);
}

.symbolCard img {
  grid-row: span 5;
  width: 86px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border: 1px solid #e0e4df;
  border-radius: 4px;
  background: #edf0ea;
}

.symbolCard label {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #56615b;
  font-size: 11px;
  font-weight: 700;
}

.symbolCard input,
.symbolCard textarea {
  min-width: 0;
  width: 100%;
}

.symbolCheck {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

.symbolCheck input {
  width: auto;
}

.symbolMeta {
  overflow: hidden;
  color: #6d7770;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  background: #e9ebe7;
}

.toolBar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #d0d5d0;
  background: #f6f7f3;
}

.tool {
  font-weight: 700;
}

.zoomControl,
.opacityControl {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #56615b;
  font-size: 12px;
  font-weight: 700;
}

.zoomControl {
  margin-left: auto;
}

.zoomControl input {
  width: 150px;
  padding: 0;
}

#zoomValue {
  min-width: 44px;
  color: #1f2b28;
  font-variant-numeric: tabular-nums;
}

.opacityControl input {
  width: 120px;
  padding: 0;
}

.canvasInfo {
  min-width: 170px;
  color: #5b6661;
  font-size: 12px;
  text-align: right;
}

.canvasWrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 14px;
  overflow: auto;
  border: 1px solid #bec6bf;
  background: #d8dbd5;
}

.canvasStage {
  position: relative;
  width: 0;
  height: 0;
  min-width: 0;
  min-height: 0;
}

#pageImage {
  position: absolute;
  inset: 0 auto auto 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}

#overlay {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  overflow: visible;
}

.bboxRect {
  fill: rgba(39, 122, 104, 0.12);
  stroke: #277a68;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
  cursor: move;
}

.bboxRectHalo {
  fill: none;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 5.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.bboxRect.plan {
  fill: rgba(255, 255, 255, 0.04);
  stroke: #b27125;
  stroke-width: 2.7;
}

.bboxRect.planBuilt {
  fill: rgba(37, 99, 235, 0.08);
  stroke: #2563eb;
}

.bboxRect.planZone {
  fill: rgba(196, 101, 31, 0.1);
  stroke: #c4651f;
  stroke-dasharray: 7 4;
}

.bboxRect.planEquipment {
  fill: rgba(180, 35, 24, 0.09);
  stroke: #b42318;
}

.bboxRect.planEngineering {
  fill: rgba(88, 80, 141, 0.09);
  stroke: #58508d;
}

.bboxRect.planOther {
  fill: rgba(17, 111, 114, 0.08);
  stroke: #116f72;
}

.bboxRect.scaleRect {
  fill: rgba(34, 122, 104, 0.1);
  stroke: #1f8f5f;
  stroke-width: 2.4;
  stroke-dasharray: 10 5;
}

.bboxRect.active {
  fill: rgba(191, 63, 55, 0.16);
  stroke: #bf3f37;
  stroke-width: 3.2;
}

.bboxRectHalo.active {
  stroke: rgba(255, 255, 255, 1);
  stroke-width: 7;
}

.bboxLabelBg {
  fill: rgba(255, 255, 255, 0.9);
  stroke: rgba(23, 32, 31, 0.18);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.bboxLabelBg.planBuilt {
  fill: rgba(232, 240, 255, 0.94);
}

.bboxLabelBg.planZone {
  fill: rgba(255, 240, 220, 0.94);
}

.bboxLabelBg.planEquipment {
  fill: rgba(255, 234, 232, 0.94);
}

.bboxLabelBg.planEngineering {
  fill: rgba(241, 238, 255, 0.94);
}

.bboxLabelBg.planOther {
  fill: rgba(224, 247, 247, 0.94);
}

.bboxLabelBg.scaleLabelBg {
  fill: rgba(223, 246, 236, 0.96);
  stroke: rgba(31, 143, 95, 0.5);
}

.bboxLabel {
  fill: #17201f;
  font-size: 12px;
  font-weight: 750;
  pointer-events: none;
}

.handle {
  fill: #ffffff;
  stroke: #bf3f37;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: nwse-resize;
}

.handle.ne,
.handle.sw {
  cursor: nesw-resize;
}

.drawDraft {
  fill: rgba(67, 94, 177, 0.14);
  stroke: #435eb1;
  stroke-dasharray: 8 5;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.emptyCanvas {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #647069;
  pointer-events: none;
}

.loadingOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  background: rgba(247, 250, 249, 0.82);
  color: #1f5b4e;
  font-weight: 700;
  font-size: 15px;
  z-index: 20;
}

.loadingSpinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(31, 143, 95, 0.25);
  border-top-color: #1f8f5f;
  border-radius: 50%;
  animation: txspin 0.8s linear infinite;
}

@keyframes txspin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .topbar {
    height: auto;
    flex-wrap: wrap;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidePanel {
    border-right: 0;
    border-bottom: 1px solid #d0d5d0;
  }

  .workspace {
    min-height: 70vh;
  }

  .toolBar {
    flex-wrap: wrap;
  }

  .opacityControl {
    margin-left: 0;
  }
}
