/* DirectionalPlan CAD Import / Viewer */

.wsCadOverlay{
  position:fixed;
  inset:0;
  z-index:45000;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  font-family:Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.wsCadOverlay.isOpen{ display:flex; }

.wsCadBackdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.52);
  backdrop-filter:blur(3px);
  -webkit-backdrop-filter:blur(3px);
}

.wsCadShell{
  position:relative;
  z-index:1;
  width:min(1700px, calc(100vw - 36px));
  height:min(930px, calc(100vh - 36px));
  min-width:1100px;
  min-height:650px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:#fff;
  border:1px solid #cfd8e6;
  border-radius:16px;
  box-shadow:0 28px 80px rgba(15,23,42,.35);
}

.wsCadHeader{
  min-height:68px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:10px 14px 10px 18px;
  color:#fff;
  background:linear-gradient(180deg, #3377B5 0%, #2f6fae 100%);
  border-bottom:1px solid rgba(0,0,0,.08);
}

.wsCadHeaderTitleBlock{ min-width:0; }
.wsCadKicker{
  font-size:10px;
  font-weight:900;
  letter-spacing:.1em;
  text-transform:uppercase;
  opacity:.78;
}
.wsCadTitle{
  margin-top:2px;
  font-size:18px;
  line-height:1.1;
  font-weight:900;
}
.wsCadFilename{
  max-width:640px;
  margin-top:3px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:11px;
  font-weight:700;
  opacity:.88;
}

.wsCadHeaderActions{
  display:flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
}
.wsCadFileInput{ display:none; }

.wsCadBtn,
.wsCadClose{
  border:1px solid rgba(255,255,255,.35);
  background:rgba(255,255,255,.14);
  color:#fff;
  font:inherit;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}
.wsCadBtn{
  min-height:32px;
  padding:0 12px;
  border-radius:999px;
}
.wsCadBtn:hover,
.wsCadClose:hover{ background:rgba(255,255,255,.24); }
.wsCadBtnPrimary{
  background:#fff;
  border-color:#fff;
  color:#123A5A;
}
.wsCadBtnPrimary:hover{ background:#edf5ff; }
.wsCadClose{
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  padding:0;
  border-radius:10px;
  font-size:20px;
  line-height:1;
}

.wsCadStatus{
  min-height:32px;
  display:flex;
  align-items:center;
  padding:7px 16px;
  border-bottom:1px solid #dbe4f0;
  background:#f8fafc;
  color:#475467;
  font-size:12px;
  font-weight:700;
}
.wsCadStatus[data-kind="success"]{ background:#edf9f0; color:#256536; }
.wsCadStatus[data-kind="warn"]{ background:#fff8e8; color:#8a5a00; }
.wsCadStatus[data-kind="error"]{ background:#fff1f1; color:#a12f2f; }

.wsCadBody{
  flex:1;
  min-height:0;
  display:grid;
  grid-template-columns:270px minmax(0,1fr) 330px;
}

.wsCadSide{
  min-height:0;
  overflow:auto;
  padding:12px;
  background:#f8fafc;
}
.wsCadSideLeft{ border-right:1px solid #dbe4f0; }
.wsCadSideRight{ border-left:1px solid #dbe4f0; }
.wsCadSide h3{
  margin:0 0 10px;
  color:#123A5A;
  font-size:14px;
  font-weight:900;
}

.wsCadSideTitleRow,
.wsCadSelectedHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.wsCadMiniActions{ display:flex; gap:5px; }
.wsCadMiniActions button,
.wsCadSelectedHeader button{
  border:1px solid #cad5e3;
  background:#fff;
  color:#344054;
  padding:4px 7px;
  border-radius:7px;
  font-size:10px;
  font-weight:800;
  cursor:pointer;
}

.wsCadInfoCard{
  display:grid;
  gap:3px;
  margin-bottom:10px;
  padding:10px;
  border:1px solid #dbe4f0;
  border-radius:10px;
  background:#fff;
  color:#475467;
  font-size:11px;
}
.wsCadInfoCard strong{ color:#123A5A; font-size:12px; }

.wsCadLayerList{ display:grid; gap:4px; }
.wsCadLayerRow{
  display:grid;
  grid-template-columns:18px minmax(0,1fr) auto;
  align-items:center;
  gap:6px;
  min-height:30px;
  padding:5px 7px;
  border:1px solid transparent;
  border-radius:8px;
  background:#fff;
  cursor:pointer;
  font-size:11px;
}
.wsCadLayerRow:hover{ border-color:#bfd0e5; background:#f3f8ff; }
.wsCadLayerName{
  min-width:0;
  display:flex;
  align-items:center;
  gap:6px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.wsCadSwatch{
  width:9px;
  height:9px;
  flex:0 0 9px;
  border-radius:2px;
  border:1px solid rgba(15,23,42,.15);
}
.wsCadLayerCount{ color:#64748b; font-variant-numeric:tabular-nums; }

.wsCadStage{
  position:relative;
  min-width:0;
  min-height:0;
  overflow:hidden;
  background-color:#fff;
  background-image:
    linear-gradient(rgba(51,119,181,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51,119,181,.055) 1px, transparent 1px);
  background-size:24px 24px;
  touch-action:none;
  cursor:crosshair;
}

#wsCadSvg{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  user-select:none;
}

.wsCadEntity{
  fill:none;
  stroke-width:1.25;
  vector-effect:non-scaling-stroke;
  pointer-events:stroke;
  cursor:pointer;
}

/*
  Invisible screen-space pick target.
  The CAD line stays visually thin, but the clickable stroke is 18 px wide.
*/
.wsCadHit{
  fill:none;
  stroke:transparent;
  stroke-width:18;
  vector-effect:non-scaling-stroke;
  pointer-events:stroke;
  cursor:pointer;
}

.wsCadHitPoint{
  fill:transparent;
  pointer-events:all;
}

.wsCadEntity.hovered:not(.selected){
  stroke-width:2.5 !important;
}

.wsCadEntity.grouped:not(.selected){
  stroke-dasharray:7 4;
  stroke-width:2.2 !important;
}
polygon.wsCadEntity,
circle.wsCadEntity{
  fill:rgba(51,119,181,.012);
  pointer-events:all;
}
.wsCadText{
  stroke:none;
  pointer-events:all;
  font-size:10px;
}
.wsCadEntity.selected{
  stroke:#006cff !important;
  stroke-width:3 !important;
}
.wsCadEntity.use-pad{ stroke:#7a3ff2 !important; stroke-width:2.2 !important; }
.wsCadEntity.use-hardline{ stroke:#d63a32 !important; stroke-width:2.2 !important; }
.wsCadEntity.use-reference{ stroke:#1877c9 !important; stroke-width:2 !important; }
.wsCadEntity.use-lease{ stroke:#18864b !important; stroke-width:2.2 !important; }
.wsCadEntity.use-section{ stroke:#d48b00 !important; stroke-width:2 !important; }
.wsCadEntity.selected{ stroke:#006cff !important; stroke-width:3 !important; }

.wsCadEmpty{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:7px;
  color:#64748b;
  text-align:center;
  pointer-events:none;
}
.wsCadEmpty[hidden]{ display:none !important; }
.wsCadEmpty strong{ color:#123A5A; font-size:17px; }
.wsCadEmpty span{ max-width:430px; font-size:12px; }
.wsCadEmptyIcon{
  width:58px;
  height:58px;
  display:grid;
  place-items:center;
  border:2px solid #b9cee6;
  border-radius:14px;
  color:#3377B5;
  background:#eef6ff;
  font-size:14px;
  font-weight:900;
}

.wsCadCoords{
  position:absolute;
  left:10px;
  bottom:10px;
  padding:5px 8px;
  border:1px solid #d6e0ec;
  border-radius:7px;
  background:rgba(255,255,255,.92);
  color:#344054;
  box-shadow:0 2px 8px rgba(15,23,42,.08);
  font:700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events:none;
}

.wsCadLoading{
  position:absolute;
  inset:0;
  z-index:10;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  background:rgba(255,255,255,.78);
  color:#123A5A;
  font-size:13px;
  font-weight:800;
}
.wsCadLoading[hidden]{ display:none !important; }
.wsCadSpinner{
  width:34px;
  height:34px;
  border:4px solid #dce7f4;
  border-top-color:#3377B5;
  border-radius:50%;
  animation:wsCadSpin .75s linear infinite;
}
@keyframes wsCadSpin{ to{ transform:rotate(360deg); } }

.wsCadCrsCard{
  display:grid;
  gap:4px;
  margin-bottom:10px;
  padding:9px 10px;
  border:1px solid #f0d39a;
  border-radius:10px;
  background:#fff8e8;
  color:#785314;
  font-size:11px;
  line-height:1.35;
}
.wsCadCrsCard.isDetected{
  border-color:#b8d1ee;
  background:#eef6ff;
  color:#24557f;
}
.wsCadCrsCard strong{ color:#123A5A; }

.wsCadInspector{
  margin-bottom:10px;
  padding:10px;
  border:1px solid #dbe4f0;
  border-radius:10px;
  background:#fff;
  color:#475467;
  font-size:11px;
}
.wsCadInspectorGrid{
  display:grid;
  grid-template-columns:75px minmax(0,1fr);
  gap:5px 8px;
}
.wsCadInspectorGrid span{ color:#667085; }
.wsCadInspectorGrid b{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  color:#101828;
}
.wsCadCoordTitle{
  margin:10px 0 5px;
  color:#123A5A;
  font-weight:900;
}
.wsCadCoordTableWrap{ max-height:180px; overflow:auto; border:1px solid #e5ebf3; border-radius:7px; }
.wsCadCoordTable{ width:100%; border-collapse:collapse; font-size:10px; font-variant-numeric:tabular-nums; }
.wsCadCoordTable th,
.wsCadCoordTable td{ padding:4px 5px; border-bottom:1px solid #edf1f6; text-align:right; }
.wsCadCoordTable th:first-child,
.wsCadCoordTable td:first-child{ text-align:center; color:#64748b; }
.wsCadCoordTable th{ position:sticky; top:0; background:#f8fafc; color:#344054; }

.wsCadSelectionCard,
.wsCadClassifyCard,
.wsCadSelectedCard{
  margin-top:10px;
  padding:10px;
  border:1px solid #dbe4f0;
  border-radius:10px;
  background:#fff;
}
.wsCadCardTitle{ color:#123A5A; font-size:12px; font-weight:900; }

.wsCadSelectionSummary{
  margin-top:7px;
  color:#475467;
  font-size:10px;
  line-height:1.4;
}

.wsCadWideAction{
  width:100%;
  min-height:32px;
  margin-top:8px;
  border:1px solid #a9c3e0;
  border-radius:8px;
  background:#edf5ff;
  color:#123A5A;
  font-size:10px;
  font-weight:900;
  cursor:pointer;
}

.wsCadWideAction:hover:not(:disabled){
  background:#e0efff;
  border-color:#7fa9d2;
}

.wsCadWideAction:disabled{
  opacity:.4;
  cursor:not-allowed;
}

.wsCadClassifyGrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  margin-top:8px;
}
.wsCadClassifyGrid button{
  min-height:30px;
  border:1px solid #cbd7e5;
  border-radius:8px;
  background:#f8fafc;
  color:#344054;
  font-size:10px;
  font-weight:800;
  cursor:pointer;
}
.wsCadClassifyGrid button:hover:not(:disabled){ background:#edf5ff; border-color:#a9c3e0; }
.wsCadClassifyGrid button:disabled{ opacity:.38; cursor:not-allowed; }
.wsCadClassifyHint{ margin-top:7px; color:#667085; font-size:10px; line-height:1.35; }

.wsCadSelectedList{ display:grid; gap:5px; margin-top:8px; }
.wsCadSelectedRow{
  display:grid;
  grid-template-columns:minmax(0,1fr) 28px;
  gap:5px;
  align-items:stretch;
}
.wsCadSelectedMain{
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  padding:7px 8px;
  border:1px solid #dbe4f0;
  border-radius:8px;
  background:#f8fafc;
  color:#123A5A;
  text-align:left;
  cursor:pointer;
}
.wsCadSelectedMain span{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#667085;
  font-size:9px;
}
.wsCadSelectedRemove{
  border:1px solid #e1c3c3;
  border-radius:8px;
  background:#fff7f7;
  color:#a33;
  cursor:pointer;
  font-size:16px;
}
.wsCadMuted{ color:#667085; font-size:10px; line-height:1.4; }


/* CAD -> DirectionalPlan import */

.wsCadImportCard{
  margin-top:10px;
  padding:10px;
  border:1px solid #b9cee6;
  border-radius:10px;
  background:#f7fbff;
}

.wsCadImportGeometry{
  margin-top:7px;
  padding:7px 8px;
  border:1px solid #dbe4f0;
  border-radius:8px;
  background:#fff;
  color:#475467;
  font-size:10px;
  line-height:1.4;
}

.wsCadImportGrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px;
}

.wsCadImportField{
  display:grid;
  gap:4px;
  margin-top:8px;
  color:#475467;
  font-size:10px;
  font-weight:800;
}

.wsCadImportField input,
.wsCadImportField select{
  width:100%;
  min-width:0;
  height:31px;
  box-sizing:border-box;
  border:1px solid #cbd7e5;
  border-radius:7px;
  background:#fff;
  color:#101828;
  padding:0 8px;
  font:inherit;
  font-size:11px;
}

.wsCadImportField input:focus,
.wsCadImportField select:focus{
  outline:none;
  border-color:#3377B5;
  box-shadow:0 0 0 2px rgba(51,119,181,.12);
}

.wsCadImportCrsSummary{
  margin-top:7px;
  padding:7px 8px;
  border:1px solid #dbe4f0;
  border-radius:7px;
  background:#fff;
  color:#475467;
  font-size:9px;
  line-height:1.4;
}

.wsCadImportConfirm{
  display:flex;
  align-items:flex-start;
  gap:7px;
  margin-top:8px;
  color:#475467;
  font-size:9px;
  line-height:1.4;
  cursor:pointer;
}

.wsCadImportConfirm input{
  flex:0 0 auto;
  margin-top:2px;
}

.wsCadImportBtn{
  width:100%;
  min-height:34px;
  margin-top:9px;
  border:1px solid #3377B5;
  border-radius:8px;
  background:#3377B5;
  color:#fff;
  font-size:10px;
  font-weight:900;
  cursor:pointer;
}

.wsCadImportBtn:hover:not(:disabled){
  background:#2d6ca7;
}

.wsCadImportBtn:disabled{
  opacity:.42;
  cursor:not-allowed;
}

.wsCadImportHint{
  margin-top:7px;
  color:#667085;
  font-size:9px;
  line-height:1.4;
}

.wsCadImportHint[data-kind="error"]{
  margin-top:8px;
  padding:9px 10px;
  border:1px solid #e4abab;
  border-left:4px solid #b42318;
  border-radius:7px;
  background:#fff0f0;
  color:#9b1c1c;
  font-size:10px;
  font-weight:900;
  line-height:1.4;
}

.wsCadImportHint[data-kind="warning"]{
  margin-top:8px;
  padding:9px 10px;
  border:1px solid #e6b85c;
  border-left:4px solid #c88708;
  border-radius:7px;
  background:#fff4d6;
  color:#714b00;
  font-size:10px;
  font-weight:900;
  line-height:1.4;
}

.wsCadImportHint[data-kind="ready"]{
  color:#256536;
  font-weight:800;
}

.wsCadEntity.imported:not(.selected){
  stroke-dasharray:3 3;
  opacity:.78;
}

@media (max-width:1250px){
  .wsCadBody{ grid-template-columns:230px minmax(0,1fr) 290px; }
}

.wsCadProjectNotice{
  padding:8px 14px;
  border-bottom:1px solid #e6d9a7;
  background:#fff8df;
  color:#715815;
  font-size:12px;
  line-height:1.35;
}

.wsCadProjectNotice strong{
  color:#493600;
  font-weight:800;
}