:root {
    --ub-form-surface: #d4e8e4;
    --ub-form-surface-border: #a8c9c2;
    --ub-input-bg: #ffffff;
    --ub-input-border: #7aa89f;
    --ub-sidebar-width: 280px;
    --ub-sidebar-bg-top: #0b3d91;
    --ub-sidebar-bg-bottom: #051a38;
    --ub-sidebar-accent: #5eb3ff;
    --ub-sidebar-accent-soft: rgba(94, 179, 255, 0.18);
    --ub-topbar-height: 40px;
}

body {
    background-color: #e8f2f0;
    font-family: 'Nunito', sans-serif;
}

/* —— Sidebar —— */
.sidebar {
    --sb-text: #f8fbff;
    --sb-text-muted: rgba(248, 251, 255, 0.82);
    --sb-text-section: #9dd4ff;
    --sb-text-item: rgba(232, 240, 252, 0.88);
    --sb-text-item-hover: #ffffff;
    --sb-section-bg: rgba(94, 179, 255, 0.14);
    --sb-section-border: rgba(94, 179, 255, 0.28);
    --sb-items-bg: rgba(2, 12, 28, 0.42);
    --sb-items-border: rgba(255, 255, 255, 0.07);
    --sb-active-bg: rgba(94, 179, 255, 0.22);
    --sb-hover-bg: rgba(255, 255, 255, 0.1);
    --sb-icon-bg: rgba(255, 255, 255, 0.08);
    --sb-icon-active-bg: rgba(94, 179, 255, 0.35);
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 120% 80% at 0% 0%, rgba(94, 179, 255, 0.14), transparent 55%),
        linear-gradient(180deg, var(--ub-sidebar-bg-top) 0%, var(--ub-sidebar-bg-bottom) 100%);
    color: var(--sb-text);
    height: 100vh;
    height: 100dvh;
    position: fixed;
    width: var(--ub-sidebar-width);
    padding: 0;
    z-index: 1030;
    overflow: hidden;
    box-shadow: 4px 0 28px rgba(5, 26, 56, 0.28);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
    flex-shrink: 0;
    padding: 1.1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    padding: 0.35rem;
    margin: -0.35rem;
    transition: background-color 0.2s ease;
}

.sidebar-brand:hover {
    background-color: var(--sb-hover-bg);
    color: inherit;
}

.sidebar-logo {
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
    border-radius: 10px;
    background-color: #ffffff;
    padding: 0.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-app-name {
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: var(--sb-text);
}

.sidebar-brand.sidebar-brand-text-only {
    padding-left: 0.5rem;
}

.sidebar-brand.sidebar-brand-text-only .sidebar-app-name {
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.65rem 0.75rem 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 4px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--sb-text-item);
    text-decoration: none;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background-color 0.18s ease, color 0.18s ease;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
    border: 1px solid transparent;
}

.sidebar-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--sb-text-item-hover);
    border-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav-link.active {
    background: linear-gradient(90deg, var(--sb-active-bg) 0%, rgba(94, 179, 255, 0.08) 100%);
    color: var(--sb-text);
    font-weight: 700;
    border-color: rgba(94, 179, 255, 0.35);
    box-shadow: inset 3px 0 0 var(--ub-sidebar-accent);
}

.sidebar-nav-link.active .sidebar-nav-icon {
    background-color: var(--sb-icon-active-bg);
    color: #ffffff;
}

.sidebar-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    flex-shrink: 0;
    border-radius: 7px;
    background-color: rgba(255, 255, 255, 0.06);
    font-size: 0.92rem;
    color: rgba(200, 218, 240, 0.85);
    transition: background-color 0.18s ease, color 0.18s ease;
}

.sidebar-nav-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    margin-bottom: 2px;
}

.sidebar-nav-item > .sidebar-nav-link {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}

.ui-help-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(108, 117, 125, 0.95);
    line-height: 1;
    flex-shrink: 0;
    cursor: help;
    vertical-align: middle;
}

.ui-help-hint:hover,
.ui-help-hint:focus-visible {
    color: var(--bs-primary, #0d6efd);
    outline: none;
    background: rgba(13, 110, 253, 0.08);
}

.ui-help-hint i {
    font-size: 0.95rem;
}

.sidebar-help-hint {
    color: rgba(180, 200, 220, 0.55);
}

.sidebar-help-hint:hover,
.sidebar-help-hint:focus-visible {
    color: #9fd0ff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link .ui-help-hint,
.ub-cal-mode-tab .ui-help-hint {
    margin-left: 0.2rem;
    color: inherit;
    opacity: 0.55;
}

.nav-link .ui-help-hint:hover,
.nav-link.active .ui-help-hint,
.ub-cal-mode-tab .ui-help-hint:hover,
.ub-cal-mode-tab.active .ui-help-hint {
    opacity: 1;
}

.btn .ui-help-hint {
    margin-left: 0.15rem;
    opacity: 0.7;
}

/* —— Встроенная правая справка (offcanvas) —— */
.ui-help-offcanvas {
    --bs-offcanvas-width: min(48vw, 880px);
    width: var(--bs-offcanvas-width) !important;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
}

@media (max-width: 991.98px) {
    .ui-help-offcanvas {
        --bs-offcanvas-width: min(92vw, 720px);
    }
}

@media (max-width: 575.98px) {
    .ui-help-offcanvas {
        --bs-offcanvas-width: 100vw;
    }
}

.ui-help-offcanvas-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bs-body-bg, #fff);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.85rem 1rem 0.85rem 1.15rem;
    align-items: center;
}

.ui-help-offcanvas-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    padding-right: 0.5rem;
}

.ui-help-close {
    width: 2.1rem;
    height: 2.1rem;
    padding: 0.55rem;
    margin: -0.15rem -0.1rem -0.15rem 0.25rem;
    opacity: 0.85;
    background-color: rgba(33, 37, 41, 0.08);
    border-radius: 0.4rem;
    box-sizing: content-box;
    flex-shrink: 0;
}

.ui-help-close:hover,
.ui-help-close:focus-visible {
    opacity: 1;
    background-color: rgba(220, 53, 69, 0.12);
}

.ui-help-lightbox-close {
    background-color: rgba(255, 255, 255, 0.18);
}

.ui-help-lightbox-close:hover,
.ui-help-lightbox-close:focus-visible {
    background-color: rgba(255, 255, 255, 0.28);
}

.ui-help-offcanvas-body {
    padding: 1rem 1.15rem 1.5rem;
    font-size: 0.98rem;
    line-height: 1.5;
}

.ui-help-article {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ui-help-article:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ui-help-article-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.55rem;
    line-height: 1.35;
}

.ui-help-article-body {
    font-size: 0.97rem;
    line-height: 1.5;
    color: var(--bs-body-color, #212529);
    white-space: pre-wrap;
    margin-bottom: 0.85rem;
}

.ui-help-article-links {
    margin-top: 0.65rem;
}

.ui-help-step {
    margin-bottom: 1.35rem;
    padding-bottom: 0.25rem;
}

.ui-help-step-title {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.4rem;
    color: var(--bs-emphasis-color, #212529);
}

.ui-help-step-text {
    font-size: 0.94rem;
    line-height: 1.5;
    color: var(--bs-secondary-color, #495057);
    margin-bottom: 0.65rem;
}

.ui-help-shot {
    display: block;
    width: 100%;
    text-align: left;
    max-width: 100%;
}

.ui-help-shot:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
    border-radius: 0.4rem;
}

.ui-help-shot-img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 0.4rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #f8f9fa;
}

.ui-help-lightbox-dialog {
    max-width: min(96vw, 1100px);
}

.ui-help-lightbox-img {
    max-height: min(82vh, 900px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.sidebar-group {
    margin-bottom: 0.55rem;
    padding-bottom: 0.15rem;
}

.sidebar-group:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.55rem;
}

.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 1px solid var(--sb-section-border);
    background: var(--sb-section-bg);
    color: var(--sb-text-section);
    padding: 0.5rem 0.6rem;
    margin: 0 0 0.3rem;
    cursor: pointer;
    border-radius: 9px;
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-group-toggle:hover {
    background-color: rgba(94, 179, 255, 0.22);
    color: #d4ecff;
    border-color: rgba(94, 179, 255, 0.45);
}

.sidebar-group-toggle:focus-visible {
    outline: 2px solid var(--ub-sidebar-accent);
    outline-offset: 2px;
}

.sidebar-group-heading {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.sidebar-group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.9rem;
    color: #ffd86b;
    background: rgba(255, 216, 107, 0.12);
    border-radius: 6px;
    flex-shrink: 0;
}

.sidebar-group .sidebar-group-title {
    display: block;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sb-text-section);
}

.sidebar-group-chevron {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--sb-text-section);
    opacity: 0.85;
    transition: transform 0.22s ease;
}

.sidebar-group.is-collapsed .sidebar-group-chevron {
    transform: rotate(-90deg);
}

.sidebar-group-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.24s ease;
}

.sidebar-group.is-collapsed .sidebar-group-body {
    grid-template-rows: 0fr;
}

.sidebar-group-body-inner {
    overflow: hidden;
    margin: 0 0.15rem 0 0.35rem;
    padding: 0.35rem 0.4rem 0.4rem 0.55rem;
    border-radius: 8px;
    background: var(--sb-items-bg);
    border: 1px solid var(--sb-items-border);
    border-left: 3px solid rgba(148, 163, 184, 0.35);
}

.sidebar-group-body .sidebar-nav-link {
    padding-left: 0.45rem;
    font-size: 0.88rem;
    color: var(--sb-text-item);
}

.sidebar-group-body .sidebar-nav-link .sidebar-nav-label {
    font-weight: 600;
}

.sidebar-group:has(.sidebar-nav-link.active) .sidebar-group-toggle {
    color: #d4ecff;
    background: rgba(94, 179, 255, 0.24);
    border-color: rgba(94, 179, 255, 0.5);
}

.sidebar-group:has(.sidebar-nav-link.active) .sidebar-group-icon {
    color: #ffe08a;
    background: rgba(255, 216, 107, 0.2);
}

.sidebar-group.is-collapsed .sidebar-group-toggle {
    margin-bottom: 0;
}

.sidebar-group.is-collapsed {
    border-bottom-color: transparent;
    padding-bottom: 0.15rem;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 0.65rem 0.75rem 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.12);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.5rem;
    margin-bottom: 0.35rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-user-avatar {
    font-size: 1.75rem;
    line-height: 1;
    color: var(--ub-sidebar-accent);
    flex-shrink: 0;
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--sb-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sb-text-section);
}

.sidebar a.sidebar-logout {
    margin-top: 0;
    color: rgba(255, 200, 200, 0.95);
}

.sidebar a.sidebar-logout:hover {
    background-color: rgba(220, 53, 69, 0.18);
    border-color: rgba(220, 53, 69, 0.25);
    color: #ffe8e8;
}

.sidebar a.sidebar-logout .sidebar-nav-icon {
    background-color: rgba(220, 53, 69, 0.2);
    color: #ffb4b4;
}

/* Legacy flat links (if any remain) */
.sidebar a:not(.sidebar-nav-link):not(.sidebar-brand) {
    color: var(--sb-text-muted);
    text-decoration: none;
    display: block;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    margin-bottom: 2px;
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0.5rem 0.65rem;
}

.topbar {
    background-color: #eef6f4;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    height: var(--ub-topbar-height);
    min-height: var(--ub-topbar-height);
    max-height: var(--ub-topbar-height);
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1020;
    gap: 0.75rem;
}

.topbar-search .form-control {
    height: 28px;
    padding: 0.15rem 0.55rem;
    font-size: 0.8125rem;
    min-width: 200px;
    max-width: 320px;
}

.topbar-search .btn {
    height: 28px;
    padding: 0 0.55rem;
    font-size: 0.8125rem;
    line-height: 1;
}

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
}

.topbar-user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.topbar-user-name {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logged-in .content-wrapper {
    margin-left: var(--ub-sidebar-width);
}

.content-wrapper {
    padding: 12px 24px 24px;
    min-height: 100vh;
}

/* Основная область страницы — фон как у холста, без белой «простыни» */
.content-panel {
    background: transparent;
    border-radius: 12px;
    padding: 0.25rem 0 1rem;
}

/*
 * Компактные формы в стиле «Быстрой заявки»:
 * небольшие карточки, мелкие поля, светлые заголовки.
 */
.content-panel .card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
    border-radius: 0.5rem;
    background-color: #ffffff;
    margin-bottom: 0.85rem;
}

.content-panel .card > .card-header {
    background: #f8fafb;
    font-size: 0.875rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.5rem 0.85rem;
}

.content-panel .card > .card-body {
    padding: 0.85rem;
    background: transparent;
}

.content-panel .card > .card-footer {
    padding: 0.5rem 0.85rem;
    background: #f8fafb;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.content-panel .form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #495057;
}

.content-panel .form-text,
.content-panel small.text-muted {
    font-size: 0.75rem;
}

/* Поля по умолчанию как form-control-sm (кроме явно крупных) */
.content-panel .form-control:not(.form-control-lg):not(.form-control-sm),
.content-panel .form-select:not(.form-select-lg):not(.form-select-sm) {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.content-panel .form-control,
.content-panel .form-select,
form.card .form-control,
form.card .form-select {
    background-color: var(--ub-input-bg);
    border: 1px solid #ced4da;
    color: #212529;
}

.content-panel .form-control:focus,
.content-panel .form-select:focus,
form.card .form-control:focus,
form.card .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    background-color: var(--ub-input-bg);
}

.content-panel .btn:not(.btn-sm):not(.btn-lg):not(.btn-close) {
    padding: 0.28rem 0.7rem;
    font-size: 0.875rem;
}

.content-panel h1.h3,
.content-panel h2:not(.h6):not(.modal-title) {
    font-size: 1.25rem;
    font-weight: 600;
}

.content-panel .table {
    font-size: 0.875rem;
}

.content-panel .table > :not(caption) > * > * {
    padding: 0.45rem 0.65rem;
}

/* POST-форма без карточки — компактный блок */
.content-panel > form[method="post"]:not(.card):not(.d-inline):not(.d-flex) {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.85rem;
    border-radius: 0.5rem;
    box-shadow: none;
    margin-bottom: 0.85rem;
}

.content-panel > form[method="get"]:not(.card):not(.d-inline):not(.d-flex):not(.topbar-search) {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.75rem 0.85rem;
    border-radius: 0.5rem;
    box-shadow: none;
    margin-bottom: 0.85rem;
}

/* form.card (legacy) */
form.card.card-body {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: none !important;
    border-radius: 0.5rem !important;
    padding: 0.85rem !important;
}

.card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
    border-radius: 0.5rem;
    background-color: #ffffff;
}

/* Модальное окно: тонированная оболочка; белые — только поля внутри тела */
.modal-content {
    background-color: #e8f2f0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.modal-dialog-scrollable .modal-content {
    /* На небольших экранах не даём модалке уходить ниже viewport */
    max-height: calc(100vh - 2rem);
}

.modal-dialog-scrollable .modal-body {
    /* Иногда кастомные отступы/обводки сбивают встроенный скролл Bootstrap */
    overflow-y: auto;
}

.modal-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-body {
    background-color: var(--ub-form-surface);
    border: 1px solid var(--ub-form-surface-border);
    border-radius: 10px;
    margin: 0 0.75rem 0.75rem;
    padding: 1.25rem;
}

.modal-body .form-control,
.modal-body .form-select {
    background-color: var(--ub-input-bg);
    border: 1px solid var(--ub-input-border);
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.18);
    background-color: var(--ub-input-bg);
}

.modal-footer {
    background-color: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Таблицы: полоски, hover, responsive */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

.table.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0,0,0,.02);
}

.table > tbody > tr:hover > * {
    background-color: rgba(13, 110, 253, 0.06) !important;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

/* Кнопки: крупные, современные */
.btn {
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0a58ca;
    border-color: #0a58ca;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

.alert {
    border-radius: 8px;
}

@media (max-width: 768px) {
    .ub-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        flex-shrink: 0;
    }

    .sidebar {
        top: 0;
        left: 0;
        width: min(var(--ub-sidebar-width), 88vw);
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 1045;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(15, 23, 42, 0.45);
        border: 0;
        padding: 0;
        margin: 0;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .logged-in .content-wrapper {
        margin-left: 0;
        padding-top: 0;
    }

    .topbar {
        height: auto;
        min-height: var(--ub-topbar-height);
        max-height: none;
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 6px 10px;
    }

    .topbar > .d-flex:first-child {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar form[role="search"] {
        width: 100%;
        max-width: 100%;
    }

    .topbar form[role="search"] .form-control {
        min-width: 0 !important;
        max-width: none;
        flex: 1 1 auto;
    }

    .topbar > .d-flex:last-child,
    .topbar .topbar-user {
        flex: 0 0 auto;
        margin-left: auto;
        font-size: 0.8125rem;
    }
}

.ub-menu-toggle {
    display: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}

/* Карточка клиента: табы на мобильных */
.client-detail-card .nav-tabs-detail {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0;
}
.client-detail-card .nav-tabs-detail .nav-link {
    white-space: nowrap;
    border-radius: 0.375rem 0.375rem 0 0;
}
@media (max-width: 576px) {
    .client-detail-card .nav-tabs-detail {
        flex-direction: column;
    }
    .client-detail-card .nav-tabs-detail .nav-item {
        width: 100%;
    }
    .client-detail-card .nav-tabs-detail .nav-link {
        border-radius: 0;
        text-align: left;
    }
}

/* Horizontal scroll tabs на мобильных */
.client-detail-card .nav-tabs-detail {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    flex-wrap: nowrap;
}
.client-detail-card .nav-tabs-detail .nav-item {
    flex-shrink: 0;
}

/* Print styles для карточки клиента */
@media print {
    .sidebar, .topbar, .breadcrumb, .nav-tabs, .btn, .content-wrapper .card:first-child,
    .modal, [data-bs-toggle="modal"], .no-print {
        display: none !important;
    }
    .content-wrapper { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #dee2e6; }
    body { background: white; }
}

/* Галерея фото: grid с auto-fit */
.client-photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
