* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
  background: #e8e8e8;
}

/* ── Viewport (3D canvas) ── */
#viewport {
  position: absolute;
  top: 0; left: 0;
  right: 450px; /* sidebar 70 + panel 380 — панель расширена под крупнее шрифты, см. задание «интерфейс 19,07» */
  bottom: 0;
}

/* ── Кнопка «Назад» (отмена последних изменений, см. js/core/history.js) — плавающая поверх
   3D-вида, всегда доступна независимо от активной вкладки. Задизейблена, когда откатываться
   некуда (только текущее состояние в истории). ── */
#undoBtn {
  position: absolute;
  top: 16px; left: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #d0d7e3;
  background: rgba(255,255,255,0.92);
  color: #445;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 6;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
#undoBtn svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#undoBtn:hover:not(:disabled) { background: #eef2fb; color: #2f6fed; border-color: #2f6fed; }
#undoBtn:disabled { opacity: 0.35; cursor: default; }

/* ── Оверлей размерных линий поверх 3D-вида (js/core/dimensions.js) — HTML-слой, не 3D-геометрия,
   поэтому всегда поверх содержимого канваса независимо от перекрытий. pointer-events:none на
   контейнере и на статичных подписях (не мешают вращению камеры мышкой), редактируемые поля во
   время драга элемента — pointer-events:auto (единственное исключение). ── */
#dimOverlay {
  position: absolute;
  top: 0; left: 0;
  right: 450px; /* совпадает с #viewport */
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

#dimArrowsSvg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}

/* Тонкая стрелка от одной границы измеряемого просвета до другой — чтобы было видно, ЧТО именно
   меряет число рядом (не только его значение), см. js/core/dimensions.js. */
.dim-arrow-line {
  stroke: #8a92a6;
  stroke-width: 1.2;
}
.dim-arrow-head {
  fill: #8a92a6;
}

/* Подсветка секции, выбранной кликом по карточке в боковой панели (js/core/tabs.js, dimensions.js)
   — полупрозрачный прямоугольник по передней грани секции, поверх канваса, но не мешает вращению
   камеры (pointer-events:none). transition — плавно едет за камерой при вращении/зуме. */
#sectionHighlight {
  position: absolute;
  z-index: 0;
  background: rgba(47, 111, 237, 0.10);
  border: 1.5px solid rgba(47, 111, 237, 0.55);
  border-radius: 3px;
  pointer-events: none;
  transition: left 0.08s linear, top 0.08s linear, width 0.08s linear, height 0.08s linear;
}

.dim-label {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.88);
  border: 1px solid #c8d0e0;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 600;
  color: #445;
  white-space: nowrap;
  pointer-events: none;
}

/* Галочка фиксации просвета (см. sec.lockedGaps, js/core/dimensions.js) — единственная
   интерактивная часть подписи, родитель .dim-label сам pointer-events:none (не должен мешать
   вращению камеры мышкой). */
.dim-lock-cb {
  pointer-events: auto;
  width: 11px;
  height: 11px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.dim-drag-input {
  position: absolute;
  z-index: 2; /* поверх .dim-label — при драге поле того же просвета не должно перекрываться статичной подписью */
  transform: translate(-50%, -50%);
  width: 56px;
  text-align: center;
  border: 1.5px solid #2f6fed;
  border-radius: 4px;
  padding: 2px 3px;
  font-size: 12px;
  font-weight: 700;
  color: #222;
  background: #fff;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.dim-drag-input:focus { outline: none; border-color: #e6a800; background: #fffbea; }

/* Стрелка «сдвинуть вплотную к соседу» рядом с полем просвета (js/core/itemDrag.js, задание
   «смещение элемента до края 19,07») — тот же принцип позиционирования/z-index, что и у самого
   поля, просто сдвинута правее (см. positionSnapBtn). */
.dim-snap-btn {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1.5px solid #2f6fed;
  border-radius: 4px;
  background: #fff;
  color: #2f6fed;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.dim-snap-btn:hover { background: #eef3ff; }

/* ── Инфопанель выбранного элемента (js/core/itemDrag.js) — пока элемент "выбран" (зажата ЛКМ
   или после отпускания, пока не кликнули мимо), в углу вьюпорта, не мешает перетаскиванию ── */
.drag-info-panel {
  display: none;
  position: absolute;
  /* правее плавающей кнопки «Назад» (#undoBtn: 16px + 40px ширины) — не перекрываются */
  top: 16px; left: 68px;
  max-width: 240px;
  background: rgba(255,255,255,0.94);
  border: 1px solid #d0d7e3;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #333;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  pointer-events: none;
  z-index: 5;
}
.drag-info-panel.visible { display: block; pointer-events: auto; }
.drag-info-panel-title { font-weight: 700; color: #222; margin-bottom: 3px; font-size: 13px; }

/* ── Sidebar (иконки вкладок) ── */
#sidebar {
  position: absolute;
  top: 0; right: 380px;
  width: 70px; height: 100%;
  background: #f0f0f0;
  border-left: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
  z-index: 10;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 58px;
  padding: 10px 4px 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: #777;
  gap: 5px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn svg {
  width: 26px; height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-btn span {
  font-size: 8px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.tab-btn:hover {
  background: #e4e4e4;
  color: #444;
}

.tab-btn.active {
  background: #fff;
  color: #2f6fed;
  border-color: #2f6fed;
}

.tab-btn-admin { color: #a07000; }
.tab-btn-admin.active { color: #a07000; border-color: #a07000; }

/* ── Panel (контент вкладки) ── */
#panel {
  position: absolute;
  top: 0; right: 0;
  width: 380px; height: 100%;
  background: #fff;
  border-left: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Полоса типа изделия ── */
#typeBar {
  position: relative; /* якорь для .kit-new-btn */
  flex-shrink: 0;
  padding: 7px 16px;
  background: #eef3ff;
  border-bottom: 1px solid #d0dcf8;
  font-size: 12px;
  font-weight: 700;
  color: #2f6fed;
  letter-spacing: 0.2px;
  display: none;
}

/* «+ Новая» — начать новую прорисовку (order.js startNewKit с предложением сохранить) */
.kit-new-btn {
  position: absolute;
  top: 50%; right: 12px;
  transform: translateY(-50%);
  padding: 4px 10px;
  border: 1.5px solid #2f6fed;
  border-radius: 6px;
  background: #fff;
  color: #2f6fed;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.kit-new-btn:hover { background: #eef3ff; }

/* Типы «в разработке» — заблокированы, приглушены, с подписью */
.type-btn:disabled { cursor: default; opacity: 0.45; }
.type-btn:disabled:hover { border-color: #e0e0e0; color: inherit; }
.wip-label {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: #b06a00;
  margin-top: 2px;
}
/* Пометка «в разработке» в заголовке группы/подписи чекбокса — в строку, не блоком */
.field-group-title .wip-label,
.checkbox-field .wip-label { display: inline; margin-left: 6px; }
/* Заблокированные контролы «в разработке» на «Фасаде» (профиль) */
.profile-btn:disabled { cursor: default; opacity: 0.45; }

/* Шапка контекста: сверху «Правка позиции #N» (крупнее), ниже комплект, ниже тип изделия */
#editBar {
  font-size: 13px;
  font-weight: 700;
  color: #d97706;
}
#kitBar {
  font-size: 12px;
  font-weight: 600;
  color: #6b87c7;
}
#kitBar.kit-editing { color: #1d9a4a; }
#typeBarName { font-size: 11px; font-weight: 600; margin-top: 1px; }

.tab-pane {
  display: none;
  flex: 1;
  min-height: 0; /* без этого flex-элемент растёт по контенту вместо сжатия под overflow-y:auto —
                    длинные списки (например, секции верхней части) обрезались бы #panel'ом
                    (overflow:hidden) без возможности прокрутки до них мышкой */
  overflow-y: auto;
  padding: 16px 16px 0;
}

.tab-pane.active { display: flex; flex-direction: column; }

.pane-title {
  font-size: 17px;
  font-weight: 700;
  color: #222;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
  flex-shrink: 0;
}

/* ── Тип изделия — сетка кнопок ── */
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: #555;
  transition: all 0.15s;
}

.type-btn svg {
  width: 36px; height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.type-btn:hover { background: #f0f4ff; color: #2f6fed; border-color: #a8c0f8; }
.type-btn.active { background: #eef3ff; color: #2f6fed; border-color: #2f6fed; }

/* ── Группы полей ── */
.field-group {
  margin-bottom: 16px;
}

.field-group-title {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #555;
  margin-bottom: 5px;
}

.field-val {
  font-weight: 600;
  color: #222;
}

.dim-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.dim-label-row label { margin: 0; }
.dim-input {
  width: 72px;
  padding: 3px 6px;
  border: 1.5px solid #d0d7e3;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  text-align: right;
  background: #f7f9fc;
}
.dim-input:focus { outline: none; border-color: #2f6fed; background: #fff; }

.field input[type="range"] { width: 100%; }

.field select {
  width: 100%;
  height: 34px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 13px;
  color: #333;
  padding: 0 8px;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  justify-content: flex-start;
}

.checkbox-field input { width: 16px; height: 16px; }

/* ── Пресеты ── */
.presets { display: flex; flex-wrap: wrap; gap: 6px; }

.preset-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #f8f8f8;
  font-size: 11px;
  color: #333;
  cursor: pointer;
}

.preset-btn:hover { background: #eef3ff; border-color: #2f6fed; color: #2f6fed; }

/* ── Фасад — типы ── */
.fasad-type-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fasad-type-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  text-align: left;
  transition: all 0.15s;
}

.fasad-type-btn svg {
  width: 36px; height: 44px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.fasad-type-btn:hover { background: #f0f4ff; color: #2f6fed; border-color: #a8c0f8; }
.fasad-type-btn.active { background: #eef3ff; color: #2f6fed; border-color: #2f6fed; }

/* ── Материалы ── */
.mat-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.mat-section:last-child { border-bottom: none; }

.mat-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* ── Цветовые образцы ── */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.swatch {
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
  position: relative;
  transition: transform 0.1s, border-color 0.1s;
}

.swatch:hover { transform: scale(1.08); }
.swatch.selected { border-color: #2f6fed; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12), 0 0 0 3px rgba(47,111,237,0.18); }

.swatch-name {
  margin-top: 6px;
  font-size: 11px;
  color: #2f6fed;
  font-weight: 600;
  min-height: 14px;
}

/* ── Сворачиваемые доп. опции ── */
.extra-details {
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.extra-details summary {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.extra-details summary::before {
  content: '▸';
  font-size: 10px;
  transition: transform 0.15s;
  display: inline-block;
}

.extra-details[open] summary::before { transform: rotate(90deg); }
.extra-details summary:hover { color: #555; background: #f8f8f8; }

.extra-details .field-group { padding: 0 14px; }
.extra-details .field-group:last-child { padding-bottom: 12px; }

/* ── Цена (всегда внизу) ── */
#price-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  background: #f8f9fb;
  border-top: 1px solid #e8e8e8;
}

.price-rows { margin-bottom: 10px; }

.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #555;
  padding: 3px 0;
}

.price-row.total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
  font-weight: 700;
  font-size: 15px;
  color: #111;
}

/* ── Бейдж на иконке Заказ ── */
.tab-btn-order { position: relative; }
.order-badge {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e84040;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ── Карточки во вкладке Заказ ── */
.order-card {
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fafafa;
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.order-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.order-card-num {
  font-size: 11px;
  font-weight: 700;
  color: #aaa;
}

.order-card-name {
  overflow-wrap: break-word;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  line-height: 1.4;
}

.order-card-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.order-card-remove:hover { color: #e44; }

.order-card-price {
  font-size: 15px;
  font-weight: 700;
  color: #2f6fed;
  margin-bottom: 8px;
}

.order-card-edit {
  width: 100%;
  padding: 7px;
  border: 1px solid #2f6fed;
  border-radius: 6px;
  background: transparent;
  color: #2f6fed;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.order-card-edit:hover { background: #eef3ff; }
.order-card-edit.editing {
  background: #fff3cd;
  border-color: #e6a800;
  color: #a07000;
}

.order-grand-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  color: #111;
  padding: 12px 0 0;
  border-top: 2px solid #e0e0e0;
  margin-top: 4px;
}

/* ── Вкладка «Добавить к заказу» ── */
.extra-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  padding: 10px 0 0;
  border-top: 1.5px solid #e0e0e0;
  margin-top: 10px;
}
.extra-result {
  margin-top: 10px;
  font-size: 12px;
  color: #1d9a4a;
  min-height: 16px;
}

/* ── Футер: текущая позиция + счётчик ── */
.price-row.current-total {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #e0e0e0;
  font-weight: 600;
  color: #333;
}

.order-counter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 6px 10px;
  background: #eef3ff;
  border-radius: 6px;
  font-size: 12px;
  color: #555;
}

.order-counter-link {
  background: none;
  border: none;
  color: #2f6fed;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.add-item-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border: 2px dashed #2f6fed;
  border-radius: 8px;
  background: transparent;
  color: #2f6fed;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.add-item-btn:hover { background: #eef3ff; }

.order-btn {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: #2f6fed;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.order-btn:hover { background: #2559c7; }

/* «Добавить в заказ» — клиент готов к оформлению, зелёный акцент */
.order-btn-accent { background: #1d9a4a; }
.order-btn-accent:hover { background: #15803c; }

/* ── Помогаторы списков (Проекты/Заказы): буквы и диапазон дат ── */
.alpha-strip { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 10px; }
.alpha-strip button {
  min-width: 24px; padding: 3px 5px;
  border: 1px solid #e0e0e0; border-radius: 5px;
  background: #fafafa; font-size: 11px; font-weight: 600; color: #555; cursor: pointer;
}
.alpha-strip button:hover { border-color: #a8c0f8; color: #2f6fed; }
.alpha-strip button.active { border-color: #2f6fed; background: #eef3ff; color: #2f6fed; }

.date-range { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.date-range input[type="date"] {
  flex: 1; padding: 5px 6px; border: 1.5px solid #d0d7e3; border-radius: 6px;
  font-size: 12px; background: #f7f9fc;
}
.date-range span { color: #999; }
.date-range .opt-btn { flex: 0 0 auto; padding: 5px 9px; }


/* ── Профиль дверей купе ── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

/* Цвета профиля дверей купе (задание «двери-начали 20,07») — круглые свотчи под сеткой видов */
.profile-colors {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.profile-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #d5d5d5;
  cursor: pointer;
  padding: 0;
}
.profile-color-btn:hover { border-color: #a8c0f8; }
.profile-color-btn.active { border-color: #2f6fed; box-shadow: 0 0 0 2px #eef3ff; }

/* ── Окно «Комбинированная дверь» (js/core/doorEditor.js) ── */
.door-editor-modal {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  width: min(680px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.door-editor-doors { display: flex; gap: 6px; flex-wrap: wrap; }
.door-editor-body { display: flex; gap: 18px; min-height: 0; }
#doorEditorSvg { flex-shrink: 0; align-self: flex-start; }
.door-editor-controls { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.door-editor-btn-row { display: flex; gap: 4px; flex-wrap: wrap; }
.door-editor-divider-row { display: flex; gap: 6px; align-items: center; }
.door-editor-fill-row {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 4px 6px; border-radius: 6px; border: 1.5px solid transparent; cursor: pointer;
}
.door-editor-fill-row:hover { background: #f4f7ff; }
.door-editor-fill-row.active { border-color: #2f6fed; background: #eef3ff; }
.door-editor-fill-row .el-row-label { min-width: 86px; }
/* Справа от селекта: селект цвета (ЛДСП/стекло) или название спеццвета (клик — переименовать) */
.door-editor-color-sel { max-width: 150px; }
.door-editor-fill-info { flex: 1; min-width: 0; font-size: 11px; color: #888; overflow-wrap: break-word; }
.door-editor-fill-info.renamable { color: #2f6fed; cursor: pointer; }
.door-editor-fill-info.renamable:hover { text-decoration: underline; }
.door-editor-fill-price { width: 74px; flex-shrink: 0; }
.door-editor-footer { flex-shrink: 0; display: flex; justify-content: flex-end; padding-top: 4px; }
.door-editor-footer .btn-primary { min-width: 160px; padding: 9px 18px; border-radius: 8px; }

.profile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 8px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  color: #666;
  transition: all 0.15s;
}

.profile-btn svg {
  width: 20px;
  height: 44px;
}

.profile-btn span {
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.profile-btn:hover { border-color: #a8c0f8; color: #2f6fed; }
.profile-btn.active { border-color: #2f6fed; background: #eef3ff; color: #2f6fed; }

/* ── Карточки популярных проектов ── */
.presets-list { display: flex; flex-direction: column; gap: 8px; }

.preset-card {
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafafa;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.preset-card:hover { border-color: #2f6fed; background: #eef3ff; }

.preset-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #222;
  margin-bottom: 4px;
}

.preset-card-desc {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
}

.preset-card-price {
  font-size: 13px;
  font-weight: 700;
  color: #2f6fed;
  margin-top: 6px;
}

/* ── Кнопка показа/скрытия дверей ── */
.toggle-doors-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}

.toggle-doors-btn:hover { border-color: #a8c0f8; color: #2f6fed; }
.toggle-doors-btn.active { border-color: #2f6fed; background: #eef3ff; color: #2f6fed; }

/* ── Группа кнопок-опций ── */
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.opt-btn {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.opt-btn:hover { border-color: #a8c0f8; color: #2f6fed; }
.opt-btn.active { border-color: #2f6fed; background: #eef3ff; color: #2f6fed; }
.opt-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.opt-btn:disabled:hover { border-color: #e0e0e0; color: #555; }

.side-replace-block {
  margin: 4px 0 8px 16px;
  padding: 8px 10px;
  border-left: 2px solid #e0e7f3;
  border-radius: 0 8px 8px 0;
  background: #f5f7fc;
}

/* ── Плейсхолдер вкладки ── */
.placeholder-note {
  margin-top: 20px;
  padding: 16px;
  background: #f5f6f8;
  border-radius: 8px;
  font-size: 13px;
  color: #888;
  line-height: 1.6;
}

/* ── Модальное окно заявки ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.overlay.visible { display: flex; }

.order-modal {
  width: 360px;
  max-width: 90vw;
  background: #fff;
  border-radius: 10px;
  padding: 22px;
}

.order-modal h3 { margin: 0 0 14px; font-size: 17px; color: #222; }

.order-summary {
  font-size: 13px;
  color: #555;
  background: #f5f6f8;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.order-modal input[type="text"],
.order-modal input[type="password"] {
  width: 100%;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #ccc;
  padding: 0 10px;
  font-size: 14px;
}

.order-result { font-size: 13px; min-height: 18px; margin-bottom: 8px; }

.order-actions { display: flex; gap: 10px; margin-top: 10px; }

.btn-primary, .btn-secondary {
  flex: 1; padding: 10px;
  border-radius: 8px; border: none;
  font-size: 14px; cursor: pointer;
}

.btn-primary { background: #2f6fed; color: #fff; font-weight: 600; }

/* ── Секции наполнения ── */
.section-card {
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fafafa;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
/* Выбор кликом по карточке (не по полям/кнопкам внутри) — подсвечивает саму секцию в 3D
   (см. #sectionHighlight, js/core/dimensions.js), задание «интерфейс 19,07». */
.section-card.selected {
  border-color: #2f6fed;
  background: #eef4ff;
  box-shadow: 0 0 0 1px #2f6fed inset;
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.section-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #222;
  flex-shrink: 0;
}

.section-collapse-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 2px;
  line-height: 0;
  flex-shrink: 0;
  display: flex;
}
.section-collapse-btn svg { transition: transform 0.15s; }
.section-collapse-btn.collapsed svg { transform: rotate(-90deg); }
.section-collapse-btn:hover { color: #2f6fed; }

.section-card-width {
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-card-width .dim-input { width: 64px; }

.section-card-unit { font-size: 13px; color: #888; }

.section-remove-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 2px;
  line-height: 0;
  flex-shrink: 0;
}
.section-remove-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.section-remove-btn:disabled:hover { color: #ccc; }

.section-remove-btn:hover { color: #e44; }

.section-lock-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 2px;
  line-height: 0;
  flex-shrink: 0;
}
.section-lock-btn:hover { color: #888; }
.section-lock-btn.active { color: #2f6fed; }

/* Внутреннее наполнение — по строке на тип элемента (полки/штанга/сетка/ящики/вешало),
   вся информация об элементе в одной линии. Текстовых подписей у под-полей нет — только
   title-подсказки при наведении, чтобы уместиться в узкую боковую панель. */
.section-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.el-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 0;
  border-bottom: 1px solid #eee;
}

.el-row:last-child { border-bottom: none; }

.el-row-label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  width: 56px;
  flex-shrink: 0;
}

.el-row-count {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  width: 16px;
  flex-shrink: 0;
  text-align: center;
}

/* Наполнение секции (полки/ящики/сетка/корзины/штанги) — теперь свободно перетаскиваемые мышкой
   элементы (см. js/core/itemDrag.js), а не счётчики: "+" добавляет экземпляр в первое свободное
   место секции по высоте (или тост, если места нет), крестик на чипе — удаляет конкретный. */
.section-add-btn {
  background: none;
  border: 1.5px solid #d0d7e3;
  border-radius: 5px;
  color: #2f6fed;
  cursor: pointer;
  width: 20px; height: 20px;
  line-height: 1;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.section-add-btn:hover { background: #eef3ff; }

.item-chip-remove {
  background: #f7f9fc;
  border: 1.5px solid #d0d7e3;
  border-radius: 5px;
  color: #999;
  cursor: pointer;
  width: 20px; height: 20px;
  line-height: 1;
  font-size: 13px;
  flex-shrink: 0;
}
.item-chip-remove:hover { color: #e44; border-color: #e44; }

/* Посегментная задняя стенка (см. tabs.js renderBackWallSegmentsRow) — компактные пронумерованные
   кнопки-переключатели, по одной на сегмент, снизу вверх. */
.section-backwall-seg-btn {
  background: #f7f9fc;
  border: 1.5px solid #d0d7e3;
  border-radius: 5px;
  color: #888;
  cursor: pointer;
  width: 20px; height: 20px;
  line-height: 1;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.section-backwall-seg-btn:hover { border-color: #2f6fed; color: #2f6fed; }
.section-backwall-seg-btn.active { background: #2f6fed; border-color: #2f6fed; color: #fff; }
.section-backwall-seg-btn.ineligible {
  background: #f0f0f0;
  border-color: #e0e0e0;
  color: #bbb;
  cursor: not-allowed;
  text-decoration: line-through;
}
.section-backwall-seg-btn.ineligible:hover { border-color: #e0e0e0; color: #bbb; }

.mini-input, .mini-select {
  border: 1.5px solid #d0d7e3;
  border-radius: 5px;
  background: #f7f9fc;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  padding: 4px 2px;
  text-align: center;
}

.mini-input:focus, .mini-select:focus { outline: none; border-color: #2f6fed; background: #fff; }

.mini-input { width: 34px; padding-left: 1px; padding-right: 1px; }

.mini-input-wide { width: 44px; }

.mini-select { width: 58px; padding-left: 2px; }
.mini-select-wide { width: 96px; }

.el-row-check {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #555;
  flex-shrink: 0;
}

.el-row-check input { width: 16px; height: 16px; flex-shrink: 0; }
.btn-secondary { background: #eee; color: #333; }

/* ── Toast (короткие уведомления, напр. невалидный проём под корзину) ── */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #2a2a2a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1000;
  max-width: 320px;
  text-align: center;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Диалог выбора из нескольких вариантов (js/core/toast.js showChoiceDialog) — когда одного
   confirm() (да/нет) не хватает, например предупреждение о ящике за раздвижными дверями с
   вариантом «сузить смещающим элементом», задание «ящики-двери 19,07» ── */
.choice-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 30, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.choice-dialog-box {
  background: #fff;
  border-radius: 10px;
  padding: 20px 22px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.choice-dialog-text {
  font-size: 14px;
  color: #222;
  line-height: 1.5;
  margin-bottom: 16px;
}
.choice-dialog-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.choice-dialog-buttons .opt-btn {
  width: 100%;
}

/* ── Большое окно «Проекты» (js/core/projects.js, сессия 37) — тот же .overlay/.visible, что и
   у сохранения проекта, но крупный бокс с прокручиваемой сеткой карточек вместо узкой колонки
   в сайдбаре ── */
.projects-modal-box {
  width: min(1000px, 92vw);
  height: min(80vh, 760px);
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 36px rgba(0,0,0,0.3);
}

.projects-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.projects-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
}
.projects-modal-close:hover { color: #333; }

.projects-modal-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.projects-modal-controls select { width: 220px; }
.projects-modal-controls input[type="text"] { flex: 1; min-width: 200px; height: 34px; }
.projects-modal-controls .date-range { margin-bottom: 0; }

.projects-modal-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-content: start;
}
.projects-modal-grid .order-card { margin-bottom: 0; }

/* «Заказы» переиспользует .projects-modal-box (flex-column): список заказов — flex:1 растяжимая
   сетка со своим скроллом (как у «Проекты»), а этот блок ниже — фиксированной высоты (min-height:
   auto по умолчанию защищает его от сжатия), поэтому «Мои конфигурации»/«Выйти» всегда видны. */
.cabinet-modal-footer { flex-shrink: 0; }

/* ── Предпросмотр печати (js/core/print.js, задание «печать 19,07») — тот же оверлей, что и у
   «Проекты», внутри серый фон с белым «листом» по центру ── */
.print-modal-box {
  width: min(860px, 94vw);
  height: min(92vh, 1040px);
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 36px rgba(0,0,0,0.3);
}
.print-actions { display: flex; align-items: center; gap: 10px; }
.print-actions .btn-primary { padding: 8px 22px; border-radius: 8px; }
.print-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  background: #e9e9ec; border-radius: 8px; padding: 16px;
}
.print-sheet {
  background: #fff;
  max-width: 794px; /* ширина A4 при 96dpi — предпросмотр близок к тому, что выйдет на бумаге */
  margin: 0 auto;
  padding: 36px 40px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  font-size: 13px;
  color: #222;
  line-height: 1.5;
}
.print-head { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.print-meta { color: #666; margin-bottom: 14px; }
.print-img {
  display: block;
  width: 100%;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  margin-bottom: 4px;
}
.print-caption { color: #666; font-size: 12px; margin-bottom: 14px; }
.print-table .print-row-shown td { background: #eef3ff; font-weight: 600; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th, .print-table td {
  border: 1px solid #d8d8d8;
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}
.print-table th { background: #f4f4f6; font-size: 12px; }
.print-table .print-num { width: 26px; text-align: center; }
.print-table .print-price { width: 110px; text-align: right; white-space: nowrap; }
.print-total { text-align: right; font-size: 16px; font-weight: 700; margin-top: 12px; }

/* Печать: виден только лист. Класс printing вешается на body на время window.print()
   (js/core/print.js) — всё приложение прячется, оверлей и лист теряют рамки/фоны/скроллы. */
@media print {
  body.printing > *:not(#printOverlay) { display: none !important; }
  body.printing #printOverlay { position: static; display: block; padding: 0; background: none; }
  body.printing .print-modal-box {
    width: auto; height: auto; padding: 0;
    box-shadow: none; border-radius: 0; display: block;
  }
  body.printing .projects-modal-header { display: none; }
  body.printing .print-scroll { overflow: visible; background: none; padding: 0; border-radius: 0; }
  body.printing .print-sheet { max-width: none; box-shadow: none; padding: 0; }
}

.order-card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #eee;
  margin-bottom: 8px;
}

/* ── Статус заказа (кабинет + админ) ── */
.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #eee;
  color: #666;
}
.status-pill.status-new        { background: #eef1f4; color: #667; }
.status-pill.status-confirmed  { background: #e3ecff; color: #2f6fed; }
.status-pill.status-production { background: #fff0e0; color: #c07000; }
.status-pill.status-done       { background: #e3f7e8; color: #1e8a3c; }

/* ── Админ-панель ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.admin-table th, .admin-table td {
  border-bottom: 1px solid #e4e4e4;
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}
.admin-table th {
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.admin-contact { color: #888; font-size: 11px; }
