/* MDI-оболочка EF 2.0 — палитра светлой темы:
   тёплый светло-серый хром, серые рамки/подсветки (синевы нет), почти белый документ.
   Верхнее меню + окна-DIV (без iframe) + панель внизу.
   Поверх style.css: сбрасываем его fixed-панель и отступ body. */
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column;
  font: 13px "Segoe UI", Tahoma, Verdana, sans-serif; color: #2b2b2b;
  background: #e0ddd6; padding-bottom: 0;
}
/* ---------- верхнее меню ---------- */
#mbar {
  display: flex; align-items: center; gap: 4px; z-index: 200;
  background: #f0eeea; border-bottom: 1px solid #b9b3a8;
  padding: 4px 10px; color: #2b2b2b; flex: none;
}
#mlogo {
  font-weight: 700; color: #ffffff; font-size: 13px; letter-spacing: 1px;
  background: #3f444a; border-radius: 4px;
  padding: 4px 12px; margin-right: 6px; cursor: pointer;
}
#mlogo:hover { background: #2b2b2b; }
#mmenus { display: flex; gap: 2px; flex-wrap: wrap; }
#mmenus .menu-error { display: flex; align-items: center; gap: 8px; color: #8b2f25; }
.mitem { position: relative; }
.mitem > button {
  background: transparent; border: 0; color: #2b2b2b;
  padding: 5px 11px; cursor: pointer; font: 400 13px "Segoe UI", Tahoma, sans-serif;
  border-radius: 4px; user-select: none;
}
.mitem > button:hover { background: #dcd8d0; }
.mitem.open > button { background: #c9cbce; color: #1e2226; }
/* Иконки меню: контурные SVG, приглушённо-серые в цвет палитры. */
.mitem > button svg {
  width: 14px; height: 14px; vertical-align: -2px; margin-right: 7px; color: #6b6f75;
}
.mitem.open > button svg { color: #1e2226; }
#mbar .drop a img {
  width: 14px; height: 14px; vertical-align: -2px; margin-right: 7px;
}
/* Пункты без иконки: текст на одной вертикали с остальными (14px + отступ). */
#mbar .drop a:not(:has(img))::before {
  content: ''; display: inline-block; flex: none; width: 21px;
}
#mwho svg {
  width: 13px; height: 13px; vertical-align: -2px; margin-right: 6px; color: #6b6f75;
}
/* Родные иконки экранов в титуле окна и на панели. */
.wt-ic { vertical-align: -2px; margin-right: 6px; }
.wt .wt-ic { width: 14px; height: 14px; }
.wt-ic-n { opacity: .65; flex: none; }
#ctitle .wt-ic { width: 14px; height: 14px; }
.tbtn .wt-ic { width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; }
#userdrop a svg {
  width: 12px; height: 12px; vertical-align: -1px; margin-right: 7px; color: #969a9e;
}
#mbar .drop {
  display: none; position: absolute; top: calc(100% + 3px); left: 0;
  background: #fdfcfa; color: #2b2b2b;
  border: 1px solid #b9b3a8; border-radius: 4px;
  box-shadow: 0 5px 16px rgba(60,55,45,.3);
  min-width: 250px; max-height: 62vh; overflow: auto; z-index: 210; padding: 4px;
}
.mitem.open .drop, #mbar .mitem.open .drop { display: block; }
#mbar .drop a {
  display: flex; align-items: center; padding: 6px 10px; color: #2b2b2b; text-decoration: none;
  white-space: nowrap; border-radius: 3px; font-weight: 400; user-select: none;
}
#mbar .drop a:hover { background: #e4e1da; }
#mbar .drop a small { color: #75705f; margin-left: auto; padding-left: 18px; }
#msp { flex: 1; }
.mbtn {
  background: #faf9f7; color: #2b2b2b; border: 1px solid #b9b3a8; border-radius: 4px;
  padding: 4px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; user-select: none;
}
.mbtn:hover { background: #e8e5df; border-color: #8a8474; }
#taskbar .mbtn { padding: 4px 8px; color: #6b6f75; }
#taskbar .mbtn svg { width: 14px; height: 14px; display: block; }
#mwho {
  margin-left: 8px; color: #5a5e63; font-weight: 600; white-space: nowrap;
  background: transparent; border: 0; border-radius: 4px;
  padding: 5px 11px; cursor: pointer; font-size: 13px; user-select: none;
}
#mwho:hover { background: #dcd8d0; }
#useritem .drop { left: auto; right: 0; min-width: 200px; }
.uhead {
  padding: 7px 10px; font-weight: 700; color: #2b2b2b;
  border-bottom: 1px solid #cfc9ba; margin-bottom: 2px;
}
/* Радиус окон и диалога-подтверждения — один (стилистика общая). */
:root { --wrad: 6px; }
/* ---------- рабочий стол ---------- */
/* isolation: z-index окон (растёт при каждом фокусе) не перебивает всплывашки
   и диалоги поверх рабочего стола. */
#desk { position: relative; flex: 1; overflow: hidden; background: #e0ddd6; min-height: 0; padding: 0; isolation: isolate; }
/* ---------- окна-div ---------- */
.mwin {
  position: absolute; display: flex; flex-direction: column;
  background: #fdfcfa; border: 1px solid #b9b3a8; border-radius: var(--wrad);
  box-shadow: 0 4px 14px rgba(60,55,45,.3);
  resize: none; overflow: hidden; min-width: 340px; min-height: 220px;
  animation: wpop .13s ease-out;
}
@keyframes wpop { from { transform: translateY(4px); opacity: .4; } }
.mwin.on {
  border-color: #6e6a60;
  box-shadow: 0 10px 28px rgba(60,55,45,.5);
}
/* Заголовок диалога #c9cbce: текст титула + кнопки управления окном. */
.wt {
  display: flex; align-items: center; gap: 6px; flex: none;
  background: #e4e1da; color: #4a4e53;
  padding: 5px 3px 5px 12px; cursor: default; user-select: none;
  border-bottom: 1px solid #a8adb3;
  border-radius: calc(var(--wrad) - 1px) calc(var(--wrad) - 1px) 0 0;
  font-size: 12px;
}
.mwin.on .wt { color: #2b2b2b; }
.wt-t {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 400;
}
.mwin.on .wt-t { font-weight: 700; }
.wb { display: flex; gap: 2px; }
.wb button {
  width: 34px; height: 22px; line-height: 1; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: inherit; border: 0; border-radius: 3px;
  font-size: 12px;
}
.wb button:hover { background: #a8adb3; color: #1e2226; }
.wb button svg { display: block; }
.wb button span { display: flex; }
.wb .i-res { display: none !important; }
.mwin.max .wb .i-max { display: none !important; }
.mwin.max .wb .i-res { display: flex !important; }
.wb button[data-a="x"]:hover { background: #e81123; color: #ffffff; }
/* Тело диалога: только данные, свой скролл. Навигации тут нет. */
.wbody {
  font-size: 12px;
  position: relative;
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; min-width: 0; background: #fdfcfa;
}
.w-masterbar {
  flex: none; background: #fff3cd; padding: 6px 12px;
  border-bottom: 1px solid #e0c36a; font-size: 12px;
}
.w-paramsbar {
  flex: none; background: #f6f4ee; padding: 6px 12px;
  border-bottom: 1px solid #cfc9ba; font-size: 12px;
}
.w-view { flex: 1; overflow: auto; padding: 12px; min-height: 0; }
.w-crumb { display: none; }
/* Статус окна — в заголовке, справа от титула; отдельной строки снизу нет,
   внизу остаётся только пейджер. */
.wstatus {
  flex: 0 1 auto; min-width: 0; max-width: 50%;
  font-size: 11px; font-weight: 400; color: #5a5e63;
  text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wstatus:empty { display: none; }
/* Спиннер загрузки — в рамках диалога, не на весь MDI. */
.wspin {
  position: absolute; inset: 0; z-index: 120;
  display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center;
  background: rgba(253,252,250,.72); font-size: 13px; color: #5a5e63; user-select: none;
}
.wspin[hidden] { display: none; }
/* Полный размер: никаких скруглений — окно сливается с краями. */
.mwin.max { border-radius: 0; }
.mwin.max .wt { border-radius: 0; }
.mwin.max {
  top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;
  resize: none;
}
/* Состыкованные плиткой: без теней (иначе ложатся на соседей) и без анимации. */
.mwin.tiled { box-shadow: none; animation: none; }
.mwin.tiled.on { box-shadow: none; }
/* Плитка делит место поровну: разрешаем ужаться меньше min 340x220,
   иначе содержимое вылезает за рамку на соседей. */
.mwin.tiled { min-width: 0; min-height: 0; }
/* ---------- shell-диалог подтверждения (Закрыть всё) ---------- */
#confirm {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(60,55,45,.35);
  display: flex; align-items: center; justify-content: center;
}
#confirm[hidden] { display: none; }
#cbox {
  background: #fdfcfa; border: 1px solid #8a8474; border-radius: var(--wrad);
  box-shadow: 0 8px 24px rgba(60,55,45,.4);
  min-width: 320px; max-width: 440px;
  overflow: hidden;
}
#ctitle {
  cursor: default; user-select: none;
  background: #c9cbce; color: #1e2226; font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-bottom: 1px solid #a8adb3;
}
#ctext { padding: 14px 12px; font-size: 13px; color: #2b2b2b; white-space: pre-line; }
#cinput { display: block; box-sizing: border-box; width: calc(100% - 24px); margin: 0 12px 12px; padding: 5px 8px;
  font: 13px "Segoe UI", Tahoma, sans-serif; border: 1px solid #b9b3a8; border-radius: 4px; background: #fff; color: #2b2b2b; }
#cinput[hidden] { display: none; }
#cchk { display: block; padding: 0 12px 12px; font-size: 12px; }
#cchk[hidden] { display: none; }
#cbtns { display: flex; gap: 8px; justify-content: flex-end; padding: 0 12px 12px; }
#cbtns button {
  background: #faf9f7; color: #2b2b2b; border: 1px solid #b9b3a8; border-radius: 4px;
  padding: 4px 18px; cursor: pointer; font-size: 12px;
}
#cbtns button:hover { background: #e8e5df; }
#cbtns button:focus-visible { outline: 2px solid #6e6a60; outline-offset: 1px; }
#cbtns button:disabled { opacity: .5; cursor: default; }
#cbtns button[hidden] { display: none; }
#cok { font-weight: 700; }
/* ---------- нижняя панель: титул + × каждого окна ---------- */
#taskbar {
  position: static;
  display: flex; gap: 6px; align-items: center; flex: none;
  background: #f0eeea; border-top: 1px solid #b9b3a8;
  padding: 4px 8px; overflow-x: auto; min-height: 32px;
}
#ttasks { display: flex; gap: 5px; flex: 1; overflow-x: auto; }
.tbtn {
  display: flex; align-items: center; justify-content: flex-start; gap: 2px;
  background: #faf9f7; color: #2b2b2b;
  border: 1px solid #b9b3a8; border-radius: 4px;
  padding: 3px 4px 3px 10px; width: 230px; min-width: 96px;
  cursor: pointer; font-size: 12px; text-align: left;
  flex: 0 1 230px;
}
.tbtn:hover { background: #e4e1da; }
.tbtn.on { background: #c9cbce; border-color: #8a8474; color: #1e2226; font-weight: 700; }
.tbtn.min { opacity: .65; }
/* Загрузка данных: кольцо вместо иконки окна (как во вкладке браузера). */
.tbtn .tspin {
  display: none; flex: none; box-sizing: border-box;
  width: 14px; height: 14px; margin-right: 5px; border-radius: 50%;
  border: 2.5px solid rgba(255,106,0,.28); border-top-color: #ff6a00;
  animation: tbspin .7s linear infinite;
}
.tbtn.busy .tspin { display: block; }
.tbtn.busy .wt-ic { display: none; }
@keyframes tbspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tbtn .tspin { animation-duration: 1.6s; } }
.tbtn .tt {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left;
}
.tbtn .tx { padding: 0; width: 18px; height: 18px; flex: none; justify-content: center; margin-left: 0; border-radius: 3px; opacity: .75; color: inherit; font-weight: 400; }
.tbtn .tx:hover, .tbtn.on .tx:hover, .tbtn button.tx:hover { background: #e81123; color: #ffffff; opacity: 1; }
/* B33: скроллбары — единый блок в style.css (грузится и тут); дубль удалён. */

/* B42: ревизия интерфейса */
.mwin.on .wt { background: #c9cbce; color: #2b2b2b; }
.wt { touch-action: none; }
.rzh { position: absolute; z-index: 6; touch-action: none; }
.rzh-n { top: 0; left: 12px; right: 12px; height: 4px; cursor: ns-resize; }
.rzh-s { bottom: 0; left: 12px; right: 12px; height: 5px; cursor: ns-resize; }
.rzh-e { right: 0; top: 12px; bottom: 12px; width: 5px; cursor: ew-resize; }
.rzh-w { left: 0; top: 12px; bottom: 12px; width: 5px; cursor: ew-resize; }
.rzh-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.rzh-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.rzh-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.rzh-se { bottom: 0; right: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.mwin.max .rzh { display: none; }
.tbtn button.tx { background: transparent; border: 0; cursor: pointer; font-size: 14px; line-height: 1; min-height: 0; min-width: 0; box-sizing: border-box; display: inline-flex; align-items: center; vertical-align: middle; }
.tbtn button.tx svg { display: block; }
