
:root{
  --nav:#051a4d;
  --nav2:#0a3f95;
  --blue:#1688f4;
  --blue2:#0a63cb;
  --line:#84a8d6;
  --text:#173961;
  --panel:rgba(225,236,249,.88);
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  font-family:Arial,Helvetica,sans-serif;
  background:#07111f;
  color:var(--text);
}
header{
  height:42px;
  position:relative;
  display:flex;
  align-items:center;
  padding:4px 10px;
  background:linear-gradient(90deg,#03113b 0%,#082968 52%,#03113b 100%);
  border-bottom:1px solid #4b86da;
}
.brand{
  display:flex;
  align-items:center;
  gap:8px;
}
.brand-mark{
  width:30px;
  height:30px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:900;
  font-size:10px;
  border:1px solid #8ec5ff;
  background:radial-gradient(circle at 35% 30%,#4eb3ff,#1f4da8 55%,#0d245d 100%);
  box-shadow:0 0 8px rgba(68,153,255,.55);
}
.brand-text{
  color:#dcecff;
  font-size:15px;
  font-weight:800;
  white-space:nowrap;
}
.system-title{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  color:#fff;
  font-size:17px;
  font-weight:800;
  white-space:nowrap;
}
.control-panel{
  margin:5px 7px 0;
  height:72px;
  position:relative;
  padding:4px 5px;
  background:linear-gradient(180deg,rgba(235,243,253,.95),rgba(205,222,244,.92));
  border:1px solid #9bb8db;
  border-radius:6px;
  box-shadow:0 4px 12px rgba(0,0,0,.16);
}
.file-row{
  height:18px;
  display:flex;
  align-items:center;
}
button{
  font-family:inherit;
  font-size:10px;
  font-weight:800;
  cursor:pointer;
}
.file-btn{
  height:18px;
  padding:1px 11px;
  border:1px solid #7697bf;
  border-radius:4px;
  background:#fff;
  color:#173961;
}
.planes{
  margin-top:2px;
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:4px;
}
.plane-btn{
  height:23px;
  border:1px solid #4c93d5;
  border-radius:12px;
  color:#fff;
  background:linear-gradient(180deg,#3cb1ff 0%,#167ee6 48%,#0a61c5 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.5);
}
.plane-btn.active{
  background:linear-gradient(180deg,#5dc3ff 0%,#1689f5 48%,#0b6fd9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.65),
    0 0 8px rgba(32,151,255,.7);
}
.bottom-row{
  position:relative;
  height:22px;
  margin-top:2px;
  display:flex;
  align-items:center;
}
.legend{
  display:flex;
  align-items:center;
  gap:18px;
  font-size:10px;
  font-weight:700;
  color:#244567;
}
.legend span{
  display:inline-flex;
  align-items:center;
  gap:5px;
}
.dot{
  width:12px;
  height:12px;
  border-radius:3px;
  border:1px solid rgba(59,86,120,.65);
}
.dot.input{background:#ffd11a}
.dot.measure{background:#15d14f}
.dot.result{background:#31cce8}
.dot.summary{background:#5fd39a}
.history{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  display:flex;
  gap:7px;
}
.history button{
  height:20px;
  min-width:82px;
  padding:1px 10px;
  border-radius:4px;
  border:1px solid #7796bc;
  background:#fff;
  color:#173961;
  box-shadow:0 1px 4px rgba(0,0,0,.12);
}
.stage{
  height:calc(100vh - 119px);
}

/* ЭТАП 2 — только верхние рабочие блоки по пользовательскому макету.
   Ничего нового не придумано: композиция и состав воспроизводятся по скрину,
   с ранее зафиксированными изменениями. */
body{
  background:#07111f url("image-b80c7ad1688e.png") center center/cover fixed no-repeat;
}
.stage{
  height:calc(100vh - 119px);
  overflow:hidden;
}
.upper-workspace{
  /* около 10 мм визуального отступа от панели */
  margin:38px auto 0;
  width:calc(100% - 28px);
  max-width:1480px;
  height:300px;
  position:relative;
}
.work-block{
  position:absolute;
  overflow:hidden;
  border:1px solid rgba(100,148,205,.92);
  border-radius:5px;
  background:rgba(226,237,250,.76);
  box-shadow:0 4px 12px rgba(0,0,0,.18);
}
.work-block-title{
  height:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 7px;
  background:linear-gradient(180deg,#1683ea,#0a60c4);
  color:#fff;
  font-size:11px;
  font-weight:800;
  text-align:center;
  white-space:nowrap;
}
.section-title{
  height:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 5px;
  background:rgba(207,222,243,.88);
  border-bottom:1px solid rgba(126,163,207,.64);
  color:#173961;
  font-size:10px;
  font-weight:800;
  text-align:center;
}

/* Левый блок: положение как в макете, без растягивания. */
.deviation-block{
  left:0;
  top:0;
  width:29.2%;
  height:260px;
}
.deviation-inner{
  height:238px;
  padding:8px 10px 6px;
  display:flex;
  flex-direction:column;
  background:rgba(238,245,252,.48);
}
.deviation-svg-wrap{
  flex:1;
  min-height:0;
}
.deviation-svg{
  width:100%;
  height:100%;
  display:block;
}
.deviation-svg .plane{
  fill:rgba(206,221,241,.64);
  stroke:#7c91a8;
  stroke-width:1.15;
}
.deviation-svg .active-plane{
  fill:rgba(60,215,109,.56);
  stroke:#15964a;
}
.deviation-svg text{
  fill:#244968;
  font-size:11px;
  font-weight:800;
}
.active-label{
  height:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  font-weight:700;
  color:#173961;
}

/* Центральная колонка: ДАННЫЕ ЗАМЕРА сверху и ПОДСКАЗКА снизу. */
.measure-block{
  left:30.2%;
  top:0;
  width:29.8%;
  height:158px;
}
.hint-block{
  left:30.2%;
  top:168px;
  width:29.8%;
  height:92px;
}
.measure-fields{
  display:grid;
  grid-template-columns:1fr 1fr;
  grid-template-rows:repeat(3,1fr);
  height:116px;
  background:rgba(239,246,252,.36);
}
.measure-field{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) 78px;
  align-items:center;
  border-right:1px solid rgba(131,167,210,.45);
  border-bottom:1px solid rgba(131,167,210,.45);
  background:rgba(229,239,250,.55);
}
.measure-field label{
  padding-left:6px;
  color:#173961;
  font-size:10px;
  font-weight:700;
}
.measure-value{
  height:24px;
  margin-right:5px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #6da780;
  border-radius:5px;
  background:linear-gradient(180deg,#2ade65,#08a93a);
  color:#082d16;
  font-size:10px;
  font-weight:800;
}
.hint-content{
  height:70px;
  padding:5px 7px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(238,245,252,.46);
  color:#3e5975;
  font-size:10px;
  text-align:center;
}

/* Правый блок — полный состав, как в текущей программе/скрине. */
.space-block{
  right:0;
  top:0;
  width:38.8%;
  height:260px;
}
.space-dashboard{
  height:238px;
  padding:4px;
  display:grid;
  grid-template-columns:1fr 1fr;
  grid-template-rows:repeat(4,1fr);
  gap:4px;
  background:rgba(236,244,252,.40);
}
.space-section{
  overflow:hidden;
  border:1px solid rgba(126,163,205,.68);
  background:rgba(240,247,253,.58);
}
.space-section.long{
  grid-column:auto;
}
.space-section-title{
  min-height:19px;
  padding:3px 4px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(207,223,243,.88);
  border-bottom:1px solid rgba(132,169,210,.54);
  color:#173961;
  font-size:8.5px;
  font-weight:800;
  line-height:1.05;
  text-align:center;
}
.space-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
}
.space-cell{
  min-height:24px;
  padding:2px 3px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  border-right:1px solid rgba(136,171,210,.36);
  border-bottom:1px solid rgba(136,171,210,.36);
  background:rgba(229,240,250,.54);
}
.space-cell b{
  color:#536b84;
  font-size:7.8px;
  font-weight:700;
  text-align:center;
}
.space-cell span{
  margin-top:1px;
  color:#153a5e;
  font-size:9px;
  font-weight:800;
}
@media(max-width:1150px){
  .upper-workspace{
    width:calc(100% - 18px);
    height:auto;
    margin-top:24px;
    display:flex;
    flex-direction:column;
    gap:8px;
  }
  .work-block{
    position:relative;
    left:auto;right:auto;top:auto;
    width:100%;
    height:auto;
    min-height:150px;
  }
}


/* КОРРЕКТИРОВКА ПО ЗАМЕЧАНИЯМ ПОЛЬЗОВАТЕЛЯ */

/* 1. Оригинальный знак MarAlex из v1.1.9 */
.brand-logo{
  width:30px;
  height:30px;
  display:block;
  object-fit:contain;
  filter:drop-shadow(0 0 5px rgba(69,151,255,.38));
}

/* 3. MarAlex digital systems — отдельное фирменное название,
   шрифтовая подача возвращена ближе к v1.1.9 */
.brand-text{
  font-family:"Segoe UI",Arial,sans-serif !important;
  font-size:13px !important;
  font-weight:600 !important;
  letter-spacing:.15px !important;
  color:#dcecff !important;
}

/* 2. Глянцевые выпуклые кнопки со стеклянной линзой */
.file-btn,
.plane-btn,
.history button{
  position:relative;
  overflow:hidden;
  border:1px solid rgba(110,160,218,.92) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.90),
    inset 0 -2px 5px rgba(0,45,115,.25),
    0 2px 5px rgba(0,0,0,.18),
    0 0 0 1px rgba(255,255,255,.14) !important;
}
.file-btn::before,
.plane-btn::before,
.history button::before{
  content:"";
  position:absolute;
  left:8%;
  right:8%;
  top:2px;
  height:45%;
  border-radius:999px;
  background:linear-gradient(180deg,rgba(255,255,255,.82),rgba(255,255,255,.12));
  pointer-events:none;
}
.file-btn::after,
.plane-btn::after,
.history button::after{
  content:"";
  position:absolute;
  inset:1px;
  border-radius:inherit;
  border:1px solid rgba(255,255,255,.22);
  pointer-events:none;
}
.file-btn,
.history button{
  background:linear-gradient(180deg,rgba(255,255,255,.98) 0%,rgba(229,239,252,.98) 48%,rgba(194,216,244,.98) 100%) !important;
}
.plane-btn{
  background:
    radial-gradient(circle at 50% 18%,rgba(255,255,255,.62) 0%,rgba(255,255,255,.16) 30%,transparent 48%),
    linear-gradient(180deg,#58b9ff 0%,#2494f2 45%,#0b66c9 100%) !important;
}
.plane-btn.active{
  background:
    radial-gradient(circle at 50% 18%,rgba(255,255,255,.78) 0%,rgba(255,255,255,.18) 34%,transparent 52%),
    linear-gradient(180deg,#7acbff 0%,#2b9cf4 45%,#086bd5 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -2px 6px rgba(0,53,125,.28),
    0 0 9px rgba(27,143,255,.62),
    0 2px 5px rgba(0,0,0,.18) !important;
}

/* 4. Активная плоскость в схеме — синяя, не зеленая */
.deviation-svg .active-plane{
  fill:rgba(39,145,242,.62) !important;
  stroke:#0a69c8 !important;
}

/* 5. Строки ввода данных полупрозрачные, фон программы должен просматриваться */
.measure-block{
  background:rgba(220,234,248,.48) !important;
}
.measure-fields{
  background:transparent !important;
}
.measure-field{
  background:rgba(226,238,250,.28) !important;
}
.measure-field label{
  background:transparent !important;
}
.measure-value{
  background:linear-gradient(180deg,rgba(42,222,101,.82),rgba(8,169,58,.78)) !important;
  backdrop-filter:blur(2px);
}

/* 6. Прямоугольное пространство: все строки и значения должны помещаться и читаться */
.space-block{
  height:294px !important;
}
.space-dashboard{
  height:272px !important;
  grid-template-rows:repeat(4,minmax(0,1fr)) !important;
  gap:3px !important;
}
.space-section{
  min-height:0 !important;
  overflow:hidden !important;
}
.space-section-title{
  min-height:17px !important;
  height:auto !important;
  padding:2px 3px !important;
  font-size:8px !important;
  line-height:1.05 !important;
  overflow:visible !important;
}
.space-grid{
  height:calc(100% - 17px);
  align-content:stretch;
}
.space-cell{
  min-height:0 !important;
  padding:1px 2px !important;
}
.space-cell b{
  font-size:7.6px !important;
  line-height:1.05 !important;
  overflow:visible !important;
}
.space-cell span{
  font-size:8.8px !important;
  line-height:1.05 !important;
  overflow:visible !important;
}
/* Длинные нижние секции — чуть плотнее */
.space-section:nth-child(7) .space-section-title,
.space-section:nth-child(8) .space-section-title{
  font-size:7.2px !important;
}
.space-section:nth-child(7) .space-cell b,
.space-section:nth-child(8) .space-cell b{
  font-size:7.2px !important;
}


/* КОРРЕКТИРОВКА v3
   1) ДАННЫЕ ЗАМЕРА ставим строго по центру ширины экрана.
      Остальные два верхних блока располагаются относительно него.
      Слева от блока отклонений сохраняется свободное место.
   2) Низ ПРЯМОУГОЛЬНОГО ПРОСТРАНСТВА выравнивается по низу ДАННЫХ ЗАМЕРА.
   3) В двух нижних секциях ПРЯМОУГОЛЬНОГО ПРОСТРАНСТВА три значения идут в одну строку. */

.upper-workspace{
  width:calc(100% - 28px) !important;
  max-width:none !important;
  margin:38px auto 0 !important;
  height:300px !important;
}

/* Центральный блок — геометрический центр экрана */
.measure-block{
  left:50% !important;
  transform:translateX(-50%) !important;
  width:29.8% !important;
  height:158px !important;
}

/* Подсказка строго под ДАННЫМИ ЗАМЕРА */
.hint-block{
  left:50% !important;
  transform:translateX(-50%) !important;
  width:29.8% !important;
  top:168px !important;
  height:92px !important;
}

/* Отклонения располагаются слева от центрального блока.
   Из-за центрирования ДАННЫХ ЗАМЕРА слева от блока отклонений остается внешний отступ. */
.deviation-block{
  left:4.5% !important;
  width:29.2% !important;
  top:0 !important;
  height:260px !important;
}

/* Прямоугольное пространство справа от центрального блока,
   нижняя граница теперь совпадает с нижней границей ДАННЫХ ЗАМЕРА. */
.space-block{
  right:1.0% !important;
  width:33.2% !important;
  top:0 !important;
  height:158px !important;
}
.space-dashboard{
  height:136px !important;
  grid-template-columns:1fr 1fr !important;
  grid-template-rows:repeat(4,minmax(0,1fr)) !important;
  gap:2px !important;
  padding:3px !important;
}
.space-section-title{
  min-height:14px !important;
  padding:1px 2px !important;
  font-size:6.7px !important;
  line-height:1 !important;
}
.space-grid{
  height:calc(100% - 14px) !important;
}
.space-cell{
  min-height:0 !important;
  padding:0 1px !important;
}
.space-cell b{
  font-size:6.2px !important;
  line-height:1 !important;
}
.space-cell span{
  margin-top:0 !important;
  font-size:7.2px !important;
  line-height:1 !important;
}

/* Нижние две секции: все 3 значения в одной горизонтальной строке */
.space-section:nth-child(7) .space-grid,
.space-section:nth-child(8) .space-grid{
  grid-template-columns:repeat(3,1fr) !important;
}
.space-section:nth-child(7) .space-cell,
.space-section:nth-child(8) .space-cell{
  border-bottom:0 !important;
}
.space-section:nth-child(7) .space-section-title,
.space-section:nth-child(8) .space-section-title{
  font-size:5.9px !important;
  line-height:1 !important;
}
.space-section:nth-child(7) .space-cell b,
.space-section:nth-child(8) .space-cell b{
  font-size:5.9px !important;
}
.space-section:nth-child(7) .space-cell span,
.space-section:nth-child(8) .space-cell span{
  font-size:7px !important;
}

@media(max-width:1150px){
  .measure-block,.hint-block{
    left:auto !important;
    transform:none !important;
  }
  .deviation-block,.space-block{
    left:auto !important;
    right:auto !important;
  }
}


/* КОРРЕКТИРОВКА v4 */

/* 1. Нижняя граница ПРЯМОУГОЛЬНОГО ПРОСТРАНСТВА
   в одной линии с нижней границей ОТКЛОНЕНИЕ... и ПОДСКАЗКА */
.space-block{
  height:260px !important;
}
.space-dashboard{
  height:238px !important;
  grid-template-columns:1fr 1fr !important;
  grid-template-rows:repeat(4,minmax(0,1fr)) !important;
  gap:3px !important;
  padding:4px !important;
}
.space-section-title{
  min-height:18px !important;
  padding:2px 3px !important;
  font-size:8px !important;
  line-height:1.05 !important;
}
.space-grid{
  height:calc(100% - 18px) !important;
}
.space-cell{
  min-height:0 !important;
  padding:1px 2px !important;
}
.space-cell b{
  font-size:7.3px !important;
  line-height:1.05 !important;
}
.space-cell span{
  font-size:8.6px !important;
  line-height:1.05 !important;
}

/* Нижние две секции — по 3 значения в одну строку */
.space-section:nth-child(7) .space-grid,
.space-section:nth-child(8) .space-grid{
  grid-template-columns:repeat(3,1fr) !important;
}
.space-section:nth-child(7) .space-section-title,
.space-section:nth-child(8) .space-section-title{
  font-size:6.9px !important;
}
.space-section:nth-child(7) .space-cell b,
.space-section:nth-child(8) .space-cell b{
  font-size:6.8px !important;
}
.space-section:nth-child(7) .space-cell span,
.space-section:nth-child(8) .space-cell span{
  font-size:8.2px !important;
}

/* 2. Названия кнопок управления — черные */
.file-btn,
.plane-btn,
.history button{
  color:#000 !important;
  text-shadow:0 1px 0 rgba(255,255,255,.55);
}

/* 3. Панель кнопок плоскостей выше, чтобы ОТМЕНА/ВЕРНУТЬ не обрезались */
.control-panel{
  height:82px !important;
  padding-bottom:7px !important;
}
.bottom-row{
  height:27px !important;
  margin-top:3px !important;
}
.history{
  top:52% !important;
}
.history button{
  height:22px !important;
  min-height:22px !important;
}
.stage{
  height:calc(100vh - 129px) !important;
}


/* КОРРЕКТИРОВКА v5 — только 4 согласованных пункта */

/* 1. Равные расстояния между блоками по ширине и высоте.
   Отступ от панели плоскостей оставляем прежним. */
.upper-workspace{
  width:calc(100% - 28px) !important;
  margin:38px auto 0 !important;
  height:300px !important;
}

/* 2. Все три основные верхние колонки одинаковой ширины,
   равной ширине блока ДАННЫЕ ЗАМЕРА. */
.measure-block{
  width:29.8% !important;
  left:50% !important;
  transform:translateX(-50%) !important;
}
.deviation-block{
  width:29.8% !important;
  left:4.9% !important;
}
.space-block{
  width:29.8% !important;
  right:4.9% !important;
}

/* Горизонтальные промежутки между тремя колонками одинаковые. */
.deviation-block{
  left:4.9% !important;
}
.measure-block{
  left:50% !important;
}
.space-block{
  right:4.9% !important;
}

/* Вертикальный промежуток между ДАННЫЕ ЗАМЕРА и ПОДСКАЗКА
   приводим к спокойному равному шагу. */
.hint-block{
  top:168px !important;
  width:29.8% !important;
  left:50% !important;
  transform:translateX(-50%) !important;
}

/* 3. Чуть уменьшаем свечение кнопок плоскостей */
.plane-btn.active{
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    inset 0 -2px 5px rgba(0,53,125,.22),
    0 0 5px rgba(27,143,255,.40),
    0 2px 4px rgba(0,0,0,.15) !important;
}

/* 4. Фон блока ОТКЛОНЕНИЕ... по прозрачности как строки ДАННЫЕ ЗАМЕРА */
.deviation-block{
  background:rgba(220,234,248,.48) !important;
}
.deviation-inner{
  background:rgba(226,238,250,.28) !important;
}


/* КОРРЕКТИРОВКА v6 — только 3 пункта */

/* 1. Сам блок ОТКЛОНЕНИЕ... остается прозрачным,
   но визуал плоскостей внутри становится непрозрачным. */
.deviation-svg .plane{
  fill:#d7e4f3 !important;
}
.deviation-svg .active-plane{
  fill:#2f92e8 !important;
  stroke:#0a69c8 !important;
}
.deviation-svg-wrap{
  background:transparent !important;
}

/* 2. У кнопок переключения плоскостей убираем центральное свечение,
   верхний стеклянный блик оставляем. */
.plane-btn{
  background:linear-gradient(180deg,#58b9ff 0%,#2494f2 45%,#0b66c9 100%) !important;
}
.plane-btn.active{
  background:linear-gradient(180deg,#72c8ff 0%,#2b9cf4 45%,#086bd5 100%) !important;
}
.plane-btn::before{
  left:8% !important;
  right:8% !important;
  top:2px !important;
  height:42% !important;
  background:linear-gradient(180deg,rgba(255,255,255,.78),rgba(255,255,255,.10)) !important;
}

/* 3. Кнопки ввода — серые.
   Квадрат легенды "ввод данных" — в тот же цвет. */
.measure-value{
  background:linear-gradient(180deg,#d5dbe2,#aeb8c4) !important;
  border:1px solid #7f8996 !important;
  color:#111 !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.72),
    inset 0 -1px 3px rgba(70,80,90,.18) !important;
}
.dot.input{
  background:#b8c1cc !important;
  border-color:#7f8996 !important;
}


/* КОРРЕКТИРОВКА v7 */

/* Легенда: серый цвет теперь относится к "данные замера".
   "ввод данных" возвращаем к желтому цвету. */
.dot.input{
  background:#ffd11a !important;
  border-color:rgba(59,86,120,.65) !important;
}
.dot.measure{
  background:#b8c1cc !important;
  border-color:#7f8996 !important;
}


/* ЭТАП 3 — утвержденные блоки алгоритмов */

/* Рабочая область теперь продолжается ниже верхнего ряда */
.stage{
  height:calc(100vh - 129px) !important;
  overflow:auto !important;
  padding-bottom:14px;
}
.upper-workspace{
  height:640px !important;
}

/* Нижний ряд алгоритмов: одинаковые размеры и равные внешние отступы */
.algorithm-block{
  position:absolute;
  top:286px;
  width:45%;
  height:330px;
  border:1px solid rgba(100,148,205,.92);
  border-radius:5px;
  overflow:hidden;
  background:rgba(226,237,250,.60);
  box-shadow:0 4px 12px rgba(0,0,0,.18);
}
.algorithm-left{left:4.9%;}
.algorithm-right{right:4.9%;}

.algorithm-title{
  height:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg,#1683ea,#0a60c4);
  color:#fff;
  font-size:11px;
  font-weight:800;
}
.algorithm-subtitle{
  height:20px;
  display:flex;
  align-items:center;
  padding:0 7px;
  background:rgba(207,222,243,.84);
  border-bottom:1px solid rgba(126,163,207,.64);
  color:#173961;
  font-size:9px;
  font-weight:800;
}

/* Панель переключения деталей */
.algorithm-switch{
  height:24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 7px;
  background:rgba(226,238,250,.28);
  border-bottom:1px solid rgba(126,163,207,.55);
  color:#173961;
  font-size:9px;
  font-weight:800;
}
.detail-buttons{
  display:flex;
  gap:5px;
}
.detail-btn{
  min-width:25px;
  height:18px;
  padding:0 7px;
  border-radius:10px;
  border:1px solid #6f92b8;
  color:#000;
  background:linear-gradient(180deg,#d5dbe2,#aeb8c4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.80),
    inset 0 -1px 3px rgba(70,80,90,.16),
    0 1px 3px rgba(0,0,0,.12);
  font-size:9px;
  font-weight:800;
}
.detail-btn.active{
  background:linear-gradient(180deg,#f4f6f8,#bcc5cf);
}

/* Ввод данных: спокойные полупрозрачные строки */
.algorithm-inputs{
  height:62px;
  display:grid;
  grid-template-columns:1fr 1fr;
  grid-template-rows:31px 31px;
  background:transparent;
}
.alg-input-row{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) 78px;
  align-items:center;
  border-right:1px solid rgba(131,167,210,.42);
  border-bottom:1px solid rgba(131,167,210,.42);
  background:rgba(226,238,250,.28);
}
.alg-input-row.empty{
  background:rgba(226,238,250,.12);
}
.alg-input-row label{
  padding-left:7px;
  color:#173961;
  font-size:9px;
  font-weight:700;
}
.alg-input-value{
  height:23px;
  margin-right:5px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #c99c12;
  border-radius:4px;
  background:linear-gradient(180deg,#ffe97a,#e9bd28);
  color:#201900;
  font-size:9px;
  font-weight:800;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.58);
}

/* Визуал детали */
.visual-section-title{
  height:21px;
  display:flex;
  align-items:center;
  padding:0 7px;
  background:rgba(207,222,243,.84);
  border-top:1px solid rgba(126,163,207,.55);
  border-bottom:1px solid rgba(126,163,207,.55);
  color:#173961;
  font-size:9px;
  font-weight:800;
}
.algorithm-visual-area{
  height:181px;
  padding:6px;
  display:grid;
  grid-template-columns:125px minmax(0,1fr);
  gap:7px;
  background:rgba(238,245,252,.36);
}
.edge-table{
  border:1px solid rgba(111,156,205,.72);
  background:rgba(223,239,250,.76);
  align-self:start;
}
.edge-row{
  min-height:39px;
  padding:3px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  border-bottom:1px solid rgba(111,156,205,.55);
}
.edge-row:last-child{border-bottom:0;}
.edge-row b{
  color:#4e6881;
  font-size:8px;
  font-weight:700;
}
.edge-row span{
  margin-top:2px;
  color:#14395c;
  font-size:9px;
  font-weight:800;
}
.detail-visual{
  min-width:0;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,.34);
  border:1px solid rgba(139,172,209,.34);
}
.detail-svg{
  width:100%;
  height:100%;
}
.detail-svg .shape{
  fill:rgba(78,165,232,.22);
  stroke:#0e6fc8;
  stroke-width:2;
}
.detail-svg text{
  fill:#405d78;
  font-size:10px;
  font-weight:700;
}
.detail-svg .corner{
  font-size:9px;
}
@media(max-width:1150px){
  .upper-workspace{height:auto !important;}
  .algorithm-block{
    position:relative;
    top:auto;
    left:auto !important;
    right:auto !important;
    width:100%;
    margin-top:8px;
  }
}


/* КОРРЕКТИРОВКА алгоритмов v2 */

/* По ширине каждый алгоритм = ширине верхнего блока (29.8%).
   Располагаем симметрично под верхним рядом. */
.algorithm-block{
  width:29.8% !important;
  top:286px !important;

  /* Высота подстраивается под оставшееся место экрана,
     чтобы весь интерфейс помещался без вертикального выхода. */
  height:calc(100vh - 286px - 145px) !important;
  min-height:240px !important;
  max-height:330px !important;
}

.algorithm-left{
  left:19.6% !important;
}
.algorithm-right{
  right:19.6% !important;
}

/* Внутренности алгоритмов ужимаются по высоте пропорционально */
.algorithm-title{
  height:20px !important;
}
.algorithm-subtitle{
  height:18px !important;
}
.algorithm-switch{
  height:22px !important;
}
.algorithm-inputs{
  height:56px !important;
  grid-template-rows:28px 28px !important;
}
.alg-input-row{
  min-height:28px !important;
}
.visual-section-title{
  height:19px !important;
}
.algorithm-visual-area{
  height:calc(100% - 135px) !important;
  min-height:110px !important;
  padding:5px !important;
}
.edge-row{
  min-height:0 !important;
  height:25% !important;
}
.detail-visual{
  height:100% !important;
}


/* КОРРЕКТИРОВКА алгоритмов v3 */

/* 1. Убираем вертикальную прокрутку */
.stage{
  overflow:hidden !important;
}
html,body{
  overflow:hidden !important;
}

/* 2. Визуал детали полностью непрозрачный */
.algorithm-visual-area{
  background:#eef3f8 !important;
}
.detail-visual{
  background:#ffffff !important;
  border:1px solid rgba(139,172,209,.55) !important;
}
.detail-svg .shape{
  fill:#d7e8f6 !important;
  stroke:#0e6fc8 !important;
  stroke-width:2 !important;
}

/* 4. Шрифт строк ввода алгоритмов = шрифту строк ДАННЫЕ ЗАМЕРА */
.alg-input-row label{
  font-size:10px !important;
  font-weight:700 !important;
}
.alg-input-value{
  font-size:10px !important;
  font-weight:800 !important;
}


/* КОРРЕКТИРОВКА v5 — откат от v4 к v3 + два точечных изменения */

/* 1. Непрозрачной делаем ТОЛЬКО строку с надписью "ВВОД ДАННЫХ".
   Остальные строки ввода сохраняют прежнюю полупрозрачность v3. */
.algorithm-switch{
  background:#d7e4f3 !important;
}

/* 2. Возвращаем вертикальную прокрутку рабочей области,
   чтобы нижняя граница алгоритмов была полностью доступна и видима.
   Геометрию и высоту блоков из v3 не меняем. */
html,body{
  overflow:hidden !important;
}
.stage{
  overflow-y:auto !important;
  overflow-x:hidden !important;
}


/* КОРРЕКТИРОВКА алгоритмов v6 */

/* 1. Область ВИЗУАЛ ДЕТАЛИ, где находится таблица,
   делаем полупрозрачной как строки ввода данных.
   Сама таблица остается непрозрачной. */
.algorithm-visual-area{
  background:rgba(226,238,250,.28) !important;
}

/* 2. Фон таблиц результатов алгоритмов = цвету квадрата
   "результаты расчёта" на панели плоскостей. */
.edge-table{
  background:#31cce8 !important;
}
.edge-row{
  background:#31cce8 !important;
}
.edge-row b,
.edge-row span{
  color:#12344f !important;
}


/* КОРРЕКТИРОВКА алгоритмов v7 */

/* 1. Возвращаем прежний фон таблиц алгоритмов.
   Квадрат "результаты расчёта" теперь совпадает именно с ним. */
.edge-table{
  background:rgba(223,239,250,.76) !important;
}
.edge-row{
  background:rgba(223,239,250,.76) !important;
}
.dot.result{
  background:rgba(223,239,250,.76) !important;
  border-color:#7f9fbe !important;
}

/* 2. Кнопки ввода данных и данные замера — глянцевые/выпуклые,
   по характеру как кнопки переключения плоскостей. */
.measure-value,
.alg-input-value{
  position:relative;
  overflow:hidden;
  border-radius:5px !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.92),
    inset 0 -2px 5px rgba(70,80,90,.22),
    0 2px 4px rgba(0,0,0,.15),
    0 0 0 1px rgba(255,255,255,.12) !important;
}
.measure-value::before,
.alg-input-value::before{
  content:"";
  position:absolute;
  left:8%;
  right:8%;
  top:2px;
  height:42%;
  border-radius:999px;
  background:linear-gradient(180deg,rgba(255,255,255,.78),rgba(255,255,255,.10));
  pointer-events:none;
}
.measure-value::after,
.alg-input-value::after{
  content:"";
  position:absolute;
  inset:1px;
  border-radius:inherit;
  border:1px solid rgba(255,255,255,.20);
  pointer-events:none;
}
/* данные замера — серые, как уже зафиксировано */
.measure-value{
  background:linear-gradient(180deg,#d7dde4 0%,#bcc5cf 48%,#a8b2bd 100%) !important;
  border-color:#7f8996 !important;
  color:#111 !important;
}
/* ввод данных алгоритмов — желтый, но с тем же глянцевым характером */
.alg-input-value{
  background:linear-gradient(180deg,#fff08b 0%,#ffd94b 48%,#e2b91f 100%) !important;
  border-color:#c99c12 !important;
  color:#201900 !important;
}

/* 3. Кнопки переключения деталей — как кнопки переключения плоскостей */
.detail-btn{
  position:relative;
  overflow:hidden;
  color:#000 !important;
  border:1px solid rgba(110,160,218,.92) !important;
  background:linear-gradient(180deg,#58b9ff 0%,#2494f2 45%,#0b66c9 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    inset 0 -2px 5px rgba(0,53,125,.22),
    0 2px 4px rgba(0,0,0,.15) !important;
  text-shadow:0 1px 0 rgba(255,255,255,.45);
}
.detail-btn::before{
  content:"";
  position:absolute;
  left:8%;
  right:8%;
  top:2px;
  height:42%;
  border-radius:999px;
  background:linear-gradient(180deg,rgba(255,255,255,.78),rgba(255,255,255,.10));
  pointer-events:none;
}
.detail-btn::after{
  content:"";
  position:absolute;
  inset:1px;
  border-radius:inherit;
  border:1px solid rgba(255,255,255,.20);
  pointer-events:none;
}
.detail-btn.active{
  background:linear-gradient(180deg,#72c8ff 0%,#2b9cf4 45%,#086bd5 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.90),
    inset 0 -2px 5px rgba(0,53,125,.20),
    0 0 5px rgba(27,143,255,.35),
    0 2px 4px rgba(0,0,0,.15) !important;
}


/* КОРРЕКТИРОВКА v8 — активные кнопки ярче неактивных */

/* Переключение плоскостей */
.plane-btn{
  filter:saturate(.82) brightness(.92);
  opacity:.88;
}
.plane-btn.active{
  filter:saturate(1.18) brightness(1.12);
  opacity:1;
  background:linear-gradient(180deg,#8ed8ff 0%,#39a9ff 45%,#0875e5 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    inset 0 -2px 5px rgba(0,53,125,.18),
    0 0 6px rgba(32,153,255,.42),
    0 2px 4px rgba(0,0,0,.14) !important;
}

/* Переключение деталей */
.detail-btn{
  filter:saturate(.82) brightness(.92);
  opacity:.88;
}
.detail-btn.active{
  filter:saturate(1.18) brightness(1.12);
  opacity:1;
  background:linear-gradient(180deg,#8ed8ff 0%,#39a9ff 45%,#0875e5 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    inset 0 -2px 5px rgba(0,53,125,.18),
    0 0 6px rgba(32,153,255,.42),
    0 2px 4px rgba(0,0,0,.14) !important;
}


/* КОРРЕКТИРОВКА v9
   Неактивные кнопки возвращаем к виду v7.
   Активные оставляем яркими как в v8. */

/* Неактивные кнопки плоскостей */
.plane-btn{
  filter:none !important;
  opacity:1 !important;
  background:linear-gradient(180deg,#58b9ff 0%,#2494f2 45%,#0b66c9 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    inset 0 -2px 5px rgba(0,53,125,.22),
    0 2px 4px rgba(0,0,0,.15) !important;
}

/* Активная плоскость — яркая, как в v8 */
.plane-btn.active{
  filter:saturate(1.18) brightness(1.12) !important;
  opacity:1 !important;
  background:linear-gradient(180deg,#8ed8ff 0%,#39a9ff 45%,#0875e5 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    inset 0 -2px 5px rgba(0,53,125,.18),
    0 0 6px rgba(32,153,255,.42),
    0 2px 4px rgba(0,0,0,.14) !important;
}

/* Неактивные кнопки деталей */
.detail-btn{
  filter:none !important;
  opacity:1 !important;
  background:linear-gradient(180deg,#58b9ff 0%,#2494f2 45%,#0b66c9 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    inset 0 -2px 5px rgba(0,53,125,.22),
    0 2px 4px rgba(0,0,0,.15) !important;
}

/* Активная деталь — яркая, как в v8 */
.detail-btn.active{
  filter:saturate(1.18) brightness(1.12) !important;
  opacity:1 !important;
  background:linear-gradient(180deg,#8ed8ff 0%,#39a9ff 45%,#0875e5 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    inset 0 -2px 5px rgba(0,53,125,.18),
    0 0 6px rgba(32,153,255,.42),
    0 2px 4px rgba(0,0,0,.14) !important;
}


/* RELINK 1.1.9 -> APPROVED UI v9 */
.measure-value,.alg-input-value{padding:0 !important;}
.measure-value input,.measure-value select,.alg-input-value input{
  width:100%;height:100%;border:0;outline:0;background:transparent;color:inherit;
  font:inherit;font-weight:inherit;text-align:center;appearance:none;-webkit-appearance:none;
  padding:0 4px;position:relative;z-index:2;
}
.measure-value select{cursor:pointer;}
.measure-value input::-webkit-inner-spin-button,.measure-value input::-webkit-outer-spin-button,
.alg-input-value input::-webkit-inner-spin-button,.alg-input-value input::-webkit-outer-spin-button{
  -webkit-appearance:none;margin:0;
}
.hint-content{padding:3px 6px !important;}
.hint-image{display:block;width:100%;height:100%;object-fit:contain;}
#undoBtn:disabled,#redoBtn:disabled{opacity:.48;cursor:default;}

/* All five inactive planes always have the same approved non-black fill. */
.deviation-svg polygon.plane{
  fill:#d7e4f3 !important;stroke:#7c91a8 !important;stroke-width:1.15 !important;
}
.deviation-svg polygon.plane.active-plane{
  fill:#2f92e8 !important;stroke:#0a69c8 !important;
}

/* Fit every value of the rectangular-space block inside the approved outer block. */
#spaceBlock .space-section-title{min-height:17px !important;padding:2px 3px !important;font-size:7.7px !important;}
#spaceBlock .space-cell{min-height:17px !important;padding:1px 2px !important;}
#spaceBlock .space-cell b{font-size:7.3px !important;line-height:1.05 !important;}
#spaceBlock .space-cell span{font-size:8.2px !important;line-height:1.05 !important;}
#sp_edgepos,#sp_base{grid-template-columns:repeat(3,minmax(0,1fr)) !important;}
#sp_edgepos .space-cell,#sp_base .space-cell{min-width:0 !important;}

/* Detail visual: fixed clearances from line to text, 90° always inside. */
.detail-svg .edge-name{font-size:9px !important;font-weight:800;}
.detail-svg .corner{font-size:8px !important;font-weight:800;}


/* FULL VISUAL CORRECTION — requested elements only */

/* Значения ОТКЛОНЕНИЕ: увеличены до визуального размера кнопок ввода
   с учетом масштаба SVG 520x300 внутри блока. */
#deviationBlock .deviation-svg text{
  font-size:17px !important;
  font-weight:800 !important;
}

/* Подписи визуала деталей. */
.detail-svg .edge-name{
  font-size:10px !important;
  font-weight:800 !important;
}
.detail-svg .corner{
  font-size:9px !important;
  font-weight:800 !important;
}


/* v13: подпись вида детали — выше и заметнее */
.detail-svg .view-name{
  font-size:11.5px !important;
  font-weight:800 !important;
  letter-spacing:.25px;
}


/* v16 — увеличение только всего блока #spaceBlock */
#spaceBlock .rect-space-title{
  position:relative;
}

#rectSpaceZoomBtn{
  position:absolute;
  top:50%;
  right:5px;
  transform:translateY(-50%);
  width:23px;
  height:18px;
  padding:0;
  border:1px solid rgba(0,70,145,.72);
  border-radius:5px;
  background:linear-gradient(#dff6ff 0%,#74cfff 45%,#1a8fe0 55%,#9fe3ff 100%);
  box-shadow:inset 0 1px 1px rgba(255,255,255,.95),0 1px 3px rgba(0,0,0,.28);
  color:#063d68;
  font:900 14px/16px Arial,sans-serif;
  cursor:pointer;
  z-index:4;
}

#rectSpaceZoomOverlay{
  position:fixed;
  inset:0;
  background:rgba(0,8,24,.48);
  z-index:9998;
}

#spaceBlock.rect-space-expanded{
  position:fixed !important;
  left:50% !important;
  top:50% !important;
  margin:0 !important;
  transform:translate(-50%,-50%) scale(1.4) !important;
  transform-origin:center center !important;
  z-index:9999 !important;
  overflow:visible !important;
  box-shadow:0 22px 65px rgba(0,0,0,.68),0 0 0 2px rgba(98,201,255,.40) !important;
}

#spaceBlock.rect-space-expanded #rectSpaceZoomBtn{
  background:linear-gradient(#fff5dd 0%,#ffd47a 48%,#e79a19 55%,#ffe5a0 100%);
  color:#5a3100;
}


/* v18 — запрет случайного выделения служебного текста интерфейса.
   ВАЖНО: интерактивность кнопок не меняется; pointer-events не трогаются. */
body,
button,
label,
svg,
.work-block-title,
.detail-visual,
.detail-svg,
.deviation-svg,
.algorithm-block,
.space-block,
.measure-block,
.hint-block,
.deviation-block,
.result-value,
.calc-value,
.output-value,
.legend,
.legend-item{
  -webkit-user-select:none;
  -moz-user-select:none;
  -ms-user-select:none;
  user-select:none;
}

/* Поля ввода/редактирования остаются полностью доступными:
   можно ставить курсор, выделять, копировать и вводить значения. */
input,
textarea,
select,
[contenteditable="true"]{
  -webkit-user-select:text !important;
  -moz-user-select:text !important;
  -ms-user-select:text !important;
  user-select:text !important;
}

/* Кнопки ввода и переключения остаются кликабельными и активными. */
button,
input[type="button"],
input[type="submit"],
input[type="reset"]{
  pointer-events:auto !important;
}


/* v19 — значения отклонений читаются отдельно от линий визуала */
#deviationBlock .deviation-svg text{
  paint-order:stroke fill;
  stroke:rgba(242,249,255,.96);
  stroke-width:2px;
  stroke-linejoin:round;
}


/* v20 — визуальный сигнал отклонённого Excel-ограничением значения */
.algorithm-inputs input.excel-limit-error{
  outline:2px solid #d10000 !important;
  box-shadow:0 0 0 2px rgba(255,210,210,.92),0 0 8px rgba(209,0,0,.65) !important;
}


/* v21 — превышение высоты/ширины подсвечивает соответствующий габарит */
#sp_rect .space-cell.rect-limit-alert{
  background:linear-gradient(180deg,rgba(255,220,220,.98),rgba(255,145,145,.96)) !important;
  border-color:#c70000 !important;
  box-shadow:inset 0 0 0 1px rgba(183,0,0,.78),0 0 8px rgba(220,0,0,.72) !important;
}
#sp_rect .space-cell.rect-limit-alert b,
#sp_rect .space-cell.rect-limit-alert span{
  color:#b00000 !important;
  font-weight:900 !important;
}


/* v23 — экспорт технического отчёта PDF */
.file-row{
  gap:5px;
}
.pdf-export-btn{
  padding-left:13px !important;
  padding-right:13px !important;
}

.pdf-export-modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(2,10,27,.58);
  z-index:20000;
}
.pdf-export-modal.open{display:flex}

.pdf-export-dialog{
  width:min(920px,92vw);
  max-height:86vh;
  overflow:auto;
  border:1px solid #6e9ed0;
  border-radius:8px;
  background:linear-gradient(180deg,#f6faff,#dceafb);
  box-shadow:0 25px 70px rgba(0,0,0,.55);
  color:#173961;
}
.pdf-export-head{
  height:34px;
  padding:0 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid #9ebbdc;
  background:linear-gradient(180deg,#dcecff,#bcd8f6);
  font-size:13px;
  font-weight:900;
}
.pdf-export-close{
  width:25px;
  height:23px;
  padding:0;
  border:1px solid #7f9fc4;
  border-radius:5px;
  background:#fff;
  color:#173961;
  font-size:17px;
  line-height:19px;
}
.pdf-export-mode{
  display:flex;
  gap:25px;
  padding:11px 13px 8px;
  font-size:11px;
  font-weight:800;
}
.pdf-export-mode label{
  display:flex;
  align-items:center;
  gap:5px;
}
.pdf-manual-selection{
  margin:0 12px;
  padding:8px;
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:7px;
  border:1px solid #adc5df;
  border-radius:6px;
  background:rgba(255,255,255,.62);
}
.pdf-manual-selection.disabled{
  opacity:.38;
  pointer-events:none;
}
.pdf-plane-group{
  min-width:0;
  padding:6px;
  border:1px solid #bdd0e5;
  border-radius:5px;
  background:#edf5fd;
}
.pdf-plane-group-title{
  margin-bottom:5px;
  padding-bottom:4px;
  border-bottom:1px solid #cbdced;
  font-size:10px;
  font-weight:900;
  text-align:center;
}
.pdf-alg-group{
  margin-top:5px;
}
.pdf-alg-title{
  margin-bottom:3px;
  color:#365a7b;
  font-size:9px;
  font-weight:900;
}
.pdf-detail-checks{
  display:flex;
  flex-wrap:wrap;
  gap:3px;
}
.pdf-detail-checks label{
  min-width:31px;
  padding:2px 4px;
  display:flex;
  align-items:center;
  gap:2px;
  border:1px solid #c7d8e9;
  border-radius:4px;
  background:#fff;
  font-size:8.5px;
}
.pdf-export-note{
  padding:8px 13px 4px;
  color:#4a6580;
  font-size:9px;
  font-weight:700;
}
.pdf-export-actions{
  padding:9px 12px 12px;
  display:flex;
  justify-content:flex-end;
  gap:8px;
}
.pdf-export-actions button{
  min-width:120px;
  height:28px;
  border:1px solid #7396bd;
  border-radius:6px;
  background:linear-gradient(#fff,#d8e7f7);
  color:#173961;
}
#pdfExportCreate{
  border-color:#4088ca;
  background:linear-gradient(#7ecbff,#1685e7);
  color:#fff;
}

/* Экранный отчёт скрыт; отображается только при печати. */
#pdfReportRoot{
  display:none;
}

@media print{
  @page{ margin:0; }

  html,body{
    width:210mm !important;
    margin:0 !important;
    padding:0 !important;
    background:#fff !important;
  }

  body.pdf-printing > *:not(#pdfReportRoot){
    display:none !important;
  }

  body.pdf-printing #pdfReportRoot{
    display:block !important;
    width:210mm;
    margin:0;
    padding:0;
    color:#111;
    background:#fff;
    font-family:"Arial","Segoe UI",sans-serif;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }

  .pdf-page{
    box-sizing:border-box;
    width:210mm;
    height:297mm;
    padding:7mm 7mm 6mm;
    page-break-after:always;
    break-after:page;
    overflow:hidden;
    background:#fff;
  }
  .pdf-page:last-child{
    page-break-after:auto;
    break-after:auto;
  }

  .pdf-page-header{
    height:13mm;
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    border-bottom:.35mm solid #7891aa;
  }
  .pdf-page-brand{
    font-size:9pt;
    font-weight:800;
    color:#173961;
  }
  .pdf-page-title{
    margin-top:1mm;
    font-size:11pt;
    font-weight:900;
    text-align:center;
    color:#111;
  }
  .pdf-page-no{
    min-width:20mm;
    font-size:7pt;
    text-align:right;
    color:#5a6774;
  }

  .pdf-card-grid{
    height:267mm;
    padding-top:4mm;
    box-sizing:border-box;
    display:grid;
    grid-template-columns:repeat(5,1fr);
    grid-template-rows:repeat(2,1fr);
    gap:3mm 2mm;
  }

  .pdf-detail-card{
    min-width:0;
    overflow:hidden;
    box-sizing:border-box;
    border:.25mm solid #9aabba;
    border-radius:1.5mm;
    background:#fff;
    break-inside:avoid;
  }
  .pdf-card-head{
    min-height:12mm;
    padding:1.4mm 1.2mm 1mm;
    box-sizing:border-box;
    border-bottom:.25mm solid #b4c1cc;
    background:#eaf2f9;
    text-align:center;
  }
  .pdf-card-plane{
    font-size:7.8pt;
    font-weight:900;
    line-height:1.05;
  }
  .pdf-card-alg{
    margin-top:.7mm;
    font-size:6.5pt;
    font-weight:800;
    line-height:1.08;
  }

  .pdf-card-point{
    min-height:10mm;
    padding:1.4mm 1.2mm;
    box-sizing:border-box;
    border-bottom:.25mm solid #d0d7de;
    font-size:7pt;
    line-height:1.15;
  }
  .pdf-card-point b{
    display:block;
    margin-bottom:.5mm;
    font-size:6.5pt;
    color:#495a68;
  }
  .pdf-card-point span{
    font-size:8.1pt;
    font-weight:900;
  }
  .pdf-card-point.empty{
    color:#7a8792;
  }

  .pdf-card-visual{
    height:37mm;
    box-sizing:border-box;
    padding:1.5mm .8mm .8mm;
    border-bottom:.25mm solid #d0d7de;
    overflow:hidden;
  }
  .pdf-card-visual .detail-visual{
    width:100%;
    height:100%;
  }
  .pdf-card-visual .detail-svg{
    width:100%;
    height:100%;
    display:block;
  }
  .pdf-card-visual .detail-svg text{
    fill:#111 !important;
    stroke:none !important;
    font-family:Arial,sans-serif !important;
  }
  .pdf-card-visual .detail-svg .shape{
    fill:#eef3f7 !important;
    stroke:#111 !important;
    stroke-width:1.2 !important;
  }
  .pdf-card-visual .detail-svg .view-name{
    font-size:11px !important;
    font-weight:900 !important;
  }
  .pdf-card-visual .detail-svg .edge-name,
  .pdf-card-visual .detail-svg .corner{
    font-size:8.5px !important;
    font-weight:800 !important;
  }

  .pdf-card-edges{
    padding:1.2mm 1.1mm 1.4mm;
  }
  .pdf-card-edges-title{
    margin-bottom:.8mm;
    font-size:6.5pt;
    font-weight:900;
    text-align:center;
    color:#354552;
  }
  .pdf-edge-line{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:1mm;
    padding:.7mm 0;
    border-bottom:.2mm solid #e0e4e8;
    font-size:7pt;
    line-height:1.1;
  }
  .pdf-edge-line:last-child{
    border-bottom:0;
  }
  .pdf-edge-name{
    min-width:0;
    overflow-wrap:anywhere;
  }
  .pdf-edge-value{
    white-space:nowrap;
    font-size:7.5pt;
    font-weight:900;
  }
}


/* v24 — меню ФАЙЛ */
.file-menu-wrap{
  position:relative;
}
.file-menu{
  position:absolute;
  left:0;
  top:calc(100% + 3px);
  min-width:150px;
  display:none;
  padding:4px;
  border:1px solid #7e9fc4;
  border-radius:6px;
  background:linear-gradient(#f7fbff,#dbe9f8);
  box-shadow:0 6px 18px rgba(0,0,0,.28);
  z-index:12000;
}
.file-menu.open{display:block}
.file-menu-item{
  width:100%;
  height:26px;
  padding:0 9px;
  border:0;
  border-radius:4px;
  background:transparent;
  color:#173961;
  font-size:10px;
  font-weight:800;
  text-align:left;
  cursor:pointer;
}
.file-menu-item:hover{
  background:#cfe6fb;
}

/* v24 — 5 × 3 карточки */
@media print{
  html,body{
    height:auto !important;
    min-height:0 !important;
    overflow:visible !important;
  }

  body.pdf-printing #pdfReportRoot{
    display:block !important;
    height:auto !important;
    overflow:visible !important;
  }

  .pdf-page{
    box-sizing:border-box;
    page-break-before:auto;
    page-break-after:always;
    break-before:auto;
    break-after:page;
    overflow:hidden;
  }
  .pdf-page:last-child{
    page-break-after:auto;
    break-after:auto;
  }

.pdf-card-grid{
    box-sizing:border-box;
    display:grid;
    grid-template-columns:repeat(5,1fr) !important;
    grid-template-rows:repeat(3,1fr) !important;
    gap:2mm 1.7mm !important;
    padding-top:2.5mm !important;
  }

.pdf-card-head{
    min-height:9.5mm !important;
    padding:1mm .9mm .7mm !important;
  }
  .pdf-card-plane{
    font-size:7.2pt !important;
  }
  .pdf-card-alg{
    margin-top:.4mm !important;
    font-size:6.1pt !important;
  }

  .pdf-card-point{
    min-height:8mm !important;
    padding:1mm .9mm !important;
    font-size:6.5pt !important;
  }
  .pdf-card-point b{
    font-size:6pt !important;
  }
  .pdf-card-point span{
    font-size:7.5pt !important;
  }

  .pdf-card-visual{
    height:25mm !important;
    padding:1mm .5mm .4mm !important;
  }

  .pdf-card-edges{
    padding:.7mm .8mm 1mm !important;
  }
  .pdf-card-edges-title{
    margin-bottom:.4mm !important;
    font-size:6pt !important;
  }
  .pdf-edge-line{
    gap:.7mm !important;
    padding:.42mm 0 !important;
    font-size:6.4pt !important;
  }
  .pdf-edge-value{
    font-size:6.8pt !important;
  }
}


/* v26 — системная ориентация печати + крупнее шрифт только в печатном визуале */
@media print{
  /*
    Не задаём size:A4 portrait/landscape.
    Размер и ориентацию выбирает системное окно печати.
  */
  @page{
    margin:0;
  }

  .pdf-page{
    box-sizing:border-box !important;
    width:100vw !important;
    height:100vh !important;
    min-height:100vh !important;
    padding:6mm !important;
    page-break-after:always !important;
    break-after:page !important;
    overflow:hidden !important;
    background:#fff !important;
  }
  .pdf-page:last-child{
    page-break-after:auto !important;
    break-after:auto !important;
  }

  .pdf-page-header{
    height:11mm !important;
  }

  .pdf-card-grid{
    box-sizing:border-box !important;
    height:calc(100vh - 23mm) !important;
    display:grid !important;
    grid-template-columns:repeat(5,1fr) !important;
    grid-template-rows:repeat(3,1fr) !important;
    gap:2mm 1.7mm !important;
    padding-top:2.5mm !important;
  }

  /* ВАЖНО: увеличиваем шрифт только на визуале детали В ПЕЧАТНОМ ЛИСТЕ. */
  #pdfReportRoot .pdf-card-visual .detail-svg .view-name{
    font-size:16px !important;
    font-weight:900 !important;
  }
  #pdfReportRoot .pdf-card-visual .detail-svg .edge-name{
    font-size:13px !important;
    font-weight:900 !important;
  }
  #pdfReportRoot .pdf-card-visual .detail-svg .corner{
    font-size:13px !important;
    font-weight:900 !important;
  }
}


/* v27 — меню проекта */
.file-menu-separator{
  height:1px;
  margin:4px 2px;
  background:rgba(110,140,170,.38);
}


/* v28 — ненулевая ошибка размеров подсвечивается красным */
#sp_err .space-cell.space-error-active{
  background:linear-gradient(180deg,rgba(255,224,224,.98),rgba(255,154,154,.96)) !important;
  border-color:#c80000 !important;
  box-shadow:inset 0 0 0 1px rgba(185,0,0,.72),0 0 7px rgba(210,0,0,.52) !important;
}
#sp_err .space-cell.space-error-active b,
#sp_err .space-cell.space-error-active span{
  color:#b00000 !important;
  font-weight:900 !important;
}

/* Кнопка полного сброса — функционально часть панели истории */
#resetAllBtn{
  min-width:145px;
}


/* v31 — только оформление замеров и разделение колонок. */
#measureBlock .measure-fields.measure-split{position:relative}
#measureBlock .measure-fields.measure-split::after{content:"";position:absolute;left:calc(50% - 1px);top:0;bottom:0;width:2px;background:linear-gradient(180deg,rgba(68,111,169,.48),rgba(38,89,156,.82),rgba(68,111,169,.48));box-shadow:1px 0 0 rgba(235,246,255,.55);pointer-events:none}
#measureBlock .measure-value,.dot.measure{background:linear-gradient(180deg,#ffe29a 0%,#ffc14b 48%,#efa324 100%) !important;border-color:#c48b22 !important;color:#241800 !important}

#coordinateStatus{padding:8px 16px;background:#e9f2ff;color:#163554;font:14px/1.5 Arial,sans-serif}#coordinateStatus.error{background:#ffe5e5;color:#8b1010}#coordinateDemoBanner{padding:14px 20px;background:#fff3cf;color:#252525;font:16px/1.5 Arial,sans-serif}#coordinateDemoBanner[hidden]{display:none}button:disabled{opacity:.5;cursor:default}@media print{#coordinateStatus,#coordinateDemoBanner{display:none!important}}
@media screen {
  html,body{overflow-y:auto!important}
  .stage{height:auto!important;overflow:visible!important}
}
@media screen and (max-width:1150px){
  header{height:auto;min-height:70px;flex-direction:column;gap:8px;padding:10px}
  .system-title{position:static;transform:none;font-size:16px;white-space:normal;text-align:center}
  .control-panel{height:auto!important;padding:8px!important}
  .file-row{height:auto}
  .file-btn,.plane-btn{height:36px!important;font-size:12px!important}
  .planes{grid-template-columns:repeat(3,minmax(0,1fr))}
  .bottom-row{height:auto!important;display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-top:8px!important}
  .legend{gap:8px;flex-wrap:wrap}
  .history{position:static!important;transform:none!important;flex-wrap:wrap}
  .history button{height:36px!important;font-size:11px!important;min-width:0}
  .upper-workspace{display:flex!important;flex-direction:column;width:calc(100% - 24px)!important;margin:16px auto!important;height:auto!important;gap:12px}
  #deviationBlock,#measureBlock,#hintBlock,#spaceBlock,#algLeft,#algRight{position:relative!important;width:100%!important;left:auto!important;right:auto!important;top:auto!important;transform:none!important;height:auto!important;min-height:0!important;max-height:none!important;flex:none;margin:0!important}
  .work-block-title,.algorithm-title,.algorithm-subtitle,.algorithm-switch,.section-title,.visual-section-title{height:auto!important;min-height:30px;padding:6px!important;white-space:normal!important;font-size:12px!important}
  .measure-fields,.algorithm-inputs{height:auto!important;grid-template-columns:1fr!important;grid-template-rows:none!important;grid-auto-rows:minmax(44px,auto)!important}
  .measure-fields::after{display:none!important}
  .measure-field,.alg-input-row{min-height:44px!important;grid-template-columns:minmax(0,1fr) 100px!important}
  .measure-field label,.alg-input-row label{font-size:12px!important;line-height:1.3}
  .measure-value,.alg-input-value{height:34px!important}
  .measure-value input,.measure-value select,.alg-input-value input{font-size:16px!important}
  .alg-input-row.empty{display:none}
  .algorithm-visual-area{height:230px!important;min-height:0!important;grid-template-columns:110px minmax(0,1fr)!important}
  .edge-row b{font-size:11px!important}.edge-row span{font-size:14px!important}
  .detail-btn{height:32px!important;min-width:32px!important;font-size:12px!important}
  #spaceBlock .space-dashboard{height:auto!important;grid-template-columns:1fr!important;grid-template-rows:none!important}
  #spaceBlock .space-section-title{font-size:11px!important;min-height:28px!important}
  #spaceBlock .space-cell{min-height:38px!important}
  #spaceBlock .space-cell b{font-size:11px!important}#spaceBlock .space-cell span{font-size:13px!important}
  .deviation-inner{height:250px!important}
  .hint-content{height:auto!important;min-height:80px}.hint-content img{max-width:100%;height:auto}
  #spaceBlock.rect-space-expanded{position:fixed!important;width:90vw!important;height:85vh!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important;overflow:auto!important;z-index:1201}
}

/* Match the edge calculator's access controls. */
#programAccountNav{font:16px/1.6 Arial,Helvetica,sans-serif;min-height:0;height:auto}
#programAccountNav[hidden]{display:none!important}
#programAccountNav>a{font:inherit;margin:0;padding:8px 16px;vertical-align:middle}
#coordinateDemoBanner{padding:12px;text-align:center;background:#fff3cd;color:#493b00;font:700 16px/1.6 Arial,Helvetica,sans-serif}
#coordinateDemoBanner>a{display:inline-block;margin:10px;padding:10px 18px;background:#1266cb;color:white;border-radius:6px;text-decoration:none;font:inherit;vertical-align:middle}
@media print{#programAccountNav{display:none!important}}
