/* Smart measurement lens — isolated from the report, archive and ASTM engine. */
.smart-lens-modal[hidden], .smart-lens-stage [hidden],
.smart-lens-modal [hidden] { display: none !important; }
.smart-lens-modal {
  position: fixed;
  z-index: 120;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px max(9px, env(safe-area-inset-right)) max(15px, env(safe-area-inset-bottom));
  background: rgba(2, 13, 27, .96);
  color: #f4f8fc;
  direction: rtl;
}
.smart-lens-sheet {
  max-width: 640px;
  margin: auto;
  background: #102c44;
  border: 1px solid #436988;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 55px #0009;
}
.smart-lens-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; background: #062239; }
.smart-lens-header small { color: #e8c686; font-weight: 800; }
.smart-lens-header h2 { margin: 3px 0 0; font-size: 20px; color: #ffdf98; }
.smart-lens-header button, .smart-lens-actions button, .smart-lens-target-tabs button, .smart-lens-upload {
  border: 1px solid #7896ac;
  color: #fff;
  background: #244e69;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.smart-lens-guidance, .smart-lens-privacy, .smart-lens-help {
  margin: 0;
  padding: 9px 15px;
  line-height: 1.6;
  font-size: 12px;
  color: #deebf7;
}
.smart-lens-stage {
  position: relative;
  width: 100%;
  height: min(50dvh, 490px);
  min-height: 270px;
  overflow: hidden;
  background: #050b12;
  touch-action: pan-y;
}
.smart-lens-stage video, .smart-lens-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.smart-lens-stage.is-review {
  width: min(100%, 400px);
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 5;
  margin-inline: auto;
  touch-action: manipulation;
}
.smart-lens-stage.is-review canvas { object-fit: contain; }
.smart-lens-center-guide {
  position: absolute;
  inset: 12% 22%;
  border: 1px dashed rgba(255, 230, 149, .6);
  pointer-events: none;
}
.smart-lens-center-guide::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px dashed #f4da9e;
}
.smart-lens-markers { position: absolute; inset: 0; pointer-events: none; }
.smart-lens-marker {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid #30c7ef;
  filter: drop-shadow(0 0 2px #000);
}
.smart-lens-marker b {
  position: absolute;
  top: -22px;
  right: 8px;
  font-size: 12px;
  background: #08344d;
  color: #fff;
  padding: 2px 7px;
  border-radius: 5px;
}
.smart-lens-marker.marker-b { border-color: #ecbc56; }
.smart-lens-marker.marker-reading { border-color: #f85f87; border-top-width: 3px; }
.smart-lens-quality { margin: 0; padding: 9px 15px; font-size: 13px; font-weight: 800; background: #64431c; color: #fff2d8; }
.smart-lens-quality.good { background: #176849; color: #fff; }
.smart-lens-quality.bad { background: #733d23; color: #fff0d9; }
.smart-lens-quality.checking { background: #344958; color: #fff; }
.smart-lens-camera-tools { padding: 14px; }
.smart-lens-zoom { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 800; }
.smart-lens-zoom input { flex: 1; accent-color: #ffd37e; }
.smart-lens-zoom output { width: 45px; direction: ltr; text-align: center; }
.smart-lens-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.smart-lens-actions button, .smart-lens-upload { flex: 1; text-align: center; }
.smart-lens-primary { background: linear-gradient(110deg,#c28b22,#f5d580) !important; color: #15273a !important; border-color: #f5d580 !important; }
.smart-lens-primary:disabled { opacity: .4; filter: grayscale(1); cursor: not-allowed; }
.smart-lens-upload { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.smart-lens-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.smart-lens-upload:focus-within { outline: 2px solid #fff; }
.smart-lens-restart { margin-top: 8px; display: block; margin-inline: auto; border: 0; background: transparent; color: #c8e4f5; text-decoration: underline; cursor: pointer; font-size: 12px; }
.smart-lens-review { padding: 14px; }
.smart-lens-review > p { font-size: 13px; line-height: 1.8; margin: 0 0 10px; }
.smart-lens-anchor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.smart-lens-anchor-grid label { font-size: 12px; font-weight: 800; }
.smart-lens-anchor-grid input { display: block; margin-top: 5px; box-sizing: border-box; width: 100%; padding: 10px; border: 1px solid #7ea2bb; border-radius: 7px; background: #fff; color: #092538; direction: ltr; text-align: center; font-size: 16px; }
.smart-lens-target-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.smart-lens-target-tabs button { flex: 1; padding: 9px 3px; font-size: 12px; }
.smart-lens-target-tabs .selected { background: #f1d28c; color: #123147; }
.smart-lens-position { display: block; font-size: 12px; font-weight: 800; margin-bottom: 11px; }
.smart-lens-position input { display: block; width: 100%; margin-top: 9px; accent-color: #fc7f9f; }
.smart-lens-result { min-height: 40px; border: 1px solid #456a88; border-radius: 9px; background: #08243b; padding: 10px; font-size: 14px !important; }
.smart-lens-privacy { border-top: 1px solid #42637e; color: #a9c5db; }
@media (max-width: 580px) {
  .smart-lens-modal { padding: 0; }
  .smart-lens-sheet { border: 0; border-radius: 0; min-height: 100dvh; }
  .smart-lens-stage { height: min(49dvh, 500px); min-height: 260px; }
  .smart-lens-header h2 { font-size: 18px; }
}
@media print { .smart-lens-modal { display: none !important; } }
