/* Окна, как в 1С (portal/js/windows.js), и страница внутри окна. */

.win-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 200px;
  max-width: 100vw;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  resize: both;
  border: 1px solid var(--pop-line, #b9c3d6);
  border-radius: 12px;
  background: var(--pop-bg, #fff);
  box-shadow: 0 18px 50px rgba(13, 22, 38, 0.28), 0 2px 6px rgba(13, 22, 38, 0.12);
  pointer-events: auto;
}
.win--active { border-color: var(--gold-deep, #c99a2e); }
.win--max { inset: 0 0 48px 0 !important; width: auto !important; height: auto !important; max-height: none; border-radius: 0; resize: none; }
.win--moving .win__frame { pointer-events: none; }
.win__head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 4px 6px 4px 14px;
  background: var(--ink, #0d1626);
  color: #fff;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.win--active .win__head { background: linear-gradient(90deg, var(--ink, #0d1626), #22355a); }
.win__title { flex: 1; overflow: hidden; font-size: 0.88rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.win__tools { display: flex; gap: 2px; }
.win__btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dfe6f3;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.win__btn:hover { background: rgba(255, 255, 255, 0.14); color: var(--gold, #f2c14e); }
.win__btn:focus-visible { outline: 2px solid var(--gold, #f2c14e); outline-offset: -2px; }
.win__frame { flex: 1; width: 100%; border: 0; background: var(--paper, #f4f2ec); }

.win-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 61;
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 44px;
  padding: 6px 150px 6px 12px; /* справа — место для «Собрать» */
  overflow-x: auto;
  border-top: 1px solid #263553;
  background: rgba(13, 22, 38, 0.94);
}
.win-bar[hidden] { display: none; }
.win-bar__item, .win-bar__close {
  flex: none;
  max-width: 240px;
  padding: 6px 12px;
  overflow: hidden;
  border: 1px solid #34466b;
  border-radius: 8px;
  background: #16233a;
  color: #dfe6f3;
  font: inherit;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.win-bar__item.is-active { border-color: var(--gold, #f2c14e); color: var(--gold, #f2c14e); }
.win-bar__close { margin-left: auto; background: transparent; }

/* Страница внутри окна: только содержимое, без меню слева, полосы сверху и «кубика». */
.in-frame .shell { display: block; min-height: 0; }
.in-frame .sidebar,
.in-frame .topbar,
.in-frame .dock,
.in-frame .studio-trigger { display: none !important; }
.in-frame .page { padding: 18px 22px 28px; max-width: none; }
.in-frame .workspace { min-height: 100vh; }

@media (max-width: 760px) {
  .win { inset: 0 0 48px 0 !important; width: auto !important; height: auto !important; border-radius: 0; resize: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .win { animation: win-in 0.16s ease-out; }
  @keyframes win-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
}
