/* Окно просмотра 3D-сканов. Цвета - токены dentacore.css; запасные значения нужны странице
   прототипа, которая открывается без стилей программы. */
.scan3d{
  --s3-surface:var(--surface,#fff); --s3-line:var(--line,#e6e3dd); --s3-ink:var(--ink,#17181b);
  --s3-muted:var(--muted,#6e6a64); --s3-accent:var(--accent,#0e7c6b);
  display:grid; grid-template-columns:minmax(0,1fr) 260px; grid-template-rows:auto minmax(0,1fr);
  grid-template-areas:"toolbar toolbar" "stage side";
  gap:0; height:100%; min-height:320px; color:var(--s3-ink); background:var(--s3-surface);
  border:1px solid var(--s3-line); border-radius:var(--radius,14px); overflow:hidden;
  font-family:var(--sans,'Segoe UI',system-ui,sans-serif); font-size:14px;
}
.scan3d-toolbar{grid-area:toolbar; display:flex; flex-wrap:wrap; gap:8px 16px; padding:8px 12px;
  border-bottom:1px solid var(--s3-line); align-items:center}
.scan3d-group{display:flex; flex-wrap:wrap; gap:6px}
/* меню "Инструменты" узкого экрана (телефон): одна строка с кнопкой меню, кнопки окна - по нажатию;
   модель занимает основную часть экрана (проверка экранов 0.70.0) */
.scan3d .btn.scan3d-menu-toggle{display:none}
@media (max-width:600px){
  .scan3d .btn.scan3d-menu-toggle{display:inline-flex; align-items:center}
  .scan3d-toolbar > .scan3d-group{display:none}
  .scan3d-toolbar.open > .scan3d-group{display:flex}
  .scan3d-toolbar.open .scan3d-menu-toggle{background:var(--s3-ink); color:var(--s3-surface); border-color:var(--s3-ink)}
}
.scan3d-stage{grid-area:stage; position:relative; min-height:0; min-width:0}
.scan3d-canvas{position:absolute; inset:0}
.scan3d-canvas canvas{display:block; width:100%; height:100%; touch-action:none; outline:none}
.scan3d-status{position:absolute; left:12px; top:12px; padding:6px 12px; border-radius:10px;
  background:var(--s3-surface); border:1px solid var(--s3-line); box-shadow:0 6px 16px -6px rgba(24,20,14,.25);
  font-size:13px; max-width:calc(100% - 24px)}
.scan3d-status[hidden]{display:none}
/* графический контекст потерян: холст пустой, сообщение об этом - в строке состояния */
.scan3d-lost .scan3d-status{background:#fff4e5; color:#7a4a00; border:1px solid #e0b877; max-width:min(520px, calc(100% - 24px))}
.scan3d-hint{position:absolute; left:12px; bottom:10px; font-size:12px; color:var(--s3-muted);
  pointer-events:none}
.scan3d[data-background="dark"] .scan3d-hint{color:#b9b4ac}
.scan3d-hint[hidden]{display:none}
.scan3d-side{grid-area:side; border-left:1px solid var(--s3-line); padding:12px; overflow-y:auto;
  display:flex; flex-direction:column; gap:12px}
.scan3d-files{display:flex; flex-direction:column; gap:12px}
.scan3d-file{display:flex; flex-direction:column; gap:4px; padding-bottom:10px; border-bottom:1px solid var(--s3-line)}
.scan3d-file-name{display:flex; gap:8px; align-items:flex-start; font-weight:500; cursor:pointer;
  overflow-wrap:anywhere}
.scan3d-file-caption{display:flex; flex-direction:column; gap:1px; min-width:0}
.scan3d-file-original{font-weight:400; font-size:12px; color:var(--s3-muted)}
.scan3d-file-download{font-size:12.5px; color:var(--s3-accent); align-self:flex-start}
.scan3d-file-name input{margin-top:3px; flex:0 0 auto}
.scan3d-file-meta{font-size:12px; color:var(--s3-muted)}
.scan3d-opacity{width:100%; accent-color:var(--s3-accent)}
.scan3d-info{font-size:12.5px; color:var(--s3-muted)}
/* холст и все, что над ним: жесты окна, а не масштаб страницы (Р22) */
.scan3d-stage,.scan3d-stage *{touch-action:none}
/* панель "Слои" (Р3): дерево файлов и частей */
.scan3d-layers{display:flex; flex-direction:column; gap:8px}
.scan3d-layers-head{display:flex; flex-wrap:wrap; gap:6px; align-items:center}
.scan3d-layers-title{font:inherit; font-weight:600; background:none; border:none; padding:2px 0; color:var(--s3-ink);
  cursor:pointer; margin-right:auto}
.scan3d-layers-title::before{content:"\25BE  "}
.scan3d-layers-title[aria-expanded="false"]::before{content:"\25B8  "}
.scan3d-tree,.scan3d-tree-parts{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px}
.scan3d-tree-file{display:flex; flex-direction:column; gap:4px; padding-bottom:10px; border-bottom:1px solid var(--s3-line)}
.scan3d-tree-parts{padding-left:12px; border-left:2px solid var(--s3-line); margin-top:2px}
.scan3d-tree-layer{display:flex; flex-direction:column; gap:3px}
.scan3d-row{display:flex; align-items:center; gap:6px; min-width:0}
.scan3d-row-tools{display:flex; flex-wrap:wrap; gap:4px 6px; align-items:center}
.scan3d-layer-name{display:flex; gap:6px; align-items:center; min-width:0; cursor:pointer; overflow-wrap:anywhere;
  font-size:13px}
.scan3d-layer-name input{flex:0 0 auto; margin:0}
.scan3d-swatch{flex:0 0 auto; width:12px; height:12px; border-radius:3px; border:1px solid var(--s3-line)}
.scan3d-layer-more{display:flex; flex-direction:column; gap:6px; padding:8px; border:1px solid var(--s3-line);
  border-radius:var(--radius-ctl,10px)}
.scan3d-field{display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12.5px}
.scan3d-field .scan3d-opacity{width:60%}
.scan3d-color{width:44px; height:26px; padding:0; border:1px solid var(--s3-line); background:none}
.scan3d-shading{font:inherit; font-size:12.5px}
.scan3d-split{display:flex; flex-direction:column; gap:3px; align-items:flex-start}
.scan3d-split-note{font-size:12px; color:var(--s3-muted)}
/* единицы файла (Р14): предупреждение о размере и выбор единиц */
.scan3d-units{display:flex; flex-direction:column; gap:6px; padding:8px; border:1px solid var(--s3-line); border-radius:10px}
.scan3d-units-warn{font-size:12.5px; color:var(--s3-ink); border-left:3px solid var(--warn,#c47a12); padding-left:8px}
/* замеры и шкала (Р15, Р16): холст поверх сцены не перехватывает указатель */
.scan3d-overlay{position:absolute; inset:0; width:100%; height:100%; pointer-events:none}
.scan3d-undo{position:absolute; right:12px; bottom:10px}
.scan3d-undo[hidden],.scan3d-measures[hidden]{display:none}
.scan3d-measures{display:flex; flex-direction:column; gap:6px}
.scan3d-measures-head{display:flex; align-items:center; justify-content:space-between; gap:8px}
.scan3d-measure{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 8px; align-items:center;
  padding:6px 8px; border:1px solid var(--s3-line); border-radius:10px}
.scan3d-measure.selected{border-color:#1f6fd1; box-shadow:inset 3px 0 0 #1f6fd1}
.scan3d-measure-title{font:inherit; font-weight:600; text-align:left; background:none; border:none; padding:2px 0;
  color:var(--s3-ink); cursor:pointer}
.scan3d-measure-note{grid-column:1 / -1; font-size:12px; color:var(--s3-muted)}
.dc-touch .scan3d-measure-title{min-height:40px}
@media (pointer: coarse){ .scan3d-measure-title{min-height:40px} }
.scan3d .btn:disabled{opacity:.55; cursor:not-allowed}
/* срез (Р4) */
.scan3d-clip{display:flex; flex-direction:column; gap:6px; padding-bottom:10px; border-bottom:1px solid var(--s3-line)}
.scan3d-clip[hidden]{display:none}
.scan3d-clip-axes{display:flex; gap:12px}
.scan3d-clip-axis{display:flex; gap:4px; align-items:center; cursor:pointer}
.scan3d-clip-range{width:100%; accent-color:var(--s3-accent)}
.scan3d-clip-caption{font-size:12px; color:var(--s3-muted)}
.scan3d:fullscreen{border-radius:0; border:none}
.scan3d-nowebgl .scan3d-toolbar,.scan3d-nowebgl .scan3d-side{display:none}
/* запасной вид кнопок для страницы без dentacore.css */
.scan3d .btn{font:inherit; font-size:12.5px; padding:4px 10px; border-radius:var(--radius-ctl,10px);
  border:1px solid var(--line-strong,#8c877f); background:var(--s3-surface); color:var(--s3-ink); cursor:pointer}
.scan3d .btn:hover{border-color:var(--s3-accent)}
.scan3d .btn.primary{background:var(--s3-accent); border-color:var(--s3-accent); color:#fff}
.scan3d .btn[hidden]{display:none}
/* сенсорное устройство: кнопки и строки не меньше 40 точек (Р22) - по медиа-признаку и по классу
   корня dc-touch (static/js/scan3d/device.js) */
@media (pointer: coarse){
  .scan3d .btn,.scan3d-layers-title,.scan3d .scan3d-file-download{min-height:40px; padding:8px 12px; font-size:14px}
  .scan3d-row,.scan3d-file-name,.scan3d-layer-name,.scan3d-field,.scan3d-clip-axis{min-height:40px}
  .scan3d-row input[type="checkbox"],.scan3d-file-name input,.scan3d-field input[type="checkbox"],
  .scan3d-clip-axis input{width:22px; height:22px}
  .scan3d-shading,.scan3d-color{min-height:40px}
  .scan3d .scan3d-file-download{display:inline-flex; align-items:center}
}
.dc-touch .scan3d .btn,.dc-touch .scan3d-layers-title,.dc-touch .scan3d .scan3d-file-download{min-height:40px;
  padding:8px 12px; font-size:14px}
.dc-touch .scan3d-row,.dc-touch .scan3d-file-name,.dc-touch .scan3d-layer-name,.dc-touch .scan3d-field,
.dc-touch .scan3d-clip-axis{min-height:40px}
.dc-touch .scan3d-row input[type="checkbox"],.dc-touch .scan3d-file-name input,
.dc-touch .scan3d-field input[type="checkbox"],.dc-touch .scan3d-clip-axis input{width:22px; height:22px}
.dc-touch .scan3d-shading,.dc-touch .scan3d-color{min-height:40px}
.dc-touch .scan3d .scan3d-file-download{display:inline-flex; align-items:center}
@media (max-width:760px){
  .scan3d{grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto auto;
    grid-template-areas:"toolbar" "stage" "side"; height:auto}
  .scan3d-stage{height:58vh; min-height:260px}
  .scan3d-side{border-left:none; border-top:1px solid var(--s3-line)}
  .scan3d:fullscreen{grid-template-rows:auto minmax(0,1fr) auto; height:100%}
  .scan3d:fullscreen .scan3d-stage{height:auto}
  .scan3d:fullscreen .scan3d-side{max-height:30vh}
}
/* Раздел "3D-сканы" карточки пациента. Плитки наборов и область загрузки оформлены классами
   плиток фото (dentacore.css): здесь только отличия. */
.scans3d [hidden],.scan3d-window [hidden]{display:none!important}
.scans3d.dragging .photo-drop{border-color:var(--accent); background:var(--accent-soft)}
/* действия плитки набора (Открыть, Изменить, Скачать, Удалить) переносятся на вторую строку, а не
   обрезаются краем узкой плитки (проверка экранов 0.70.0) */
[data-scan-grid] .photo-actions{flex-wrap:wrap; row-gap:2px}
.scan-thumb-empty{display:flex; align-items:center; justify-content:center; height:150px; font-size:30px; font-weight:700;
  letter-spacing:.06em; color:var(--muted)}
.scan-title{font-weight:600; font-size:13.5px; overflow-wrap:anywhere}
.scan-files{display:flex; flex-direction:column; gap:8px; border-top:1px solid var(--line); padding-top:10px}
.scan-files-title{font-weight:600; font-size:13.5px}
.scan-file-row{display:grid; grid-template-columns:minmax(0,1fr) 190px auto; gap:8px 12px; align-items:center;
  padding:8px 10px; border:1px solid var(--line); border-radius:var(--radius-ctl,10px)}
.scan-file-name{display:flex; flex-direction:column; gap:2px; min-width:0; font-size:13px; overflow-wrap:anywhere}
.scan-file-name .muted{font-size:12px}
.scan-file-role{display:flex; flex-direction:column; gap:2px; font-size:12px}
.scan-file-actions{display:flex; flex-direction:column; gap:4px; align-items:flex-start; font-size:13px}
/* Обзор сетевой папки: список файлов без уменьшенных копий */
.scan-net-wrap{overflow-x:auto}
.scan-net-table td,.scan-net-table th{vertical-align:top}
.scan-net-check{width:28px}
.scan-net-check input{width:18px; height:18px; margin:0}
.scan-net-name{cursor:pointer; font-weight:600; overflow-wrap:anywhere}
.scan-net-folder{display:block; font-size:12px; text-align:left; overflow-wrap:anywhere}
.scan-net-date{white-space:nowrap}
.scan-net-file.attached{opacity:.62}
/* Наборы в наряд-заказе лаборатории и окно их выбора */
.scan-order-files{font-size:12px; overflow-wrap:anywhere}
.scan-pick-list{display:flex; flex-direction:column; gap:8px; max-height:56vh; overflow:auto}
.scan-pick-row{display:grid; grid-template-columns:auto 96px minmax(0,1fr); gap:10px; align-items:center;
  border:1px solid var(--line); border-radius:var(--radius-ctl,10px); padding:8px 10px; cursor:pointer}
.scan-pick-row:has(input:checked){border-color:var(--accent)}
.scan-pick-row input{width:18px; height:18px; margin:0}
.scan-pick-thumb img{display:block; width:96px; height:72px; object-fit:cover; border-radius:6px; background:var(--surface-alt)}
.scan-pick-thumb .scan-thumb-empty{height:72px; font-size:20px}
.scan-pick-text{display:flex; flex-direction:column; gap:2px; min-width:0; font-size:13px; overflow-wrap:anywhere}
.scan-pick-text .muted{font-size:12px}
/* Окно просмотра набора: поверх страницы, как просмотр фото */
.scan3d-window{position:fixed; inset:0; z-index:1200; display:flex; flex-direction:column; gap:8px; padding:10px 12px 12px;
  background:var(--paper,#f4f3ef)}
.scan3d-window-head{display:flex; align-items:center; gap:14px}
.scan3d-window-head .btn{flex:none}
.scan3d-window-old{margin:12px; font-size:14px}
/* уведомления программы видны поверх окна просмотра */
.scan3d-open #dc-toasts{z-index:1300}
.scan3d-window-head h2{margin:0; font-size:16px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0}
.scan3d-window-note{flex:1; min-width:0; font-size:13px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.scan3d-window-body{flex:1; min-height:0; position:relative}
.scan3d-window-files{position:absolute; left:12px; right:12px; top:56px; display:flex; flex-wrap:wrap; gap:8px}
/* невидимое окно: в нем строится картинка набора сразу после загрузки */
.scan3d-offscreen{position:fixed; left:-10000px; top:0; width:480px; height:360px; visibility:hidden; pointer-events:none}
@media (max-width:760px){
  .scan-file-row{grid-template-columns:minmax(0,1fr)}
  .scan-pick-row{grid-template-columns:auto 72px minmax(0,1fr)}
  .scan-pick-thumb img{width:72px; height:54px}
  .scan3d-window{padding:8px; overflow-y:auto}
  .scan3d-window-body{flex:none}
  .scan3d-window-note{display:none}
}
