/* Окно раздела в духе Windows 11 (рамка, заголовок, кнопка закрыть) */
html.section-app-html,
html.section-app-html body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.section-app-page {
  position: fixed;
  inset: 0;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 400;
}

.section-app-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 35%, #1a1a2e 100%);
  opacity: 0.35;
}

[data-theme="light"] .section-app-backdrop {
  background: linear-gradient(145deg, #e8eef8 0%, #dce8f4 40%, #c8d8ec 100%);
  opacity: 0.9;
}

.section-app-main {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 32px;
  box-sizing: border-box;
}

.w11-window {
  width: min(920px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

[data-theme="light"] .w11-window:not(.section-shell-window) {
  background: rgba(243, 243, 243, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: blur(48px) saturate(1.35);
  backdrop-filter: blur(48px) saturate(1.35);
}

[data-theme="dark"] .w11-window:not(.section-shell-window) {
  background: rgba(36, 36, 40, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(56px) saturate(1.2);
  backdrop-filter: blur(56px) saturate(1.2);
}

.w11-titlebar {
  flex-shrink: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 0 12px;
  gap: 8px;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

[data-theme="light"] .w11-titlebar {
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .w11-titlebar {
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.w11-titlebar-leading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.w11-titlebar-appicon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}

.w11-titlebar-text {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.3;
  letter-spacing: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .w11-titlebar-text {
  color: #1a1a1a;
}

[data-theme="dark"] .w11-titlebar-text {
  color: #fafafa;
}

/* Панель «путь» (breadcrumb), как адресная строка проводника Windows 11 */
.section-shell-pathbar {
  flex-shrink: 0;
  padding: 6px 10px 8px;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

[data-theme="light"] .section-shell-pathbar {
  background: rgba(243, 243, 243, 0.55);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .section-shell-pathbar {
  background: rgba(28, 28, 32, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-shell-pathbar-box {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 2px 4px;
  border-radius: 6px;
  box-sizing: border-box;
}

[data-theme="light"] .section-shell-pathbar-box {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .section-shell-pathbar-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.section-shell-pathbar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.section-shell-pathbar-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 3px 8px 3px 6px;
  border-radius: 4px;
  box-sizing: border-box;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
}

.section-shell-pathbar-item--current {
  cursor: default;
}

[data-theme="light"] .section-shell-pathbar-item--current {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.06);
  color: #1a1a1a;
}

[data-theme="dark"] .section-shell-pathbar-item--current {
  background: rgba(56, 56, 60, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0.5px 2px rgba(0, 0, 0, 0.35);
  color: #fafafa;
}

.section-shell-pathbar-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.88;
}

.section-shell-pathbar-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.section-shell-pathbar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-shell-pathbar-item:not(.section-shell-pathbar-item--current) {
  background: transparent;
  border: 1px solid transparent;
}

.section-shell-pathbar-sep {
  flex-shrink: 0;
  list-style: none;
  margin: 0;
  padding: 0 2px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  opacity: 0.5;
  -webkit-user-select: none;
  user-select: none;
}

[data-theme="light"] .section-shell-pathbar-sep {
  color: rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .section-shell-pathbar-sep {
  color: rgba(255, 255, 255, 0.45);
}

.section-shell-pathbar-link {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="light"] .section-shell-pathbar-link {
  color: #0067c0;
}

[data-theme="dark"] .section-shell-pathbar-link {
  color: #60cdff;
}

.section-shell-pathbar-link:hover {
  text-decoration: underline;
}

.section-shell-pathbar-link.section-shell-pathbar-link--with-folder {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.section-shell-pathbar-link:disabled {
  cursor: default;
  text-decoration: none;
  opacity: 0.45;
}

.w11-titlebar-controls {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  height: 100%;
}

.w11-titlebar-btn {
  width: 46px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: background-color 0.12s ease, color 0.12s ease;
}

[data-theme="light"] .w11-titlebar-btn {
  color: #1a1a1a;
}

[data-theme="dark"] .w11-titlebar-btn {
  color: #fafafa;
}

.w11-titlebar-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .w11-titlebar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.w11-titlebar-btn--close:hover {
  background: #e81123;
  color: #fff;
}

.w11-titlebar-btn svg {
  width: 10px;
  height: 10px;
  display: block;
}

.w11-titlebar-btn .section-shell-icon-max[hidden],
.w11-titlebar-btn .section-shell-icon-restore[hidden] {
  display: none;
}

.w11-client-area {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px;
  overflow: auto;
  box-sizing: border-box;
}

/* Глобальный пресет кнопок для всех разделов */
body.section-app-page button,
body.section-app-page input[type="button"],
body.section-app-page input[type="submit"],
body.section-app-page input[type="reset"] {
  font-weight: 400 !important;
  padding: 16px 36px !important;
  border-radius: 5px !important;
  min-height: 52px !important;
  justify-content: center !important;
  text-align: center !important;
}

[data-theme="light"] .w11-client-area:not(.section-shell-client) {
  background: rgba(255, 255, 255, 0.45);
  color: #1a1a1a;
}

[data-theme="dark"] .w11-client-area:not(.section-shell-client) {
  background: rgba(28, 28, 32, 0.45);
  color: #e8e8e8;
}

.w11-placeholder {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.75;
}

@media (prefers-reduced-motion: reduce) {
  .w11-titlebar-btn {
    transition-duration: 0.01ms;
  }
}

/* Окно раздела поверх рабочего стола (оболочка «Пуск») */
.section-shell-host {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 48px;
  z-index: 11;
  box-sizing: border-box;
  /* Клики мимо окна проходят к элементам ниже (чат), само окно — pointer-events: auto */
  pointer-events: none;
}

.section-shell-host[hidden] {
  display: none !important;
}

.section-shell-scrim {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  display: block;
  cursor: default;
  background: transparent;
  pointer-events: none;
}

.section-shell-window-slot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  box-sizing: border-box;
}

.section-shell-window {
  position: fixed;
  z-index: 1;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.14),
    0 32px 64px rgba(0, 0, 0, 0.18);
}

.section-shell-host--minimized {
  pointer-events: none;
}

.section-shell-host--minimized .section-shell-stack {
  visibility: hidden;
}

.w11-caption-fake {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-height: 32px;
  flex-shrink: 0;
  opacity: 0.55;
  pointer-events: none;
  color: inherit;
}

.w11-caption-icon {
  width: 11px;
  height: 11px;
  display: block;
}

.section-shell-client {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-shell-iframe {
  /* basis 0: иначе во WebKit/Safari iframe в flex-колонке может схлопнуться по содержимому и «съесть» область ввода */
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 0;
  display: block;
  background: #fafafa;
  pointer-events: auto;
}

[data-theme="dark"] .section-shell-iframe {
  background: #1c1c1c;
}

body.section-shell-open .taskbar {
  z-index: 12;
}

@media (prefers-reduced-motion: reduce) {
  .section-shell-scrim {
    transition-duration: 0.01ms;
  }
}

/* === veil fix v5: section windows opaque (Safari iframe wash) === */
[data-theme="light"] .w11-window:not(.section-shell-window) {
  /* keep mica for DM/other windows — rule below only documents intent */
}

.w11-window.section-shell-window {
  background: #f3f3f3 !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
[data-theme="dark"] .w11-window.section-shell-window {
  background: #202020 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
[data-theme="light"] .w11-client-area.section-shell-client {
  background: #f3f3f3 !important;
}
[data-theme="dark"] .w11-client-area.section-shell-client {
  background: #202020 !important;
}
