/* UI-1: только общая оболочка; компоновка форм остаётся прежней. */
:root { --header-height: 38px; --sidebar-width: 278px; }
:root.mrn-collapsed { --sidebar-width: 60px; }
html, body { height: 100%; overflow: hidden; }
body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar { height: 38px; min-height: 38px; flex: 0 0 38px; padding: 0 13px; gap: 10px; }
.topbar-left { display: flex; align-items: center; gap: 12px; flex: none; }
.header-back { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border: 1px solid currentColor; border-radius: 5px; color: inherit; font-size: 12px; line-height: 1; white-space: nowrap; }
.header-back:hover { background: #ffffff1a; color: inherit; text-decoration: none; }
.header-back:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.brand { font-size: 15px; gap: 8px; line-height: 1.15; }
.brand-mark { width: 27px; height: 26px; font-size: 17px; border-radius: 5px; }
.brand-caption { display: none; }
.topbar-right { gap: 9px; min-width: 0; }
.version-badge { font-size: 10px; padding: 2px 7px; }
.user-block { gap: 7px; padding-left: 9px; min-width: 0; }
.user-avatar { width: 24px; height: 24px; font-size: 15px; }
.user-name { font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-method { font-size: 9px; }
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 0; flex: 1 1 auto; }
.workspace { height: 100%; min-height: 0; max-width: none; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
:root.mrn-menu-animate .app-shell { transition: grid-template-columns .18s ease; }
.sidebar { position: relative; z-index: 6; height: 100%; min-height: 0; min-width: 0; padding: 0; border-right: 1px solid var(--border); border-bottom: 0; }
.side-top { height: 42px; flex: 0 0 42px; display: flex; align-items: center; gap: 9px; padding: 5px 10px; border-bottom: 1px solid var(--border); }
.side-toggle { display: grid; place-items: center; width: 36px; height: 30px; flex: none; padding: 0; border: 1px solid #d6e0e8; border-radius: 6px; background: #f6f9fb; color: #2b4b69; font-size: 17px; cursor: pointer; }
.side-top-label { font-size: 10px; font-weight: 700; color: #667587; letter-spacing: .1em; white-space: nowrap; }
.side-groups { display: flex; flex-direction: column; gap: 2px; padding: 7px; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.side-group { display: flex; flex-direction: column; flex: 0 0 auto; min-height: 35px; }
.side-group.is-open { flex: 1 1 auto; }
.side-group-button { display: flex; align-items: center; gap: 11px; width: 100%; height: 35px; flex: 0 0 35px; border: 0; border-radius: 6px; background: transparent; color: #475b6e; font: inherit; font-size: 12px; font-weight: 600; padding: 5px 9px; text-align: left; cursor: pointer; }
.side-group-button:hover, .side-toggle:hover { background: #eef4fa; }
.side-group.is-open > .side-group-button { background: #eaf3fb; color: #205c96; }
.side-group.is-current > .side-group-button { box-shadow: inset 3px 0 #2872b5; color: #205c96; }
.side-icon { width: 19px; height: 19px; flex: 0 0 19px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.side-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-chevron { color: #708697; transform: rotate(-90deg); }
.is-open > .side-group-button .side-chevron { transform: none; }
.side-children { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-gutter: stable; padding: 3px 0 5px; }
.side-children[hidden] { display: none !important; }
.sidebar .side-child { display: flex; align-items: flex-start; gap: 7px; min-height: 27px; padding: 6px 7px 6px 38px; border-radius: 5px; color: #4f6071; line-height: 1.25; font-size: 11px; }
.side-child-label { flex: 1; overflow-wrap: anywhere; }
.sidebar .side-child > span:first-child { width: auto; font-size: inherit; text-align: left; }
.side-child small, .side-key { flex: none; color: #667587; font-size: 9px; padding-top: 1px; }
.sidebar .side-child.is-active { color: #165b95; background: #e8f2fc; font-weight: 700; }
.sidebar a.side-child:hover { background: #f1f6fb; text-decoration: none; }
.side-child.is-disabled { color: #697889; }
.side-bottom { flex: 0 0 29px; min-height: 29px; display: flex; align-items: center; padding: 4px 12px; border-top: 1px solid var(--border); color: #506578; font-size: 11px; white-space: nowrap; }
.side-flyout-heading { display: none; }
:root.mrn-collapsed .side-top { justify-content: center; }
:root.mrn-collapsed .side-top-label, :root.mrn-collapsed .side-name, :root.mrn-collapsed .side-chevron, :root.mrn-collapsed .side-bottom-label { display: none; }
:root.mrn-collapsed .side-groups { padding: 7px 6px; }
:root.mrn-collapsed .side-group.is-open { flex: 0 0 auto; }
:root.mrn-collapsed .side-group-button { justify-content: center; padding: 5px 0; }
:root.mrn-collapsed .side-bottom { justify-content: center; padding: 4px 0; }
:root.mrn-collapsed .side-children { display: none; position: fixed; z-index: 20; left: var(--sidebar-width); top: 80px; width: 315px; max-width: calc(100vw - var(--sidebar-width) - 8px); max-height: calc(100vh - 92px); max-height: calc(100dvh - 92px); padding: 8px; border: 1px solid #d5e0eb; border-radius: 8px; background: white; box-shadow: 0 12px 44px #11263e2b; }
:root.mrn-collapsed .is-flyout-open > .side-children { display: block; }
:root.mrn-collapsed .sidebar .side-child { padding-left: 10px; }
:root.mrn-collapsed .side-flyout-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 12px; }
.side-flyout-heading button { border: 0; background: transparent; color: #526b7f; font-size: 22px; cursor: pointer; }
@media (max-width: 1080px) {
    :root { --sidebar-width: 246px; }
    :root.mrn-collapsed { --sidebar-width: 56px; }
}
@media (max-width: 760px) {
    :root { --sidebar-width: 205px; }
    :root.mrn-collapsed { --sidebar-width: 54px; }
    .side-groups { padding-inline: 4px; }
    .side-group-button { gap: 7px; font-size: 11px; }
    .sidebar .side-child { padding-left: 23px; }
    .topbar .version-badge { display: none; }
}
@media (max-height: 345px) { .side-groups { overflow-y: auto; } }
@media (prefers-reduced-motion: reduce) { :root.mrn-menu-animate .app-shell { transition: none; } }
