:root {
    --primary-color: var(--accent-primary);  /* legacy alias — points to design token */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 68px;
    --sidebar-tree-width: 320px;
    --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* No transitions during initial load */
html.no-transitions,
html.no-transitions *,
html.no-transitions *::before,
html.no-transitions *::after {
    transition: none !important;
}

/* Pre-apply sidebar state before JS runs */
html.pre-tree-mode .sidebar {
    width: var(--sidebar-tree-width) !important;
}
html.pre-tree-mode .main-content {
    margin-left: var(--sidebar-tree-width) !important;
}
html.pre-pinned .sidebar {
    width: var(--sidebar-width) !important;
}
html.pre-pinned .main-content {
    margin-left: var(--sidebar-width) !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-page);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-collapsed-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    padding: 1rem 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 1000;
    transition: width var(--sidebar-transition);
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar:hover,
.sidebar.pinned {
    width: var(--sidebar-width);
}

.sidebar.tree-mode {
    width: var(--sidebar-tree-width);
}

.sidebar.tree-mode:hover {
    width: var(--sidebar-tree-width);
}

/* Sidebar resize handle */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    transition: background 0.2s;
    z-index: 1001;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: var(--primary-color);
}

.sidebar.resizing {
    transition: none !important;
}

body.sidebar-resizing {
    cursor: ew-resize !important;
    user-select: none !important;
}

.sidebar-brand {
    color: var(--text-inverse);
    font-weight: 700;
    font-size: 1.25rem;
    padding: 0.5rem 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .brand-icon {
    font-size: 1.5rem;
    min-width: 24px;
}

.sidebar-brand .brand-text {
    opacity: 0;
    transition: opacity var(--sidebar-transition);
}

.sidebar:hover .brand-text,
.sidebar.pinned .brand-text,
.sidebar.tree-mode .brand-text {
    opacity: 1;
}

.sidebar-brand .brand-name {
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.sidebar-brand .brand-full {
    font-size: 0.65rem;
    opacity: 0.5;
    letter-spacing: 0.5px;
    display: block;
    margin-top: 2px;
}

.sidebar-brand .brand-version {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 4px;
}

.sidebar-pin {
    position: absolute;
    top: 1rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}

.sidebar:hover .sidebar-pin,
.sidebar.tree-mode .sidebar-pin {
    opacity: 1;
}

.sidebar-pin:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.1);
}

.sidebar.pinned .sidebar-pin {
    opacity: 1;
    color: var(--primary-color);
}

.sidebar-nav {
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-nav li a i {
    font-size: 1.1rem;
    min-width: 20px;
    text-align: center;
}

.sidebar-nav li a .nav-text {
    opacity: 0;
    transition: opacity var(--sidebar-transition);
}

.sidebar:hover .nav-text,
.sidebar.pinned .nav-text,
.sidebar.tree-mode .nav-text {
    opacity: 1;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-inverse);
}

.sidebar-nav li a.active {
    border-left: 3px solid var(--primary-color);
}

.sidebar-section {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    padding: 1.5rem 1.25rem 0.5rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-section .section-text {
    opacity: 0;
    transition: opacity var(--sidebar-transition);
}

.sidebar:hover .section-text,
.sidebar.pinned .section-text,
.sidebar.tree-mode .section-text {
    opacity: 1;
}

.sidebar:not(:hover):not(.pinned):not(.tree-mode):not(.show) .sidebar-section {
    padding: 1rem 0;
    text-align: center;
}

.sidebar:not(:hover):not(.pinned):not(.tree-mode):not(.show) .sidebar-section::after {
    content: '';
    display: block;
    width: 24px;
    height: 1px;
    background: rgba(255,255,255,0.2);
    margin: 0 auto;
}

/* Tree Mode */
.sidebar-tree-toggle {
    display: none;
    padding: 0.5rem 1.25rem;
    margin-bottom: 0.5rem;
}

.sidebar-tree-toggle button {
    width: 100%;
    background: rgba(37, 99, 235, 0.2);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: var(--text-inverse);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.sidebar-tree-toggle button:hover {
    background: rgba(37, 99, 235, 0.3);
}

.sidebar-tree-toggle button.active {
    background: var(--primary-color);
}

body.estimate-page .sidebar-tree-toggle {
    display: block;
}

body.estimate-page .sidebar:hover .sidebar-tree-toggle,
body.estimate-page .sidebar.pinned .sidebar-tree-toggle,
body.estimate-page .sidebar.tree-mode .sidebar-tree-toggle {
    display: block;
}

body.estimate-page .sidebar:not(:hover):not(.pinned):not(.tree-mode):not(.show) .sidebar-tree-toggle {
    display: none;
}

.equipment-tree {
    display: none;
    padding: 0 0.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.sidebar.tree-mode .equipment-tree {
    display: block;
}

.sidebar.tree-mode .sidebar-nav-main {
    display: none;
}

.tree-node {
    user-select: none;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    color: rgba(255,255,255,0.8);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.tree-node-header:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-inverse);
}

.tree-node-header .tree-icon {
    font-size: 0.75rem;
    width: 16px;
    text-align: center;
    color: rgba(255,255,255,0.5);
    transition: transform 0.2s;
}

.tree-node.expanded > .tree-node-header .tree-icon {
    transform: rotate(90deg);
}

.tree-node-header .tree-type-icon {
    font-size: 1rem;
    min-width: 18px;
}

.tree-node-header .tree-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-node-header .tree-count {
    font-size: 0.7rem;
    background: rgba(255,255,255,0.15);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
}

.tree-children {
    display: none;
    padding-left: 1rem;
}

.tree-node.expanded > .tree-children {
    display: block;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem 0.35rem 1.5rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.15s;
}

.tree-item:hover {
    background: rgba(37, 99, 235, 0.3);
    color: var(--text-inverse);
}

.tree-item:active {
    cursor: grabbing;
}

.tree-item.dragging {
    opacity: 0.5;
}

.tree-item .item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-item .item-price {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
}

.tree-item .item-drag-icon {
    opacity: 0.4;
    font-size: 0.75rem;
}

/* Visual flags for problem items in catalog tree:
   - zero-stock: яркий тонкий border слева (нет на складе — нечего отгружать)
   - zero-price: badge в строке (цена не выставлена)
   Видно мгновенно даже в большом списке. */
.tree-item.zero-stock {
    box-shadow: inset 3px 0 0 var(--status-danger);
}
.tree-item.zero-stock .item-stock {
    color: var(--status-danger);
    font-weight: 600;
}
.tree-item.zero-price {
    background: rgba(234, 179, 8, 0.10);
}
.tree-item.zero-price.zero-stock {
    background: rgba(239, 68, 68, 0.12);
}
.tree-item .item-flag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.3;
    flex-shrink: 0;
}
.tree-item .item-flag.flag-zero-price {
    background: var(--status-warning);
    color: #000;
}

.tree-search-results .tree-item {
    padding-left: 0.5rem;
}

.tree-search-results .search-result-type {
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.25rem;
}

.tree-search-results .search-result-type.equipment {
    background: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.tree-search-results .search-result-type.subrent {
    background: rgba(168, 85, 247, 0.3);
    color: #d8b4fe;
}

.tree-items-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.25rem;
}

.tree-search {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.tree-search input {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-inverse);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.tree-search input::placeholder {
    color: rgba(255,255,255,0.4);
}

.tree-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255,255,255,0.15);
}

/* Edit mode styles */
.tree-edit-toggle {
    display: none;
    padding: 0.25rem 0.5rem 0.5rem;
}

.sidebar.tree-mode .tree-edit-toggle {
    display: block;
}

.tree-edit-toggle button {
    width: 100%;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--text-inverse);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.tree-edit-toggle button:hover {
    background: rgba(168, 85, 247, 0.3);
}

.tree-edit-toggle button.active {
    background: #a855f7;
}

.edit-mode .tree-item {
    cursor: pointer;
}

.edit-mode .tree-item .item-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 3px;
    margin-right: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.edit-mode .tree-item.selected .item-checkbox {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.edit-mode .tree-item.selected .item-checkbox::after {
    content: "\2713";
    color: var(--text-inverse);
    font-size: 10px;
}

.edit-mode .tree-item.selected {
    background: rgba(37, 99, 235, 0.25);
}

.edit-mode .tree-item:not(.selected):hover .item-checkbox {
    border-color: rgba(255,255,255,0.7);
}

.edit-mode .tree-item .item-drag-icon {
    display: none;
}

.edit-mode .tree-node[data-type="category"].drop-target > .tree-node-header {
    background: rgba(37, 99, 235, 0.4);
    outline: 2px dashed var(--primary-color);
    outline-offset: -2px;
}

.tree-selection-info {
    display: none;
    padding: 0.5rem;
    background: rgba(37, 99, 235, 0.2);
    border-radius: 6px;
    margin: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
}

.tree-selection-info.visible {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tree-selection-info .selection-hint {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 0.5rem;
}

.tree-selection-info button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--text-inverse);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

.tree-selection-info button:hover {
    background: rgba(255,255,255,0.1);
}

.tree-node.empty-category > .tree-node-header {
    opacity: 0.6;
}

.tree-node.empty-category > .tree-node-header .tree-name {
    font-style: italic;
}

.tree-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: rgba(255,255,255,0.5);
}

.tree-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.8);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tree-back-btn:hover {
    background: rgba(255,255,255,0.2);
    color: var(--text-inverse);
}

/* Drop zones */
.drop-zone-active {
    outline: 2px dashed var(--primary-color) !important;
    outline-offset: -2px;
    background: rgba(37, 99, 235, 0.05) !important;
}

.drop-zone-hover {
    outline: 2px solid var(--primary-color) !important;
    background: rgba(37, 99, 235, 0.1) !important;
}

.drag-ghost {
    position: fixed;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--text-inverse);
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-collapsed-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left var(--sidebar-transition);
}

body.sidebar-pinned .main-content {
    margin-left: var(--sidebar-width);
}

body.sidebar-tree-mode .main-content {
    margin-left: var(--sidebar-tree-width);
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-default);
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
}

.table th {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.alert {
    border: none;
    border-radius: 8px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-strong);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s, width var(--sidebar-transition);
        width: var(--sidebar-width);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.tree-mode {
        width: 100%;
    }

    /* Открытая панель обязана быть раскрытой. Подписи держались на :hover,
       которого пальцем не вызвать, а скрепка на мобиле скрыта — панель
       выезжала на 240px «рейлом»: иконки у края, разделы чёрточками. */
    .sidebar.show .brand-text,
    .sidebar.show .nav-text,
    .sidebar.show .section-text {
        opacity: 1;
    }

    /* гамбургер лежит поверх шапки панели — уводим логотип из-под него */
    .sidebar-brand {
        padding-top: 2.75rem;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .mobile-toggle {
        display: block !important;
    }

    .sidebar-pin {
        display: none;
    }
}

.mobile-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    color: var(--text-inverse);
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ============================================
   Responsive: Tablets & Small Screens
   ============================================ */
@media (max-width: 767.98px) {
    /* Tables: horizontal scroll on mobile */
    .table-responsive-custom {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Cards: full-width, less padding */
    .card {
        border-radius: 8px;
    }
    .card-body {
        padding: 0.75rem;
    }

    /* Forms: larger touch targets */
    .form-control, .form-select, .btn {
        min-height: 42px;
        font-size: 0.95rem;
    }

    /* Modals: full-screen on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }
    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Badge + small elements */
    .badge {
        font-size: 0.75rem;
        padding: 0.35em 0.5em;
    }

    /* Project header: stack vertically */
    .project-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Gantt: horizontal scroll */
    .gantt-card {
        overflow-x: auto;
    }

    /* Selection toolbar: compact on mobile */
    .selection-toolbar {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    .selection-toolbar select,
    .selection-toolbar input {
        font-size: 0.8rem;
        min-height: 36px;
    }

    /* Date cards: smaller */
    .date-card {
        padding: 0.5rem;
    }

    /* Finance section */
    .finance-row {
        flex-wrap: wrap;
    }

    /* Staff cards */
    .staff-row {
        flex-wrap: wrap;
    }

    /* Toast notifications */
    .toast-container {
        max-width: 90vw;
    }

    /* Bottom safe area for phones */
    .main-content {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
}

/* Extra small screens (phones) */
@media (max-width: 575.98px) {
    .main-content {
        padding: 0.5rem;
    }

    h1, .h1 { font-size: 1.4rem; }
    h2, .h2 { font-size: 1.2rem; }
    h3, .h3 { font-size: 1.1rem; }

    /* Estimate item rows: more compact */
    .item-row td {
        padding: 0.35rem 0.25rem;
        font-size: 0.85rem;
    }

    /* Hide less-important columns on phone */
    .d-phone-none {
        display: none !important;
    }
}

/* Тач-устройства: раскрытие сайдбара — только явным действием.
   :hover после тапа «залипает», и панель разъезжалась до 240px поверх
   контента сама по себе, пока человек не ткнёт мимо. Ниже 992px раскрытие
   даёт класс .show (кнопка-гамбургер), выше — закрепление (.pinned),
   поэтому оба состояния из правил исключены. */
@media (hover: none) {
    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .brand-text,
    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .nav-text,
    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .section-text,
    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .sidebar-pin {
        opacity: 0;
    }

    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .quick-nav {
        display: none;
    }

    body.estimate-page .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .sidebar-tree-toggle {
        display: none;
    }

    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .sidebar-section {
        padding: 1rem 0;
        text-align: center;
    }

    .sidebar:hover:not(.pinned):not(.tree-mode):not(.show) .sidebar-section::after {
        content: '';
        display: block;
        width: 24px;
        height: 1px;
        background: rgba(255,255,255,0.2);
        margin: 0 auto;
    }
}

/* Планшет в альбоме: гамбургера здесь не было вовсе, а скрепка проявлялась
   тем же :hover — раскрыть панель пальцем было нечем. Кнопка видима и
   закрепляет панель рядом с контентом, а не поверх него. */
@media (hover: none) and (min-width: 992px) {
    .mobile-toggle {
        display: block;
    }

    .sidebar-brand {
        padding-top: 2.75rem;
    }
}

/* Затемнение под выехавшей панелью: тап мимо неё закрывает меню. */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

@media (max-width: 991.98px) {
    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    /* Larger click targets */
    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }

    /* Remove hover-only effects */
    .editable:hover {
        background: inherit;
    }

    /* Better scrolling */
    .table-responsive-custom {
        -webkit-overflow-scrolling: touch;
    }
}

/* ══════════════════════════════════════════════════════════
   TOPBAR ROW — вкладки «последних проектов» + слот страницы
   Живёт в base.html. Если блок `topbar_actions` пуст (а он пуст
   почти везде), ряд рендерится ровно как раньше: единственный
   ребёнок растягивается на всю ширину, высота не меняется.
   ══════════════════════════════════════════════════════════ */
.topbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.topbar-row > #recentProjects {
    flex: 1 1 auto;
    min-width: 0;
}

/* ══════════════════════════════════════════════════════════
   RECENT PROJECTS bar — closed-tab style bookmark widget
   Lives in base.html, rendered on every page. Persists list
   in localStorage. Tabs touch each other like browser bookmarks.
   ══════════════════════════════════════════════════════════ */
.recent-projects-bar {
    display: flex;
    align-items: stretch;
    gap: 2px;
    flex-wrap: wrap;
    font-size: 12px;
    margin-bottom: 4px;
}
.recent-projects-bar__icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 0 6px 0 2px;
}
.recent-tab {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 6px 6px 2px 2px;
    transition: all var(--transition-fast);
    overflow: hidden;
}
.recent-tab:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.recent-tab__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
}
.recent-tab__link:hover {
    color: var(--text-primary);
}
.recent-tab__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    /* background-color set inline from status (data-driven) */
}
.recent-tab--current .recent-tab__dot {
    background-color: var(--status-success-strong) !important;
    box-shadow: 0 0 0 2px rgba(22,163,74,.2);
}
.recent-tab--current .recent-tab__link { font-weight: 700; }
.recent-tab__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 7px 0 4px;
    color: var(--text-tertiary);
    font-size: 13px;
    line-height: 1;
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}
.recent-tab:hover .recent-tab__close {
    opacity: 1;
}
.recent-tab__close:hover {
    color: var(--status-danger);
}

/* ══════════════════════════════════════════════════════════
   THEME PICKER — radio cards in profile/settings
   ══════════════════════════════════════════════════════════ */
.theme-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.theme-card {
    display: block;
    cursor: pointer;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px;
    background: var(--bg-card);
    transition: all var(--transition-fast);
    margin: 0;
    user-select: none;
}
.theme-card:hover {
    border-color: var(--border-strong);
}
.theme-card:has(input:checked) {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-soft);
}
.theme-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.theme-card__preview {
    display: flex;
    gap: 4px;
    height: 44px;
    border-radius: var(--radius-md);
    padding: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
}
.theme-card__preview--classic { background: #f8fafc; }
.theme-card__preview--linear { background: #fafafa; }
.theme-card__swatch {
    flex: 1;
    border-radius: 3px;
}
.theme-card__name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}
.theme-card__hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* === Quick Nav === */
.quick-nav {
    position: relative;
    margin: 0 12px 12px;
}
.quick-nav-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    pointer-events: none;
}
.quick-nav-input {
    width: 100%;
    padding: 8px 36px 8px 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: background 120ms, border-color 120ms;
}
.quick-nav-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}
.quick-nav-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.quick-nav-shortcut {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    font-family: -apple-system, system-ui, sans-serif;
    pointer-events: none;
}
.quick-nav-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    padding: 4px 0;
}
.quick-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}
.quick-nav-item:hover,
.quick-nav-item.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.quick-nav-item i {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}
.quick-nav-item .quick-nav-text {
    flex: 1;
    min-width: 0;
}
.quick-nav-item .quick-nav-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-nav-item .quick-nav-title mark {
    background: rgba(250, 204, 21, 0.3);
    color: #fde68a;
    padding: 0 1px;
    border-radius: 2px;
}
.quick-nav-item .quick-nav-category {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-nav-empty {
    padding: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}
.quick-nav-empty i {
    margin-right: 6px;
}
.sidebar:not(.pinned):not(:hover):not(.show) .quick-nav,
.sidebar.tree-mode .quick-nav {
    display: none;
}

/* WMRLinkify — кликабельные ссылки в свободном тексте (примечания/комментарии).
   Контейнер переносит длинные URL без пробелов, сама ссылка может рваться где угодно. */
.wmr-linkify {
    overflow-wrap: anywhere;
    word-break: break-word;
}
a.wmr-link {
    color: var(--text-link);
    text-decoration: underline;
    word-break: break-all;
}
a.wmr-link:hover {
    color: var(--accent-primary-hover);
}

/* ── Баннеры-оповещения (общий ствол static/js/common/alert_banner.js) ────────
   Разметка — templates/includes/_alert_banner.html + _alert_chip.html.
   Потребители: федеративная субаренда и гостевой портал витрины.
   Цвета баннера — плотные заливки под белый текст, поэтому одинаковы в светлой
   и тёмной теме и в переливке dark-classic.css не участвуют. */
#wmr-banner-stack {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    pointer-events: none;   /* пустой стек не должен перехватывать клики */
}
#wmr-banner-stack > * {
    pointer-events: auto;
}
.wmr-alert-banner {
    /* Видимостью управляет модуль классом `.is-open`, а НЕ инлайновым
       `style.display`: правило класса перебило бы снятый инлайн, и баннер
       остался бы невидимым. */
    display: none;
    color: #fff;
    padding: 8px 16px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.wmr-alert-banner__inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.wmr-alert-banner__msg {
    flex: 1;
}
.wmr-alert-banner__collapse,
.wmr-alert-banner__action {
    color: #fff;
    flex-shrink: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.14);
}
.wmr-alert-banner__collapse {
    padding: 4px 13px;
    font-size: 13px;
}
.wmr-alert-banner__action {
    padding: 3px 12px;
    font-size: 12px;
    margin-left: 14px;
}
.wmr-alert-banner__collapse:hover,
.wmr-alert-banner__action:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.26);
}
.wmr-alert-banner__link {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}
.wmr-alert-banner__link:hover {
    color: #fff;
}
.wmr-alert-banner__sep {
    margin: 0 10px;
    opacity: 0.6;
}

#wmr-chip-stack {
    position: fixed;
    top: 10px;
    /* Отступ справа = ширина переключателя темы (34px) + зазор: до выноса
       общего ствола свёрнутый чип федерации стоял ровно на нём и перехватывал
       клик по нему. Со вторым чипом это стало видно сразу. */
    right: 58px;
    z-index: 9998;
    display: flex;
    flex-direction: row-reverse;   /* первый в разметке остаётся у правого края */
    gap: 8px;
    pointer-events: none;
}
.wmr-alert-banner.is-open {
    display: block;
}
.wmr-alert-chip {
    display: none;
    color: #fff;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    user-select: none;
    pointer-events: auto;
}
.wmr-alert-chip.is-open {
    display: block;
}

/* Тона. Значения — те же, что были инлайном у федеративного баннера. */
.wmr-alert-banner[data-tone="blue"],
.wmr-alert-chip[data-tone="blue"] { background: #1d4ed8; }
.wmr-alert-banner[data-tone="red"],
.wmr-alert-chip[data-tone="red"] { background: #b91c1c; }
.wmr-alert-banner[data-tone="sky"],
.wmr-alert-chip[data-tone="sky"] { background: #0369a1; }
.wmr-alert-banner[data-tone="amber"],
.wmr-alert-chip[data-tone="amber"] { background: #b45309; }
.wmr-alert-banner[data-tone="violet"],
.wmr-alert-chip[data-tone="violet"] { background: #6d28d9; }

/* ============================================================
   Попап «пометить проект отменённым» (project_cancel_prompt.js).
   Живёт в base.css, а не в estimates.css: тот же диалог поднимается
   со страницы сметы, из списка смет проекта и из личного финкокпита.
   Разметка — safe DOM, классы .wcp-*; образец — .topup-* в estimates.css.
   ============================================================ */
.wcp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10700;
    padding: 16px;
}
.wcp-dialog {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    /* min-height:0 — без него flex-контейнер не даёт содержимому сжаться
       и кнопки уезжают за нижний край окна (грабля из showTopUpDialog). */
    min-height: 0;
    padding: 22px 24px 18px;
    animation: wcp-pop .16s ease-out;
}
@keyframes wcp-pop {
    from { opacity: 0; transform: translateY(6px) scale(.985); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .wcp-dialog { animation: none; }
}
.wcp-title {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 6px;
}
.wcp-subtitle {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0 0 14px;
}
.wcp-warn {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--chip-danger-text);
    background: var(--bg-tinted-danger);
    border: 1px solid var(--chip-danger-border);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 0 10px;
}
.wcp-note {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0;
}
.wcp-error {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--status-danger-text);
    margin: 12px 0 0;
}
.wcp-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}
/* Кнопки диалога — свои, а не bootstrap'овские: `.btn-outline-secondary`
   в состоянии :focus красится серым фоном поверх серого текста темы, и
   надпись исчезает. Фокус тут стоит на безопасной кнопке, так что этот
   стык виден всегда. */
.wcp-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}
.wcp-btn:disabled { opacity: .6; cursor: default; }
.wcp-btn--ghost {
    background: var(--bg-subtle);
    border-color: var(--border-default);
    color: var(--text-primary);
}
.wcp-btn--ghost:hover:not(:disabled) { border-color: var(--border-strong); }
.wcp-btn--danger {
    background: var(--status-danger-text);
    color: #fff;
}
.wcp-btn--danger:hover:not(:disabled) { filter: brightness(0.93); }
.wcp-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Денежное поле: видимый отказ независимо от классов Bootstrap.
   ⚠️ Bootstrap рисует `.is-invalid` ТОЛЬКО на `.form-control`/`.form-select`/
   `.form-check-input`, а переведённые поля живут и без этих классов
   (`#ltpPrice`, `#searchQtyPrice`, `.sr-price-edit-input`, инлайн-редактор
   каталога) — у них подсветка ствола была НЕВИДИМОЙ, то есть отказ выглядел
   как «не нажалось». Правило узкое: только поля, помеченные денежными. */
[data-money-input].is-invalid {
    border-color: var(--status-danger-text, #dc3545) !important;
    background-color: rgba(220, 53, 69, 0.06);
}

/* Поиск по настройкам (права роли, карточки модулей) — static/js/settings_search.js.
   Цвета только токенами: подсветка обязана читаться и в тёмной теме. */
.settings-search-box {
    position: relative;
    flex: 1 1 auto;
    max-width: 340px;
}
.settings-search-icon {
    position: absolute;
    left: .6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8rem;
    color: var(--text-tertiary);
    pointer-events: none;
}
.settings-search-input { padding-left: 1.9rem; padding-right: 1.9rem; }
/* Нативный крестик webkit убираем: он чистит поле мимо нашего обработчика. */
.settings-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.settings-search-clear {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-tertiary);
    line-height: 1;
    padding: .2rem .3rem;
    font-size: .7rem;
    cursor: pointer;
}
.settings-search-clear:hover { color: var(--text-primary); }
/* Совпавшая вложенная настройка внутри показанной карточки. */
.settings-search-hit {
    background: var(--accent-primary-soft);
    box-shadow: inset 2px 0 0 var(--accent-primary);
    border-radius: 4px;
}

/* ── Островок «Примерка роли» ────────────────────────────────────────────
   Механика один в один с Ревизором (.proebot в estimates.css): пилюля +
   панель, column-reverse, `--flip`/`--left` при перетаскивании. Расхождение
   поведения двух плавающих виджетов путало бы сильнее, чем экономия строк.
   Дефолт — правый низ НАД Ревизором (тот сидит на bottom:134px и высок ~34px),
   чтобы на странице сметы два островка не легли друг на друга. */
.rolepv {
    position: fixed;
    right: 18px;
    bottom: 186px;
    z-index: 1045;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: flex-end;
}
.rolepv[hidden] { display: none; }
.rolepv--flip { flex-direction: column; }
.rolepv--left { align-items: flex-start; }
.rolepv--dragging { transition: none; }

.rolepv-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    font-size: 13px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    max-width: 260px;
    transition: border-color .15s ease, color .15s ease;
}
.rolepv-pill:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.rolepv--dragging .rolepv-pill { cursor: grabbing; }
.rolepv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Примерка активна — пилюля обязана кричать. Она заменила собой оранжевую
   полосу поверх страницы: индикатор нужен, полоса поверх макета — нет. */
.rolepv--on .rolepv-pill {
    border-color: var(--status-warning-text);
    background: var(--status-warning-soft);
    color: var(--status-warning-text);
    font-weight: 600;
}

.rolepv-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--status-info-soft);
    color: var(--status-info-text);
}
.rolepv-badge[hidden] { display: none; }

.rolepv-panel {
    width: 360px;
    max-width: calc(100vw - 36px);
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: var(--bg-elevated);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    overflow: hidden;
}
.rolepv-panel[hidden] { display: none; }

.rolepv-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-default);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.rolepv-head-title { flex: 1 1 auto; }
.rolepv-refresh {
    flex: 0 0 auto;
    border: 1px solid var(--accent-primary);
    background: var(--accent-primary-soft);
    color: var(--accent-primary);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.rolepv-refresh[hidden] { display: none; }
.rolepv-close {
    flex: 0 0 auto;
    border: 0;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.rolepv-close:hover { color: var(--text-primary); }

.rolepv-body { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; }
.rolepv-select {
    width: 100%;
    font-size: .82rem;
    padding: 5px 6px;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    background: var(--bg-card);
}
.rolepv-hint {
    font-size: .68rem;
    line-height: 1.35;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.rolepv-perms { margin-top: 10px; border-top: 1px solid var(--border-default); padding-top: 8px; }
.rolepv-perms[hidden] { display: none; }
.rolepv-search {
    width: 100%;
    font-size: .78rem;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background: var(--bg-card);
    color: var(--text-primary);
}
.rolepv-perms-body { margin-top: 6px; }

.rolepv-section { border-radius: 6px; margin-bottom: 2px; }
.rolepv-section[hidden] { display: none; }
.rolepv-section-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
}
.rolepv-section-head:hover { background: var(--bg-subtle); }
.rolepv-section-title { flex: 1 1 auto; }
.rolepv-section-count { color: var(--text-tertiary); font-weight: 400; font-size: 11px; }
.rolepv-section-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-tertiary);
    padding: 0 6px 4px 20px;
}
.rolepv-section-items { padding: 2px 0 6px 20px; }
.rolepv-section-items[hidden] { display: none; }

.rolepv-perm {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 3px 6px 3px 0;
    font-size: 12px;
    line-height: 1.3;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
}
.rolepv-perm[hidden] { display: none; }
.rolepv-perm:hover { background: var(--bg-subtle); }
.rolepv-perm input { margin-top: 2px; flex: 0 0 auto; }
.rolepv-perm-label { flex: 1 1 auto; }
/* Право отличается от того, что записано в роли, — это и есть «нащёлкано». */
.rolepv-perm--dirty .rolepv-perm-label { color: var(--accent-primary); font-weight: 600; }
.rolepv-perm-desc { display: block; font-size: 11px; color: var(--text-tertiary); font-weight: 400; }

.rolepv-empty { padding: 10px 6px; font-size: 12px; color: var(--text-tertiary); text-align: center; }

.rolepv-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    border-top: 1px solid var(--border-default);
    background: var(--bg-subtle);
}
.rolepv-foot[hidden] { display: none; }
.rolepv-btn {
    border: 1px solid var(--border-default);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}
.rolepv-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.rolepv-btn[hidden] { display: none; }
.rolepv-btn[disabled] { opacity: .5; cursor: default; }
.rolepv-btn--commit {
    flex: 1 1 auto;
    border-color: var(--status-warning-text);
    color: var(--status-warning-text);
    font-weight: 600;
}
.rolepv-btn--exit { margin-left: auto; }

/* Диалог подтверждения записи прав в роль. Структура — как у диалога смены
   подачи налога (образец в estimate_items.js): что происходит → почему →
   числа «было → стало» → оговорка → кнопки. Нативный confirm() здесь не
   годится: он спрашивает «уверены?», не называя, что права увидят ВСЕ
   носители роли. */
.rolepv-dlg-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, .38);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rolepv-dlg {
    width: 420px;
    max-width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
    padding: 20px 22px;
}
.rolepv-dlg-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.rolepv-dlg-body { font-size: 13px; line-height: 1.45; color: var(--text-secondary); margin: 8px 0 0; }
.rolepv-dlg-nums {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    font-size: 22px;
    font-weight: 700;
}
.rolepv-dlg-was { text-decoration: line-through; color: var(--text-tertiary); }
.rolepv-dlg-now { color: var(--accent-primary); }
.rolepv-dlg-caption { text-align: center; font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.rolepv-dlg-note {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-tertiary);
    background: var(--bg-subtle);
    border-radius: 8px;
    padding: 8px 10px;
    margin: 12px 0 0;
}
.rolepv-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Примерка роли — инструмент админа за десктопным столом, и на телефоне она
   только мешает: островок фиксирован (`position: fixed`) и ложится поверх
   контента десктопной страницы, открытой с телефона (жалоба 29.08.2026 —
   накрывал чекбоксы настроек календаря). Прячем ЦЕЛИКОМ, а не двигаем: под
   ним всё равно нет ни одной страницы, где примеркой пользуются с телефона —
   мобильные шаблоны standalone и base.html не наследуют вовсе. */
@media (max-width: 767.98px) {
    .rolepv { display: none; }
}
