/*
 * Назначение: единая оболочка внутренних страниц Курьер365.
 * Работа: формирует сворачиваемое боковое меню, верхнюю панель и адаптивную рабочую область.
 */

/* 1. Переменные и базовая геометрия */
:root{--shell-navy:#142e47;--shell-navy-hover:#1d405e;--shell-teal:#16827f;--shell-bg:#f4f7f9;--shell-line:#dce4eb;--shell-text:#21384c;--shell-muted:#718190;--sidebar-width:272px;--sidebar-collapsed:78px;--topbar-height:76px}
body.app-authenticated{min-height:100vh;margin:0;background:var(--shell-bg);color:var(--shell-text)}.app-skip-link{position:fixed;top:-60px;left:20px;z-index:2000;padding:11px 15px;border-radius:5px;color:#fff;background:var(--shell-teal)}.app-skip-link:focus{top:12px}

/* 2. Боковое меню */
.app-sidebar{position:fixed;z-index:1040;inset:0 auto 0 0;width:var(--sidebar-width);display:flex;flex-direction:column;overflow:hidden;color:#dce6ed;background:var(--shell-navy);box-shadow:8px 0 28px rgba(16,38,58,.09);transition:width .22s ease,transform .22s ease}.sidebar-brand{min-height:var(--topbar-height);display:flex;align-items:center;gap:8px;padding:0 16px;border-bottom:1px solid rgba(255,255,255,.09)}.sidebar-brand>a{min-width:0;flex:1;display:flex;align-items:center;gap:12px;color:#fff;text-decoration:none}.sidebar-logo{width:40px;height:40px;flex:0 0 40px;display:grid;place-items:center;border-radius:9px;color:#fff;background:var(--shell-teal);font-size:20px}.sidebar-brand-text{min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;overflow:hidden;font-size:22px;font-weight:700;white-space:nowrap}.sidebar-brand-text>span{color:#50b9b4}.sidebar-brand-text small{width:100%;color:#9fb2c0;font-size:10px;font-weight:400;text-transform:uppercase}.sidebar-collapse-button,.logout-button{width:34px;height:34px;flex:0 0 34px;border:0;border-radius:6px;color:#a9bdca;background:transparent;cursor:pointer}.sidebar-collapse-button:hover,.logout-button:hover{color:#fff;background:rgba(255,255,255,.08)}.sidebar-navigation{flex:1;overflow-x:hidden;overflow-y:auto;padding:20px 12px;scrollbar-width:thin}.sidebar-section-label{margin:0 12px 9px;overflow:hidden;color:#7f99aa;font-size:10px;font-weight:700;letter-spacing:1.1px;text-transform:uppercase;white-space:nowrap}.sidebar-section-label.admin-label{margin-top:24px}.sidebar-link{min-height:45px;display:flex;align-items:center;gap:14px;margin-bottom:4px;padding:10px 12px;border-radius:7px;color:#c8d6df;text-decoration:none;white-space:nowrap;transition:background .15s,color .15s}.sidebar-link i{width:22px;flex:0 0 22px;text-align:center;font-size:18px}.sidebar-link span{overflow:hidden;text-overflow:ellipsis}.sidebar-link:hover{color:#fff;background:rgba(255,255,255,.07)}.sidebar-link.active{color:#fff;background:var(--shell-teal);box-shadow:0 5px 16px rgba(5,31,41,.2)}.sidebar-footer{padding:14px 12px;border-top:1px solid rgba(255,255,255,.09)}.sidebar-user{min-height:48px;display:flex;align-items:center;gap:10px;padding:4px 5px}.user-avatar{width:38px;height:38px;flex:0 0 38px;display:grid;place-items:center;border-radius:50%;color:#fff;background:#294b65}.user-details{min-width:0;flex:1;display:flex;flex-direction:column;overflow:hidden}.user-details small{color:#8fa6b6;font-size:10px}.user-details strong{overflow:hidden;color:#fff;font-size:12px;text-overflow:ellipsis;white-space:nowrap}

/* 3. Свёрнутое состояние */
body.sidebar-collapsed .app-sidebar{width:var(--sidebar-collapsed)}body.sidebar-collapsed .sidebar-brand{padding:10px 0;flex-direction:column;min-height:108px}body.sidebar-collapsed .sidebar-brand>a{flex:0 0 auto}body.sidebar-collapsed .sidebar-brand-text,body.sidebar-collapsed .sidebar-section-label,body.sidebar-collapsed .sidebar-link span,body.sidebar-collapsed .user-details{display:none}body.sidebar-collapsed .sidebar-link{justify-content:center;padding:10px}body.sidebar-collapsed .sidebar-link i{width:auto}body.sidebar-collapsed .sidebar-user{justify-content:center;flex-wrap:wrap}body.sidebar-collapsed .app-shell{margin-left:var(--sidebar-collapsed)}

/* 4. Верхняя панель и контент */
.app-shell{min-height:100vh;margin-left:var(--sidebar-width);transition:margin-left .22s ease}.app-topbar{position:sticky;z-index:1020;top:0;min-height:var(--topbar-height);display:flex;align-items:center;gap:20px;padding:10px 32px;border-bottom:1px solid var(--shell-line);background:rgba(255,255,255,.96);box-shadow:0 3px 14px rgba(20,46,71,.035);backdrop-filter:blur(8px)}.mobile-menu-button{display:none;width:42px;height:42px;border:1px solid var(--shell-line);border-radius:7px;color:var(--shell-navy);background:#fff;font-size:24px}.topbar-title{min-width:0;display:flex;flex-direction:column}.topbar-title span{color:var(--shell-muted);font-size:11px;text-transform:uppercase;letter-spacing:.7px}.topbar-title strong{overflow:hidden;font-size:18px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}.company-switcher{min-width:260px;max-width:460px;margin-left:auto;display:flex;align-items:center;gap:10px}.company-switcher label{display:flex;align-items:center;gap:7px;margin:0;color:var(--shell-muted);font-size:12px;white-space:nowrap}.company-switcher label i{color:var(--shell-teal);font-size:16px}.company-switcher select{width:100%;min-width:180px;height:40px;padding:0 34px 0 12px;border:1px solid #ccd7e0;border-radius:6px;color:var(--shell-text);background:#fff;font-size:14px}.company-switcher select:focus{border-color:var(--shell-teal);outline:2px solid rgba(22,130,127,.14)}.app-content{width:100%;max-width:1720px;margin:0 auto;padding:30px 32px 46px}.app-content>.container{width:100%;max-width:none;padding:0}.sidebar-overlay{display:none}

/* 5. Унификация существующих страниц */
.app-content h1{margin-bottom:24px;color:var(--shell-navy);font-size:clamp(1.55rem,2vw,2rem);font-weight:650}.app-content h2,.app-content h3{color:var(--shell-navy)}.app-content .card{border-color:var(--shell-line);border-radius:10px;box-shadow:0 5px 18px rgba(20,46,71,.045)}.app-content .card-header{padding:14px 18px;border-bottom:1px solid var(--shell-line);background:#fff}.app-content .table-responsive{border:1px solid var(--shell-line);border-radius:9px;background:#fff}.app-content .table{margin-bottom:0}.app-content .table thead th{border-bottom-width:1px;color:#52697c;background:#eef3f6;font-size:.8rem;font-weight:650;white-space:nowrap}.app-content .form-control,.app-content .form-select{border-color:#cdd8e0;border-radius:6px}.app-content .form-control:focus,.app-content .form-select:focus{border-color:var(--shell-teal);box-shadow:0 0 0 .2rem rgba(22,130,127,.13)}.app-content .btn-primary,.app-content .btn-custom{border-color:var(--shell-navy);background:var(--shell-navy)}.app-content .btn-primary:hover,.app-content .btn-custom:hover{border-color:var(--shell-navy-hover);background:var(--shell-navy-hover)}

/* 6. Публичные страницы */
body.app-public{margin:0;background:var(--shell-bg)}.public-header{min-height:70px;display:flex;align-items:center;justify-content:space-between;padding:0 max(24px,calc((100% - 1180px)/2));border-bottom:1px solid var(--shell-line);background:#fff}.public-brand{color:var(--shell-navy);font-size:22px;font-weight:700;text-decoration:none}.public-brand span{color:var(--shell-teal)}.public-auth-links{display:flex;align-items:center;gap:18px}.public-auth-links a{color:var(--shell-navy);text-decoration:none}.public-login-link{padding:9px 15px;border:1px solid var(--shell-line);border-radius:6px}.public-content{width:min(1180px,calc(100% - 48px));margin:0 auto;padding:36px 0}

/* 7. Адаптация */
@media(max-width:991.98px){.app-sidebar{width:var(--sidebar-width);transform:translateX(-102%)}.app-shell,body.sidebar-collapsed .app-shell{margin-left:0}body.mobile-menu-open .app-sidebar{transform:translateX(0)}body.mobile-menu-open .sidebar-overlay{position:fixed;z-index:1030;inset:0;display:block;border:0;background:rgba(9,25,38,.48)}.sidebar-collapse-button{display:none}.mobile-menu-button{display:grid;place-items:center}.app-topbar{padding:10px 20px}.app-content{padding:24px 20px 38px}}
@media(max-width:680px){:root{--topbar-height:68px}.app-topbar{gap:12px}.topbar-title span{display:none}.topbar-title strong{max-width:34vw;font-size:15px}.company-switcher{min-width:0;max-width:none}.company-switcher label span{display:none}.company-switcher select{min-width:0;max-width:42vw;height:38px;font-size:12px}.app-content{padding:20px 14px 32px}.public-header{padding:0 18px}.public-content{width:calc(100% - 28px);padding:24px 0}}
@media(prefers-reduced-motion:reduce){.app-sidebar,.app-shell{transition:none}}

/* 8. Доступность, действия строк и обновлённые модальные окна */
.sidebar-link:focus-visible,.sidebar-collapse-button:focus-visible{outline:2px solid #8be2dd;outline-offset:-2px}
.sidebar-collapse-button{min-width:34px;min-height:34px}
body.mobile-menu-open{overflow:hidden}
.icon-action{width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:7px}
.interactive-row{cursor:pointer}.interactive-row:focus-visible{outline:2px solid var(--shell-teal);outline-offset:-2px}
.address-editor .modal-header,.help-modal .modal-header{background:#f1f6f8;border-bottom:1px solid var(--shell-line)}
.address-editor .modal-title{color:var(--shell-navy);font-weight:600}
.address-editor .modal-dialog{max-width:1140px}
.address-editor .photo-preview-panel{padding:16px;background:#f4f7f9;border-radius:8px}
.address-editor #modalPreviewImage{max-height:55vh;border-radius:6px}
.address-editor #suggestionsContainer{min-height:220px;max-height:45vh;overflow-y:auto;border-radius:8px}
.address-editor #selectedAddressSummary{margin-top:12px;padding:12px;border:1px solid var(--shell-line);border-radius:8px;overflow-wrap:anywhere}
.help-document{width:100%;height:65vh;border:0}
@media(max-width:767px){.address-editor #modalPreviewImage{max-height:30vh}.address-editor #suggestionsContainer{max-height:30vh}}
