/* ================================================================
   SMIT Theme — Light & Dark modes
   Palette based on smit34.ru / support.smit34.ru
   Toggle: body[data-theme="light"] / body[data-theme="dark"]

   Colors:
   - Green primary:    #43b77a
   - Green dark:       #379963
   - Green light bg:   #e8f5e9
   - Accent teal:      #3cbfae
   - Dark bg:          #1a1d23
   - Dark surface:     #22262e
   - Dark card:        #2a2e37
   - Text light:       #e4e6ea
   - Border dark:      #353940
   ================================================================ */

/* ================================================================
   DESIGN TOKENS вынесены в отдельный файл (build 490, 2026-05-07):
   billing/static/css/tokens.css — единый источник правды для админки + ЛК.
   Подключается в base_adminlte.html ПЕРЕД этим файлом.
   ================================================================ */

@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]):not(.light-theme) {
        --surface-page:    #1a1d23;
        --surface-card:    #22262e;
        --surface-muted:   #2a2e37;
        --surface-toolbar: #2a2e37;
        --border-subtle:   #353940;
        --border-default:  #3a3f47;
    }
}

/* ============================================
   Navbar compact
   ============================================ */
.layout-navbar-fixed .wrapper .content-wrapper {
    margin-top: calc(2.5rem + 0.1px) !important;
}

/* ============================================
   Logo — matches smit34.ru
   ============================================ */
.smit-logo {
    display: flex !important;
    align-items: center;
    gap: 6px;
    padding: 0 0.5rem !important;
    text-decoration: none !important;
    line-height: 1;
}
.smit-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #43b77a, #3cbfae);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    border-radius: 6px;
    flex-shrink: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1;
}
.smit-logo-icon-sm {
    width: 22px;
    height: 22px;
    font-size: 13px;
    border-radius: 5px;
}
.smit-logo-text {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1;
}
.smit-logo-caps {
    font-weight: 800;
}

/* Sidebar brand logo */
.brand-link {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 0 0.8rem !important;
    height: 40px;
    min-height: 40px;
}
.brand-link .brand-text {
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Theme toggle button */
#theme-toggle {
    font-size: 0.85rem;
    padding: 0 0.4rem !important;
    opacity: 0.6;
    transition: opacity .2s;
    line-height: 1;
}
#theme-toggle:hover {
    opacity: 1;
}


/* ================================================================
   LIGHT THEME (default)
   ================================================================ */

/* --- Navbar --- */
.main-header.navbar {
    background-color: #fff !important;
    border-bottom: 2px solid #e8e8e8 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    min-height: 40px;
    height: 40px;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
.main-header .navbar-nav {
    height: 40px;
    align-items: center;
}
/* Navbar: profile dropdown must not be clipped by navbar overflow */
.main-header.navbar { overflow: visible !important; }

/* PLAN 2026 pill (только для is_superuser, в навбаре рядом с theme toggle) */
.main-header .smit-plan-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 5px 12px !important;
    background: linear-gradient(135deg, #10b981, #14b8a6) !important;
    color: #fff !important;
    font-size: .78rem !important;
    font-weight: 700 !important;
    letter-spacing: .5px;
    border-radius: 100px !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    transition: transform .15s, box-shadow .15s, filter .15s;
    text-decoration: none !important;
    border: none;
    line-height: 1.2;
}
.main-header .smit-plan-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
    filter: brightness(1.08);
    color: #fff !important;
}
.main-header .smit-plan-pill:focus { outline: 2px solid #34d399; outline-offset: 2px; }
#nav-main > .nav-item:last-child { flex-shrink: 0; }
#nav-main > .nav-item:last-child .nav-link > span {
    display: inline !important;
}
.main-header .nav-link {
    color: #555 !important;
    font-size: 0.82rem;
    padding: 0.3rem 0.55rem !important;
    transition: color .15s, background .15s;
    line-height: 1.2;
    height: auto;
}
.main-header .nav-link:hover {
    color: #43b77a !important;
    background: rgba(67,183,122,.06);
    border-radius: 4px;
}
.main-header .nav-item.active > .nav-link {
    color: #fff !important;
    background-color: #43b77a !important;
    border-radius: 4px;
}
.main-header .smit-logo .smit-logo-text {
    color: #2d3a2e;
}
.main-header [data-widget="pushmenu"] {
    color: #666 !important;
    padding: 0 0.5rem !important;
}
.main-header [data-widget="pushmenu"]:hover {
    color: #43b77a !important;
}
#theme-toggle { color: #666 !important; }
#theme-toggle:hover { color: #43b77a !important; }

/* Dropdown */
.main-header .dropdown-menu {
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.main-header .dropdown-item { color: #333 !important; }
.main-header .dropdown-item:hover {
    background-color: #e8f5e9 !important;
    color: #2d3a2e !important;
}

/* --- Sidebar --- */
.main-sidebar {
    background-color: #1e2b1f !important;
}
.main-sidebar .brand-link {
    background-color: #1a241b !important;
    border-bottom: 1px solid #3a5a3b !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
}
/* build 700/710: brand-link в свёрнутом виде. build 710: упрощено — один селектор. */
body.sidebar-collapse .main-sidebar .brand-link {
    padding: 0 !important;
    justify-content: center !important;
    width: 4.6rem !important;
    overflow: hidden !important;
}
body.sidebar-collapse .main-sidebar .brand-link .smit-logo-icon {
    margin: 0 !important;
}
body.sidebar-collapse .main-sidebar .brand-link .brand-text {
    display: none !important;
}
.main-sidebar .brand-text,
.main-sidebar .smit-logo-text {
    color: #fff !important;
}
.main-sidebar .smit-logo-caps { color: #fff; }
.main-sidebar .nav-link { color: #b0c4b0 !important; }
.main-sidebar .nav-link:hover {
    color: #fff !important;
    background-color: rgba(67,183,122,.2) !important;
}
.main-sidebar .nav-link.active {
    background-color: #43b77a !important;
    color: #fff !important;
}
.main-sidebar .nav-treeview > .nav-item > .nav-link { color: #8fa88f !important; }
.main-sidebar .nav-treeview > .nav-item > .nav-link:hover { color: #fff !important; }
.main-sidebar .nav-treeview > .nav-item > .nav-link.active {
    background-color: rgba(67,183,122,.3) !important;
    color: #fff !important;
}
[class*="sidebar-dark"] { background-color: #1e2b1f !important; }
[class*="sidebar-dark"] .brand-link { border-bottom-color: #3a5a3b !important; }
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
    background-color: #43b77a !important;
    color: #fff !important;
}

/* --- Content --- */
body { background-color: #343a40 !important; }  /* Match navbar bg — eliminates white strip between navbar and content */
.content-wrapper { background-color: #f5f6f8 !important; }
#top-alerts:empty, #top-alerts:not(:has(*)) { display: none; padding: 0; margin: 0; }
#top-alerts { margin: 0; padding: 0; }
.content-wrapper > .content { padding-top: 0 !important; }
.content-wrapper > .content.pt-2 { padding-top: 15px !important; }
.container-fluid {
    padding-right: 0 !important;
    padding-left: 1.5rem !important;
}
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.5rem !important;
    }
}
.content-wrapper textarea {
    height: auto;
    min-height: 0;
}
.form-row.row > .span4 {
    padding-left: 0px;
}
.comment-row {
    align-items: baseline;
}

/* --- Sub-tabs (merged tab groups) --- */
.sub-tabs {
    background: #f8f9f8;
    border: 1px solid #d5ddd5;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: .88em;
    display: inline-flex;
    margin: 0 auto 12px;
}
.sub-tabs .nav-link {
    padding: 5px 16px;
    color: #6c757d;
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    border-radius: 4px 4px 0 0;
}
.sub-tabs .nav-link:hover {
    color: #43b77a;
    background: rgba(67,183,122,.06);
}
.sub-tabs .nav-link.active {
    color: #43b77a !important;
    border-bottom: 2px solid #43b77a !important;
    background: #fff;
}
.sub-tabs-wrap {
    text-align: center;
}
body.dark-theme .sub-tabs {
    background: #1e222a;
    border-color: #3a3f47;
}
body.dark-theme .sub-tabs .nav-link {
    color: #9ea3ad;
}
body.dark-theme .sub-tabs .nav-link:hover {
    background: color-mix(in srgb, var(--brand-primary) 8%, transparent);
}
body.dark-theme .sub-tabs .nav-link.active {
    color: var(--brand-primary) !important;
    border-bottom-color: var(--brand-primary) !important;
    background: #22262e;
}

/* --- Row-fluid desktop fix --- */
.row-fluid {
    margin-right: 0;
    margin-left: 0;
}

/* --- Sidebar no horizontal scroll --- */
.main-sidebar .sidebar {
    overflow-x: hidden !important;
}

/* --- Button icon colors --- */
/* build 542 (/critique part 2): clean btn-outline-secondary — белый фон + чистый
   border + brand-hover, как у toolbar-чипов «Месяц/Квартал/30д».
   Раньше был background:#dcdcdc — давало «серую губую выпуклость» AdminLTE, которую
   пользователь явно отметил как «выглядит как гавно». */
.btn-outline-secondary {
    background: #fff !important;
    color: #495057 !important;
    border: 1px solid #ced4da !important;
    box-shadow: none !important;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: #f1f8f4 !important;
    color: #2f8556 !important;
    border-color: #43b77a !important;
}
/* Высокая специфичность — иначе AdminLTE с :not(:disabled):not(.disabled).active побеждает */
.btn-outline-secondary:not(:disabled):not(.disabled):active,
.btn-outline-secondary:not(:disabled):not(.disabled).active,
.btn-check:checked + .btn-outline-secondary:not(:disabled):not(.disabled),
.show > .btn-outline-secondary.dropdown-toggle:not(:disabled):not(.disabled) {
    background: #43b77a !important;
    background-color: #43b77a !important;
    color: #fff !important;
    border-color: #3aa86e !important;
    box-shadow: none !important;
}
.btn-outline-secondary:disabled,
.btn-outline-secondary.disabled {
    background: #fff !important;
    color: #adb5bd !important;
    border-color: #e9ecef !important;
}
/* btn-outline-primary — тот же чистый язык, brand-зелёный по умолчанию */
.btn-outline-primary {
    background: #fff !important;
    color: #2f8556 !important;
    border: 1px solid #43b77a !important;
    box-shadow: none !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: #43b77a !important;
    color: #fff !important;
    border-color: #3aa86e !important;
}
.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-check:checked + .btn-outline-primary {
    background: #379963 !important;
    color: #fff !important;
    border-color: #2f8556 !important;
}
#exportitem .fa-download,
a[id="exportitem"] .fa-download {
    color: #28a745;
}
#exportitem:hover .fa-download,
a[id="exportitem"]:hover .fa-download {
    color: #fff;
}
.btn .fa-print {
    color: #8B5E3C;
}
.btn:hover .fa-print {
    color: #fff;
}
.head-navbar a[id="additem_folder"] .fa-plus-circle {
    color: #e67e22;
}
.head-navbar a[id="additem_folder"]:hover .fa-plus-circle {
    color: #fff;
}

/* --- Buttons --- */
.btn-primary {
    background-color: #43b77a !important;
    border-color: #3aa86e !important;
    color: #fff !important;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: #379963 !important;
    border-color: #2f8556 !important;
}
.btn-success {
    background-color: #43b77a !important;
    border-color: #3aa86e !important;
}
.btn-success:hover, .btn-success:focus {
    background-color: #379963 !important;
    border-color: #2f8556 !important;
}
.btn-danger {
    background-color: #e05555 !important;
    border-color: #d44848 !important;
}
.btn-danger:hover { background-color: #c93c3c !important; }
.btn-warning {
    background-color: #f0ad4e !important;
    border-color: #eea236 !important;
    color: #fff !important;
}
.btn-warning:hover { background-color: #ec971f !important; }
.btn-info {
    background-color: #5bc0de !important;
    border-color: #46b8da !important;
}
.btn-outline-primary {
    color: #43b77a !important;
    border-color: #43b77a !important;
}
.btn-outline-primary:hover {
    background-color: #43b77a !important;
    color: #fff !important;
}

/* --- Toolbar --- */
.head-navbar {
    background: #f8f9f8 !important;
    border: 1px solid #d5ddd5 !important;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    width: 100%;
    padding: 8px 12px !important;
    flex-wrap: wrap;
}
.head-navbar .search-button,
.head-navbar #qf_search_button {
    background-color: #43b77a !important;
    border-color: #3aa86e !important;
    color: #fff !important;
}
.head-navbar .search-button:hover,
.head-navbar #qf_search_button:hover {
    background-color: #379963 !important;
}

/* --- Desktop navbar dropdown menus --- */
#nav-main .nav-dropdown-toggle {
    cursor: pointer;
}
#nav-main .nav-dropdown-toggle::after {
    display: none; /* hide default caret */
}
#nav-main .nav-dropdown-menu {
    border: none;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
    padding: 6px;
    min-width: 220px;
    max-height: 70vh;
    overflow-y: auto;
}
#nav-main .nav-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 13px;
    color: #4a5568;
    border-radius: 6px;
    transition: background .2s, color .2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#nav-main .nav-dropdown-menu .dropdown-item .sidebar-sub-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    transition: color .2s;
}
#nav-main .nav-dropdown-menu .dropdown-item:hover {
    background: rgba(67,183,122,.08);
    color: #1a6b46;
}
#nav-main .nav-dropdown-menu .dropdown-item:hover .sidebar-sub-icon {
    color: #43b77a;
}
#nav-main .nav-dropdown-menu .dropdown-item.active {
    background: rgba(67,183,122,.12);
    color: #1a6b46;
    font-weight: 600;
}
#nav-main .nav-dropdown-menu .dropdown-item.active .sidebar-sub-icon {
    color: #43b77a;
}

/* --- Rich nav-dropdown items: title + sub-text (build 632) --- */
#nav-main .nav-dropdown-rich { min-width: 280px; padding: 8px; }
#nav-main .nav-dropdown-rich .dropdown-item {
    align-items: flex-start;
    padding: 9px 12px;
    gap: 12px;
    white-space: normal;
}
#nav-main .nav-dropdown-rich .dropdown-item .sidebar-sub-icon {
    width: 20px;
    font-size: 14px;
    margin-top: 2px;
}
#nav-main .nav-dropdown-rich .dd-item-body {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    flex: 1;
    min-width: 0;
}
#nav-main .nav-dropdown-rich .dd-item-title {
    font-size: .88rem;
    font-weight: 500;
    color: #2d3748;
}
#nav-main .nav-dropdown-rich .dd-item-sub {
    font-size: .72rem;
    color: #94a3b8;
    margin-top: 1px;
    font-weight: 400;
    letter-spacing: .005em;
}
#nav-main .nav-dropdown-rich .dropdown-item:hover .dd-item-title,
#nav-main .nav-dropdown-rich .dropdown-item.active .dd-item-title {
    color: #1a6b46;
}
#nav-main .nav-dropdown-rich .dropdown-item:hover .dd-item-sub {
    color: #5a7d6c;
}
#nav-main .nav-dropdown-rich .dropdown-divider {
    margin: 4px 0;
    border-color: #e9ecef;
    opacity: .8;
}
body.dark-theme #nav-main .nav-dropdown-rich .dd-item-title { color: #e2e8f0; }
body.dark-theme #nav-main .nav-dropdown-rich .dd-item-sub { color: #6b7686; }
body.dark-theme #nav-main .nav-dropdown-rich .dropdown-item:hover .dd-item-title,
body.dark-theme #nav-main .nav-dropdown-rich .dropdown-item.active .dd-item-title { color: #65d0a0; }
body.dark-theme #nav-main .nav-dropdown-rich .dropdown-item:hover .dd-item-sub { color: #8fa898; }

/* --- Tabs (match original Carbon style) --- */
.nav-tabs {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 12px;
    padding-left: 0;
    gap: 2px;
}
.nav-tabs .nav-item {
    margin-bottom: -2px;
}
.nav-tabs .nav-link {
    color: #6c757d !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    padding: 8px 14px !important;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .01em;
    transition: color .25s ease, border-color .25s ease, background .25s ease;
    border-radius: 6px 6px 0 0 !important;
    position: relative;
    white-space: nowrap;
}
.nav-tabs .nav-link:hover {
    color: #2d8a5e !important;
    border-bottom-color: #43b77a !important;
    background: rgba(67,183,122,.06) !important;
}
.nav-tabs .nav-link.active {
    color: #1a6b46 !important;
    border-bottom: 2px solid #43b77a !important;
    font-weight: 600;
    background: rgba(67,183,122,.08) !important;
}

/* --- Form subgroups — see bs-compat.css for layout --- */

/* --- Tables --- */
#choice_list td,
#result_list td,
.table td {
    vertical-align: top;
}
#choice_list tbody tr:hover,
#result_list tbody tr:hover {
    background-color: #e8f5e9 !important;
}
#choice_list thead th,
#result_list thead th {
    background: #f0f5f0 !important;
    color: #2d3a2e;
    border-bottom: 2px solid #43b77a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    font-weight: 600;
    white-space: nowrap;
}
#choice_list td {
    vertical-align: middle;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Unified action buttons (all pages) --- */
.actions-cell {
    white-space: nowrap;
    width: 1%;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 14px;
    padding: 3px;
    transition: color .2s;
    text-decoration: none;
    background: none;
    border: none;
}
.action-btn:hover {
    color: #43b77a;
    text-decoration: none;
}
.action-btn.action-delete:hover {
    color: #dc3545;
}
.action-btn.action-play:hover {
    color: #22863a;
}

/* Override Bootstrap blue accent everywhere */
a { color: #2d8a5e; }
a:hover { color: #1a6b46; }
.card-primary > .card-header,
.card-outline.card-primary { border-top-color: #43b77a !important; }
.btn-primary { background-color: #43b77a !important; border-color: #3aa86e !important; }
.btn-primary:hover { background-color: #379963 !important; border-color: #2f8956 !important; }
.btn-outline-primary { color: #43b77a !important; border-color: #43b77a !important; }
.btn-outline-primary:hover { background-color: #43b77a !important; color: #fff !important; }

/* --- Select/input spacing fix --- */
.form-select, select.form-control {
    padding-top: .375rem;
    padding-bottom: .375rem;
}
fieldset { margin: 0; padding: 0; border: none; }
fieldset + fieldset { margin-top: 0; }

/* --- Focus --- */
.content-wrapper input:focus,
.content-wrapper select:focus,
.content-wrapper textarea:focus {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 0.2rem rgba(67,183,122,.25) !important;
}

/* --- Pagination --- */
.page-item.active .page-link {
    background-color: #43b77a !important;
    border-color: #3aa86e !important;
}
.page-link { color: #43b77a; }
.page-link:hover { color: #379963; }

/* --- Select2 --- */
.select2-container--bootstrap-5 .select2-dropdown {
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    border-color: #dee2e6;
    overflow: hidden;
}
.select2-container--bootstrap-5 .select2-results__option {
    padding: 6px 12px;
    font-size: .9rem;
    transition: background .1s;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #e8f5e9 !important;
    color: #2e7d32 !important;
}
.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: #43b77a !important;
    color: #fff !important;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #86cfaa;
    box-shadow: 0 0 0 .2rem rgba(67,183,122,.2);
}
.select2-container * {
    padding-left: inherit !important;
}

/* --- Checkboxes --- */
.form-check {
    padding-left: 0;
}
.form-check-label {
    padding-left: 1.2em;
    vertical-align: middle;
}

/* --- Footer --- */
.main-footer {
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    color: #777;
    font-size: 0.8rem;
    padding: 8px 15px;
}

/* --- Selector icons --- */
.selector-icons a:hover { color: #43b77a !important; }

/* --- Badges --- */
.badge-primary, .bg-primary { background-color: #43b77a !important; }
.badge-warning, .bg-warning { background-color: #f0ad4e !important; }
.badge-danger, .bg-danger { background-color: #e05555 !important; }


/* ================================================================
   DARK THEME
   ================================================================ */
body.dark-theme,
body[data-theme="dark"] {
    color: #e4e6ea;
}

/* --- Navbar dark --- */
body.dark-theme .main-header.navbar {
    background-color: #1a1d23 !important;
    border-bottom-color: #353940 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
body.dark-theme .main-header .smit-logo .smit-logo-text {
    color: #e4e6ea;
}
body.dark-theme .main-header .nav-link {
    color: #9ca3af !important;
}
body.dark-theme .main-header .nav-link:hover {
    color: #fff !important;
    background: rgba(67,183,122,.15) !important;
}
body.dark-theme .main-header .nav-item.active > .nav-link {
    color: #fff !important;
    background-color: #43b77a !important;
}
body.dark-theme .main-header .smit-logo .smit-logo-text {
    color: #e4e6ea;
}
body.dark-theme .main-header [data-widget="pushmenu"] { color: #9ca3af !important; }
body.dark-theme #theme-toggle { color: #f0c040 !important; }

/* Profile dropdown: user info card */
.main-header .dropdown-menu .dropdown-user-card strong { color: #212529; }
.main-header .dropdown-menu .dropdown-user-card small { color: #6c757d; }

/* Navbar dropdown divider header label */
.main-header .dropdown-menu .dropdown-header {
    color: #9aa0a8;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* Navbar dropdown dark */
body.dark-theme .main-header .dropdown-menu {
    background: #22262e;
    border-color: #353940;
}
body.dark-theme .main-header .dropdown-item { color: #c0c4cc !important; }
body.dark-theme .main-header .dropdown-item:hover {
    background-color: #2a2e37 !important;
    color: #fff !important;
}
body.dark-theme .main-header .dropdown-menu .dropdown-user-card strong { color: #dee2e6; }
body.dark-theme .main-header .dropdown-menu .dropdown-user-card small { color: #6c757d; }
body.dark-theme .main-header .dropdown-menu .border-bottom { border-color: #3a3f47 !important; }

/* --- Sidebar dark --- */
body.dark-theme .main-sidebar {
    background-color: #0d0f14 !important;
}
body.dark-theme .main-sidebar .brand-link {
    background-color: #080a0e !important;
    border-bottom-color: #1a1d24 !important;
}
body.dark-theme [class*="sidebar-dark"] {
    background-color: #0d0f14 !important;
}

/* --- Content dark --- */
body.dark-theme .content-wrapper {
    background-color: #1a1d23 !important;
    color: #e4e6ea;
}

/* --- Cards / subgroups dark --- */
body.dark-theme .form-subgroup {
    background: #22262e !important;
    border-color: #353940 !important;
    box-shadow: 0 0 1px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.4) !important;
}
body.dark-theme .form-subgroup legend {
    background: #2d8f5e !important;
    color: #fff !important;
    border-bottom: none !important;
}
body.dark-theme .card {
    background: #22262e !important;
    border-color: #353940 !important;
    box-shadow: 0 0 1px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.4) !important;
}
body.dark-theme .card.card-primary > .card-header {
    background: #2d8f5e !important;
    color: #fff !important;
}
body.dark-theme .card-header {
    background: #2a2e37 !important;
    border-bottom-color: #353940 !important;
    color: #c0c4cc !important;
}
body.dark-theme .card-body {
    color: #e4e6ea;
}

/* --- Form inputs dark --- */
body.dark-theme .content-wrapper input[type="text"],
body.dark-theme .content-wrapper input[type="number"],
body.dark-theme .content-wrapper input[type="email"],
body.dark-theme .content-wrapper input[type="password"],
body.dark-theme .content-wrapper input[type="url"],
body.dark-theme .content-wrapper input[type="tel"],
body.dark-theme .content-wrapper input[type="date"],
body.dark-theme .content-wrapper input[type="datetime-local"],
body.dark-theme .content-wrapper input[type="time"],
body.dark-theme .content-wrapper select,
body.dark-theme .content-wrapper textarea {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #e4e6ea !important;
}
body.dark-theme .content-wrapper input:focus,
body.dark-theme .content-wrapper select:focus,
body.dark-theme .content-wrapper textarea:focus {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 0.2rem rgba(67,183,122,.2) !important;
}

/* --- Toolbar dark --- */
body.dark-theme .head-navbar {
    background: #22262e !important;
    border-color: #353940 !important;
}

/* --- Tabs dark --- */
body.dark-theme .nav-tabs {
    border-bottom-color: #353940 !important;
}
body.dark-theme .nav-tabs .nav-link {
    color: #9ca3af !important;
    background: transparent !important;
}
body.dark-theme .nav-tabs .nav-link:hover {
    color: #43b77a !important;
    background: transparent !important;
}
body.dark-theme .nav-tabs .nav-link.active {
    color: #43b77a !important;
    border-bottom-color: #43b77a !important;
}

/* --- Tables dark --- */
body.dark-theme #choice_list,
body.dark-theme #result_list {
    border-color: #353940 !important;
}
body.dark-theme #choice_list thead th,
body.dark-theme #result_list thead th {
    background: #2a2e37 !important;
    color: #c0c4cc;
    border-bottom-color: #43b77a;
}
body.dark-theme #choice_list tbody td,
body.dark-theme #result_list tbody td {
    border-color: #2a2e37 !important;
    color: #d0d3d8;
}
body.dark-theme #choice_list tbody tr:hover,
body.dark-theme #result_list tbody tr:hover {
    background-color: rgba(67,183,122,.08) !important;
}
/* build 731: единая переменная --table-border-dark = #404653.
   Старый #353940 давал контраст ~2:1 c фоном таблицы #22262e — линии невидимы.
   #404653 даёт контраст ~3:1 — границы читаемы, но не «кричат». */
body.dark-theme,
[data-bs-theme="dark"] {
    --table-border-dark: #404653;
    --table-border-strong-dark: #4a5161;
}
body.dark-theme .table { color: #d0d3d8; }
body.dark-theme .table td, body.dark-theme .table th {
    border-color: var(--table-border-dark);
}

/* --- Well / alerts dark --- */
body.dark-theme .well {
    background-color: #22262e !important;
    border-color: #353940 !important;
    color: #d0d3d8;
}
body.dark-theme .alert-info {
    background-color: #1c3545;
    border-color: #2a4a5c;
    color: #8ecae6;
}
body.dark-theme .alert-danger {
    background-color: #3a1f1f;
    border-color: #6d3535;
    color: #ff8080;
}
body.dark-theme .alert-warning {
    background-color: #3a3520;
    border-color: #6d5f35;
    color: #ffd080;
}
body.dark-theme .alert-success {
    background-color: #1f3a25;
    border-color: #356d40;
    color: #80ff90;
}
/* Block status — reduce oversized text */
body.dark-theme .alert { font-size: 0.95rem; }

/* ============================================
   Panel Left — slide menu navigation
   ============================================ */
.panel-left-menu {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

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

.panel-left-item {
    margin: 2px 0;
}

.panel-left-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
}

.panel-left-link:hover {
    background: rgba(67,183,122,.06);
    color: #334155;
}

.panel-left-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: all .25s ease;
}

.panel-left-link:hover .panel-left-dot {
    background: #43b77a;
    box-shadow: 0 0 0 3px rgba(67,183,122,.15);
}

.panel-left-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active item */
.panel-left-item.active .panel-left-link {
    background: linear-gradient(135deg, rgba(67,183,122,.10), rgba(60,191,174,.08));
    color: #1e7a4a;
    font-weight: 600;
}

.panel-left-item.active .panel-left-dot {
    background: #43b77a;
    box-shadow: 0 0 0 3px rgba(67,183,122,.20);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(67,183,122,.20); }
    50% { box-shadow: 0 0 0 5px rgba(67,183,122,.10); }
}

.panel-left-item.active .panel-left-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #43b77a, #3cbfae);
    border-radius: 0 3px 3px 0;
}

/* Dark theme */
body.dark-theme .panel-left-menu {
    background: #22262e;
    border-color: #353940;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

body.dark-theme .panel-left-link {
    color: #a0a6b0;
}

body.dark-theme .panel-left-link:hover {
    background: rgba(67,183,122,.08);
    color: #d0d3d8;
}

body.dark-theme .panel-left-dot {
    background: #454950;
}

body.dark-theme .panel-left-link:hover .panel-left-dot {
    background: #5cc98d;
    box-shadow: 0 0 0 3px rgba(92,201,141,.15);
}

body.dark-theme .panel-left-item.active .panel-left-link {
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 15%, transparent), color-mix(in srgb, var(--brand-primary) 8%, transparent));
    color: var(--brand-primary);
}

body.dark-theme .panel-left-item.active .panel-left-dot {
    background: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 25%, transparent);
}

body.dark-theme .panel-left-item.active .panel-left-link::before {
    background: var(--brand-primary);
}

/* --- Divider in panel-left --- */
.panel-left-divider {
    margin: 8px 0 4px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.panel-left-divider::before {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,.10);
}
.panel-left-divider-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9aa0a8;
    white-space: nowrap;
}
body.dark-theme .panel-left-divider::before {
    background: rgba(255,255,255,.10);
}
body.dark-theme .panel-left-divider-label {
    color: #6c757d;
}

/* --- Icon in panel-left --- */
.panel-left-icon {
    width: 18px;
    text-align: center;
    font-size: .82em;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color .2s;
}
.panel-left-link:hover .panel-left-icon { color: #43b77a; }
.panel-left-item.active .panel-left-icon { color: #1e7a4a; }
body.dark-theme .panel-left-icon { color: #5a6270; }
body.dark-theme .panel-left-link:hover .panel-left-icon { color: #5cc98d; }
body.dark-theme .panel-left-item.active .panel-left-icon { color: var(--brand-primary); }

/* --- Submenu in panel-left --- */
.panel-left-sub {
    list-style: none;
    margin: 0;
    padding: 0 0 4px 28px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.panel-left-item.has-sub.active .panel-left-sub,
.panel-left-item.has-sub.open .panel-left-sub {
    max-height: 500px;
}
.panel-left-sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    font-size: .78rem;
    color: #64748b;
    text-decoration: none !important;
    border-radius: 5px;
    transition: all .15s;
}
.panel-left-sublink:hover {
    background: rgba(67,183,122,.06);
    color: #334155;
}
.panel-left-sublink.active {
    color: #1e7a4a;
    font-weight: 600;
    background: rgba(67,183,122,.08);
}
/* build 702/703: иконки sub-элементов — мельче, зелёные (admin запрос) */
.panel-left-sub-icon {
    font-size: .7rem;
    width: 14px;
    text-align: center;
    color: var(--brand-primary, #43b77a);
    opacity: .75;
    flex-shrink: 0;
}
.panel-left-sublink:hover .panel-left-sub-icon,
.panel-left-sublink.active .panel-left-sub-icon {
    opacity: 1;
}
.panel-left-sub-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
    margin: 0 5px;
}
.panel-left-sublink:hover .panel-left-sub-icon,
.panel-left-sublink.active .panel-left-sub-icon {
    color: var(--brand-primary, #43b77a);
}
.panel-left-sub-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

body.dark-theme .panel-left-sublink { color: #7a8290; }
body.dark-theme .panel-left-sublink:hover { background: rgba(67,183,122,.08); color: #c0c4ca; }
body.dark-theme .panel-left-sublink.active { color: var(--brand-primary); background: color-mix(in srgb, var(--brand-primary) 10%, transparent); }
body.dark-theme .panel-left-sub-icon { color: #7a8290; }
body.dark-theme .panel-left-sub-dot { background: #4a5057; }

/* build 705/710: panel-left в свёрнутом виде. build 710: убраны агрессивные
   width: 100% !important + max-width: 4.6rem !important с .panel-left-link/-item/-nav —
   они применялись на ВСЕ страницы (когда body.sidebar-collapse) и ломали верстку
   panel-left на /admin/Abonents/AdminAccounts/ и др. (admin: «поломалась верстка»). */
body.sidebar-collapse .panel-left-menu {
    padding: 4px 0;
}
body.sidebar-collapse .panel-left-link {
    padding: 8px 0 !important;
    justify-content: center !important;
    gap: 0 !important;
}
body.sidebar-collapse .panel-left-text,
body.sidebar-collapse .panel-left-sub-text {
    display: none !important;
}
body.sidebar-collapse .panel-left-icon {
    margin: 0 !important;
    font-size: 1.05rem !important;
    width: 22px !important;
    text-align: center;
}

/* ═══ build 705: подменю активного has-sub в collapsed-режиме —
   светло-зелёный фон + все sub-icons видимы вертикально ═══
   admin: «При активном пункте вложенного меню в свернутом виде показывать
   развернутое вложенное меню этой категории с светло-зеленым фоном». */
/* build 708: показываем подменю ТОЛЬКО при .open (не .active).
   admin: «перед тем как показывать иконки выбранного раздела сначала сворачиваются
   все остальные». .active помечает URL-привязку, .open — что подменю развёрнуто.
   JS на load: ставит .open только активному разделу. Клик: переключает .open,
   снимая со всех остальных. */
body.sidebar-collapse .panel-left-item.has-sub .panel-left-sub {
    display: none !important;
}
body.sidebar-collapse .panel-left-item.has-sub.open .panel-left-sub {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 4px 0 !important;
    margin: 4px 4px 6px 4px !important;
    background: rgba(67, 183, 122, .08) !important;
    border-radius: 6px;
    border: 1px solid rgba(67, 183, 122, .18);
}
body.dark-theme.sidebar-collapse .panel-left-item.has-sub.open .panel-left-sub,
[data-bs-theme="dark"] body.sidebar-collapse .panel-left-item.has-sub.open .panel-left-sub {
    background: rgba(67, 183, 122, .15) !important;
    border-color: rgba(67, 183, 122, .25);
}

body.sidebar-collapse .panel-left-sublink {
    padding: 5px 0 !important;
    justify-content: center !important;
    gap: 0 !important;
    width: 100% !important;
}
/* Иконки sub-элементов в collapsed — меньше и зелёные (admin: «меньше и зелёного цвета») */
body.sidebar-collapse .panel-left-sub-icon {
    font-size: .75rem !important;
    width: 18px !important;
    margin: 0 !important;
    color: var(--brand-primary, #43b77a) !important;
    opacity: .8;
}
body.sidebar-collapse .panel-left-sublink:hover .panel-left-sub-icon,
body.sidebar-collapse .panel-left-sublink.active .panel-left-sub-icon {
    opacity: 1 !important;
}
body.sidebar-collapse .panel-left-sub-dot {
    margin: 0 auto !important;
}
/* Разделитель «ОБСЛУЖИВАНИЕ» — только полоска */
body.sidebar-collapse .panel-left-divider-label {
    display: none !important;
}
body.sidebar-collapse .panel-left-divider {
    margin: 6px 8px !important;
    height: 1px;
    border-top: 1px solid rgba(0,0,0,.08);
    padding: 0 !important;
}
body.sidebar-collapse .panel-left-divider::before,
body.sidebar-collapse .panel-left-divider::after {
    display: none !important;
}
body.dark-theme.sidebar-collapse .panel-left-divider,
[data-bs-theme="dark"] body.sidebar-collapse .panel-left-divider {
    border-top-color: rgba(255,255,255,.08);
}
/* Активная иконка sublink */
body.sidebar-collapse .panel-left-sublink.active {
    background: rgba(67,183,122,.22) !important;
    box-shadow: inset 3px 0 0 var(--brand-primary, #43b77a);
}
body.sidebar-collapse .panel-left-sublink.active .panel-left-sub-icon {
    color: var(--brand-primary, #43b77a) !important;
}

/* build 705/710/711: блокировка раскрытия sidebar при hover/click.
   build 711: восстановлено base правило `body.sidebar-collapse .main-sidebar`
   (build 710 ошибочно убрал — sidebar при загрузке оставался 250px). */
body.sidebar-collapse .main-sidebar,
body.sidebar-collapse .main-sidebar:hover,
body.sidebar-collapse .main-sidebar.sidebar-focused,
body.sidebar-collapse .main-sidebar.sidebar-focused:hover,
body.sidebar-collapse.sidebar-mini-expand-on-hover .main-sidebar:hover {
    width: 4.6rem !important;
}

/* build 708: убрать скроллбар в свёрнутом сайдбаре (admin: «не должно быть скроллбара»).
   Скрываем все варианты — OverlayScrollbars, webkit, firefox. Скролл функционально
   работает (overflow-y:auto), но визуально полоса не отображается. */
body.sidebar-collapse .main-sidebar .os-scrollbar,
body.sidebar-collapse .main-sidebar .os-scrollbar-handle,
body.sidebar-collapse .main-sidebar:hover .os-scrollbar {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}
body.sidebar-collapse .main-sidebar .sidebar::-webkit-scrollbar,
body.sidebar-collapse .main-sidebar::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}
body.sidebar-collapse .main-sidebar .sidebar::-webkit-scrollbar-thumb,
body.sidebar-collapse .main-sidebar::-webkit-scrollbar-thumb {
    background: transparent !important;
}
body.sidebar-collapse .main-sidebar .sidebar,
body.sidebar-collapse .main-sidebar {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* --- Divider improved --- */
.panel-left-divider {
    margin: 12px 0 6px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-left-divider::before {
    content: '';
    flex: 0 0 18px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,.12));
}
.panel-left-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(0,0,0,.12), transparent);
}
body.dark-theme .panel-left-divider::before { background: linear-gradient(90deg, transparent, rgba(255,255,255,.1)); }
body.dark-theme .panel-left-divider::after { background: linear-gradient(90deg, rgba(255,255,255,.1), transparent); }

/* Arrow for has-sub items */
.panel-left-item.has-sub > .panel-left-link::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: .65em;
    color: #94a3b8;
    transition: transform .2s;
}
.panel-left-item.has-sub.active > .panel-left-link::after,
.panel-left-item.has-sub.open > .panel-left-link::after {
    transform: rotate(180deg);
    color: #43b77a;
}

/* --- Footer dark --- */
body.dark-theme .main-footer {
    background-color: #1a1d23 !important;
    border-top-color: #353940 !important;
    color: #777;
}

/* --- Links dark --- */
body.dark-theme a { color: #5cc98d; }
body.dark-theme a:hover { color: #7ddba7; }
body.dark-theme .btn a { color: inherit; }

/* --- Select2 dark --- */
body.dark-theme .select2-container--bootstrap-5 .select2-selection,
body.dark-theme .select2-container .select2-selection,
body.dark-theme .select2-selection {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #e4e6ea !important;
}
body.dark-theme .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered,
body.dark-theme .select2-selection--single .select2-selection__rendered,
body.dark-theme .select2-selection__rendered {
    color: #dee2e6 !important;
    background-color: transparent !important;
}
body.dark-theme .select2-selection--single .select2-selection__placeholder {
    color: #6c757d !important;
}
body.dark-theme .select2-selection--single .select2-selection__clear {
    color: #9ca3af !important;
}
body.dark-theme .select2-selection--multiple .select2-selection__choice {
    background-color: #353940 !important;
    border-color: #454950 !important;
    color: #dee2e6 !important;
}
body.dark-theme .select2-selection--multiple .select2-selection__choice__remove {
    color: #9ca3af !important;
}
body.dark-theme .select2-container--bootstrap-5 .select2-selection__arrow b,
body.dark-theme .select2-selection__arrow b {
    border-color: #9ca3af transparent transparent transparent !important;
}
body.dark-theme .select2-dropdown,
body.dark-theme .select2-container--bootstrap-5 .select2-dropdown {
    background-color: #22262e !important;
    border-color: #353940 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
body.dark-theme .select2-search__field {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #dee2e6 !important;
}
body.dark-theme .select2-results__option { color: #d0d3d8; }
body.dark-theme .select2-results__option--highlighted {
    background-color: rgba(67,183,122,.15) !important;
    color: #8fdeb5 !important;
}
body.dark-theme .select2-results__option--selected {
    background-color: #43b77a !important;
    color: #fff !important;
}

/* --- Modals dark --- */
body.dark-theme .modal-content {
    background-color: #22262e !important;
    border-color: #353940;
    color: #e4e6ea;
}
body.dark-theme .modal-header { border-bottom-color: #353940; }
body.dark-theme .modal-footer { border-top-color: #353940; }

/* --- Paginator dark --- */
body.dark-theme .page-link {
    background-color: #22262e;
    border-color: #353940;
    color: #9ca3af;
}
body.dark-theme .page-link:hover {
    background-color: #2a2e37;
    color: #43b77a;
}

/* --- Misc dark --- */
body.dark-theme h1, body.dark-theme h2, body.dark-theme h3,
body.dark-theme h4, body.dark-theme h5, body.dark-theme h6 {
    color: #e4e6ea;
}
body.dark-theme label { color: #c0c4cc !important; }
body.dark-theme .text-muted { color: #777 !important; }
body.dark-theme hr { border-color: #353940; }

/* --- Form labels dark (override responsive.css specificity) --- */
body.dark-theme .form-row.row > .span4 label,
body.dark-theme .form-row.row > .col-md-4 label {
    color: #c0c4cc !important;
}
body.dark-theme .form-row.row > .span4,
body.dark-theme .form-row.row > .col-md-4 {
    color: #c0c4cc !important;
}
body.dark-theme .form-subgroup > legend {
    color: #fff !important;
    background: #2d8f5e !important;
    border-bottom: none !important;
}
body.dark-theme .content-wrapper label,
body.dark-theme .content-wrapper .control-label {
    color: #c0c4cc !important;
}
body.dark-theme .content-wrapper p,
body.dark-theme .content-wrapper span,
body.dark-theme .content-wrapper div {
    color: inherit;
}
body.dark-theme .content-wrapper .form-subgroup {
    color: #d0d3d8;
}
/* Dark: balance table */
body.dark-theme .acc-balance-table thead th {
    color: #6c757d;
    border-bottom-color: #353940;
}
body.dark-theme .acc-balance-table tbody td {
    color: #c0c4cc;
}
body.dark-theme .acc-balance-table tbody td.acc-row-label,
body.dark-theme .acc-balance-table tbody th.acc-row-label {
    color: #adb5bd;
}
/* th[scope=row] in balance table — keep regular weight, no header styling */
.acc-balance-table tbody th.acc-row-label {
    font-weight: inherit;
    text-align: inherit;
    background: none;
}
body.dark-theme .acc-balance-table tbody td.acc-op {
    color: #6c757d;
}
body.dark-theme .acc-section-title {
    color: #adb5bd;
}
body.dark-theme .acc-field-row > label {
    color: #adb5bd;
}

/* --- Finance info 3-column grid --- */
.acc-grid-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
    margin-left: 15px;
    margin-right: 15px;
}
.acc-grid-cell {
    text-align: center;
}
.acc-grid-label {
    font-size: .78em;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.acc-grid-cell .form-control {
    text-align: center;
    font-size: .85em;
}
body.dark-theme .acc-grid-label {
    color: #9ea3ad;
}
body.dark-theme .acc-readonly {
    background: #2a2e37 !important;
    border-color: #353940 !important;
    color: #c0c4cc !important;
}

/* --- White bar fix: ensure no light borders/gaps leak in dark mode --- */
body.dark-theme .main-header.navbar {
    border-bottom: 2px solid #353940 !important;
}
body.dark-theme .content-wrapper {
    border-top: none !important;
}
body.dark-theme .navbar + .content-wrapper,
body.dark-theme .content-wrapper::before {
    border: none !important;
}
body.dark-theme {
    background-color: #1a1d23 !important;
}
body.dark-theme .wrapper {
    background-color: #1a1d23 !important;
}
body.dark-theme .content {
    background-color: transparent !important;
}
body.dark-theme .content-header {
    background-color: transparent !important;
    border-bottom: none !important;
}

/* --- Toolbar/buttons text dark --- */
body.dark-theme .head-navbar .btn {
    color: #e4e6ea;
}
body.dark-theme .head-navbar .btn-default,
body.dark-theme .head-navbar .btn-light {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .head-navbar .btn-default:hover,
body.dark-theme .head-navbar .btn-light:hover {
    background-color: #353940 !important;
    color: #fff !important;
}
body.dark-theme .head-navbar label {
    color: #c0c4cc !important;
}
body.dark-theme .head-navbar input[type="text"] {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #e4e6ea !important;
}

/* --- Inline forms / tab content dark --- */
body.dark-theme .tab-content { color: #d0d3d8; }
body.dark-theme .inline-related { border-color: #353940; }

/* --- Balance table dark --- */
table#balance_table {
    padding: 10px;
    background: #f8f9fa;
    margin: 0 10px 20px;
    width: 97% !important;
}
body.dark-theme #balance_table { color: #d0d3d8; background: #22262e; }
body.dark-theme #balance_table td { border-color: var(--table-border-dark); }


/* ============================================
   Sidebar tree navigation (Abonents)
   ============================================ */
.main-sidebar .nav-treeview {
    padding-left: 0.5rem;
}
.main-sidebar .nav-treeview .nav-link {
    padding: 0.2rem 0.5rem 0.2rem 0.8rem !important;
    font-size: 0.78rem;
}
.main-sidebar .nav-treeview .nav-icon {
    font-size: 0.4rem;
    width: 1rem;
}
.main-sidebar .nav-treeview .nav-treeview .nav-link {
    padding-left: 1.2rem !important;
    font-size: 0.75rem;
}
.main-sidebar .menu-open > .nav-treeview {
    background: rgba(0,0,0,.1);
}
.main-sidebar .nav-sidebar .nav-link p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.main-sidebar .nav-sidebar > .nav-item > .nav-link > .nav-icon.fa-folder {
    color: #f0ad4e;
}

/* ============================================
   Sidebar recent pages navigation
   ============================================ */
.nav-sidebar .nav-header {
    color: #6b7f6b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem 0.25rem;
}
.nav-sidebar.nav-compact .nav-link {
    padding: 0.3rem 0.5rem 0.3rem 1rem !important;
}
.nav-sidebar.nav-compact .nav-link p {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
.nav-sidebar.nav-compact .nav-icon {
    font-size: 0.45rem;
    margin-right: 0.4rem;
    width: auto;
}
.nav-sidebar.nav-flat .nav-link {
    border-radius: 0;
}

/* Sidebar width tweak for readability */
.main-sidebar {
    width: 260px;
}
.main-sidebar .brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-theme .nav-sidebar .nav-header {
    color: #5a6370;
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #aaa; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #888; }

body.dark-theme ::-webkit-scrollbar-track { background: #1a1d23; }
body.dark-theme ::-webkit-scrollbar-thumb { background: #454950; }
body.dark-theme ::-webkit-scrollbar-thumb:hover { background: #5a5f68; }

/* ============================================
   Dashboard & Operations — Dark mode
   ============================================ */

/* Stat cards: restore colored gradients in dark mode (overrides generic .card rule) */
body.dark-theme .stat-card { box-shadow: 0 2px 8px rgba(0,0,0,.5) !important; }
body.dark-theme .stat-card.bg-gradient-info {
    background-color: #006478 !important;
    background-image: linear-gradient(to bottom right, #00bcd4, #0277bd) !important;
}
body.dark-theme .stat-card.bg-gradient-success {
    background-color: #1b5e20 !important;
    background-image: linear-gradient(to bottom right, #00695c, #2e7d32) !important;
}
body.dark-theme .stat-card.bg-gradient-warning {
    background-color: #bf360c !important;
    background-image: linear-gradient(to bottom right, #e64a19, #f9a825) !important;
}
body.dark-theme .stat-card.sc-teal {
    background-color: #004d40 !important;
    background-image: linear-gradient(to bottom right, #00695c, #00897b) !important;
}
body.dark-theme .stat-card.sc-orange {
    background-color: #bf360c !important;
    background-image: linear-gradient(to bottom right, #d84315, #f57c00) !important;
}
body.dark-theme .stat-card.sc-blue {
    background-color: #0d47a1 !important;
    background-image: linear-gradient(to bottom right, #1565c0, #1e88e5) !important;
}

/* Info-boxes (AdminLTE) in dark */
body.dark-theme .info-box { background: #22262e !important; }
body.dark-theme .info-box-text { color: #9ca3af !important; }
body.dark-theme .info-box-number { color: #e4e6ea !important; }

/* Finance summary cards (operations_log) */
body.dark-theme .summary-card { background: #22262e !important; border-color: #353940 !important; }
body.dark-theme .summary-card.income { border-left-color: #28a745 !important; }
body.dark-theme .summary-card.expense { border-left-color: #dc3545 !important; }
body.dark-theme .summary-card.count { border-left-color: #17a2b8 !important; }

/* Filter bars — all variants */
body.dark-theme .filter-bar,
body.dark-theme .hdsk-filter-bar,
body.dark-theme [class*="filter-bar"] { background: #22262e !important; border-color: #353940 !important; }
body.dark-theme .hdsk-filter-field label { color: #9ca3af !important; }

/* Generic light bg containers in dark mode */
body.dark-theme .bg-light,
body.dark-theme .bg-white {
    background-color: #2a2e37 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .card,
body.dark-theme .card-header {
    background-color: #22262e !important;
    border-color: #353940 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .card-header.bg-light {
    background-color: #262a33 !important;
}
body.dark-theme .table {
    color: #d0d3d8 !important;
    --bs-table-bg: transparent;
}
body.dark-theme .table th {
    color: #9ca3af !important;
    border-color: var(--table-border-dark) !important;
}
body.dark-theme .table td {
    border-color: var(--table-border-dark) !important;
}
body.dark-theme .table-hover tbody tr:hover {
    background-color: rgba(255,255,255,.07) !important;
}
body.dark-theme .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255,255,255,.03) !important;
    --bs-table-bg-type: transparent;
}
body.dark-theme .table td,
body.dark-theme .table th,
body.dark-theme td,
body.dark-theme th {
    border-color: var(--table-border-dark) !important;
    color: #d0d3d8 !important;
}
/* build 731: усиленный border у заголовка thead — отделение шапки от данных */
body.dark-theme .table thead th,
body.dark-theme thead th,
[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] thead th {
    border-bottom-color: var(--table-border-strong-dark) !important;
    border-bottom-width: 2px !important;
}
body.dark-theme .table thead th,
body.dark-theme thead th,
[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] thead th {
    background-color: #1e222a !important;
    /* build 688: было #9ca3af (контраст ~3.5:1 — ниже WCAG AA).
       #d0d8e3 даёт ~9:1, заголовки колонок читаются однозначно. */
    color: #d0d8e3 !important;
    font-weight: 600;
    letter-spacing: .02em;
}
/* Folder-table — особый кейс — ещё ярче для важных списков абонентов */
body.dark-theme .folder-table thead th,
[data-bs-theme="dark"] .folder-table thead th {
    color: #e9ecef !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: .72rem;
}
/* Ссылки-сортировки внутри заголовка (class="text-dark") в тёмной теме */
body.dark-theme .folder-table thead th a,
body.dark-theme .folder-table thead th a.text-dark,
[data-bs-theme="dark"] .folder-table thead th a,
[data-bs-theme="dark"] .folder-table thead th a.text-dark {
    color: #e9ecef !important;
    text-decoration: none;
}
body.dark-theme .folder-table thead th a:hover,
[data-bs-theme="dark"] .folder-table thead th a:hover {
    color: var(--brand-primary, #43b77a) !important;
}
/* Иконка-замок для блокировки в списке абонентов — чуть крупнее, видимая */
.abonent-block-icon {
    font-size: .9rem;
    vertical-align: middle;
    cursor: help;
}
body.dark-theme .abonent-block-icon.text-warning,
[data-bs-theme="dark"] .abonent-block-icon.text-warning {
    color: #ffc857 !important;
}
body.dark-theme .abonent-block-icon.text-danger,
[data-bs-theme="dark"] .abonent-block-icon.text-danger {
    color: #ff6b6b !important;
}
/* jqGrid / legacy tables */
body.dark-theme .ui-jqgrid,
body.dark-theme .ui-jqgrid-bdiv,
body.dark-theme .ui-jqgrid-hdiv,
body.dark-theme .ui-jqgrid tr.jqgrow td {
    background-color: #22262e !important;
    color: #d0d3d8 !important;
    border-color: var(--table-border-dark) !important;
}
body.dark-theme .ui-jqgrid tr.jqgrow:hover td {
    background-color: #2a2e37 !important;
}
body.dark-theme .ui-jqgrid .ui-jqgrid-htable th {
    background-color: #1e222a !important;
    color: #d0d8e3 !important;
    border-color: var(--table-border-strong-dark) !important;
    border-bottom-width: 2px !important;
}
/* Pagination / pager dark */
body.dark-theme .pagination .page-link {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .pagination .page-item.active .page-link {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #fff !important;
}
/* Toolbar / button bar */
body.dark-theme .head-navbar,
body.dark-theme .btn-toolbar,
body.dark-theme .toolbar,
body.dark-theme .content-wrapper > .content-header,
body.dark-theme .content-wrapper > div:first-child,
body.dark-theme .content-wrapper > .container-fluid > div:first-child {
    background-color: #22262e !important;
    border-color: #353940 !important;
}
/* Any stray white/light backgrounds */
body.dark-theme .content-wrapper,
body.dark-theme .content-wrapper * {
    --bs-table-bg: transparent;
}
body.dark-theme .content-wrapper [style*="background:#fff"],
body.dark-theme .content-wrapper [style*="background: #fff"],
body.dark-theme .content-wrapper [style*="background:white"],
body.dark-theme .content-wrapper [style*="background: white"] {
    background-color: #22262e !important;
}
/* Pay sections, system cards */
body.dark-theme .pay-section {
    background-color: #22262e !important;
    border-color: #353940 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .pay-section.bg-light,
body.dark-theme .pay-section.border-0 {
    background-color: #1e222a !important;
}
body.dark-theme .pay-section h6 {
    border-bottom-color: #353940 !important;
    color: #e4e6ea !important;
}
body.dark-theme .system-card {
    border-color: #454950 !important;
    background: #2a2e37 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .system-card.active {
    border-color: var(--brand-primary) !important;
    background: color-mix(in srgb, var(--brand-primary) 10%, transparent) !important;
}
body.dark-theme .system-card:hover {
    border-color: var(--brand-primary) !important;
}
body.dark-theme .section-disabled {
    opacity: 0.4;
}

/* Dashboard cards, quick links, system info */
body.dark-theme .card-body,
body.dark-theme .list-group-item,
body.dark-theme .info-box,
body.dark-theme .small-box,
body.dark-theme .callout {
    background-color: #22262e !important;
    color: #d0d3d8 !important;
}
body.dark-theme .info-box .info-box-text { color: #9ca3af !important; }
body.dark-theme .info-box .info-box-number { color: #e4e6ea !important; }
/* System info / about block light bg */
body.dark-theme .content-wrapper .bg-light,
body.dark-theme .content-wrapper .rounded.bg-light,
body.dark-theme .content-wrapper [style*="background:#f"],
body.dark-theme .content-wrapper [style*="background: #f"] {
    background-color: #2a2e37 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .modal-content {
    background-color: #22262e !important;
    border-color: #353940 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    border-color: #353940 !important;
}
body.dark-theme .text-muted { color: #9ca3af !important; }
body.dark-theme .border { border-color: #353940 !important; }
body.dark-theme hr { border-color: #353940 !important; opacity: .5; }
body.dark-theme .nav-tabs .nav-link { color: #9ca3af; }
body.dark-theme .nav-tabs .nav-link.active {
    background-color: #22262e !important;
    border-color: #353940 #353940 #22262e !important;
    color: #e4e6ea !important;
}
body.dark-theme .nav-tabs { border-bottom-color: #353940 !important; }
body.dark-theme .badge { opacity: .9; }
body.dark-theme a { color: #5cc98d; }
body.dark-theme a:hover { color: #7ddba7; }
body.dark-theme .btn-outline-primary { color: #5cc98d; border-color: #5cc98d; }
body.dark-theme .btn-outline-primary:hover { background: #5cc98d; color: #fff; }

/* Select options readable in dark */
body.dark-theme select option,
body.dark-theme .form-select option {
    background-color: #2a2e37 !important;
    color: #e4e6ea !important;
}
/* Catch-all: any input/select/textarea in dark */
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme .form-control,
body.dark-theme .form-select {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #e4e6ea !important;
}
body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: #6c757d !important;
}
body.dark-theme label,
body.dark-theme .form-label,
body.dark-theme .control-label {
    color: #d0d3d8 !important;
}
body.dark-theme .form-text,
body.dark-theme .help-text {
    color: #9ca3af !important;
}

/* Quick period buttons */
body.dark-theme .quick-btn { color: #9ca3af !important; border-color: #454950 !important; }
body.dark-theme .quick-btn:hover { color: #e4e6ea !important; background: #2a2e37 !important; }
body.dark-theme .quick-btn.active {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
    color: #fff !important;
}

/* Period selector on welcome chart */
body.dark-theme .period-btn { color: #9ca3af !important; border-color: #454950 !important; }
body.dark-theme .period-btn:hover { color: #e4e6ea !important; background: #2a2e37 !important; }
body.dark-theme .period-btn.active {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
    color: #fff !important;
}

/* Table hover rows in dark */
body.dark-theme .op-row:hover { background: rgba(67,183,122,.1) !important; }

/* Table-light header in dark */
body.dark-theme .table-light,
body.dark-theme .table-light th,
body.dark-theme thead.table-light th {
    background-color: #2a2e37 !important;
    color: #c0c4cc !important;
    border-color: #353940 !important;
}

/* Table-striped in dark */
body.dark-theme .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255,255,255,.02);
    color: inherit;
}

/* Form selects/inputs in filter bar */
body.dark-theme .form-select,
body.dark-theme .form-control {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #e4e6ea !important;
}

/* Card footer in dark */
body.dark-theme .card-footer {
    background-color: #2a2e37 !important;
    border-top-color: #353940 !important;
}

/* List-group (quick links) in dark */
body.dark-theme .list-group-item {
    background-color: #22262e !important;
    border-color: #353940 !important;
    color: #d0d3d8 !important;
}
body.dark-theme .list-group-item-action:hover {
    background-color: #2a2e37 !important;
}
body.dark-theme .list-group-item a { color: #5cc98d !important; }
body.dark-theme .list-group-item a:hover { color: #7ddba7 !important; }

/* Finance big numbers */
body.dark-theme .finance-big.text-success { color: #5cc98d !important; }
body.dark-theme .finance-big.text-danger { color: #f07070 !important; }

/* Btn outline in dark — чистый стиль (build 542) */
body.dark-theme .btn-outline-secondary {
    background: #1f2329 !important;
    color: #c5cdd6 !important;
    border-color: #2a2f37 !important;
}
body.dark-theme .btn-outline-secondary:hover,
body.dark-theme .btn-outline-secondary:focus {
    background-color: rgba(67,183,122,.14) !important;
    color: #6fdc92 !important;
    border-color: #43b77a !important;
}
body.dark-theme .btn-outline-secondary:active,
body.dark-theme .btn-outline-secondary.active,
body.dark-theme .btn-check:checked + .btn-outline-secondary {
    background: #43b77a !important;
    color: #fff !important;
    border-color: #3aa86e !important;
}
body.dark-theme .btn-outline-primary {
    color: #5cc98d !important;
    border-color: #5cc98d !important;
}
body.dark-theme .btn-outline-primary:hover {
    background-color: #43b77a !important;
    color: #fff !important;
}
body.dark-theme .btn-outline-danger {
    color: #f07070 !important;
    border-color: #f07070 !important;
}
body.dark-theme .btn-outline-danger:hover {
    background-color: #e05555 !important;
    color: #fff !important;
}

/* Server load block background */
body.dark-theme .load-block { background: #2a2e37 !important; }

/* Sticky header in dark */
body.dark-theme thead.sticky-top th {
    background-color: #2a2e37 !important;
}

/* ─── Compact form fields ─── */
.modal-body .mb-3,
.content-wrapper .mb-3 {
    margin-bottom: 0.6rem !important;
}
.modal-body .form-label,
.content-wrapper .form-label {
    margin-bottom: 0.2rem;
    font-size: 0.875rem;
}
.modal-body .form-text,
.content-wrapper .form-text {
    margin-top: 0.15rem;
    font-size: 0.8rem;
}

/* ─── Input-group fix ─── */
.input-group .form-control { flex: 1 1 auto !important; width: 1% !important; }
.input-group .input-group-text { white-space: nowrap; }

/* ─── Radio & Checkbox fix (AdminLTE/Bootstrap conflict) ─── */
.content-wrapper input[type="radio"],
.content-wrapper input[type="checkbox"]:not(.form-check-input):not(.no-style) {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    width: auto !important;
    height: auto !important;
}
.system-card input[type="radio"] {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    width: 16px !important;
    height: 16px !important;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

/* ─── Checkbox & Switch fix (AdminLTE/Bootstrap conflict) ─── */
.form-check-input:checked,
.content-wrapper input[type="checkbox"]:checked {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}
.form-switch .form-check-input:checked {
    background-position: right center !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--brand-primary) 25%, transparent) !important;
    border-color: var(--brand-primary) !important;
}

/* ─── Inline table (tabs: Услуги тарифов, RADIUS-параметры etc.) ─── */
.inline-form td { vertical-align: middle !important; padding: .35rem .5rem !important; }
.inline-form .inline_select { float: none; position: static; margin: 0 2px; display: inline; }
.inline-form .view_obj { display: inline; margin: 0 2px; }
.inline-form td .nowait { white-space: nowrap; }
.inline-form .selector-icons { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.inline-form .selector-icons a { display: inline-flex; }
.inline-form select { max-width: 100%; }
.inline-form .last_th { white-space: nowrap; min-width: 70px; }
/* Action icons in last column — single line */
.inline-form td:last-child { white-space: nowrap; }
.inline-form td:last-child a { margin: 0 2px; }

/* ─── Responsive inline tables ─── */
@media (max-width: 767.98px) {
    .inline-form { font-size: .85rem; }
    .inline-form thead { display: none; }
    .inline-form tr {
        display: block; border: 1px solid #dee2e6; border-radius: 6px;
        margin-bottom: .5rem; padding: .4rem; background: var(--bs-body-bg, #fff);
    }
    .inline-form td {
        display: flex; align-items: center; padding: .25rem .4rem !important;
        border: none !important;
    }
    .inline-form td::before {
        content: attr(data-label);
        font-weight: 600; min-width: 100px; flex-shrink: 0;
        color: #6c757d; font-size: .85em; padding-right: .4rem;
    }
    .inline-form td:last-child { justify-content: flex-end; }
    .inline-form select { width: 100% !important; max-width: 100%; }
}

/* ─── Fix list-group active color (AdminLTE uses blue #007bff) ─── */
.list-group-item.active {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #fff !important;
}
.list-group-item.active:hover {
    background-color: #4a9589 !important;
}

/* ─── Fix empty desktop-subsection-header gap ─── */
.desktop-subsection-header h5:empty { display: none; }
.desktop-subsection-header:has(h5:empty) { padding: 0; min-height: 0; margin: 0; }

/* ─── Abonent title bar ─── */
.abonent-title-bar {
    background: linear-gradient(90deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 4px;
}
.abonent-title-bar h5,
.abonent-title-bar h1.abonent-title-h1,
.abonent-title-bar .abonent-title-h1 { color: #333; font-size: 1.15rem !important; font-weight: 700; line-height: 1.3 !important; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin: 0 !important; }
.abonent-title-id { color: #6c757d; font-weight: 600; }
.abonent-title-name { color: #212529; }
.abonent-title-balance { font-size: .85rem; padding: 6px 14px; white-space: nowrap; }
.abonent-title-badge { font-size: .68rem !important; font-weight: 600; padding: 4px 8px !important; vertical-align: middle; line-height: 1.2; }
.abonent-title-badge i { font-size: .7rem; }
/* build 686: info-иконка справа в шапке абонента/папки — ссылка на docs */
.abonent-title-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #6c757d;
    text-decoration: none !important;
    transition: color .15s, background-color .15s;
}
.abonent-title-info:hover,
.abonent-title-info:focus-visible {
    color: var(--brand-primary, #43b77a);
    background-color: rgba(67, 183, 122, .12);
    outline: none;
}
.abonent-title-info i { font-size: 1.05rem; }
body.dark-theme .abonent-title-info,
[data-bs-theme="dark"] .abonent-title-info { color: #a8b3bd; }
body.dark-theme .abonent-title-info:hover,
[data-bs-theme="dark"] .abonent-title-info:hover { color: #5fd29a; background-color: rgba(95, 210, 154, .15); }
body.dark-theme .abonent-title-bar {
    background: linear-gradient(90deg, #2b3035, #343a40) !important;
    border-color: #495057;
}
body.dark-theme .abonent-title-bar h5,
body.dark-theme .abonent-title-bar .abonent-title-h1 { color: #e9ecef !important; }
body.dark-theme .abonent-title-id { color: #adb5bd; }
body.dark-theme .abonent-title-name { color: #f8f9fa; }
body.dark-theme .abonent-title-badge.bg-light { background-color: #495057 !important; color: #e9ecef !important; border-color: #6c757d !important; }
/* Mobile: hide action buttons bar for Abonents, compact title, show back arrow */
@media (max-width: 767.98px) {
    .abonent-title-bar h5,
    .abonent-title-bar h1.abonent-title-h1,
    .abonent-title-bar .abonent-title-h1 { font-size: .95rem !important; }
    .abonent-title-balance { font-size: .75rem; padding: 4px 10px; }
    .abonent-title-badge { font-size: .62rem !important; padding: 3px 6px !important; }
    body.page-abonent-card .head-navbar { display: none !important; }
    .abonent-title-back { display: inline-flex !important; color: #6c757d; font-size: 1rem; text-decoration: none; }
    .abonent-title-back:hover { color: #333; }
    .chip-desktop-only { display: none !important; }
    #abon-summary-right { display: none !important; }
}
body.dark-theme .abonent-title-back { color: #adb5bd; }
body.dark-theme .abonent-title-back:hover { color: #f8f9fa; }

/* ─── Dark theme: subsection header gradient ─── */
body.dark-theme .desktop-subsection-header {
    background: linear-gradient(90deg, #43b880, #37a896) !important;
    border-bottom-color: #2d8a73;
}
body.dark-theme .desktop-subsection-header h5 { color: #fff !important; }
/* build 709: i-иконка (help-link) в шапке subsection-header.
   admin: «в светлой теме серого цвета, в тёмной теме белого цвета». */
.desktop-subsection-header .help-link {
    color: #6c757d !important;
    text-decoration: none;
    transition: color .15s;
}
.desktop-subsection-header .help-link:hover,
.desktop-subsection-header .help-link:focus-visible {
    color: #495057 !important;
    outline: none;
}
body.dark-theme .desktop-subsection-header .help-link,
[data-bs-theme="dark"] .desktop-subsection-header .help-link {
    color: #fff !important;
    opacity: .75;
}
body.dark-theme .desktop-subsection-header .help-link:hover,
body.dark-theme .desktop-subsection-header .help-link:focus-visible,
[data-bs-theme="dark"] .desktop-subsection-header .help-link:hover,
[data-bs-theme="dark"] .desktop-subsection-header .help-link:focus-visible {
    color: #fff !important;
    opacity: 1;
}

/* ─── Dark theme: backup page ─── */
body.dark-theme .backup-config-card { background: #22262e !important; border-color: #3a3f47; }
body.dark-theme .modal-content { background: #1e2530; color: #dee2e6; border-color: #3a3f47; }
body.dark-theme .modal-header { border-color: #3a3f47; }
body.dark-theme .modal-footer { border-color: #3a3f47; }
body.dark-theme .modal-content .form-control,
body.dark-theme .modal-content .form-select { background: #22262e; color: #dee2e6; border-color: #3a3f47; }
body.dark-theme .modal-content .form-control:focus,
body.dark-theme .modal-content .form-select:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand-primary) 25%, transparent); }
body.dark-theme .modal-content .btn-close { filter: invert(1); }

/* ─── Dark theme: table row hover gradient ─── */
body.dark-theme .table tbody tr:hover > td,
body.dark-theme .table tbody tr:hover > th,
body.dark-theme #choice_list tbody tr:hover > td,
body.dark-theme #result_list tbody tr:hover > td,
body.dark-theme .content-wrapper table tbody tr:hover > td {
    background: linear-gradient(90deg, rgba(67,184,128,.18), rgba(55,168,150,.10)) !important;
    color: #e0e0e0;
}

/* ─── Dark theme: select/option text readable ─── */
body.dark-theme select,
body.dark-theme select option,
body.dark-theme .form-select,
body.dark-theme .form-select option { color: #dee2e6 !important; background-color: #22262e; }
body.dark-theme select option:checked { background-color: var(--brand-primary); color: #fff !important; }

/* ─── Dark theme: sidebar nav links ─── */
body.dark-theme .nav-sidebar > .nav-item > .nav-link {
    color: #c0c4cc;
}
body.dark-theme .nav-sidebar .nav-treeview > .nav-item > .nav-link {
    color: #9ea3ad;
}
body.dark-theme .nav-sidebar .nav-link:hover {
    background-color: color-mix(in srgb, var(--brand-primary) 12%, transparent) !important;
    color: #e4e6ea;
}
body.dark-theme .nav-sidebar .nav-link.active {
    background-color: color-mix(in srgb, var(--brand-primary) 20%, transparent) !important;
    color: var(--brand-primary) !important;
}

/* ─── Dark theme: sidebar menu icons ─── */
body.dark-theme .main-sidebar .nav-link i,
body.dark-theme .main-sidebar .nav-link .fas,
body.dark-theme .main-sidebar .nav-link .far,
body.dark-theme .main-sidebar .nav-link .fa,
body.dark-theme .panel-left-nav .fas,
body.dark-theme .panel-left-nav .far,
body.dark-theme .panel-left-nav .fa { color: var(--brand-primary); }

/* ─── build 691: ROOT-CAUSE цветного текста на цветном фоне ───
   Bootstrap 5 объявляет `.table-warning { --bs-table-color: #664d03 }` и
   `.table-danger { --bs-table-color: #58151c }` через CSS-переменные,
   которые применяются изнутри через `--bs-table-color-state` и побеждают
   все мои td-правила (build 684-690). Из-за этого на скриншоте admin
   тёмная тема показывала жёлтый/розовый текст на одноимённом фоне.
   Решение: переопределяем нативные Bootstrap-переменные на самой <tr>.
   Тогда Bootstrap «изнутри» сам отрисует правильный цвет. */

/* Light theme — лёгкий фон, текст обычный чёрный */
tr.row-negbal > td { background-color: rgba(220, 53, 69, .08) !important; }
tr.table-warning, tr.table-danger, tr.table-info {
    --bs-table-color: inherit;
    --bs-table-color-state: inherit;
    --bs-table-color-type: inherit;
}

/* Dark theme — переменные для каждого статуса.
   Селекторы намеренно минимальные: tr.<class> > td.
   НЕ трогаем td a, td small, td .text-muted — пусть наследуют
   обычный цвет тёмной темы. */

/* table-danger — отключённые/удалённые абоненты */
body.dark-theme tr.table-danger > td,
[data-bs-theme="dark"] tr.table-danger > td {
    background-color: rgba(220, 53, 69, .14) !important;
    --bs-table-bg: transparent;
}
body.dark-theme tr.table-danger:hover > td,
[data-bs-theme="dark"] tr.table-danger:hover > td {
    background-color: rgba(220, 53, 69, .22) !important;
}

/* table-warning — административная блокировка */
body.dark-theme tr.table-warning > td,
[data-bs-theme="dark"] tr.table-warning > td {
    background-color: rgba(255, 193, 7, .10) !important;
    --bs-table-bg: transparent;
}
body.dark-theme tr.table-warning:hover > td,
[data-bs-theme="dark"] tr.table-warning:hover > td {
    background-color: rgba(255, 193, 7, .18) !important;
}

/* table-info — папки */
body.dark-theme tr.table-info > td,
[data-bs-theme="dark"] tr.table-info > td {
    background-color: rgba(60, 140, 180, .12) !important;
    --bs-table-bg: transparent;
}
body.dark-theme tr.table-info:hover > td,
[data-bs-theme="dark"] tr.table-info:hover > td {
    background-color: rgba(60, 140, 180, .20) !important;
}

/* row-deep-debt — глубокая задолженность (<-500) */
body.dark-theme tr.row-deep-debt > td,
[data-bs-theme="dark"] tr.row-deep-debt > td {
    background-color: rgba(220, 60, 60, .12) !important;
}
body.dark-theme tr.row-deep-debt:hover > td,
[data-bs-theme="dark"] tr.row-deep-debt:hover > td {
    background-color: rgba(220, 60, 60, .20) !important;
}

/* row-negbal — финансовая блокировка (b_negbal). Самый яркий. */
body.dark-theme tr.row-negbal > td,
[data-bs-theme="dark"] tr.row-negbal > td {
    background-color: rgba(220, 53, 69, .18) !important;
}
body.dark-theme tr.row-negbal:hover > td,
[data-bs-theme="dark"] tr.row-negbal:hover > td {
    background-color: rgba(220, 53, 69, .28) !important;
}

/* Двойной класс row-deep-debt.row-negbal — оба применимы. Чуть насыщеннее. */
body.dark-theme tr.row-deep-debt.row-negbal > td,
[data-bs-theme="dark"] tr.row-deep-debt.row-negbal > td {
    background-color: rgba(220, 53, 69, .24) !important;
}
body.dark-theme tr.row-deep-debt.row-negbal:hover > td,
[data-bs-theme="dark"] tr.row-deep-debt.row-negbal:hover > td {
    background-color: rgba(220, 53, 69, .34) !important;
}

/* Двойной класс row-deep-debt + table-warning (адм. блокировка + долг) */
body.dark-theme tr.row-deep-debt.table-warning > td,
[data-bs-theme="dark"] tr.row-deep-debt.table-warning > td {
    background-color: rgba(220, 100, 40, .16) !important;
}
body.dark-theme tr.row-deep-debt.table-warning:hover > td,
[data-bs-theme="dark"] tr.row-deep-debt.table-warning:hover > td {
    background-color: rgba(220, 100, 40, .26) !important;
}

/* Двойной class row-deep-debt + table-danger */
body.dark-theme tr.row-deep-debt.table-danger > td,
[data-bs-theme="dark"] tr.row-deep-debt.table-danger > td {
    background-color: rgba(220, 53, 69, .22) !important;
}
body.dark-theme tr.row-deep-debt.table-danger:hover > td,
[data-bs-theme="dark"] tr.row-deep-debt.table-danger:hover > td {
    background-color: rgba(220, 53, 69, .32) !important;
}

/* build 731: toggle «Цвет маркер» OFF — отключаем подсветку строк в folder-table.
   Bootstrap 5 рисует фон через `box-shadow: inset 0 0 0 9999px var(--bs-table-bg)`,
   поэтому одного background-color: transparent недостаточно — нужно сбросить
   box-shadow и обнулить --bs-table-bg-* CSS-переменные, плюс убрать диагональный
   pattern (background-image у folder-row) и вернуть исходный цвет ссылок. */
.folder-table.no-color-markers tr.table-warning,
.folder-table.no-color-markers tr.table-danger,
.folder-table.no-color-markers tr.table-info,
.folder-table.no-color-markers tr.row-negbal,
.folder-table.no-color-markers tr.row-deep-debt,
.folder-table.no-color-markers tr.folder-row {
    --bs-table-bg: transparent !important;
    --bs-table-bg-type: transparent !important;
    --bs-table-bg-state: transparent !important;
    --bs-table-accent-bg: transparent !important;
    --bs-table-color: inherit !important;
    --bs-table-color-state: inherit !important;
    --bs-table-hover-bg: transparent !important;
    --bs-table-striped-bg: transparent !important;
}
.folder-table.no-color-markers tr.table-warning > td,
.folder-table.no-color-markers tr.table-danger > td,
.folder-table.no-color-markers tr.table-info > td,
.folder-table.no-color-markers tr.row-negbal > td,
.folder-table.no-color-markers tr.row-deep-debt > td,
.folder-table.no-color-markers tr.folder-row > td {
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: inherit !important;
}
.folder-table.no-color-markers tr.table-warning:hover > td,
.folder-table.no-color-markers tr.table-danger:hover > td,
.folder-table.no-color-markers tr.table-info:hover > td,
.folder-table.no-color-markers tr.row-negbal:hover > td,
.folder-table.no-color-markers tr.row-deep-debt:hover > td,
.folder-table.no-color-markers tr.folder-row:hover > td {
    background-color: transparent !important;
    box-shadow: none !important;
}
.folder-table.no-color-markers tr.folder-row > td.col-name a {
    color: inherit !important;
    font-weight: normal !important;
}
.folder-table.no-color-markers tr.table-info > td.col-name a {
    color: inherit !important;
    font-weight: normal !important;
}

/* Бейджи внутри проблемных строк — собственные яркие цвета */
body.dark-theme tr.table-danger > td .badge.bg-danger,
body.dark-theme tr.row-negbal > td .badge.bg-danger,
[data-bs-theme="dark"] tr.table-danger > td .badge.bg-danger,
[data-bs-theme="dark"] tr.row-negbal > td .badge.bg-danger {
    background-color: #c0392b !important;
    color: #fff !important;
}
body.dark-theme tr.table-warning > td .badge.bg-warning,
[data-bs-theme="dark"] tr.table-warning > td .badge.bg-warning {
    background-color: #d4a017 !important;
    color: #000 !important;
}

/* ─── Dark theme: tariff badges ─── */
body.dark-theme .badge.bg-success,
body.dark-theme .badge.badge-success {
    background-color: #2d8f5e !important;
    color: #e0f5eb !important;
}
body.dark-theme .badge.bg-info,
body.dark-theme .badge.badge-info {
    background-color: #1f6a7a !important;
    color: #d0eef5 !important;
}

/* ─── Dark theme: datepicker ─── */
body.dark-theme .datepicker,
body.dark-theme .datepicker-dropdown,
body.dark-theme .bootstrap-datetimepicker-widget {
    background-color: #22262e !important;
    border-color: #3a3f47 !important;
    color: #d0d3d8;
}
body.dark-theme .datepicker table tr td,
body.dark-theme .datepicker table tr th,
body.dark-theme .bootstrap-datetimepicker-widget table td,
body.dark-theme .bootstrap-datetimepicker-widget table th {
    color: #c0c4cc;
    border-color: #353940;
}
body.dark-theme .datepicker table tr td.active,
body.dark-theme .datepicker table tr td.active:hover,
body.dark-theme .bootstrap-datetimepicker-widget table td.active {
    background-color: #43b77a !important;
    color: #fff !important;
}
body.dark-theme .datepicker table tr td.today,
body.dark-theme .bootstrap-datetimepicker-widget table td.today {
    background-color: rgba(67, 183, 122, .2) !important;
    color: #43b77a;
}
body.dark-theme .datepicker table tr td:hover,
body.dark-theme .bootstrap-datetimepicker-widget table td:hover {
    background-color: #2a2e37 !important;
}
body.dark-theme .datepicker .datepicker-switch,
body.dark-theme .datepicker .prev,
body.dark-theme .datepicker .next {
    color: #c0c4cc;
}

/* ─── Dark theme: abonent comments block ─── */
body.dark-theme .comment-block,
body.dark-theme [class*="comment"] .card,
body.dark-theme .card.comment-card {
    background-color: #1e222a !important;
    border-color: #353940 !important;
}
body.dark-theme .comments-section {
    margin-top: 8px;
    padding: 10px 12px;
    background: #2a2e37;
    border-radius: 6px;
    border: 1px solid #454950;
}

/* ─── Dark theme: form subgroup legends ─── */
body.dark-theme .form-subgroup .badge,
body.dark-theme .card-header .badge {
    opacity: .85;
}

/* ─── Dark theme: folder rows in abonent table ─── */
body.dark-theme tr td .fa-folder,
body.dark-theme tr td .fa-folder-open {
    color: #e6a817;
}

/* ─── Dark theme: dev_reports toolbar icons ─── */
body.dark-theme #md-card .btn-outline-secondary { color: var(--brand-primary); border-color: #3a3f47; }
body.dark-theme #md-card .btn-outline-secondary:hover { background: var(--brand-primary); color: #fff; }

/* ─── GLOBAL: Replace Bootstrap blue #007bff with green var(--brand-primary) ─── */
.text-primary { color: var(--brand-primary) !important; }
a.text-primary:hover, a.text-primary:focus { color: #4a9589 !important; }
.bg-primary { background-color: var(--brand-primary) !important; }
.btn-primary { background-color: var(--brand-primary) !important; border-color: var(--brand-primary) !important; }
.btn-primary:hover { background-color: #4a9589 !important; border-color: #4a9589 !important; }
.btn-outline-primary { color: var(--brand-primary) !important; border-color: var(--brand-primary) !important; }
.btn-outline-primary:hover { background-color: var(--brand-primary) !important; color: #fff !important; }
.nav-link.active { color: var(--brand-primary) !important; border-bottom-color: var(--brand-primary) !important; }
.nav-tabs .nav-link.active { color: var(--brand-primary) !important; border-bottom: 2px solid var(--brand-primary) !important; }
.page-link { color: var(--brand-primary) !important; }
.page-item.active .page-link { background-color: var(--brand-primary) !important; border-color: var(--brand-primary) !important; color: #fff !important; }
a { color: var(--brand-primary); }
a:hover { color: #4a9589; }

/* ─── GLOBAL: Fix ALL checkboxes (AdminLTE/BS5 conflict) ─── */
.content-wrapper input[type="checkbox"],
.modal input[type="checkbox"] {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    width: auto !important;
    height: auto !important;
    accent-color: var(--brand-primary) !important;
}
.perms-options input[type="checkbox"],
#choice_list input[type="checkbox"],
.form-check-input[type="checkbox"] {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    width: 18px !important;
    height: 18px !important;
    accent-color: var(--brand-primary) !important;
    cursor: pointer;
}

/* ─── Bootstrap 5 toggle switch — preserve pill rendering ─── */
/* Override the default 18×18 square checkbox styles when wrapped in .form-switch */
.form-switch {
    padding-left: 2.5em !important;
}
.form-switch .form-check-input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 2em !important;
    height: 1em !important;
    border-radius: 2em !important;
    background-color: rgba(0,0,0,.15) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
    background-position: left center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
    border: 1px solid rgba(0,0,0,.25) !important;
    transition: background-position .15s ease-in-out, background-color .15s ease-in-out !important;
    margin-left: -2.5em !important;
    margin-top: .25em !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
}
.form-switch .form-check-input[type="checkbox"]:checked {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    background-position: right center !important;
}
.form-switch .form-check-input[type="checkbox"]:focus {
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand-primary) 25%, transparent) !important;
    border-color: var(--brand-primary) !important;
}
body.dark-theme .form-switch .form-check-input[type="checkbox"] {
    background-color: rgba(255,255,255,.15) !important;
    border-color: rgba(255,255,255,.25) !important;
}

/* ─── GLOBAL: Compact form rows — reduce vertical spacing ─── */
.form-row.row {
    margin-bottom: 1px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    min-height: 0 !important;
}
.form-row.row > .col-md-4,
.form-row.row > .col-md-8,
.form-row.row > div[class*="col-"] {
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    margin-bottom: 0 !important;
}
/* ALL selects inside form subgroups — compact */
.form-subgroup select,
.form-row select {
    padding: 3px 6px !important;
    height: 30px !important;
    min-height: 0 !important;
    font-size: .88rem !important;
    line-height: 1.3 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
/* ALL inputs inside form subgroups — compact */
.form-subgroup input[type="text"],
.form-subgroup input[type="number"],
.form-subgroup input[type="email"],
.form-subgroup input[type="password"],
.form-subgroup input[type="url"],
.form-subgroup input.form-control,
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input.form-control {
    padding: 3px 6px !important;
    height: 30px !important;
    font-size: .88rem !important;
}
/* Checkbox alignment — left edge, no centering */
.form-subgroup input[type="checkbox"],
.form-row input[type="checkbox"] {
    margin-left: 0 !important;
    margin-top: 6px !important;
    margin-right: 0 !important;
    display: block !important;
}
/* Select2 compact */
.form-subgroup .select2-container .select2-selection--single,
.form-row .select2-container .select2-selection--single {
    min-height: 30px !important;
    height: 30px !important;
    padding: 1px 6px !important;
}
.form-subgroup .select2-container .select2-selection__rendered,
.form-row .select2-container .select2-selection__rendered {
    line-height: 26px !important;
    font-size: .88rem !important;
    padding-left: 4px !important;
}
.form-subgroup .select2-container .select2-selection__arrow,
.form-row .select2-container .select2-selection__arrow {
    height: 28px !important;
}
/* popup-select row compact */
.popup-select-row select {
    padding: 3px 6px !important;
    height: 30px !important;
}
/* field-with-help flex alignment */
.field-with-help {
    display: flex !important;
    align-items: center !important;
    gap: 4px;
}
.field-with-help select,
.field-with-help input {
    flex: 1;
    min-width: 0;
}

/* ═══ Mobile sidebar overrides — must come AFTER AdminLTE active rules ═══ */
@media (max-width: 767.98px) {
    /* Kill AdminLTE + earlier theme-smit green fill on active */
    .main-sidebar .nav-sidebar > .nav-item > .nav-link.active,
    .sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
    body .main-sidebar .nav-link.active {
        background: color-mix(in srgb, var(--brand-primary) 15%, transparent) !important;
        background-color: color-mix(in srgb, var(--brand-primary) 15%, transparent) !important;
        color: #fff !important;
        box-shadow: inset 3px 0 0 var(--brand-primary) !important;
    }
    .main-sidebar .nav-sidebar .nav-treeview > .nav-item > .nav-link.active,
    .sidebar-dark-primary .nav-sidebar .nav-treeview > .nav-item > .nav-link.active {
        background: color-mix(in srgb, var(--brand-primary) 18%, transparent) !important;
        background-color: color-mix(in srgb, var(--brand-primary) 18%, transparent) !important;
        color: #fff !important;
        box-shadow: none !important;
    }
    /* Dark theme parity */
    body.dark-theme .main-sidebar .nav-sidebar > .nav-item > .nav-link.active {
        background-color: color-mix(in srgb, var(--brand-primary) 20%, transparent) !important;
        color: #fff !important;
        box-shadow: inset 3px 0 0 var(--brand-primary) !important;
    }
    /* Active icon teal */
    .main-sidebar .nav-sidebar > .nav-item > .nav-link.active > .nav-icon,
    .main-sidebar .nav-sidebar .nav-treeview .nav-link.active > .nav-icon,
    .main-sidebar .nav-sidebar .nav-treeview .nav-link.active > .sidebar-sub-icon {
        color: var(--brand-primary) !important;
        opacity: 1 !important;
    }
}

/* ═══ Abonents section — larger top nav items ═══ */
/* On /admin/Abonents/search/ — whole sidebar-main-nav bigger */
body.section-abonents .sidebar-main-nav.nav-compact .nav-link p {
    font-size: 1rem;
    margin: 0 10px;
}
/* (build 634) Old rule for first 3 items — disabled: quick-nav links use own typography */

/* ═══ Abonents sidebar tree — refined UX (build 631+) ═══ */
/* Sticky CTA «Новый абонент» — prominently above the tree */
.sidebar-abonents-nav .sidebar-cta-row {
    position: sticky;
    top: 0;
    z-index: 5;
    background: linear-gradient(180deg, rgba(20, 27, 35, .98) 0%, rgba(20, 27, 35, .92) 100%);
    backdrop-filter: blur(4px);
    padding: 10px 14px 8px !important;
    margin: 0 0 4px 0 !important;
    list-style: none;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    display: block;
}
.sidebar-abonents-nav .sidebar-cta-row .sidebar-cta-btn {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100%;
}
.sidebar-abonents-nav .sidebar-cta-btn {
    background: var(--brand-primary, #43b77a);
    border-color: var(--brand-primary, #43b77a);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    letter-spacing: .01em;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(67, 183, 122, .25);
    transition: background-color .15s, box-shadow .15s, transform .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.sidebar-abonents-nav .sidebar-cta-btn:hover {
    background: #3aa86b;
    border-color: #3aa86b;
    box-shadow: 0 3px 10px rgba(67, 183, 122, .35);
    color: #fff;
}
.sidebar-abonents-nav .sidebar-cta-btn:active { transform: scale(.97); }
.sidebar-abonents-nav .sidebar-cta-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Section labels — small caps separator (Разделы / Папки)
   build 711: контраст усилен с .35 до .6 (admin: «бледные тексты», 35% было ниже WCAG AA) */
.sidebar-abonents-nav .sidebar-tree-label,
.sidebar-abonents-nav .sidebar-section-label {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .6);
    padding: 8px 14px 4px;
    margin: 4px 0 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sidebar-abonents-nav .sidebar-tree-label i,
.sidebar-abonents-nav .sidebar-section-label i { font-size: .8em; opacity: .8; }
.sidebar-abonents-nav .sidebar-section-label { margin-top: 8px; }
.sidebar-abonents-nav .sidebar-tree-label { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .04); }

/* Quick-nav links (Поиск/Карта/Счета/Фин.опер.) — visually distinct from tree leaves */
.sidebar-abonents-nav .sidebar-quicknav-link {
    padding: 8px 14px !important;
    color: rgba(255, 255, 255, .82) !important;
    font-size: .88rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    line-height: 1.2 !important;
}
.sidebar-abonents-nav .sidebar-quicknav-link .nav-icon {
    color: var(--brand-primary, #43b77a) !important;
    width: 20px !important;
    text-align: center !important;
    font-size: .95rem !important;
    opacity: .9 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}
.sidebar-abonents-nav .sidebar-quicknav-link p {
    margin: 0 !important;
    font-size: .88rem !important;
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: rgba(255, 255, 255, .92) !important;
}
.sidebar-abonents-nav .sidebar-quicknav-link:hover { background: rgba(67, 183, 122, .15) !important; }
.sidebar-abonents-nav .sidebar-quicknav-link:hover .nav-icon { opacity: 1 !important; }
.sidebar-abonents-nav .sidebar-quicknav-link.active {
    background: rgba(67, 183, 122, .22) !important;
}
.sidebar-abonents-nav .sidebar-quicknav-link.active p { color: #fff !important; font-weight: 500 !important; }

/* Folder vs leaf — subtle visual hierarchy */
.sidebar-abonents-nav .nav-link {
    transition: background-color .12s, color .12s;
    border-radius: 4px;
    margin: 1px 4px;
}
.sidebar-abonents-nav .nav-link:hover {
    background: rgba(67, 183, 122, .12);
}
.sidebar-abonents-nav .nav-link.active {
    background: var(--brand-primary, #43b77a) !important;
}
/* Leaf items (абоненты — circles) — muted, slightly smaller */
.sidebar-abonents-nav .nav-link i.far.fa-circle,
.sidebar-abonents-nav .nav-link i.fas.fa-circle {
    font-size: .55em !important;
    opacity: .55;
    color: rgba(255, 255, 255, .5) !important;
}
.sidebar-abonents-nav .nav-link:hover i.far.fa-circle { opacity: 1; }

/* ═══ Build 629: Sidebar COLLAPSED mode — clean icon-only view ═══
   Когда body.sidebar-collapse:
   • CTA «Новый абонент» → круглая иконка-кнопка 32×32 по центру
   • Section labels (РАЗДЕЛЫ / ПАПКИ) → полностью скрыты
   • Quick-nav <p> текст → скрыт, остаются только цветные иконки
   • Tree leaves <p> → скрыты
   • Hover на сайдбар (sidebar-mini-expand-on-hover) — текст возвращается
*/
body.sidebar-collapse .sidebar-abonents-nav .sidebar-cta-row {
    padding: 8px 6px !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-cta-btn {
    padding: 8px 0 !important;
    min-width: 36px;
    width: 36px !important;
    height: 36px;
    border-radius: 50%;
    margin: 0 auto;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-cta-btn > span {
    display: none;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-cta-btn > i {
    margin: 0 !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-section-label,
body.sidebar-collapse .sidebar-abonents-nav .sidebar-tree-label {
    display: none !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link {
    padding: 10px 0 !important;
    justify-content: center !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link p {
    display: none !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link .nav-icon {
    margin: 0 !important;
    width: auto !important;
    font-size: 1.05rem !important;
}
body.sidebar-collapse .sidebar-abonents-nav .nav-link {
    padding: 8px 0 !important;
    text-align: center;
    justify-content: center;
}
body.sidebar-collapse .sidebar-abonents-nav .nav-link > p {
    display: none !important;
}
body.sidebar-collapse .sidebar-abonents-nav .nav-link > i.nav-icon {
    margin: 0 !important;
    width: auto !important;
}
/* Скрыть expand-toggle стрелку у папок в collapsed */
body.sidebar-collapse .sidebar-abonents-nav .nav-link > p > .right {
    display: none !important;
}
/* Treeview — скрыть полностью в collapsed (показываются на hover в AdminLTE) */
body.sidebar-collapse .sidebar-abonents-nav .nav-treeview {
    display: none !important;
}

/* ═══ build 692/704: НЕТ hover-expand. Sidebar остаётся узким при наведении,
   AdminLTE по умолчанию пытается развернуть его — блокируем width на 4.6rem.
   build 704: добавил `.main-sidebar.sidebar-focused:hover` для случая
   когда AdminLTE добавляет sidebar-focused при hover/click. ═══ */
body.sidebar-collapse.sidebar-mini-expand-on-hover .main-sidebar:hover,
body.sidebar-collapse .main-sidebar:hover,
body.sidebar-collapse .main-sidebar.sidebar-focused,
body.sidebar-collapse .main-sidebar.sidebar-focused:hover {
    width: 4.6rem !important;
}
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .sidebar-cta-btn {
    width: 36px !important;
    padding: 8px 0 !important;
    border-radius: 50% !important;
}
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .sidebar-cta-btn > span,
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .sidebar-section-label,
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .sidebar-tree-label,
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .sidebar-quicknav-link p,
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .nav-link > p {
    display: none !important;
}
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .sidebar-quicknav-link,
body.sidebar-collapse .main-sidebar:hover .sidebar-abonents-nav .nav-link {
    justify-content: center !important;
    text-align: center;
    padding: 8px 0 !important;
}

/* ═══ build 704: ROOT-CAUSE — AdminLTE применяет `opacity: 0` к содержимому
   .nav-link при sidebar-collapse, но иконки .nav-icon должны остаться видимы.
   Перебиваем всё с !important и явным opacity: 1. ═══ */
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link,
body.sidebar-collapse .sidebar-abonents-nav .nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 6px 0 !important;
    min-height: 38px !important;
    border-radius: 0;
    transition: background-color .15s;
    opacity: 1 !important;
    transform: none !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link:hover,
body.sidebar-collapse .sidebar-abonents-nav .nav-link:hover {
    background: rgba(67, 183, 122, .15) !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link:hover .nav-icon,
body.sidebar-collapse .sidebar-abonents-nav .nav-link:hover > i.nav-icon {
    color: var(--brand-primary, #43b77a) !important;
    opacity: 1 !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link.active,
body.sidebar-collapse .sidebar-abonents-nav .nav-link.active {
    background: rgba(67, 183, 122, .22) !important;
    box-shadow: inset 3px 0 0 var(--brand-primary, #43b77a);
}
/* Иконки — ВСЕГДА видимы, opacity:1, размер 18px по центру.
   AdminLTE по умолчанию ставит opacity:0 на .nav-link content при collapse. */
body.sidebar-collapse .sidebar-abonents-nav .sidebar-quicknav-link .nav-icon,
body.sidebar-collapse .sidebar-abonents-nav .nav-link > i.nav-icon,
body.sidebar-collapse .sidebar-abonents-nav .nav-link > i.fas,
body.sidebar-collapse .sidebar-abonents-nav .nav-link > i.far {
    opacity: .85 !important;
    visibility: visible !important;
    transform: none !important;
    font-size: 1.1rem !important;
    width: 22px !important;
    height: 22px;
    line-height: 22px;
    text-align: center;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* Кружки leaf-items (последние абоненты) — тонкий контур, центр */
body.sidebar-collapse .sidebar-abonents-nav .nav-link i.far.fa-circle,
body.sidebar-collapse .sidebar-abonents-nav .nav-link i.fas.fa-circle {
    font-size: .7rem !important;
    opacity: .6;
    width: 12px !important;
    height: 12px;
    line-height: 12px;
}
body.sidebar-collapse .sidebar-abonents-nav .nav-link:hover i.far.fa-circle,
body.sidebar-collapse .sidebar-abonents-nav .nav-link:hover i.fas.fa-circle {
    opacity: 1;
}
/* Разделитель между секциями (РАЗДЕЛЫ / ПАПКИ / НЕДАВНИЕ) — тонкая линия */
body.sidebar-collapse .sidebar-abonents-nav .sidebar-tree-label {
    display: block !important;
    visibility: hidden;
    margin: 6px 8px !important;
    border-top: 1px solid rgba(255, 255, 255, .08);
    height: 1px;
    padding: 0 !important;
    overflow: hidden;
}

/* ═══ build 699: collapsed-режим — полировка по фидбеку admin ═══ */

/* Скрыть блок «Недавние» в свёрнутом виде (admin: «Недавние не показывать») */
body.sidebar-collapse .sidebar-recent-nav,
body.sidebar-collapse .sidebar-abonents-nav .sidebar-recent-section {
    display: none !important;
}

/* CTA-кнопка «Новый абонент» в свёрнутом виде — размер как у иконок-навигации (не больше) */
body.sidebar-collapse .sidebar-abonents-nav .sidebar-cta-row {
    padding: 4px 0 !important;
    text-align: center;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-cta-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
body.sidebar-collapse .sidebar-abonents-nav .sidebar-cta-btn > i {
    font-size: 1.05rem !important;
    margin: 0 !important;
}

/* Горизонтальные тултипы при hover на иконку в свёрнутом виде.
   Используем стандартные title-атрибуты + CSS ::after на :hover.
   Реализуем через JS ниже — здесь только стиль tooltip. */
.smit-collapsed-tooltip {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #1f2227;
    color: #e7eaf0;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: .8rem;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    z-index: 10010;
    pointer-events: none;
    border: 1px solid #3a3f47;
}
.smit-collapsed-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #1f2227;
}
body.dark-theme .smit-collapsed-tooltip,
[data-bs-theme="dark"] .smit-collapsed-tooltip {
    background: #2a2f37;
    border-color: #4a5057;
}
body.dark-theme .smit-collapsed-tooltip::before,
[data-bs-theme="dark"] .smit-collapsed-tooltip::before {
    border-right-color: #2a2f37;
}

/* build 700: Вложенные меню (treeview) в свёрнутом виде — flyout-стиль.
   Используем JS-driven body-level контейнер .smit-flyout с position:fixed,
   потому что .sidebar имеет overflow-x:hidden !important (строка 310) которое
   нельзя обнулить без поломок прокрутки. JS клонирует <ul.nav-treeview> в
   body на mouseenter, удаляет на mouseleave. */
body.sidebar-collapse .main-sidebar .nav-treeview { display: none !important; }

.smit-flyout-menu {
    position: fixed;
    min-width: 220px;
    background: #1f2227;
    border: 1px solid #3a3f47;
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
    z-index: 10005;
    padding: 4px 0;
    border-radius: 0 6px 6px 0;
    list-style: none;
    margin: 0;
}
.smit-flyout-menu .nav-item { list-style: none; }
.smit-flyout-menu .nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 8px 14px !important;
    text-align: left !important;
    font-size: .85rem !important;
    color: #d0d3d8 !important;
    text-decoration: none;
    line-height: 1.3;
}
.smit-flyout-menu .nav-link p {
    display: inline-block !important;
    margin: 0 !important;
}
.smit-flyout-menu .nav-link i.nav-icon,
.smit-flyout-menu .nav-link i.fas,
.smit-flyout-menu .nav-link i.far {
    margin-right: 10px !important;
    width: 16px !important;
    font-size: .9rem !important;
    text-align: center;
}
.smit-flyout-menu .nav-link:hover {
    background: rgba(67, 183, 122, .15) !important;
    color: #fff !important;
}
.smit-flyout-menu .nav-link.active {
    background: rgba(67, 183, 122, .22) !important;
    color: #fff !important;
}
body.dark-theme .smit-flyout-menu,
[data-bs-theme="dark"] .smit-flyout-menu {
    background: #2a2f37;
    border-color: #4a5057;
}
body:not(.dark-theme) .smit-flyout-menu {
    background: #fff;
    border-color: #dee2e6;
    color: #212529;
}
body:not(.dark-theme) .smit-flyout-menu .nav-link {
    color: #495057 !important;
}
body:not(.dark-theme) .smit-flyout-menu .nav-link:hover {
    background: rgba(67, 183, 122, .12) !important;
    color: #0d6efd !important;
}

body.sidebar-collapse .main-sidebar .nav-sidebar .nav-item.has-treeview { position: relative; }
/* ═══ build 692: убрать визуальный вертикальный скроллбар в сайдбаре ═══
   admin: «в сайдбар меню отображается скроллбар. так быть не должно».
   Сохраняем функциональность скролла, но прячем толстую полосу. */
.main-sidebar .os-scrollbar,
.main-sidebar .os-scrollbar-handle {
    /* OverlayScrollbars — приглушённый, авто-скрытие */
    opacity: .25 !important;
    transition: opacity .2s;
}
.main-sidebar:hover .os-scrollbar { opacity: .55 !important; }
.main-sidebar .sidebar::-webkit-scrollbar { width: 4px; }
.main-sidebar .sidebar::-webkit-scrollbar-track { background: transparent; }
.main-sidebar .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .08);
    border-radius: 2px;
}
.main-sidebar:hover .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .22);
}
.main-sidebar .sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .12) transparent;
}

/* Build 643+: те же правила применяются когда main-sidebar реально узкий
   (например auto-collapse на tablet 768-991px без класса sidebar-collapse).
   Используем атрибутный селектор + max-width на контейнере. AdminLTE при
   collapse даёт sidebar ширину ~4.6rem (~74px). Если sidebar < 100px —
   точно collapsed. */
.main-sidebar:not(:hover) {
    /* container query — но fallback через :has если поддерживается */
}
/* Build 643: body.sidebar-narrow выставляется JS-ResizeObserver когда sidebar < 200px.
   Покрывает все случаи когда sidebar узкий, независимо от того есть ли .sidebar-collapse */
body.sidebar-narrow .sidebar-abonents-nav .sidebar-cta-btn > span,
body.sidebar-narrow .sidebar-abonents-nav .sidebar-section-label,
body.sidebar-narrow .sidebar-abonents-nav .sidebar-tree-label,
body.sidebar-narrow .sidebar-abonents-nav .sidebar-quicknav-link p,
body.sidebar-narrow .sidebar-abonents-nav .nav-link > p {
    display: none !important;
}
body.sidebar-narrow .sidebar-abonents-nav .sidebar-cta-row {
    padding: 8px 6px !important;
}
body.sidebar-narrow .sidebar-abonents-nav .sidebar-cta-btn {
    padding: 8px 0 !important;
    min-width: 36px;
    width: 36px !important;
    height: 36px;
    border-radius: 50%;
    margin: 0 auto;
}
body.sidebar-narrow .sidebar-abonents-nav .sidebar-cta-btn > i {
    margin: 0 !important;
}
body.sidebar-narrow .sidebar-abonents-nav .sidebar-quicknav-link {
    padding: 10px 0 !important;
    justify-content: center !important;
}
body.sidebar-narrow .sidebar-abonents-nav .sidebar-quicknav-link .nav-icon {
    margin: 0 !important;
    width: auto !important;
    font-size: 1.05rem !important;
}
body.sidebar-narrow .sidebar-abonents-nav .nav-link {
    padding: 8px 0 !important;
    text-align: center;
    justify-content: center;
}
body.sidebar-narrow .sidebar-abonents-nav .nav-link > i.nav-icon {
    margin: 0 !important;
    width: auto !important;
}
body.sidebar-narrow .sidebar-abonents-nav .nav-link > p > .right {
    display: none !important;
}
body.sidebar-narrow .sidebar-abonents-nav .nav-treeview {
    display: none !important;
}

/* Build 644: Sidebar — убираем горизонтальный скролл и делаем вертикальный почти невидимым */
.main-sidebar,
.main-sidebar .sidebar,
.main-sidebar .nav-sidebar,
.main-sidebar .sidebar-abonents-nav,
.main-sidebar .sidebar-main-nav {
    overflow-x: hidden !important;
}
/* Длинные имена папок — обрезаем многоточием вместо horizontal-scroll */
.main-sidebar .nav-link > p,
.main-sidebar .sidebar-abonents-nav .nav-link > p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
/* Стилизация вертикального скроллбара — едва заметный, на hover чуть ярче */
.main-sidebar::-webkit-scrollbar,
.main-sidebar .sidebar::-webkit-scrollbar {
    width: 4px;
    height: 0;
}
.main-sidebar::-webkit-scrollbar-track,
.main-sidebar .sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.main-sidebar::-webkit-scrollbar-thumb,
.main-sidebar .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .08);
    border-radius: 2px;
    transition: background-color .2s;
}
.main-sidebar:hover::-webkit-scrollbar-thumb,
.main-sidebar .sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .22);
}
.main-sidebar::-webkit-scrollbar-thumb:hover,
.main-sidebar .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .35);
}
/* Firefox */
.main-sidebar,
.main-sidebar .sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .12) transparent;
}
.main-sidebar:hover,
.main-sidebar .sidebar:hover {
    scrollbar-color: rgba(255, 255, 255, .25) transparent;
}

/* Light theme tweaks for sticky CTA */
body.light-theme .sidebar-abonents-nav .sidebar-cta-row {
    background: linear-gradient(180deg, rgba(20, 27, 35, .98) 0%, rgba(20, 27, 35, .92) 100%);
}

/* ═══════════════════════════════════════════════════════════════════════
   A11Y: UX-аудит build 261 — Sprint 1
   P0-3 focus-visible · P0-2 colour independence · Time-2 prefers-reduced-motion
   P1-3 word-break · P1-4 dark contrast · P1-7 button labels · P0-1 bulk modal
   ═══════════════════════════════════════════════════════════════════════ */

/* P0-3: видимый focus для клавиатурной навигации */
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.page-link:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
a:focus-visible,
.card-tools .btn:focus-visible,
.tariff-type-btn:focus-visible,
.fin-type-btn:focus-visible {
    outline: 2px solid #43b77a !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, 0.25) !important;
    z-index: 5;
}
.select2-container--default.select2-container--focus .select2-selection {
    outline: 2px solid #43b77a !important;
    outline-offset: 1px !important;
}
.nav-tabs .nav-link:focus-visible,
.nav-pills .nav-link:focus-visible {
    outline: 2px solid #43b77a !important;
    outline-offset: -2px !important;
}

/* P1-3: длинные имена в Top-debtors */
.top-debtors-list .debtor-name,
.top-debtors-list td:nth-child(2),
#top-debtors td:nth-child(2),
.dashboard-list .item-name {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}

/* Build 289 P0-2 + Build 600 фикс: иконки направления для финопераций.
   Раньше иконка рендерилась только через CSS ::before. С build 289+
   шаблон operations_inline.html сам рисует <i class="fa-arrow-down/up">
   с aria-label — это правильнее (доступно screen-reader'ам). Здесь ::before
   оставляем ТОЛЬКО для legacy-классов .fin-amount-positive/-negative
   (используются в LK/dashboard где нет inline-иконки), но НЕ для
   .ops-income/.ops-expense — там получался дубль ↓↓ или ↑↑. */
.fin-amount-positive::before {
    content: "\f063";
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    margin-right: 4px;
    font-size: 0.85em;
    color: #28a745;
}
.fin-amount-negative::before {
    content: "\f062";
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    margin-right: 4px;
    font-size: 0.85em;
    color: #dc3545;
}

/* P1-4: контраст текста на ECharts в тёмной теме */
body.dark-theme .echarts-tooltip,
body.dark-theme .chart-axis-label {
    color: #a8b8cc !important;
}

/* Time-2 + a11y-motion-sensitivity */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .echarts-container,
    [_echarts_instance_] {
        animation: none !important;
    }
    .main-header {
        animation: none !important;
        background-position: 0 0 !important;
    }
    .small-box:hover,
    .info-box:hover,
    .stat-card:hover {
        transform: none !important;
    }
}

/* P1-7: текст рядом с иконкой на широких экранах */
@media (min-width: 992px) {
    .tariff-type-btn .btn-label,
    .fin-type-btn .btn-label {
        display: inline-block;
        margin-left: 4px;
        font-size: 0.85em;
    }
}
@media (max-width: 991.98px) {
    .tariff-type-btn .btn-label,
    .fin-type-btn .btn-label {
        display: none;
    }
}

/* P0-1: bulk-action confirmation modal */
.bulk-confirm-modal .modal-body .alert-warning {
    border-left: 4px solid #ffc107;
}
.bulk-confirm-modal .preview-list {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.875rem;
    background: rgba(0,0,0,0.04);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}
body.dark-theme .bulk-confirm-modal .preview-list {
    background: rgba(255,255,255,0.06);
}
.bulk-confirm-modal .confirm-input {
    font-family: "Courier New", monospace;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════════════════
   UX AUDIT — Spring 2026, build 408
   Единая система компонентов на design tokens.
   Применяется ко всем страницам админки автоматически.
   Источник: dev_reports/Отчёты/2026-04-30_UX_аудит_полный_прогон_build408.md
   ═══════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1. Skip-link (WCAG 2.4.1 Bypass Blocks)
   ───────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100px;
    left: 8px;
    z-index: 10000;
    background: var(--brand-primary);
    color: #fff !important;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: top .15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: 8px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   2. Унифицированные статус-бейджи
   .smit-badge — единый компонент.
   Используется через пары
       .smit-badge.is-success / .is-warning / .is-danger / .is-info / .is-neutral
   Цветовая независимость: иконка + текст — не только цвет.
   ───────────────────────────────────────────── */
.smit-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    white-space: nowrap;
    vertical-align: middle;
    letter-spacing: 0.01em;
}
.smit-badge.is-success {
    color: #1a6b46;
    background: #d4edda;
    border-color: #b8e0c4;
}
.smit-badge.is-warning {
    color: #7a4f0d;
    background: #fff3cd;
    border-color: #ffe1a8;
}
.smit-badge.is-danger {
    color: #842029;
    background: #f8d7da;
    border-color: #f1aeb5;
}
.smit-badge.is-info {
    color: #084056;
    background: #cff4fc;
    border-color: #9eeaf9;
}
.smit-badge.is-neutral {
    color: var(--text-secondary);
    background: var(--surface-muted);
    border-color: var(--border-subtle);
}
body.dark-theme .smit-badge.is-success {
    color: #7fd9a0;
    background: rgba(40, 167, 69, .18);
    border-color: rgba(40, 167, 69, .35);
}
body.dark-theme .smit-badge.is-warning {
    color: #ffd476;
    background: rgba(240, 173, 78, .18);
    border-color: rgba(240, 173, 78, .35);
}
body.dark-theme .smit-badge.is-danger {
    color: #ff9aa0;
    background: rgba(224, 85, 85, .20);
    border-color: rgba(224, 85, 85, .40);
}
body.dark-theme .smit-badge.is-info {
    color: #6ed4ec;
    background: rgba(91, 192, 222, .18);
    border-color: rgba(91, 192, 222, .35);
}
body.dark-theme .smit-badge.is-neutral {
    color: var(--text-secondary);
    background: var(--surface-muted);
    border-color: var(--border-subtle);
}

/* ─────────────────────────────────────────────
   3. Унифицированные чипы фильтров
   .smit-chip-row — обёртка
   .smit-chip — кнопка-фильтр (нажимается, активна)
   ───────────────────────────────────────────── */
.smit-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}
.smit-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    -webkit-user-select: none;
    user-select: none;
    line-height: 1.4;
    font-weight: 500;
}
.smit-chip:hover {
    color: var(--brand-primary-dark);
    border-color: var(--brand-primary);
    background: color-mix(in srgb, var(--brand-primary) 6%, var(--surface-card));
}
.smit-chip.is-active,
.smit-chip[aria-pressed="true"] {
    color: #fff;
    background: var(--brand-primary);
    border-color: var(--brand-primary-dark);
}
.smit-chip:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
}
body.dark-theme .smit-chip {
    color: var(--text-secondary);
    background: var(--surface-card);
    border-color: var(--border-default);
}

/* ─────────────────────────────────────────────
   4. Toolbar-pattern — единый header для всех
   списков (уже использовался в search.html, finops_list,
   accounts_list — теперь общий компонент).
   ───────────────────────────────────────────── */
.smit-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-toolbar);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-3);
}
.smit-toolbar h1,
.smit-toolbar h2,
.smit-toolbar h3,
.smit-toolbar .smit-toolbar-title {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.smit-toolbar .smit-toolbar-spacer { flex: 1 1 auto; }
body.dark-theme .smit-toolbar {
    background: var(--surface-toolbar);
    border-color: var(--border-subtle);
}

/* ─────────────────────────────────────────────
   5. Stat-cards (мини-карточки KPI в шапке списка)
   Применяются вместо разрозненных h4/.badge.
   ───────────────────────────────────────────── */
.smit-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.smit-stat {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 6px 12px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    min-width: 90px;
    line-height: 1.2;
}
.smit-stat .stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.smit-stat .stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}
.smit-stat.is-success .stat-value { color: var(--status-success); }
.smit-stat.is-warning .stat-value { color: var(--status-warning); }
.smit-stat.is-danger  .stat-value { color: var(--status-danger);  }

/* ─────────────────────────────────────────────
   6. Единые AJAX loading-states
   .smit-loading — overlay для container
   .smit-skeleton — placeholder для row
   ───────────────────────────────────────────── */
.smit-loading {
    position: relative;
    min-height: 80px;
    pointer-events: none;
}
.smit-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.6);
    border-radius: inherit;
    z-index: 1;
}
body.dark-theme .smit-loading::after {
    background: rgba(20,22,28,.55);
}
.smit-loading::before {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 28px; height: 28px;
    border: 3px solid rgba(67,183,122,.15);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: smit-spin 0.7s linear infinite;
    z-index: 2;
}
@keyframes smit-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .smit-loading::before { animation: none; }
}
.smit-skeleton {
    display: inline-block;
    height: 1em;
    background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.10) 50%, rgba(0,0,0,.06) 75%);
    background-size: 200% 100%;
    animation: smit-shine 1.4s ease-in-out infinite;
    border-radius: var(--radius-xs);
    min-width: 60px;
}
body.dark-theme .smit-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.10) 50%, rgba(255,255,255,.05) 75%);
}
@keyframes smit-shine {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .smit-skeleton { animation: none; }
}

/* ─────────────────────────────────────────────
   7. Mobile touch targets (WCAG 2.5.5 AAA — min 44×44)
   Не меняем размеры через !important — только обеспечиваем
   минимум через padding.
   ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .smit-chip,
    .head-navbar .btn,
    .ops-toolbar .btn,
    .filter-bar .btn,
    button.btn-sm,
    .btn-group-sm > .btn {
        min-height: 38px;
    }
    .smit-chip { padding: 8px 14px; }
}

/* ─────────────────────────────────────────────
   8. Унифицированные модалки
   Все модалки SmitBilling должны использовать одинаковую
   шапку, padding, footer.  Это покрывает 12+ модалок (FinOps,
   Users, Uslugi/Bonus, Tarif, NAS Online, и т.д.)
   ───────────────────────────────────────────── */
.modal-content {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-3) var(--space-4);
}
.modal-header .modal-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.modal-body { padding: var(--space-4); }
.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-3) var(--space-4);
    gap: var(--space-2);
}
body.dark-theme .modal-content {
    background-color: var(--surface-card);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}
body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    border-color: var(--border-subtle);
}

/* ─────────────────────────────────────────────
   9. Empty state — единый паттерн
   ───────────────────────────────────────────── */
.smit-empty {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--text-muted);
}
.smit-empty .empty-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: var(--space-3);
}
.smit-empty .empty-title {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
    font-weight: 600;
}
.smit-empty .empty-hint {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────
   10. Унификация отступов между card-body, table, list
       — устраняет «двойные паддинги» наблюдаемые в
       /admin/Abonents/<id>/ и /admin/welcome/
   ───────────────────────────────────────────── */
.card > .card-body > .table:last-child,
.card > .card-body > .list-group:last-child { margin-bottom: 0; }
.card-header > h5, .card-header > h6 { margin: 0; }

/* ─────────────────────────────────────────────
   11. Глобальный focus-visible для всех интерактивов
       (расширяет правила build 261 на новые селекторы:
       .smit-chip, .smit-stat, ссылки в таблицах списков)
   ───────────────────────────────────────────── */
.smit-chip:focus-visible,
.smit-stat:focus-visible,
.tab-content a:focus-visible,
.modal-content [tabindex]:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ─────────────────────────────────────────────
   12. Унификация tooltip'ов и popper'ов
   ───────────────────────────────────────────── */
.tooltip-inner {
    background: #1a1d23;
    color: #fff;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    box-shadow: var(--shadow-md);
}
.bs-tooltip-top .tooltip-arrow::before { border-top-color: #1a1d23; }
.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: #1a1d23; }
.bs-tooltip-end .tooltip-arrow::before { border-right-color: #1a1d23; }
.bs-tooltip-start .tooltip-arrow::before { border-left-color: #1a1d23; }

/* ─────────────────────────────────────────────
   13. ARIA-live region для AJAX-нотификаций
   (использовать для статуса bulk-actions, save в модалках)
   ───────────────────────────────────────────── */
.smit-sr-only,
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─────────────────────────────────────────────
   14. AdminAccounts/Tarif/Usluga list — унификация
   высот строк и hover'а (раньше пять разных стилей)
   ───────────────────────────────────────────── */
table.smit-table tbody tr {
    transition: background .12s ease;
}
table.smit-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-primary) 5%, transparent);
}
body.dark-theme table.smit-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
}
table.smit-table th {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 12px;
}
table.smit-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════════════
   END UX AUDIT 2026-04-30
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════
   build 455 — UX Day 2 — единый компонент `.smit-kpi`

   Унифицирует .ip-kpi-card (IpPull) / .vp-kpi-card (VLAN) / .dbc-stat
   (DbCleanup) / .nas-kpi (NAS list). Структура:

     <button class="smit-kpi smit-kpi--ok" aria-pressed="true">
       <i class="smit-kpi__icon fas fa-check-circle"></i>
       <div class="smit-kpi__num">42</div>
       <div class="smit-kpi__lbl">Активных</div>
     </button>

   Modifiers (по семантике состояния, не цвету):
     .smit-kpi--ok       — норма / зелёный
     .smit-kpi--warn     — предупреждение / оранжевый
     .smit-kpi--danger   — критично / красный
     .smit-kpi--info     — нейтральная инфо / голубой
     .smit-kpi--muted    — totals / серый

   Используются токены --smit-state-* (build 454).
   ═══════════════════════════════════════════════════════════════════════ */

.smit-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .5rem;
    margin-bottom: .75rem;
}

.smit-kpi {
    padding: .55rem .75rem;
    border-radius: .4rem;
    border: 1px solid #e9ecef;
    background: #fff;
    color: inherit;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    text-align: left;
    position: relative;
    min-height: 60px;
    display: block;
}
.smit-kpi:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.smit-kpi[aria-pressed="true"] {
    box-shadow: 0 0 0 2px rgba(67,183,122,.4);
    border-color: var(--brand-primary, #43b77a);
}

.smit-kpi__icon {
    position: absolute;
    top: .55rem;
    right: .75rem;
    font-size: 1.05rem;
    opacity: .55;
}
.smit-kpi__num {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.smit-kpi__lbl {
    font-size: .78em;
    color: var(--text-muted, #6c757d);
    margin-top: .2rem;
}
.smit-kpi__extra {
    font-size: .85em;
    color: var(--text-muted, #6c757d);
    margin-top: .15rem;
}

/* Цветовые варианты по семантике */
.smit-kpi--ok      { background: #d1e7dd; border-color: #a3cfbb; }
.smit-kpi--ok      .smit-kpi__num    { color: #0a3622; }
.smit-kpi--warn    { background: #fff3cd; border-color: #ffe69c; }
.smit-kpi--warn    .smit-kpi__num    { color: #664d03; }
.smit-kpi--danger  { background: #f8d7da; border-color: #f1aeb5; }
.smit-kpi--danger  .smit-kpi__num    { color: #58151c; }
.smit-kpi--info    { background: #cff4fc; border-color: #9eeaf9; }
.smit-kpi--info    .smit-kpi__num    { color: #055160; }
.smit-kpi--muted   { background: #f8f9fa; border-color: #dee2e6; }

/* Dark theme */
[data-bs-theme="dark"] .smit-kpi { background: #1e2024; border-color: #2a2f37; }
[data-bs-theme="dark"] .smit-kpi__lbl, [data-bs-theme="dark"] .smit-kpi__extra { color: #a8b8cc; }
[data-bs-theme="dark"] .smit-kpi--ok      { background: #0f3a26; border-color: #185a3a; }
[data-bs-theme="dark"] .smit-kpi--ok      .smit-kpi__num   { color: #a3cfbb; }
[data-bs-theme="dark"] .smit-kpi--warn    { background: #3a2e10; border-color: #5a4715; }
[data-bs-theme="dark"] .smit-kpi--warn    .smit-kpi__num   { color: #ffe69c; }
[data-bs-theme="dark"] .smit-kpi--danger  { background: #3a161a; border-color: #5a232a; }
[data-bs-theme="dark"] .smit-kpi--danger  .smit-kpi__num   { color: #f1aeb5; }
[data-bs-theme="dark"] .smit-kpi--info    { background: #0a3a44; border-color: #155a6a; }
[data-bs-theme="dark"] .smit-kpi--info    .smit-kpi__num   { color: #9eeaf9; }
[data-bs-theme="dark"] .smit-kpi--muted   { background: #2a2f37; border-color: #353940; }

/* Mobile */
@media (max-width: 480px) {
    .smit-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .smit-kpi__num { font-size: 1.25rem; }
}

/* a11y */
@media (prefers-reduced-motion: reduce) {
    .smit-kpi { transition: none; }
    .smit-kpi:hover { transform: none; }
}

/* ============================================================
   AdminAccounts (build 473) — список + модалка с 5 вкладками
   План: dev_reports/Планы/2026-05-07_План_UX_AdminAccounts_модалки.md
   ============================================================ */

/* === список === */
.acc-page .acc-tbl th { font-size: .84em; white-space: nowrap; }
.acc-page .acc-tbl td { font-size: .88em; vertical-align: middle; }
.acc-page .acc-tbl tr.row-debt    td { background: rgba(220,53,69,.08); }
.acc-page .acc-tbl tr.row-orphan  td { background: rgba(108,117,125,.06); }
.acc-page .acc-tbl tr.row-selected td { background: rgba(67,183,122,.10); }
.acc-page .acc-tbl tr:hover td { cursor: pointer; }
.acc-page .acc-tbl .bal-neg  { color: var(--status-danger, #dc3545); font-weight: 600; }
.acc-page .acc-tbl .bal-pos  { color: var(--status-success, #43b77a); }
.acc-page .acc-tbl .bal-zero { color: var(--text-muted, #6c757d); }

.acc-page .acc-col-chk { width: 30px; }
.acc-page .acc-col-id  { width: 64px; }
.acc-page .acc-col-act { width: 60px; }
.acc-page .acc-search-wrap { max-width: 280px; }
.acc-page .acc-perpage { width: auto; }

.acc-page .acc-th-sort { -webkit-user-select: none; -moz-user-select: none; user-select: none; cursor: pointer; }
.acc-page .acc-th-sort .sort-icon { color: var(--text-muted, #6c757d); font-size: .8em; margin-left: 2px; }

.acc-page tr.acc-row-flash td { animation: accRowFlash 1.5s ease-out; }
@keyframes accRowFlash {
    0%   { background: rgba(67,183,122,.35); }
    100% { background: transparent; }
}

/* dark theme — список */
[data-bs-theme="dark"] .acc-page .acc-tbl tr.row-debt   td { background: rgba(180,40,40,.18); }
[data-bs-theme="dark"] .acc-page .acc-tbl tr.row-orphan td { background: rgba(80,80,80,.18); }
[data-bs-theme="dark"] .acc-page .acc-tbl tr.row-selected td { background: rgba(67,183,122,.18); }
body.dark-theme .acc-page .acc-tbl tr.row-debt   td { background: rgba(180,40,40,.18); }
body.dark-theme .acc-page .acc-tbl tr.row-orphan td { background: rgba(80,80,80,.18); }

/* infinite scroll sentinel — невидимый элемент для IntersectionObserver */
.acc-scroll-sentinel { height: 1px; width: 100%; }

/* Toolbar row: поиск + кнопки в одну линию (поиск растягивается, кнопки справа) */
.acc-search-row {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}
.acc-search-row .acc-search-wrap {
    flex: 1 1 auto;
    min-width: 200px;
    max-width: none;
}
.acc-search-row .acc-toolbar-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}
@media (max-width: 575px) {
    .acc-search-row { flex-wrap: wrap; }
    .acc-search-row .acc-search-wrap { flex: 1 1 100%; min-width: 0; }
}

/* === bulk toolbar === */
.acc-bulk-toolbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 12px; margin-bottom: 8px;
    background: linear-gradient(180deg, rgba(67,183,122,.10), rgba(67,183,122,.04));
    border: 1px solid rgba(67,183,122,.35);
    border-radius: 6px;
}
.acc-bulk-toolbar .acc-bulk-count { font-size: .9em; color: var(--text-muted, #6c757d); }
.acc-bulk-toolbar .acc-bulk-count strong { color: var(--brand-primary, #43b77a); }

[data-bs-theme="dark"] .acc-bulk-toolbar {
    background: linear-gradient(180deg, rgba(67,183,122,.18), rgba(67,183,122,.06));
    border-color: rgba(67,183,122,.45);
}

/* === модалка === */
.acc-modal-header {
    background: linear-gradient(90deg, rgba(67,183,122,.12), transparent);
}
.acc-modal-header .acc-modal-balance-badge {
    margin-left: 12px; padding: 2px 10px; border-radius: 14px;
    font-size: .82em; font-weight: 600; vertical-align: middle;
    background: rgba(108,117,125,.15); color: var(--text-muted, #6c757d);
}
.acc-modal-header .acc-modal-balance-badge.is-pos {
    background: rgba(67,183,122,.18); color: #2d8a5a;
}
.acc-modal-header .acc-modal-balance-badge.is-neg {
    background: rgba(220,53,69,.18); color: #b3344a;
}
[data-bs-theme="dark"] .acc-modal-header .acc-modal-balance-badge.is-pos { color: #6fdb9c; }
[data-bs-theme="dark"] .acc-modal-header .acc-modal-balance-badge.is-neg { color: #f08593; }

.acc-main-wrap {
    display: flex; min-height: 520px;
}
.acc-side-nav {
    flex: 0 0 220px; border-right: 1px solid var(--border-default, #dee2e6);
    background: rgba(0,0,0,.02); padding: 8px 0;
    display: flex; flex-direction: column;
}
[data-bs-theme="dark"] .acc-side-nav {
    background: rgba(255,255,255,.02);
    border-right-color: #2a2f37;
}
.acc-side-nav .acc-tab {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border: 0; background: transparent;
    color: inherit; text-align: left; cursor: pointer;
    border-left: 3px solid transparent;
    font-size: .92em; transition: background .15s;
}
.acc-side-nav .acc-tab:hover {
    background: rgba(67,183,122,.08);
}
.acc-side-nav .acc-tab:focus-visible {
    outline: 2px solid var(--brand-primary, #43b77a);
    outline-offset: -2px;
}
.acc-side-nav .acc-tab.is-active {
    background: rgba(67,183,122,.14);
    border-left-color: var(--brand-primary, #43b77a);
    font-weight: 600;
}
.acc-side-nav .acc-tab-num {
    display: inline-block; min-width: 22px; height: 22px; line-height: 22px; text-align: center;
    border-radius: 50%; background: rgba(0,0,0,.08); color: inherit;
    font-size: .76em; font-weight: 600;
}
.acc-side-nav .acc-tab.is-active .acc-tab-num {
    background: var(--brand-primary, #43b77a); color: #fff;
}
.acc-side-nav .acc-tab-lbl { flex: 1 1 auto; }
.acc-side-nav .acc-tab-counter { font-size: .68em; }

.acc-content {
    flex: 1 1 auto; padding: 16px 20px;
    overflow-y: auto;
}
.acc-section[hidden] { display: none !important; }
.acc-section.is-active { display: block; }

.acc-card {
    background: var(--bg-elevated, #fff);
    border: 1px solid var(--border-default, #dee2e6);
    border-radius: 6px; padding: 14px 16px; margin-bottom: 14px;
}
[data-bs-theme="dark"] .acc-card {
    background: #1f242b; border-color: #2a2f37;
}
.acc-card-title {
    font-size: .92em; font-weight: 600; margin-bottom: 10px;
    color: var(--brand-primary, #43b77a);
}
.acc-card-title i { margin-right: 4px; }

.acc-error-banner {
    padding: 10px 14px; margin-bottom: 12px;
    background: rgba(220,53,69,.12); color: #b3344a;
    border: 1px solid rgba(220,53,69,.35); border-radius: 6px;
    font-size: .92em;
}
[data-bs-theme="dark"] .acc-error-banner { color: #f08593; }

/* === вкладка Баланс === */
.acc-balance-hero {
    text-align: center; padding: 16px 12px 20px;
    background: linear-gradient(180deg, rgba(67,183,122,.08), transparent);
    border-radius: 8px; margin-bottom: 14px;
}
.acc-balance-big {
    font-size: 2.6rem; font-weight: 700; line-height: 1.1;
    margin-bottom: 6px;
}
.acc-balance-big.is-pos  { color: var(--status-success, #43b77a); }
.acc-balance-big.is-neg  { color: var(--status-danger, #dc3545); }
.acc-balance-big.is-zero { color: var(--text-muted, #6c757d); }
.acc-balance-formula {
    font-size: .82em; color: var(--text-muted, #6c757d);
    margin-bottom: 14px;
}
.acc-balance-actions {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.acc-balance-actions .btn { min-width: 140px; min-height: 44px; }

.acc-balance-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.acc-balance-cell {
    text-align: center; padding: 10px 8px;
    background: rgba(0,0,0,.02); border-radius: 4px;
    display: flex; flex-direction: column; gap: 4px;
}
[data-bs-theme="dark"] .acc-balance-cell { background: rgba(255,255,255,.03); }
.acc-balance-cell .lbl { font-size: .76em; color: var(--text-muted, #6c757d); text-transform: uppercase; letter-spacing: .03em; }
.acc-balance-cell .val { font-size: 1.05em; font-weight: 600; }

.acc-balance-notes { margin-top: 12px; font-size: .88em; }
.acc-balance-notes > div { margin-bottom: 4px; }

/* === вкладка ФинОпы === */
.acc-fops-tbl tr.fop-in  td.fop-sum { color: var(--status-success, #43b77a); font-weight: 600; }
.acc-fops-tbl tr.fop-out td.fop-sum { color: var(--status-danger, #dc3545); font-weight: 600; }
.acc-fops-tbl tr.fop-storno td { text-decoration: line-through; opacity: .65; }
.acc-fops-tbl .fop-descr { max-width: 280px; }

/* === вкладка Абоненты === */
.acc-ab-tbl .acc-main-badge { font-size: .72em; }

/* === вкладка Уведомления === */
.acc-msg-list { list-style: none; padding: 0; margin: 0; }
.acc-msg-item {
    border-bottom: 1px solid var(--border-default, #dee2e6);
    padding: 8px 0; font-size: .88em;
}
.acc-msg-item:last-child { border-bottom: 0; }
.acc-msg-head { display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }
.acc-msg-subject { font-weight: 600; }
.acc-msg-body { color: var(--text-muted, #6c757d); margin-top: 2px; }

/* === a11y === */
.acc-modal-header :focus-visible,
.acc-content :focus-visible {
    outline: 2px solid var(--brand-primary, #43b77a);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    tr.acc-row-flash td { animation: none; background: rgba(67,183,122,.18); }
    .acc-side-nav .acc-tab { transition: none; }
}

/* === mobile (≤768px) === */
@media (max-width: 768px) {
    .acc-page .acc-bulk-toolbar { padding: 6px 8px; }
    .acc-page .acc-tbl { font-size: .84em; }

    .acc-main-wrap { flex-direction: column; min-height: 0; }
    .acc-side-nav {
        flex: 0 0 auto; flex-direction: row; overflow-x: auto;
        border-right: 0; border-bottom: 1px solid var(--border-default, #dee2e6);
        padding: 4px 6px;
    }
    .acc-side-nav .acc-tab {
        flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent;
        padding: 8px 10px; white-space: nowrap;
    }
    .acc-side-nav .acc-tab.is-active {
        border-left: 0; border-bottom-color: var(--brand-primary, #43b77a);
    }
    .acc-side-nav .acc-tab-lbl { font-size: .9em; }

    .acc-content { padding: 12px; }
    .acc-balance-big { font-size: 2rem; }
    .acc-balance-grid { grid-template-columns: repeat(2, 1fr); }
    .acc-balance-actions .btn { flex: 1 1 auto; min-width: 0; }
}

@media (max-width: 480px) {
    .acc-balance-big { font-size: 1.7rem; }
    .acc-balance-actions { flex-direction: column; }
    .acc-balance-actions .btn { width: 100%; }
}

/* touch targets >=44px (a11y-touch-target-design) */
.acc-page .btn-sm { min-height: 32px; }
.acc-balance-actions .btn { min-height: 44px; }
.acc-side-nav .acc-tab { min-height: 44px; }

/* === payment_modal (Sprint 2) === */
.acc-pay-modal .acc-pay-header {
    background: linear-gradient(90deg, rgba(67,183,122,.10), transparent);
}
.acc-pay-modal .acc-pay-context {
    padding: 8px 12px; margin-bottom: 12px;
    background: rgba(0,0,0,.03); border-radius: 6px;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
[data-bs-theme="dark"] .acc-pay-modal .acc-pay-context { background: rgba(255,255,255,.04); }
.acc-pay-modal .acc-pay-current-bal { margin-left: auto; font-size: .92em; }

.acc-pay-modal .acc-pay-advanced summary {
    cursor: pointer; padding: 4px 0;
    -webkit-user-select: none; -moz-user-select: none; user-select: none;
}
.acc-pay-modal .acc-pay-advanced[open] summary { color: var(--brand-primary, #43b77a); }

.acc-pay-modal .acc-pay-preview {
    margin-top: 14px; padding: 10px 14px;
    background: linear-gradient(180deg, rgba(67,183,122,.08), rgba(67,183,122,.02));
    border: 1px solid rgba(67,183,122,.30); border-radius: 6px;
}
.acc-pay-modal .acc-pay-preview-row {
    display: flex; justify-content: space-between; padding: 3px 0;
}
.acc-pay-modal .acc-pay-preview-result {
    border-top: 1px dashed rgba(67,183,122,.40);
    margin-top: 6px; padding-top: 8px; font-size: 1.05em;
}
[data-bs-theme="dark"] .acc-pay-modal .acc-pay-preview {
    background: linear-gradient(180deg, rgba(67,183,122,.16), rgba(67,183,122,.04));
    border-color: rgba(67,183,122,.40);
}

@media (max-width: 480px) {
    .acc-pay-modal .acc-pay-context { flex-direction: column; align-items: flex-start; gap: 4px; }
    .acc-pay-modal .acc-pay-current-bal { margin-left: 0; }
}

/* === abonent_link_modal (Sprint 3) === */
.acc-link-results {
    margin-top: 8px;
    max-height: 280px; overflow-y: auto;
    border: 1px solid var(--border-default, #dee2e6);
    border-radius: 6px;
}
.acc-link-results:empty { display: none; }
[data-bs-theme="dark"] .acc-link-results { border-color: #2a2f37; }

.acc-link-result-item {
    display: block; width: 100%; text-align: left;
    padding: 8px 12px; border: 0;
    background: transparent; color: inherit;
    border-bottom: 1px solid var(--border-default, #dee2e6);
    cursor: pointer; transition: background .12s;
    min-height: 44px;
}
.acc-link-result-item:last-child { border-bottom: 0; }
.acc-link-result-item:hover { background: rgba(67,183,122,.08); }
.acc-link-result-item:focus-visible {
    outline: 2px solid var(--brand-primary, #43b77a);
    outline-offset: -2px;
}
.acc-link-result-item.is-selected {
    background: rgba(67,183,122,.18); font-weight: 600;
}
[data-bs-theme="dark"] .acc-link-result-item:hover { background: rgba(67,183,122,.14); }
[data-bs-theme="dark"] .acc-link-result-item.is-selected { background: rgba(67,183,122,.24); }
[data-bs-theme="dark"] .acc-link-result-item { border-bottom-color: #2a2f37; }

/* ═══════════════════════════════════════════════════════════════════
   SMIT mobile filter sheet — переиспользуемый паттерн (build 646)
   Кнопка-триггер «🎚 Фильтры» в mg-toolbar (видна только d-md-none)
   открывает offcanvas-bottom со всеми фильтрами раздела.
   Применяется в /admin/debtors/, можно переиспользовать в любом списке.
   ═══════════════════════════════════════════════════════════════════ */

/* Триггер «Фильтры» в toolbar (mobile-only через d-md-none на элементе) */
.smit-mobile-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
}
.smit-mobile-filter-trigger .smit-filter-count {
    background: var(--brand-primary, #43b77a);
    color: #fff;
    border-radius: 999px;
    padding: 0 8px;
    margin-left: 4px;
    font-size: 11px;
    line-height: 18px;
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Offcanvas bottom-sheet с фильтрами.

   Высота:
   - height: auto = адаптируется под контент
   - max-height: 90vh = почти весь экран при много фильтрах
   - min-height: 50vh = минимум места при коротком контенте (sheet не схлопывается)
   - .offcanvas-body растягивается и скроллится — много фильтров не страшно
*/
.smit-mobile-filter-sheet {
    /* build 772: высота подстраивается под контент (height:auto), но не больше 80vh.
       Раньше было height:80vh — короткие фильтры (1-2 секции) висели в полупустой панели. */
    height: auto !important;
    max-height: 80vh !important;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -8px 24px rgba(0,0,0,.18);
    display: flex !important;
    flex-direction: column;
}
/* Decorative drag-handle (визуальная подсказка свайпа) */
.smit-mobile-filter-sheet::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: var(--border-default, #dee2e6);
    border-radius: 999px;
    margin: 8px auto 0;
    flex-shrink: 0;
}
.smit-mobile-filter-sheet .offcanvas-header {
    padding: 8px 18px 12px;
    border-bottom: 1px solid var(--border-subtle, #dee2e6);
    flex-shrink: 0;
}
.smit-mobile-filter-sheet .offcanvas-title {
    font-size: 1rem; font-weight: 700;
    display: inline-flex; align-items: center; gap: 6px;
}
.smit-mobile-filter-sheet .offcanvas-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
}

/* Секция внутри sheet (заголовок + чипы или поля) */
.smit-sheet-section {
    border-bottom: 1px solid var(--border-subtle, #dee2e6);
    padding-bottom: 14px;
    margin-bottom: 14px;
}
.smit-sheet-section:last-of-type {
    border-bottom: 0;
    margin-bottom: 8px;
}
.smit-sheet-section h6 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted, #6c757d);
    margin-bottom: 10px;
    font-weight: 700;
    display: inline-flex; align-items: center; gap: 4px;
}

/* Чипы внутри sheet — крупнее (touch ≥44px) */
.smit-sheet-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.smit-sheet-chips .btn {
    min-height: 40px;
    padding: 8px 14px;
    font-size: .85rem;
    border-radius: 999px;
}
/* Active state для чипов в sheet (как в mg-chips) */
.smit-sheet-chips .btn.active,
.smit-sheet-chips .btn[aria-pressed="true"] {
    background: #198754 !important;
    color: #fff !important;
    border-color: #198754 !important;
}
.smit-sheet-chips .btn[data-flag="promise_pay"].active,
.smit-sheet-chips .btn[data-flag="promise_pay"][aria-pressed="true"] {
    background: #0dcaf0 !important; border-color: #0dcaf0 !important; color: #000 !important;
}
.smit-sheet-chips .btn[data-period="mid"].active,
.smit-sheet-chips .btn[data-period="old"].active {
    background: #b58105 !important; border-color: #b58105 !important;
}
.smit-sheet-chips .btn[data-period="chronic"].active {
    background: #dc3545 !important; border-color: #dc3545 !important;
}

/* Range inputs внутри sheet */
.smit-sheet-range {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}
.smit-sheet-range label {
    font-size: .85rem;
    color: var(--text-muted, #6c757d);
    margin: 0;
}
.smit-sheet-range input {
    min-height: 40px;
    font-size: 16px;       /* ≥16 чтобы iOS не зумил */
}

/* Sticky действия снизу sheet (Применить/Сбросить) — build 720 fix */
.smit-sheet-actions {
    display: flex; gap: 10px;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    margin: 8px -18px 0;   /* растягиваем во всю ширину offcanvas-body */
    padding-left: 18px;
    padding-right: 18px;
    position: sticky;
    bottom: -1px;          /* iOS Safari rounding hack — закрывает 1px щель снизу */
    background: #fff;
    border-top: 1px solid var(--border-subtle, #dee2e6);
    box-shadow: 0 -4px 12px rgba(0,0,0,.04);
    z-index: 5;
}
.smit-sheet-actions .btn {
    min-height: 44px;
    font-size: .95rem;
    font-weight: 600;
}
/* offcanvas-body: место под sticky-actions, чтобы не перекрывал последний sheet-section */
.smit-mobile-filter-sheet .offcanvas-body { padding-bottom: 0 !important; }

[data-bs-theme="dark"] .smit-sheet-actions { background: #1e2228; border-top-color: #2c3038; }
[data-bs-theme="dark"] .smit-mobile-filter-sheet { background: #1e2228; }

/* ═══ Dark theme для mobile filter sheet (build 723) ═══
   Применяется и через [data-bs-theme="dark"] и через body.dark-theme
   (на разных страницах используются разные механизмы установки тёмной темы) */

/* Триггер «Фильтры N» в toolbar (build 724: тёмный фон в dark) */
body.dark-theme .smit-mobile-filter-trigger,
[data-bs-theme="dark"] .smit-mobile-filter-trigger {
    background: #2a2f37 !important;
    color: #65d0a0 !important;
    border-color: #3a3f47 !important;
}
body.dark-theme .smit-mobile-filter-trigger:hover,
body.dark-theme .smit-mobile-filter-trigger:focus,
[data-bs-theme="dark"] .smit-mobile-filter-trigger:hover,
[data-bs-theme="dark"] .smit-mobile-filter-trigger:focus {
    background: #353b44 !important;
    color: #fff !important;
    border-color: var(--brand-primary, #43b77a) !important;
}
body.dark-theme .smit-mobile-filter-trigger .smit-filter-count,
[data-bs-theme="dark"] .smit-mobile-filter-trigger .smit-filter-count {
    background: var(--brand-primary, #43b77a);
    color: #fff;
}

/* Sheet — фон, текст, заголовок, drag-handle */
body.dark-theme .smit-mobile-filter-sheet { background: #1e2228; color: #e7eaf0; }
body.dark-theme .smit-mobile-filter-sheet::before,
[data-bs-theme="dark"] .smit-mobile-filter-sheet::before { background: #3a3f47; }
body.dark-theme .smit-mobile-filter-sheet .offcanvas-header,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .offcanvas-header { border-bottom-color: #2c3038; }
body.dark-theme .smit-mobile-filter-sheet .offcanvas-title,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .offcanvas-title { color: #e7eaf0; }
body.dark-theme .smit-mobile-filter-sheet .btn-close,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Section headers */
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-section,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-section { border-bottom-color: #2c3038; }
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-section h6,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-section h6 { color: #9aaab4; }

/* Chips: outline-стиль без active — фон #2a2f37, текст светлый */
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-chips .btn,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-chips .btn {
    background: #2a2f37;
    color: #c8d0d8;
    border-color: #3a3f47;
}
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-chips .btn:hover,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-chips .btn:hover {
    background: #353b44;
    color: #fff;
    border-color: #4a5260;
}
/* Active chip: brand-primary fill (поверх любых .btn-outline-*) */
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-chips .btn.active,
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-chips .btn[aria-pressed="true"],
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-chips .btn.active,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-chips .btn[aria-pressed="true"] {
    background: var(--brand-primary, #43b77a) !important;
    color: #fff !important;
    border-color: var(--brand-primary, #43b77a) !important;
}

/* Inputs / selects внутри sheet */
body.dark-theme .smit-mobile-filter-sheet .form-control,
body.dark-theme .smit-mobile-filter-sheet .form-select,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .form-control,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .form-select {
    background: #2a2f37;
    color: #e7eaf0;
    border-color: #3a3f47;
}
body.dark-theme .smit-mobile-filter-sheet .form-control::placeholder,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .form-control::placeholder {
    color: #6a7682;
}
body.dark-theme .smit-mobile-filter-sheet .form-control:focus,
body.dark-theme .smit-mobile-filter-sheet .form-select:focus,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .form-control:focus,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .form-select:focus {
    background: #2a2f37;
    color: #fff;
    border-color: var(--brand-primary, #43b77a);
    box-shadow: 0 0 0 .2rem rgba(67, 183, 122, .25);
}
/* Select option text (option сам не темнеет в native, но фон форсим) */
body.dark-theme .smit-mobile-filter-sheet .form-select option,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .form-select option {
    background: #2a2f37;
    color: #e7eaf0;
}

/* smit-sheet-range labels */
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-range label,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-range label {
    color: #9aaab4;
}

/* Toggle-list (ab-sheet-toggle-*) — переопределяет светлые стили */
body.dark-theme .smit-mobile-filter-sheet .ab-sheet-toggle-list,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .ab-sheet-toggle-list {
    background: #2a2f37;
    border-color: #3a3f47;
}
body.dark-theme .smit-mobile-filter-sheet .ab-sheet-toggle-row .ab-sheet-toggle-name,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .ab-sheet-toggle-row .ab-sheet-toggle-name {
    color: #e7eaf0;
}
body.dark-theme .smit-mobile-filter-sheet .ab-sheet-toggle-row .ab-sheet-toggle-count,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .ab-sheet-toggle-row .ab-sheet-toggle-count {
    background: rgba(255, 255, 255, .08);
    color: #9aaab4;
}
body.dark-theme .smit-mobile-filter-sheet .ab-sheet-toggle-row:hover,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .ab-sheet-toggle-row:hover {
    background: rgba(67, 183, 122, .12);
}
body.dark-theme .smit-mobile-filter-sheet .ab-sheet-toggle-row:not(:last-child),
[data-bs-theme="dark"] .smit-mobile-filter-sheet .ab-sheet-toggle-row:not(:last-child) {
    border-bottom-color: #353b44;
}
body.dark-theme .smit-mobile-filter-sheet .ab-sheet-toggle-row .form-check-input,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .ab-sheet-toggle-row .form-check-input {
    background-color: #3a3f47;
    border-color: #4a5260;
}
body.dark-theme .smit-mobile-filter-sheet .ab-sheet-toggle-row .form-check-input:checked,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .ab-sheet-toggle-row .form-check-input:checked {
    background-color: var(--brand-primary, #43b77a);
    border-color: var(--brand-primary, #43b77a);
}

/* Sticky-actions: фон + reset-кнопка */
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-actions,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-actions {
    background: #1e2228;
    border-top-color: #2c3038;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .4);
}
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-actions .btn-outline-secondary,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-actions .btn-outline-secondary {
    color: #c8d0d8;
    border-color: #3a3f47;
}
body.dark-theme .smit-mobile-filter-sheet .smit-sheet-actions .btn-outline-secondary:hover,
[data-bs-theme="dark"] .smit-mobile-filter-sheet .smit-sheet-actions .btn-outline-secondary:hover {
    background: #2a2f37;
    color: #fff;
    border-color: #4a5260;
}

/* ─── Toggle-switch list внутри sheet (build 720) ─── */
.ab-sheet-toggle-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle, #dee2e6);
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}
.ab-sheet-toggle-row {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 10px 12px;
    min-height: 44px;       /* touch target */
    cursor: pointer;
    border-radius: 6px;
    transition: background .12s;
}
.ab-sheet-toggle-row:hover { background: rgba(67, 183, 122, .06); }
.ab-sheet-toggle-row:not(:last-child) { border-bottom: 1px solid #f1f3f5; border-radius: 0; }
.ab-sheet-toggle-row .form-check-input {
    flex-shrink: 0;
    width: 2.2em;
    height: 1.2em;
    margin: 0;
    cursor: pointer;
}
.ab-sheet-toggle-row .form-check-input:checked {
    background-color: var(--brand-primary, #43b77a);
    border-color: var(--brand-primary, #43b77a);
}
.ab-sheet-toggle-row .ab-sheet-toggle-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .92rem;
    color: var(--text-primary, #212529);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ab-sheet-toggle-row .ab-sheet-toggle-count {
    flex-shrink: 0;
    font-size: .8rem;
    color: var(--text-muted, #6c757d);
    background: rgba(0,0,0,.04);
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 32px;
    text-align: center;
}
[data-bs-theme="dark"] .ab-sheet-toggle-list { background: #2a2f37; border-color: #3a3f47; }
[data-bs-theme="dark"] .ab-sheet-toggle-row:hover { background: rgba(67, 183, 122, .12); }
[data-bs-theme="dark"] .ab-sheet-toggle-row:not(:last-child) { border-bottom-color: #3a3f47; }
[data-bs-theme="dark"] .ab-sheet-toggle-row .ab-sheet-toggle-count { background: rgba(255,255,255,.06); }

/* ═══════════════════════════════════════════════════════════════════════
   Mobile search bar (build 729) — slide-down popup из шапки
   ═══════════════════════════════════════════════════════════════════════ */

#mobile-search-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1090;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    transform: translateY(-100%);
    transition: transform .25s ease, opacity .2s ease;
    opacity: 0;
}
#mobile-search-bar:not(.d-none) {
    display: block !important;
    transform: translateY(0);
    opacity: 1;
}
#mobile-search-bar form { width: 100%; }
#mobile-search-bar .form-control,
#mobile-search-bar .btn {
    height: 40px;
    min-height: 40px;
    font-size: 16px;            /* iOS: ≥16 чтобы не зумило */
    padding: 6px 12px;
}
#mobile-search-bar .btn { padding-left: 14px; padding-right: 14px; flex: 0 0 auto; }
#mobile-search-bar .btn i { font-size: 14px; }

/* Dark theme */
body.dark-theme #mobile-search-bar,
[data-bs-theme="dark"] #mobile-search-bar {
    background: #22262c;
    border-bottom-color: #3a3f47;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
body.dark-theme #mobile-search-bar .form-control,
[data-bs-theme="dark"] #mobile-search-bar .form-control {
    background: #2a2f37;
    color: #e7eaf0;
    border-color: #3a3f47;
}
body.dark-theme #mobile-search-bar .form-control::placeholder,
[data-bs-theme="dark"] #mobile-search-bar .form-control::placeholder {
    color: #6a7682;
}
body.dark-theme #mobile-search-bar .form-control:focus,
[data-bs-theme="dark"] #mobile-search-bar .form-control:focus {
    background: #2a2f37;
    color: #fff;
    border-color: var(--brand-primary, #43b77a);
    box-shadow: 0 0 0 .2rem rgba(67, 183, 122, .25);
}
body.dark-theme #mobile-search-bar .btn-outline-secondary,
[data-bs-theme="dark"] #mobile-search-bar .btn-outline-secondary {
    color: #c8d0d8;
    border-color: #3a3f47;
    background: #2a2f37;
}
body.dark-theme #mobile-search-bar .btn-outline-secondary:hover,
[data-bs-theme="dark"] #mobile-search-bar .btn-outline-secondary:hover {
    background: #353b44;
    color: #fff;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #mobile-search-bar { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   abonent-title-bar mobile (build 802/804 — запрос Марии 2026-05-13)
   ═══════════════════════════════════════════════════════════════════════
   Структура на mobile через CSS Grid: 3 ряда × 2 колонки + 4-й full-width
   ┌──────────────────────────────────────────────────────────────┐
   │ ←                                                  2025_Супер │  row 1: back / tarif
   │ #6713 Абонент №6713                                   7,19 ₽ │  row 2: id+name / balance
   │ ✓ Активен                                          1199 ₽/мес │  row 3: badge / cost
   ├──────────────────────────────────────────────────────────────┤
   │ 💾 🖨 📄 ⏸ 🔌 🗑 ℹ                                              │  row 4: action-icons full width
   ├──────────────────────────────────────────────────────────────┤
   │ Информация · Операции · Аккаунты · Сессии · ...                │  вкладки на ВСЮ ширину окна
   └──────────────────────────────────────────────────────────────┘
   Все 3 ряда: левая часть align-left, правая align-right.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
    /* Title-bar — CSS Grid 2 колонки (left/right), несколько рядов */
    .abonent-title-bar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        grid-auto-rows: auto;
        align-items: center !important;
        gap: 4px 8px !important;
        flex-wrap: unset !important;
    }

    /* Стрелка «Назад» — row 1, column 1 (left) */
    .abonent-title-bar .abonent-title-back {
        grid-row: 1;
        grid-column: 1;
        justify-self: start;
        display: inline-flex !important;
        align-items: center;
    }

    /* H1 (id + name + badges) — занимает rows 2-3, column 1 (left) */
    .abonent-title-bar h1.abonent-title-h1,
    .abonent-title-bar .abonent-title-h1 {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        flex-wrap: nowrap !important;
        margin: 0 !important;
        grid-row: 2 / span 2;
        grid-column: 1;
        min-width: 0 !important;
        width: 100%;
    }
    /* #6713 + ФИО — на одной строке: используем .abonent-title-id-name внутри h1 */
    .abonent-title-bar .abonent-title-id {
        font-size: .78rem !important;
        font-weight: 500 !important;
        color: #6c757d !important;
        line-height: 1.2 !important;
        margin: 0 !important;
    }
    .abonent-title-bar .abonent-title-name {
        font-size: 1rem !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        margin-left: 4px !important;
        word-break: break-word;
    }
    /* «#6713 Абонент» вместе на одной строке (row 2 в h1) */
    .abonent-title-bar .abonent-title-h1 > .abonent-title-id,
    .abonent-title-bar .abonent-title-h1 > .abonent-title-name {
        display: inline;
    }
    /* Бейдж статуса — отдельная подстрока в h1 (row 3 в h1) */
    .abonent-title-bar .abonent-title-badge {
        margin-left: 0 !important;
        align-self: flex-start;
        display: inline-flex !important;
    }

    /* Balance-wrap — занимает rows 1-3, column 2 (right), align-right */
    .abonent-title-bar .abonent-title-balance-wrap {
        grid-row: 1 / span 3;
        grid-column: 2;
        justify-self: end;
        align-self: stretch;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        justify-content: space-between !important;
        gap: 2px !important;
        text-align: right;
    }
    /* Тариф на mobile в правом верхнем углу — СКРЫТЬ (запрос Марии build 805).
       Тариф уже виден в шапке и через кнопку «Изменить тариф» в карточке — дубль не нужен. */
    .abonent-title-bar .abonent-title-tarif-mobile {
        display: none !important;
    }
    /* Баланс — 2-я строка справа */
    .abonent-title-bar .abonent-title-balance,
    .abonent-title-bar .abonent-title-balance-positive {
        order: 2;
        font-size: .95rem;
        white-space: nowrap;
    }
    /* Цена 1199 ₽/мес — 3-я строка справа */
    .abonent-title-bar .abonent-title-cost-mobile {
        order: 3;
        font-size: .75rem !important;
        line-height: 1.2;
    }

    /* Wrapper-div (родитель balance-wrap + #ab-title-actions + info-icon) — display:contents
       чтобы его дети ОЧУТИЛИСЬ ПРЯМО в grid title-bar и могли быть позиционированы
       по своим row/column независимо. */
    .abonent-title-bar > div.d-flex.align-items-center.gap-1.ms-auto,
    .abonent-title-bar > div.ms-auto {
        display: contents !important;
    }

    /* Action-icons row 4 — full-width (2 колонки сразу) */
    .abonent-title-bar #ab-title-actions {
        grid-row: 4;
        grid-column: 1 / -1;
        display: flex !important;
        width: 100% !important;
        gap: 4px !important;
        flex-wrap: wrap;
        justify-content: flex-start !important;
        margin-top: 8px !important;
        padding-top: 8px !important;
        border-top: 1px solid rgba(0,0,0,.08);
    }
    /* Info-icon показываем — кладём в row 4 после actions */
    .abonent-title-bar .abonent-title-info {
        display: inline-flex !important;
        grid-row: 4;
        grid-column: 1 / -1;
        justify-self: end;
        margin-top: 8px;
    }

    /* Вкладки на ВСЮ ширину окна (от края до края, без отступов container'а).
       Container-fluid на mobile имеет padding-left: 0.5rem, padding-right: 0 —
       компенсируем negative margin. */
    .ab-navbar-tabs {
        margin-left: -0.5rem !important;
        margin-right: 0 !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        width: calc(100% + 0.5rem) !important;
        max-width: none !important;
    }
    /* Контейнер табов внутри карточки (.ab-navbar) — тоже без padding */
    .abonent-title-bar + .ab-navbar,
    .ab-navbar {
        margin-left: -0.5rem !important;
        margin-right: 0 !important;
        width: calc(100% + 0.5rem) !important;
    }
}
[data-bs-theme="dark"] .abonent-title-balance-name,
body.dark-theme .abonent-title-balance-name { color: #9aaab4 !important; }
[data-bs-theme="dark"] .abonent-title-bar #ab-title-actions,
body.dark-theme .abonent-title-bar #ab-title-actions { border-top-color: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .abonent-title-bar .abonent-title-id,
body.dark-theme .abonent-title-bar .abonent-title-id { color: #9aaab4 !important; }

/* ═══════════════════════════════════════════════════════════════════════
   Mobile search-row: input + filter trigger в одну строку (build 731)
   Универсальный класс для search.html, folder, и других mobile-страниц
   Кнопка «Фильтры» по высоте равна полю поиска (≈38px Bootstrap form-control)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
    .ab-mobile-search-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px;
        align-items: stretch;
        width: 100%;
    }
    .ab-mobile-search-row > form,
    .ab-mobile-search-row > .input-group,
    .ab-mobile-search-row > .search-wrap {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: stretch !important;
    }
    .ab-mobile-search-row .input-group { height: auto; flex: 1 1 auto; }
    .ab-mobile-search-row .form-control { min-height: 38px; }
    .ab-mobile-search-row .smit-mobile-filter-trigger {
        flex: 0 0 auto !important;
        white-space: nowrap;
        padding: 0 14px !important;
        font-size: .85rem !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-height: 38px !important;
        height: 38px !important;
        line-height: 1 !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Navbar user avatar (build 733): defensive стиль — даже если кеш отдаст
   старый CSS, изображение никогда не вылезет за допустимый размер.
   Ставим max-width/max-height и !important на всё что определяет размер.
   ═══════════════════════════════════════════════════════════════════════ */
.navbar-user-avatar,
.navbar-user-avatar-mobile,
img.navbar-user-avatar,
img.navbar-user-avatar-mobile {
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid rgba(255,255,255,.35);
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary, #43b77a);
    color: #fff !important;
    font-weight: 700;
    text-transform: uppercase;
    overflow: hidden !important;
    box-sizing: border-box !important;
    vertical-align: middle;
}
.navbar-user-avatar,
img.navbar-user-avatar {
    width: 30px !important;
    height: 30px !important;
    max-width: 30px !important;
    max-height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    font-size: .72rem !important;
    line-height: 1 !important;
}
.navbar-user-avatar-mobile,
img.navbar-user-avatar-mobile {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    font-size: .76rem !important;
    line-height: 1 !important;
}
.navbar-user-avatar-fallback {
    background: linear-gradient(135deg, var(--brand-primary, #43b77a) 0%, #379963 100%) !important;
    letter-spacing: .5px;
}
.navbar-user-toggle { position: relative; }
.navbar-user-name { line-height: 1.1; }
body.dark-theme .navbar-user-avatar,
body.dark-theme .navbar-user-avatar-mobile,
[data-bs-theme="dark"] .navbar-user-avatar,
[data-bs-theme="dark"] .navbar-user-avatar-mobile {
    border-color: rgba(255,255,255,.18);
    box-shadow: 0 0 0 1px rgba(0,0,0,.25);
}

/* ═══════════════════════════════════════════════════════════════════════
   Mobile filter sheet (build 734): защита от scroll-pass-through на iOS.
   Когда offcanvas-bottom открыт — touch-скролл через панель «утекал»
   на основную страницу под backdrop. overscroll-behavior:contain плюс
   фиксация body предотвращают это.
   ═══════════════════════════════════════════════════════════════════════ */
.smit-mobile-filter-sheet {
    overscroll-behavior: contain;
}
.smit-mobile-filter-sheet .offcanvas-body {
    overscroll-behavior: contain;
    overflow-y: auto;
}
@media (max-width: 767.98px) {
    body.offcanvas-open,
    body.modal-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        touch-action: none;
    }
    /* Backdrop offcanvas — гарантированно перекрывает touch */
    .offcanvas-backdrop.show {
        touch-action: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Quick-add abonent modal mobile (build 740) — FULLSCREEN на ≤768px.
   На mobile модалка занимает весь экран (modal-fullscreen-md-down +
   собственные правила для footer/header sticky и safe-area iOS).
   На desktop (≥768px) — обычная centered modal-lg 780px.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
    .modal .qa-modal-dialog,
    .modal .modal-dialog.qa-modal-dialog {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        align-items: stretch !important;
        display: flex !important;
    }
    .qa-modal-dialog .modal-content {
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    .qa-modal-dialog .modal-header {
        border-radius: 0 !important;
        padding: .65rem .8rem !important;
        padding-top: max(.65rem, env(safe-area-inset-top, .65rem)) !important;
        flex-shrink: 0 !important;
    }
    .qa-modal-dialog .modal-body {
        padding: .9rem !important;
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
    }
    .qa-modal-dialog .modal-footer {
        border-radius: 0 !important;
        padding: .6rem .8rem !important;
        padding-bottom: max(.6rem, env(safe-area-inset-bottom, .6rem)) !important;
        flex-wrap: wrap;
        gap: .25rem;
        flex-shrink: 0 !important;
        background: var(--surface-default, #fff);
        border-top: 1px solid var(--border-default, #dee2e6);
    }
    body.dark-theme .qa-modal-dialog .modal-footer,
    [data-bs-theme="dark"] .qa-modal-dialog .modal-footer {
        background: #1f2227 !important;
        border-top-color: #2f343a !important;
    }
    /* Robot illustration отключаем на mobile — только на desktop */
    .qa-modal-dialog .qa-body-wrap::after { display: none !important; }
    /* Поля input должны быть 16px чтобы iOS Safari не зумил при фокусе */
    .qa-modal-dialog .form-control,
    .qa-modal-dialog .form-select,
    .qa-modal-dialog input[type="text"],
    .qa-modal-dialog input[type="email"],
    .qa-modal-dialog input[type="number"],
    .qa-modal-dialog textarea { font-size: 16px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Abonent title-bar mobile (build 731): тариф над балансом + стоимость снизу
   ═══════════════════════════════════════════════════════════════════════ */
.abonent-title-balance-name {
    font-size: .65rem;
    line-height: 1;
    margin-bottom: 1px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6c757d;
}
.abonent-title-tarif-mobile {
    margin-bottom: 2px !important;
    font-weight: 500;
}
.abonent-title-cost-mobile {
    margin-top: 2px !important;
    margin-bottom: 0 !important;
    font-weight: 500;
    color: #43b77a;
}
body.dark-theme .abonent-title-tarif-mobile,
[data-bs-theme="dark"] .abonent-title-tarif-mobile {
    color: #9aaab4 !important;
}
body.dark-theme .abonent-title-cost-mobile,
[data-bs-theme="dark"] .abonent-title-cost-mobile {
    color: #65d0a0 !important;
}
.abonent-title-balance-positive {
    font-size: .92rem;
    color: #2e7d32;
}
body.dark-theme .abonent-title-balance-positive,
[data-bs-theme="dark"] .abonent-title-balance-positive {
    color: #65d0a0 !important;
}

/* ════════════════════════════════════════════════════════════════
   Select2 — refined look (build 836)
   Единый аккуратный вид выпадающих списков по мотивам
   21st.dev timezone-select: мягкие скруглённые углы, многослойная
   тень, тонкий кастомный скроллбар, pill-подсветка строк.
   Применяется глобально ко всем Select2 (bootstrap-5 + default).
   Светлая + тёмная тема, фирменный зелёный #43b77a.
   ════════════════════════════════════════════════════════════════ */

/* --- Поле выбора (selection box) --- */
.select2-container--bootstrap-5 .select2-selection,
.select2-container--default .select2-selection {
    border-radius: 6px !important;
    border-color: var(--border-default, #ced4da) !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}
.select2-container--bootstrap-5 .select2-selection:hover,
.select2-container--default .select2-selection:hover {
    border-color: #86cfaa !important;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection,
.select2-container--default.select2-container--focus .select2-selection,
.select2-container--default.select2-container--open .select2-selection {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .18) !important;
}

/* --- Выпадающий список (dropdown panel) --- */
.select2-container .select2-dropdown,
.select2-container--bootstrap-5 .select2-dropdown,
.select2-container--default .select2-dropdown {
    border-radius: 8px !important;
    border: 1px solid var(--border-default, #e2e6ea) !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16),
                0 2px 8px rgba(15, 23, 42, .08) !important;
    overflow: hidden !important;
    padding: 4px !important;
}
.select2-container--bootstrap-5 .select2-dropdown--above,
.select2-container--default .select2-dropdown--above {
    border-radius: 8px !important;
}

/* --- Поле поиска внутри dropdown --- */
.select2-container .select2-search--dropdown,
.select2-container--bootstrap-5 .select2-search--dropdown {
    padding: 4px 4px 6px !important;
}
.select2-container .select2-search--dropdown .select2-search__field,
.select2-container--bootstrap-5 .select2-search__field,
.select2-container--default .select2-search__field {
    border-radius: 6px !important;
    border: 1px solid var(--border-default, #ced4da) !important;
    padding: 6px 10px !important;
    font-size: .88rem !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
    outline: none !important;
}
.select2-container .select2-search--dropdown .select2-search__field:focus,
.select2-container--bootstrap-5 .select2-search__field:focus,
.select2-container--default .select2-search__field:focus {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .15) !important;
}

/* --- Контейнер результатов: тонкий кастомный скроллбар --- */
.select2-container .select2-results__options {
    scrollbar-width: thin;
    scrollbar-color: rgba(67, 183, 122, .45) transparent;
    scroll-behavior: smooth;
}
.select2-container .select2-results__options::-webkit-scrollbar {
    width: 8px;
}
.select2-container .select2-results__options::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}
.select2-container .select2-results__options::-webkit-scrollbar-thumb {
    background: rgba(67, 183, 122, .4);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.select2-container .select2-results__options::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 183, 122, .65);
    background-clip: padding-box;
}

/* --- Строки результатов: pill-подсветка --- */
.select2-container .select2-results__option,
.select2-container--bootstrap-5 .select2-results__option,
.select2-container--default .select2-results__option {
    padding: 8px 12px !important;
    margin: 1px 0 !important;
    border-radius: 5px !important;
    font-size: .9rem !important;
    line-height: 1.35 !important;
    transition: background-color .12s ease, color .12s ease !important;
}
.select2-container .select2-results__option--highlighted,
.select2-container--bootstrap-5 .select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #e8f5e9 !important;
    color: #2e7d32 !important;
}
.select2-container .select2-results__option--selected,
.select2-container--bootstrap-5 .select2-results__option--selected,
.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #43b77a !important;
    color: #fff !important;
    font-weight: 600 !important;
}
.select2-container .select2-results__option--selected.select2-results__option--highlighted,
.select2-container--default .select2-results__option[aria-selected="true"].select2-results__option--highlighted {
    background-color: #379963 !important;
    color: #fff !important;
}
.select2-container .select2-results__option--group > .select2-results__group {
    padding: 6px 10px 4px !important;
    font-size: .72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .5px !important;
    color: #94a3b8 !important;
}
.select2-container .select2-results__message {
    padding: 10px 12px !important;
    color: #94a3b8 !important;
    font-size: .88rem !important;
}

/* ───────── Тёмная тема ───────── */
body.dark-theme .select2-container--bootstrap-5 .select2-selection,
body.dark-theme .select2-container--default .select2-selection,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection {
    border-color: #454950 !important;
}
body.dark-theme .select2-container--bootstrap-5 .select2-selection:hover,
body.dark-theme .select2-container--default .select2-selection:hover {
    border-color: #43b77a !important;
}
body.dark-theme .select2-container--bootstrap-5.select2-container--focus .select2-selection,
body.dark-theme .select2-container--bootstrap-5.select2-container--open .select2-selection,
body.dark-theme .select2-container--default.select2-container--focus .select2-selection,
body.dark-theme .select2-container--default.select2-container--open .select2-selection {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .25) !important;
}
body.dark-theme .select2-container .select2-dropdown,
body.dark-theme .select2-container--bootstrap-5 .select2-dropdown,
body.dark-theme .select2-container--default .select2-dropdown {
    background-color: #22262e !important;
    border-color: #353940 !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5),
                0 2px 8px rgba(0, 0, 0, .35) !important;
}
body.dark-theme .select2-container .select2-search--dropdown .select2-search__field,
body.dark-theme .select2-container--bootstrap-5 .select2-search__field,
body.dark-theme .select2-container--default .select2-search__field {
    background-color: #2a2e37 !important;
    border-color: #454950 !important;
    color: #dee2e6 !important;
}
body.dark-theme .select2-container .select2-search--dropdown .select2-search__field:focus,
body.dark-theme .select2-container--bootstrap-5 .select2-search__field:focus {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .22) !important;
}
body.dark-theme .select2-container .select2-results__options {
    scrollbar-color: rgba(67, 183, 122, .55) transparent;
}
body.dark-theme .select2-container .select2-results__options::-webkit-scrollbar-thumb {
    background: rgba(67, 183, 122, .5);
    background-clip: padding-box;
}
body.dark-theme .select2-container .select2-results__options::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 183, 122, .75);
    background-clip: padding-box;
}
body.dark-theme .select2-container .select2-results__option,
body.dark-theme .select2-container--bootstrap-5 .select2-results__option,
body.dark-theme .select2-container--default .select2-results__option {
    color: #d0d3d8 !important;
}
body.dark-theme .select2-container .select2-results__option--highlighted,
body.dark-theme .select2-container--bootstrap-5 .select2-results__option--highlighted,
body.dark-theme .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: rgba(67, 183, 122, .18) !important;
    color: #8fdeb5 !important;
}
body.dark-theme .select2-container .select2-results__option--selected,
body.dark-theme .select2-container--bootstrap-5 .select2-results__option--selected,
body.dark-theme .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #43b77a !important;
    color: #fff !important;
}
body.dark-theme .select2-container .select2-results__option--selected.select2-results__option--highlighted {
    background-color: #379963 !important;
}
body.dark-theme .select2-container .select2-results__message,
body.dark-theme .select2-container .select2-results__option--group > .select2-results__group {
    color: #6c7480 !important;
}

@media (prefers-reduced-motion: reduce) {
    .select2-container--bootstrap-5 .select2-selection,
    .select2-container--default .select2-selection,
    .select2-container .select2-results__option,
    .select2-container .select2-search__field { transition: none !important; }
    .select2-container .select2-results__options { scroll-behavior: auto; }
}

/* ════════════════════════════════════════════════════════════════
   Карточка абонента — hero-блок (build 838)
   Вкладка «Информация»: тариф + цена + кнопка смены крупным блоком,
   ниже — компактные секции «Аккаунты / Скорость» и «Комментарии».
   Светлая + тёмная тема, фирменный зелёный #43b77a, адаптив ≤767px.
   Поле «Точка подключения» и ФИО-заголовок убраны (см. show_field*.html).
   ════════════════════════════════════════════════════════════════ */

/* ── Hero: строка тарифа ── */
.ab-hero-tarif {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 2px 0 10px;
    background: linear-gradient(135deg,
                rgba(67, 183, 122, .10) 0%,
                rgba(60, 191, 174, .08) 100%);
    border: 1px solid rgba(67, 183, 122, .28);
    border-radius: 10px;
}
.ab-hero-tarif-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #43b77a;
    color: #fff;
    font-size: 1rem;
}
.ab-hero-tarif-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ab-hero-tarif-name {
    font-size: 1.02rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ab-hero-tarif-price {
    font-size: .82rem;
    font-weight: 600;
    color: #379963;
}
.ab-hero-tarif-btn {
    flex-shrink: 0;
    border: 1px solid #43b77a;
    background: #fff;
    color: #379963;
    font-weight: 600;
    border-radius: 7px;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.ab-hero-tarif-btn:hover {
    background: #43b77a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(67, 183, 122, .3);
}
.ab-hero-tarif-btn:focus-visible {
    outline: 2px solid #43b77a;
    outline-offset: 2px;
}

/* ── Hero: компактные секции (аккаунты, комментарии) ── */
.ab-hero-section {
    margin: 0 0 10px;
    padding: 10px 14px;
    background: var(--surface-card, #fff);
    border: 1px solid var(--border-subtle, #e9ecef);
    border-radius: 10px;
    border-left: 3px solid #43b77a;
}
.ab-hero-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.ab-hero-section-icon {
    color: #43b77a;
    font-size: .92rem;
}
.ab-hero-section-title {
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary, #6c757d);
}
.ab-hero-section-count {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(67, 183, 122, .14);
    color: #379963;
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
}

/* ── Аккаунты / Скорость ── */
.ab-hero-acc-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.ab-hero-acc-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    font-size: .85rem;
}
.ab-hero-acc-login {
    font-weight: 700;
    color: #2c3e50;
    text-decoration: none;
}
.ab-hero-acc-login:hover { color: #379963; text-decoration: underline; }
.ab-hero-acc-tpl {
    font-size: .68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: #6c757d;
    color: #fff;
    margin-right: 3px;
}
.ab-hero-acc-ip {
    font-size: .78rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(67, 183, 122, .12);
    color: #379963;
}
.ab-hero-acc-speed {
    font-size: .74rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 4px;
    background: rgba(60, 191, 174, .15);
    color: #2a8a7e;
}
.ab-hero-acc-online {
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    background: #43b77a;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.ab-hero-acc-more {
    font-size: .78rem;
    color: var(--text-secondary, #6c757d);
    text-decoration: none;
}
.ab-hero-acc-more:hover { color: #379963; }

/* ── Комментарии ── */
.ab-hero-cmt-list {
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(67, 183, 122, .4) transparent;
}
.ab-hero-cmt-list::-webkit-scrollbar { width: 6px; }
.ab-hero-cmt-list::-webkit-scrollbar-thumb {
    background: rgba(67, 183, 122, .4);
    border-radius: 6px;
}
.ab-hero-cmt-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 0;
    font-size: .83rem;
    line-height: 1.4;
}
.ab-hero-cmt-row:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle, #eef0f2);
}
.ab-hero-cmt-meta {
    flex-shrink: 0;
    color: var(--text-muted, #94a3b8);
    font-size: .73rem;
    white-space: nowrap;
    padding-top: 1px;
}
.ab-hero-cmt-text {
    flex: 1;
    word-break: break-word;
    color: var(--text-primary, #2c3e50);
}
.ab-hero-cmt-del {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #cbd3da;
    font-size: .76rem;
    padding: 0 2px;
    cursor: pointer;
    transition: color .15s ease;
}
.ab-hero-cmt-del:hover { color: #dc3545; }
.ab-hero-cmt-del:focus-visible {
    outline: 2px solid #dc3545;
    outline-offset: 1px;
    border-radius: 3px;
}
.ab-hero-cmt-empty {
    font-size: .8rem;
    color: var(--text-muted, #94a3b8);
    padding: 4px 0 8px;
}
.ab-hero-cmt-input {
    display: flex;
    gap: 6px;
    align-items: center;
}
.ab-hero-cmt-input textarea {
    flex: 1;
    resize: none;
    font-size: .83rem;
    padding: 5px 9px !important;
    border-radius: 6px !important;
}
.ab-hero-cmt-add {
    flex-shrink: 0;
    background: #43b77a;
    border: 1px solid #43b77a;
    color: #fff;
    font-weight: 600;
    border-radius: 6px;
    transition: background .15s ease;
}
.ab-hero-cmt-add:hover { background: #379963; border-color: #379963; color: #fff; }
.ab-hero-cmt-add:focus-visible { outline: 2px solid #43b77a; outline-offset: 2px; }

/* ── Тёмная тема ── */
body.dark-theme .ab-hero-tarif,
[data-bs-theme="dark"] .ab-hero-tarif {
    background: linear-gradient(135deg,
                rgba(67, 183, 122, .16) 0%,
                rgba(60, 191, 174, .12) 100%);
    border-color: rgba(67, 183, 122, .35);
}
body.dark-theme .ab-hero-tarif-name,
[data-bs-theme="dark"] .ab-hero-tarif-name { color: #e4e6ea; }
body.dark-theme .ab-hero-tarif-price,
[data-bs-theme="dark"] .ab-hero-tarif-price { color: #65d0a0; }
body.dark-theme .ab-hero-tarif-btn,
[data-bs-theme="dark"] .ab-hero-tarif-btn {
    background: #2a2e37;
    color: #65d0a0;
    border-color: #43b77a;
}
body.dark-theme .ab-hero-tarif-btn:hover,
[data-bs-theme="dark"] .ab-hero-tarif-btn:hover {
    background: #43b77a;
    color: #fff;
}
body.dark-theme .ab-hero-section,
[data-bs-theme="dark"] .ab-hero-section {
    background: #22262e;
    border-color: #353940;
    border-left-color: #43b77a;
}
body.dark-theme .ab-hero-acc-login,
[data-bs-theme="dark"] .ab-hero-acc-login { color: #d8e0e8; }
body.dark-theme .ab-hero-acc-login:hover,
[data-bs-theme="dark"] .ab-hero-acc-login:hover { color: #65d0a0; }
body.dark-theme .ab-hero-acc-ip,
[data-bs-theme="dark"] .ab-hero-acc-ip {
    background: rgba(67, 183, 122, .18);
    color: #8fdeb5;
}
body.dark-theme .ab-hero-acc-speed,
[data-bs-theme="dark"] .ab-hero-acc-speed {
    background: rgba(60, 191, 174, .2);
    color: #6fd8c8;
}
body.dark-theme .ab-hero-cmt-text,
[data-bs-theme="dark"] .ab-hero-cmt-text { color: #d8e0e8; }
body.dark-theme .ab-hero-cmt-row:not(:last-child),
[data-bs-theme="dark"] .ab-hero-cmt-row:not(:last-child) {
    border-bottom-color: #2f343c;
}
body.dark-theme .ab-hero-cmt-del,
[data-bs-theme="dark"] .ab-hero-cmt-del { color: #5a6671; }

/* ── Адаптив ≤767px ── */
@media (max-width: 767px) {
    .ab-hero-tarif {
        flex-wrap: wrap;
        gap: 8px 10px;
        padding: 10px 12px;
    }
    .ab-hero-tarif-info { flex-basis: calc(100% - 50px); }
    .ab-hero-tarif-btn {
        flex-basis: 100%;
        order: 3;
    }
    .ab-hero-tarif-name { font-size: .96rem; }
    .ab-hero-section { padding: 9px 11px; }
    .ab-hero-acc-row { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
    .ab-hero-tarif-btn, .ab-hero-cmt-add, .ab-hero-cmt-del,
    .ab-hero-acc-login { transition: none; }
}

/* ════════════════════════════════════════════════════════════════
   Bootstrap 5 модалки — единый аккуратный стиль (build 841)
   По мотивам 21st.dev efferd/dialog/sticky-header-footer:
   sticky header + scrollable body + sticky footer (для
   .modal-dialog-scrollable), фирменный зелёный акцент-полоса
   слева на header, тени при скролле, тонкий зелёный скроллбар.
   Применяется глобально ко всем .modal через стандартные
   Bootstrap-классы. Светлая + тёмная тема.
   ════════════════════════════════════════════════════════════════ */

/* --- Контейнер (.modal-content) — мягкие скругления + многослойная тень --- */
.modal .modal-content {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .08);
    box-shadow: 0 16px 48px rgba(15, 23, 42, .18),
                0 4px 12px rgba(15, 23, 42, .08);
    overflow: hidden;
}

/* --- Header --- */
.modal .modal-header {
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle, #e9ecef);
    /* фирменная зелёная полоса-акцент слева */
    border-left: 3px solid #43b77a;
    background: var(--surface-card, #fff);
    transition: box-shadow .2s ease;
}
.modal .modal-header .modal-title {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary, #2c3e50);
    letter-spacing: -0.005em;
}
.modal .modal-header .btn-close {
    padding: 6px;
    margin: 0 -4px 0 4px;
    border-radius: 6px;
    opacity: .55;
    transition: opacity .15s ease, background-color .15s ease;
}
.modal .modal-header .btn-close:hover {
    opacity: 1;
    background-color: rgba(220, 53, 69, .08);
}
.modal .modal-header .btn-close:focus-visible {
    outline: 2px solid #43b77a;
    outline-offset: 2px;
    opacity: 1;
}

/* --- Body --- */
.modal .modal-body {
    padding: 16px 20px;
    color: var(--text-primary, #2c3e50);
    /* тонкий фирменный скроллбар (когда .modal-dialog-scrollable) */
    scrollbar-width: thin;
    scrollbar-color: rgba(67, 183, 122, .4) transparent;
    scroll-behavior: smooth;
}
.modal .modal-body::-webkit-scrollbar { width: 8px; }
.modal .modal-body::-webkit-scrollbar-track { background: transparent; margin: 4px 0; }
.modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(67, 183, 122, .4);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 183, 122, .65);
    background-clip: padding-box;
}

/* --- Footer --- */
.modal .modal-footer {
    gap: 6px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle, #e9ecef);
    background: var(--surface-card, #fff);
    transition: box-shadow .2s ease;
}
.modal .modal-footer > * { margin: 0; }
.modal .modal-footer .btn { font-weight: 500; }
.modal .modal-footer .btn:focus-visible {
    outline: 2px solid #43b77a;
    outline-offset: 2px;
}

/* --- Sticky-эффект для .modal-dialog-scrollable -------------------------
   Bootstrap уже делает .modal-content flex-column с прокручиваемым body —
   header и footer естественно остаются на месте. Добавляем тень-индикатор:
   когда body прокручен — header/footer получают мягкую тень-разделитель.
   Тень включается JS (см. abonents_edit_one.html и аналоги) добавлением
   класса .modal-scrolled-top / .modal-scrolled-bottom на .modal-content.
   Если JS не включит — fallback: чистая граница без тени, как сейчас. */
.modal-dialog-scrollable .modal-content.modal-scrolled-top .modal-header {
    box-shadow: 0 4px 8px -4px rgba(15, 23, 42, .12);
}
.modal-dialog-scrollable .modal-content.modal-scrolled-bottom .modal-footer {
    box-shadow: 0 -4px 8px -4px rgba(15, 23, 42, .12);
}

/* --- Тёмная тема ------------------------------------------------------- */
body.dark-theme .modal .modal-content,
[data-bs-theme="dark"] .modal .modal-content {
    border-color: rgba(255, 255, 255, .08);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .55),
                0 4px 12px rgba(0, 0, 0, .35);
}
body.dark-theme .modal .modal-header,
[data-bs-theme="dark"] .modal .modal-header {
    background: #1e2530;
    border-bottom-color: #353940;
    /* левая зелёная полоса сохраняется */
}
body.dark-theme .modal .modal-header .modal-title,
[data-bs-theme="dark"] .modal .modal-header .modal-title { color: #e7eaf0; }
body.dark-theme .modal .modal-header .btn-close,
[data-bs-theme="dark"] .modal .modal-header .btn-close { filter: invert(1); }
body.dark-theme .modal .modal-header .btn-close:hover,
[data-bs-theme="dark"] .modal .modal-header .btn-close:hover {
    background-color: rgba(248, 113, 113, .15);
}
body.dark-theme .modal .modal-body,
[data-bs-theme="dark"] .modal .modal-body { color: #d8e0e8; }
body.dark-theme .modal .modal-body::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] .modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(67, 183, 122, .5);
    background-clip: padding-box;
}
body.dark-theme .modal .modal-footer,
[data-bs-theme="dark"] .modal .modal-footer {
    background: #1e2530;
    border-top-color: #353940;
}
body.dark-theme .modal-dialog-scrollable .modal-content.modal-scrolled-top .modal-header,
[data-bs-theme="dark"] .modal-dialog-scrollable .modal-content.modal-scrolled-top .modal-header {
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .45);
}
body.dark-theme .modal-dialog-scrollable .modal-content.modal-scrolled-bottom .modal-footer,
[data-bs-theme="dark"] .modal-dialog-scrollable .modal-content.modal-scrolled-bottom .modal-footer {
    box-shadow: 0 -4px 12px -4px rgba(0, 0, 0, .45);
}

/* --- Адаптив ≤575px (mobile) ------------------------------------------ */
@media (max-width: 575.98px) {
    .modal .modal-content { border-radius: 10px; }
    .modal .modal-header { padding: 12px 14px; }
    .modal .modal-header .modal-title { font-size: .96rem; }
    .modal .modal-body { padding: 12px 14px; }
    .modal .modal-footer { padding: 10px 14px; }
    /* На очень узких экранах кнопки в footer переносятся, выравнивание по центру */
    .modal .modal-footer { justify-content: center; }
    .modal .modal-footer .btn { flex: 1 1 auto; min-width: 90px; }
}

/* --- Лёгкая анимация открытия модалки -------------------------------- */
/* Bootstrap по умолчанию даёт fade + translateY(-50px). Делаем заметнее:
   scale(0.96) + smooth ease-out. Уважает prefers-reduced-motion (ниже). */
.modal.fade .modal-dialog {
    transform: scale(0.96) translateY(-12px);
    opacity: 0;
    transition: transform .28s cubic-bezier(.34, 1.3, .64, 1),
                opacity .22s ease-out;
}
.modal.fade.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    /* Отключаем масштабирование при reduced-motion, оставляем чистый fade */
    .modal.fade .modal-dialog,
    .modal.fade.show .modal-dialog {
        transform: none;
        transition: opacity .15s ease-out;
    }
    .modal .modal-header,
    .modal .modal-footer,
    .modal .modal-header .btn-close { transition: none; }
    .modal .modal-body { scroll-behavior: auto; }
}

/* ════════════════════════════════════════════════════════════════
   Карточка абонента — Финансовая информация (build 843)
   Делает блок .sg-finance яркой hero-секцией с фирменным
   зелёным акцентом, читаемыми лейблами/значениями полей.
   Остальные subgroup'ы не трогаем — там общий стиль
   .form-subgroup в show_fields.html.
   ════════════════════════════════════════════════════════════════ */
.sg-finance.form-subgroup {
    border: 1px solid var(--border-subtle, #e9ecef);
    border-left: 4px solid #43b77a;
    border-radius: 10px;
    padding: 12px 14px 8px;
    background: linear-gradient(180deg,
                rgba(67, 183, 122, .04) 0%,
                transparent 60px);
}
.sg-finance.form-subgroup > legend {
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(67, 183, 122, .14) !important;
    color: #2e7d32 !important;
    border: none !important;
    margin-bottom: 10px;
    width: auto;
    display: inline-block;
}
.sg-finance.form-subgroup .form-row {
    margin-bottom: 6px;
}
.sg-finance.form-subgroup label {
    color: var(--text-secondary, #6c757d);
    font-weight: 500;
}
.sg-finance.form-subgroup .form-control,
.sg-finance.form-subgroup .form-select {
    border-radius: 6px;
    border-color: var(--border-default, #ced4da);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.sg-finance.form-subgroup .form-control:focus,
.sg-finance.form-subgroup .form-select:focus {
    border-color: #43b77a;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .18);
}
.sg-finance.form-subgroup .form-check-input:checked {
    background-color: #43b77a;
    border-color: #43b77a;
}
.sg-finance.form-subgroup .form-check-input:focus {
    border-color: #43b77a;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .18);
}
/* Тёмная тема Финансовой */
body.dark-theme .sg-finance.form-subgroup,
[data-bs-theme="dark"] .sg-finance.form-subgroup {
    background: linear-gradient(180deg,
                rgba(67, 183, 122, .08) 0%,
                transparent 60px);
    border-color: #353940;
    border-left-color: #43b77a;
}
body.dark-theme .sg-finance.form-subgroup > legend,
[data-bs-theme="dark"] .sg-finance.form-subgroup > legend {
    background: rgba(67, 183, 122, .22) !important;
    color: #8fdeb5 !important;
}
body.dark-theme .sg-finance.form-subgroup label,
[data-bs-theme="dark"] .sg-finance.form-subgroup label { color: #adb5bd; }
body.dark-theme .sg-finance.form-subgroup .form-control,
body.dark-theme .sg-finance.form-subgroup .form-select,
[data-bs-theme="dark"] .sg-finance.form-subgroup .form-control,
[data-bs-theme="dark"] .sg-finance.form-subgroup .form-select {
    background-color: #1e2530;
    border-color: #3a3f47;
    color: #e7eaf0;
}

/* ════════════════════════════════════════════════════════════════
   Карточка абонента — «Договор и контакты» (build 843)
   Subgroup 61 теперь содержит и контактные поля, и поля договора
   (вкл. юр-поля, скрытые/показываемые JS по чекбоксу COMPANY).
   Полоса слева бирюзовая (как было у контактного блока), без
   агрессивного градиента — блок и так длинный.
   ════════════════════════════════════════════════════════════════ */
.sg-contact.form-subgroup {
    border: 1px solid var(--border-subtle, #e9ecef);
    border-left: 4px solid #17a2b8;
    border-radius: 10px;
    padding: 12px 14px 8px;
}
.sg-contact.form-subgroup > legend {
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(23, 162, 184, .14) !important;
    color: #00695c !important;
    border: none !important;
    margin-bottom: 10px;
    width: auto;
    display: inline-block;
}
/* Юр-поля — мягкая фоновая подсветка чтобы было видно «это часть юр.лица» */
.sg-contact.form-subgroup .ab-legal-only {
    background: rgba(245, 158, 11, .06);
    border-radius: 6px;
    padding: 6px 8px;
    margin-left: -8px;
    margin-right: -8px;
}
body.dark-theme .sg-contact.form-subgroup,
[data-bs-theme="dark"] .sg-contact.form-subgroup {
    border-color: #353940;
    border-left-color: #17a2b8;
}
body.dark-theme .sg-contact.form-subgroup > legend,
[data-bs-theme="dark"] .sg-contact.form-subgroup > legend {
    background: rgba(23, 162, 184, .22) !important;
    color: #6ecfcf !important;
}
body.dark-theme .sg-contact.form-subgroup .ab-legal-only,
[data-bs-theme="dark"] .sg-contact.form-subgroup .ab-legal-only {
    background: rgba(245, 158, 11, .10);
}
@media (prefers-reduced-motion: reduce) {
    .sg-finance.form-subgroup .form-control,
    .sg-finance.form-subgroup .form-select { transition: none; }
}

/* ════════════════════════════════════════════════════════════════
   Buttons — refined look (build 845)
   По мотивам hextaui/button: мягкие скругления, читаемая
   типографика, focus-ring зелёный, hover-приподнимание +1px,
   active press-эффект, disabled приглушённый. Применяется
   глобально ко всем .btn через стандартные Bootstrap-классы.
   Существующие background/color правила выше в файле сохраняются —
   мы только дополняем поведение и геометрию.
   ════════════════════════════════════════════════════════════════ */

.btn {
    border-radius: 8px;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: background-color .15s ease,
                border-color .15s ease,
                color .15s ease,
                box-shadow .18s ease,
                transform .12s ease;
    position: relative;
    /* анти-jitter: фиксируем минимальную высоту через padding */
    line-height: 1.4;
}
.btn-sm { border-radius: 6px; padding: .32rem .7rem; font-size: .82rem; }
.btn-lg { border-radius: 10px; padding: .65rem 1.25rem; font-size: 1.02rem; }
/* icon-only кнопки не приподнимаются (часто toolbar — было бы дёрганно) */
.btn:not(.btn-ab-icon):not(.btn-close):not(.btn-link):hover:not(:disabled):not(.disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, .10);
}
.btn:active:not(:disabled):not(.disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .14);
    transition-duration: .08s;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .30);
}
.btn:disabled, .btn.disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Variants — фокус-ring подстраивается под цвет кнопки */
.btn-primary:focus-visible,
.btn-success:focus-visible,
.btn-outline-primary:focus-visible,
.btn-outline-success:focus-visible {
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .35);
}
.btn-danger:focus-visible,
.btn-outline-danger:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .30);
}
.btn-warning:focus-visible,
.btn-outline-warning:focus-visible {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .32);
}
.btn-info:focus-visible,
.btn-outline-info:focus-visible {
    box-shadow: 0 0 0 3px rgba(23, 162, 184, .30);
}
.btn-secondary:focus-visible,
.btn-outline-secondary:focus-visible,
.btn-light:focus-visible,
.btn-dark:focus-visible {
    box-shadow: 0 0 0 3px rgba(108, 117, 125, .25);
}

/* Hover-тень для основных вариантов чуть усиливается фирменным цветом */
.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(67, 183, 122, .28);
}
.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(220, 53, 69, .26);
}
.btn-warning:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(245, 158, 11, .28);
}
.btn-info:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(23, 162, 184, .26);
}

/* Btn-link — без приподнимания и без рамки на focus, только подчёркивание */
.btn-link {
    text-decoration: none;
    border-radius: 4px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link:focus-visible {
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .25);
    text-decoration: underline;
}

/* Btn-group — внутренние кнопки сохраняют border-radius снаружи группы */
.btn-group > .btn:not(:first-child):not(.dropdown-toggle-split),
.btn-group > .btn:nth-child(n+3) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.btn-group .btn { transform: none !important; box-shadow: none !important; }
.btn-group .btn:focus-visible {
    z-index: 2;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .25);
}

/* Иконки внутри кнопок — лёгкая анимация при hover */
.btn i.fas, .btn i.far, .btn i.fa {
    transition: transform .15s ease;
}
.btn:hover:not(:disabled) i.fas,
.btn:hover:not(:disabled) i.far,
.btn:hover:not(:disabled) i.fa {
    transform: scale(1.06);
}

/* ── Тёмная тема ── */
body.dark-theme .btn:focus-visible,
[data-bs-theme="dark"] .btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .40);
}
body.dark-theme .btn:not(.btn-ab-icon):not(.btn-close):not(.btn-link):hover:not(:disabled):not(.disabled),
[data-bs-theme="dark"] .btn:not(.btn-ab-icon):not(.btn-close):not(.btn-link):hover:not(:disabled):not(.disabled) {
    box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
}
body.dark-theme .btn-primary:hover:not(:disabled),
body.dark-theme .btn-success:hover:not(:disabled),
[data-bs-theme="dark"] .btn-primary:hover:not(:disabled),
[data-bs-theme="dark"] .btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 14px rgba(67, 183, 122, .42);
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .btn i.fas, .btn i.far, .btn i.fa { transition: none !important; }
    .btn:hover:not(:disabled), .btn:active { transform: none !important; }
}

/* ════════════════════════════════════════════════════════════════
   Карточка абонента — блоки «Основные» и «Смена тарифа / Блокировки»
   (build 846). Hero-стиль аналогично .sg-finance/.sg-contact из 843.
   .sg-main — фирменный зелёный (главный блок: hero-тариф + комментарии).
   .sg-tarif — янтарный (внимание: смены/блокировки).
   Группировки внутри .sg-tarif добавляет JS в show_fields.html (3d).
   ════════════════════════════════════════════════════════════════ */

.sg-main.form-subgroup,
.sg-tarif.form-subgroup {
    border: 1px solid var(--border-subtle, #e9ecef);
    border-radius: 10px;
    padding: 12px 14px 8px;
}
.sg-main.form-subgroup { border-left: 4px solid #43b77a; }
.sg-tarif.form-subgroup { border-left: 4px solid #f0ad4e; }

.sg-main.form-subgroup > legend,
.sg-tarif.form-subgroup > legend {
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: none !important;
    margin-bottom: 10px;
    width: auto;
    display: inline-block;
}
.sg-main.form-subgroup > legend {
    background: rgba(67, 183, 122, .14) !important;
    color: #2e7d32 !important;
}
.sg-tarif.form-subgroup > legend {
    background: rgba(240, 173, 78, .18) !important;
    color: #8a5b1d !important;
}

/* Подгруппы внутри «Смена тарифа / Блокировки» — JS-разделители (3d) */
.sg-tarif .ab-tarif-subhead {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary, #6c757d);
    padding: 8px 0 4px;
    margin-top: 6px;
    border-top: 1px dashed var(--border-subtle, #e9ecef);
    display: flex;
    align-items: center;
    gap: 6px;
}
.sg-tarif .ab-tarif-subhead:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 2px;
}
.sg-tarif .ab-tarif-subhead i {
    color: #f0ad4e;
    font-size: .85em;
}
.sg-tarif .ab-tarif-subhead.ab-th-block-own i { color: #17a2b8; }
.sg-tarif .ab-tarif-subhead.ab-th-block-admin i { color: #dc3545; }

/* ── Тёмная тема ── */
body.dark-theme .sg-main.form-subgroup,
body.dark-theme .sg-tarif.form-subgroup,
[data-bs-theme="dark"] .sg-main.form-subgroup,
[data-bs-theme="dark"] .sg-tarif.form-subgroup {
    border-color: #353940;
}
body.dark-theme .sg-main.form-subgroup,
[data-bs-theme="dark"] .sg-main.form-subgroup { border-left-color: #43b77a; }
body.dark-theme .sg-tarif.form-subgroup,
[data-bs-theme="dark"] .sg-tarif.form-subgroup { border-left-color: #f0ad4e; }

body.dark-theme .sg-main.form-subgroup > legend,
[data-bs-theme="dark"] .sg-main.form-subgroup > legend {
    background: rgba(67, 183, 122, .22) !important;
    color: #8fdeb5 !important;
}
body.dark-theme .sg-tarif.form-subgroup > legend,
[data-bs-theme="dark"] .sg-tarif.form-subgroup > legend {
    background: rgba(240, 173, 78, .22) !important;
    color: #f4c785 !important;
}

body.dark-theme .sg-tarif .ab-tarif-subhead,
[data-bs-theme="dark"] .sg-tarif .ab-tarif-subhead {
    color: #adb5bd;
    border-top-color: #353940;
}

/* ════════════════════════════════════════════════════════════════
   Кастомные кнопки — унификация под единый язык .btn (build 847)
   На скриншоте пользователя кнопки «Рассчитать платёж», «Подробнее»,
   «Изменить тариф», «+ Добавить», «🗑 удалить» были разные по форме —
   у каждой свой radius/font-weight/hover. Build 845 переопределил
   только стандартный .btn, а кастомные классы (.ab-hero-tarif-btn,
   .ab-hero-cmt-add, .ab-hero-cmt-del, .btn-ab-icon, .abd-acc-toggle,
   .toggle-mob-card) обходили .btn-стиль. Привожу их к одному
   рисунку: радиус 8px (мелкие 6px), focus-ring 3px зелёный glow,
   hover translateY(-1px), transitions .15s.
   ════════════════════════════════════════════════════════════════ */

/* Кастомные «полноразмерные» кнопки: hero, чат, accordion-toggle */
.ab-hero-tarif-btn,
.ab-hero-cmt-add,
.smit-action-btn,
.btn-ab-confirm:not(.btn-ab-icon) {
    border-radius: 8px !important;
    font-weight: 500 !important;
    transition: background-color .15s ease,
                border-color .15s ease,
                color .15s ease,
                box-shadow .18s ease,
                transform .12s ease !important;
}
.ab-hero-tarif-btn:hover:not(:disabled),
.ab-hero-cmt-add:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 183, 122, .28) !important;
}
.ab-hero-tarif-btn:active:not(:disabled),
.ab-hero-cmt-add:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(67, 183, 122, .22) !important;
    transition-duration: .08s !important;
}
.ab-hero-tarif-btn:focus-visible,
.ab-hero-cmt-add:focus-visible,
.ab-hero-cmt-del:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .35) !important;
}

/* Иконочные кнопки (toolbar, удалить, accordion-каретка) — общий ring */
.btn-ab-icon,
.ab-hero-cmt-del,
.abd-acc-toggle,
.btn-close {
    border-radius: 6px !important;
    transition: background-color .15s ease,
                color .15s ease,
                box-shadow .18s ease,
                opacity .15s ease !important;
}
.btn-ab-icon:focus-visible,
.abd-acc-toggle:focus-visible,
.btn-close:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .30) !important;
}
.ab-hero-cmt-del:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .30) !important;
}

/* Все link-кнопки (внутри карточек hero, drawer'а, accordion'ов) —
   единый focus-ring без outline, чтобы не смешивался стиль */
.ab-hero-acc-login:focus-visible,
.ab-hero-acc-more:focus-visible,
.smit-action-btn:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .25) !important;
    border-radius: 4px;
}

/* Тёмная тема — focus-ring ярче */
body.dark-theme .ab-hero-tarif-btn:focus-visible,
body.dark-theme .ab-hero-cmt-add:focus-visible,
body.dark-theme .btn-ab-icon:focus-visible,
body.dark-theme .abd-acc-toggle:focus-visible,
body.dark-theme .btn-close:focus-visible,
[data-bs-theme="dark"] .ab-hero-tarif-btn:focus-visible,
[data-bs-theme="dark"] .ab-hero-cmt-add:focus-visible,
[data-bs-theme="dark"] .btn-ab-icon:focus-visible,
[data-bs-theme="dark"] .abd-acc-toggle:focus-visible,
[data-bs-theme="dark"] .btn-close:focus-visible {
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .45) !important;
}
body.dark-theme .ab-hero-tarif-btn:hover:not(:disabled),
body.dark-theme .ab-hero-cmt-add:hover:not(:disabled),
[data-bs-theme="dark"] .ab-hero-tarif-btn:hover:not(:disabled),
[data-bs-theme="dark"] .ab-hero-cmt-add:hover:not(:disabled) {
    box-shadow: 0 4px 14px rgba(67, 183, 122, .42) !important;
}

@media (prefers-reduced-motion: reduce) {
    .ab-hero-tarif-btn,
    .ab-hero-cmt-add,
    .ab-hero-cmt-del,
    .btn-ab-icon,
    .abd-acc-toggle,
    .btn-close,
    .smit-action-btn { transition: none !important; }
    .ab-hero-tarif-btn:hover, .ab-hero-cmt-add:hover,
    .ab-hero-tarif-btn:active, .ab-hero-cmt-add:active { transform: none !important; }
}

/* ════════════════════════════════════════════════════════════════
   ЕДИНЫЙ СТИЛЬ КНОПОК — свод всех Bootstrap-вариантов (build 849)
   В проекте используются 14+ вариантов .btn-* в 80 шаблонах для
   по-смыслу одинаковых действий. Build 845/847 унифицировали
   геометрию, но цвета оставались разные (.btn-light vs
   .btn-secondary vs .btn-outline-secondary, .btn-info vs .btn-success).
   Свожу к 3 палитрам:
   - PRIMARY (зелёный fill): .btn-primary, .btn-success, .btn-info
   - SECONDARY (серый outline): .btn-light, .btn-secondary,
     .btn-outline-secondary, .btn-outline-light, .btn-outline-info
   - PRIMARY OUTLINE (зелёный outline → fill): .btn-outline-primary,
     .btn-outline-success
   - DESTRUCTIVE (красный/янтарный): .btn-danger/.btn-warning/outline
   Этот блок находится в самом конце файла и побеждает все
   предыдущие правила за счёт порядка каскада + !important.
   ════════════════════════════════════════════════════════════════ */

/* === PRIMARY palette (зелёный fill) === */
.btn-primary,
.btn-success,
.btn-info {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
    color: #fff !important;
}
.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-info:hover:not(:disabled) {
    background-color: #379963 !important;
    border-color: #379963 !important;
    color: #fff !important;
}
.btn-primary:active:not(:disabled),
.btn-success:active:not(:disabled),
.btn-info:active:not(:disabled),
.btn-check:checked + .btn-primary,
.btn-check:checked + .btn-success,
.btn-check:checked + .btn-info {
    background-color: #2f8956 !important;
    border-color: #2f8956 !important;
    color: #fff !important;
}

/* === PRIMARY OUTLINE (зелёный outline → fill) === */
.btn-outline-primary,
.btn-outline-success {
    color: #379963 !important;
    border-color: #43b77a !important;
    background-color: transparent !important;
}
.btn-outline-primary:hover:not(:disabled),
.btn-outline-success:hover:not(:disabled) {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
    color: #fff !important;
}
.btn-outline-primary:active:not(:disabled),
.btn-outline-success:active:not(:disabled),
.btn-check:checked + .btn-outline-primary,
.btn-check:checked + .btn-outline-success {
    background-color: #379963 !important;
    border-color: #379963 !important;
    color: #fff !important;
}

/* === SECONDARY palette (серый outline) === */
.btn-secondary,
.btn-light,
.btn-outline-secondary,
.btn-outline-light,
.btn-outline-info {
    background-color: transparent !important;
    color: #495057 !important;
    border-color: #ced4da !important;
}
.btn-secondary:hover:not(:disabled),
.btn-light:hover:not(:disabled),
.btn-outline-secondary:hover:not(:disabled),
.btn-outline-light:hover:not(:disabled),
.btn-outline-info:hover:not(:disabled) {
    background-color: #f1f3f5 !important;
    color: #212529 !important;
    border-color: #adb5bd !important;
}
.btn-secondary:active:not(:disabled),
.btn-light:active:not(:disabled),
.btn-outline-secondary:active:not(:disabled),
.btn-outline-light:active:not(:disabled),
.btn-outline-info:active:not(:disabled),
.btn-check:checked + .btn-secondary,
.btn-check:checked + .btn-light,
.btn-check:checked + .btn-outline-secondary {
    background-color: #e9ecef !important;
    color: #212529 !important;
    border-color: #adb5bd !important;
}

/* === DESTRUCTIVE/WARNING palette === */
.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}
.btn-danger:hover:not(:disabled) {
    background-color: #b02a37 !important;
    border-color: #b02a37 !important;
}
.btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
    background-color: transparent !important;
}
.btn-outline-danger:hover:not(:disabled) {
    background-color: #dc3545 !important;
    color: #fff !important;
}
.btn-warning {
    background-color: #f0ad4e !important;
    border-color: #f0ad4e !important;
    color: #fff !important;
}
.btn-warning:hover:not(:disabled) {
    background-color: #ec971f !important;
    border-color: #ec971f !important;
    color: #fff !important;
}
.btn-outline-warning {
    color: #b8860b !important;
    border-color: #f0ad4e !important;
    background-color: transparent !important;
}
.btn-outline-warning:hover:not(:disabled) {
    background-color: #f0ad4e !important;
    color: #fff !important;
}

/* === Кастомные кнопки в карточке абонента — сводим к тем же 3 палитрам === */
/* «Изменить тариф» (.ab-hero-tarif-btn) — используется как outline-primary */
.ab-hero-tarif-btn {
    background-color: transparent !important;
    color: #379963 !important;
    border-color: #43b77a !important;
}
.ab-hero-tarif-btn:hover:not(:disabled) {
    background-color: #43b77a !important;
    color: #fff !important;
    border-color: #43b77a !important;
}
/* «+ Добавить» комментарий (.ab-hero-cmt-add) — primary fill */
.ab-hero-cmt-add {
    background-color: #43b77a !important;
    color: #fff !important;
    border-color: #43b77a !important;
}
.ab-hero-cmt-add:hover:not(:disabled) {
    background-color: #379963 !important;
    border-color: #379963 !important;
    color: #fff !important;
}
/* Single-icon utility-кнопки в шапке абонента (.btn-ab-icon) — secondary outline */
.btn-ab-icon {
    border: 1px solid transparent !important;
    color: #6c757d !important;
    background: transparent !important;
}
.btn-ab-icon:hover:not(:disabled) {
    background: #f1f3f5 !important;
    color: #212529 !important;
    border-color: #ced4da !important;
}

/* === Кнопки внутри красных/коричневых banner'ов (.abon-banner) ===
   На красном фоне .btn-light и .btn-outline-secondary становятся
   серыми и теряются. Делаем им белый стиль с прозрачным фоном. */
.abon-banner .btn-light,
.abon-banner .btn-outline-secondary,
.abon-banner .btn-outline-light,
.abon-banner .btn-secondary,
.abon-banner-diag .btn-light,
.abon-banner-diag .btn-outline-secondary,
.abon-banner-diag .btn-outline-light,
.abon-banner-diag .btn-secondary {
    background-color: rgba(255, 255, 255, .14) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, .35) !important;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.abon-banner .btn-light:hover:not(:disabled),
.abon-banner .btn-outline-secondary:hover:not(:disabled),
.abon-banner .btn-outline-light:hover:not(:disabled),
.abon-banner .btn-secondary:hover:not(:disabled),
.abon-banner-diag .btn-light:hover:not(:disabled),
.abon-banner-diag .btn-outline-secondary:hover:not(:disabled),
.abon-banner-diag .btn-outline-light:hover:not(:disabled),
.abon-banner-diag .btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, .26) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, .55) !important;
}

/* === Disabled — единое приглушение для всех вариантов === */
.btn:disabled, .btn.disabled {
    opacity: .55 !important;
    cursor: not-allowed !important;
}

/* === Тёмная тема: secondary палитра адаптируется к тёмному фону === */
body.dark-theme .btn-secondary,
body.dark-theme .btn-light,
body.dark-theme .btn-outline-secondary,
body.dark-theme .btn-outline-light,
body.dark-theme .btn-outline-info,
[data-bs-theme="dark"] .btn-secondary,
[data-bs-theme="dark"] .btn-light,
[data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-light,
[data-bs-theme="dark"] .btn-outline-info {
    color: #adb5bd !important;
    border-color: #3a3f47 !important;
    background-color: transparent !important;
}
body.dark-theme .btn-secondary:hover:not(:disabled),
body.dark-theme .btn-light:hover:not(:disabled),
body.dark-theme .btn-outline-secondary:hover:not(:disabled),
body.dark-theme .btn-outline-light:hover:not(:disabled),
body.dark-theme .btn-outline-info:hover:not(:disabled),
[data-bs-theme="dark"] .btn-secondary:hover:not(:disabled),
[data-bs-theme="dark"] .btn-light:hover:not(:disabled),
[data-bs-theme="dark"] .btn-outline-secondary:hover:not(:disabled),
[data-bs-theme="dark"] .btn-outline-light:hover:not(:disabled),
[data-bs-theme="dark"] .btn-outline-info:hover:not(:disabled) {
    background-color: #2b2f33 !important;
    color: #e7eaf0 !important;
    border-color: #4a5057 !important;
}

/* ════════════════════════════════════════════════════════════════
   Подсветка незаполненных полей (build 857)
   На .sg-contact (и других hero-блоках) JS навешивает класс
   .smit-empty на input/select когда значение пустое — оператор
   сразу видит «что нужно дозаполнить».
   ════════════════════════════════════════════════════════════════ */
.smit-empty,
.smit-empty + .select2-container .select2-selection {
    border-color: #f1aeb5 !important;
    background-color: rgba(220, 53, 69, .04) !important;
    box-shadow: inset 0 0 0 1px rgba(220, 53, 69, .12) !important;
}
.smit-empty:focus,
.smit-empty + .select2-container--focus .select2-selection,
.smit-empty + .select2-container--open .select2-selection {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .18) !important;
}
body.dark-theme .smit-empty,
body.dark-theme .smit-empty + .select2-container .select2-selection,
[data-bs-theme="dark"] .smit-empty,
[data-bs-theme="dark"] .smit-empty + .select2-container .select2-selection {
    border-color: #6b3a40 !important;
    background-color: rgba(220, 53, 69, .08) !important;
}
body.dark-theme .smit-empty:focus,
[data-bs-theme="dark"] .smit-empty:focus {
    border-color: #ef6f7c !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .25) !important;
}

/* ════════════════════════════════════════════════════════════════
   ЕДИНЫЙ СТИЛЬ ЧЕКБОКСОВ + ТОГГЛОВ (build 857)
   По мотивам ShadcnStudio/checkbox-1 (чекбоксы) и reui/toggle-group-1
   (toggle-groups). Глобально для .form-check-input и нативных
   <input type=checkbox> через стандартные Bootstrap-классы.
   ════════════════════════════════════════════════════════════════ */

/* === Чекбоксы (.form-check-input[type=checkbox] без .form-switch) ===
   Build 859 fix: добавлен appearance:none — иначе старое правило
   2653 (appearance:auto + accent-color) рисовало нативную галочку
   поверх SVG-фона, и текст лейбла наезжал. */
.form-check-input[type="checkbox"]:not([role="switch"]) {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 5px !important;
    border: 1.5px solid #ced4da !important;
    background-color: #fff !important;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease,
                box-shadow .15s ease;
    margin-top: .15em;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Bootstrap .form-check: padding-left под 18px чекбокс (1.25em вместо 1.5em
   слишком узко при новом размере). Лейбл получает gap через padding-left
   на самой метке — иначе при flex-row с gap соседние .form-check слипаются. */
.form-check:not(.form-switch) {
    padding-left: 1.65em;
    min-height: 1.5rem;
}
.form-check:not(.form-switch) .form-check-input {
    margin-left: -1.65em !important;
}
.form-check:not(.form-switch) .form-check-label {
    padding-left: .25em;
    line-height: 1.5;
}
.form-check-input[type="checkbox"]:not([role="switch"]):hover:not(:disabled) {
    border-color: #43b77a !important;
}
.form-check-input[type="checkbox"]:not([role="switch"]):focus:not(:disabled) {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .22) !important;
    outline: none !important;
}
.form-check-input[type="checkbox"]:not([role="switch"]):checked {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
    /* белая галочка */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
    background-size: 70% 70% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}
.form-check-input[type="checkbox"]:not([role="switch"]):checked:hover:not(:disabled) {
    background-color: #379963 !important;
    border-color: #379963 !important;
}
.form-check-input[type="checkbox"]:not([role="switch"]):indeterminate {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-width='3' d='M5 10h10'/%3e%3c/svg%3e") !important;
}
.form-check-input[type="checkbox"]:disabled {
    opacity: .55 !important;
    cursor: not-allowed !important;
}

/* === Радио (.form-check-input[type=radio]) === */
.form-check-input[type="radio"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    border: 1.5px solid #ced4da !important;
    background-color: #fff !important;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease,
                box-shadow .15s ease;
    margin-top: .15em;
    flex-shrink: 0;
    vertical-align: middle;
}
.form-check-input[type="radio"]:hover:not(:disabled) { border-color: #43b77a !important; }
.form-check-input[type="radio"]:focus:not(:disabled) {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .22) !important;
    outline: none !important;
}
.form-check-input[type="radio"]:checked {
    background-color: #fff !important;
    border-color: #43b77a !important;
    /* зелёная точка */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.4' fill='%2343b77a'/%3e%3c/svg%3e") !important;
}

/* === Свитчи (.form-switch / role=switch) — pill-style toggle === */
.form-switch .form-check-input,
.form-check-input[role="switch"] {
    width: 38px !important;
    height: 22px !important;
    border-radius: 999px !important;
    border: 1.5px solid #ced4da !important;
    background-color: #e9ecef !important;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease,
                box-shadow .2s ease;
    /* белый «шарик» через background-image */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
    background-position: left center !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
}
.form-switch .form-check-input:focus,
.form-check-input[role="switch"]:focus {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .22) !important;
    outline: none !important;
}
.form-switch .form-check-input:checked,
.form-check-input[role="switch"]:checked {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
    background-position: right center !important;
}
.form-switch .form-check-input:disabled,
.form-check-input[role="switch"]:disabled { opacity: .55 !important; cursor: not-allowed; }

/* Лейбл рядом с чекбоксом/свитчем */
.form-check-label {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    padding-left: 4px;
}
.form-check-input:disabled ~ .form-check-label { cursor: not-allowed; opacity: .65; }

/* === Toggle-group (.btn-check + .btn внутри .btn-group) ===
   По мотивам reui/toggle-group-1: pill-style контейнер,
   активная кнопка фирменная зелёная, единая высота. */
.btn-group:has(.btn-check) {
    background-color: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
    overflow: hidden;
}
.btn-check + .btn,
.btn-group .btn-check + .btn {
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    color: #495057 !important;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease,
                box-shadow .15s ease, transform .12s ease;
}
.btn-check + .btn:hover:not(:disabled),
.btn-group .btn-check + .btn:hover:not(:disabled) {
    background: rgba(67, 183, 122, .10) !important;
    color: #379963 !important;
    transform: none;
    box-shadow: none !important;
}
.btn-check:checked + .btn,
.btn-check:active + .btn,
.btn-group .btn-check:checked + .btn {
    background: #43b77a !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(67, 183, 122, .35) !important;
    transform: none;
}
.btn-check:checked + .btn:hover:not(:disabled),
.btn-group .btn-check:checked + .btn:hover:not(:disabled) {
    background: #379963 !important;
    color: #fff !important;
}
.btn-check:focus-visible + .btn,
.btn-group .btn-check:focus-visible + .btn {
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .30) !important;
}
.btn-check:disabled + .btn { opacity: .55 !important; cursor: not-allowed; }

/* === Поля даты (input[type=date], input[type=datetime-local]) ===
   По мотивам ruixenui/chrono-select: скруглённый, фирменный
   focus-ring, стилизованная calendar-иконка. */
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 6px 10px;
    font-size: .9rem;
    transition: border-color .15s ease, box-shadow .15s ease;
    cursor: pointer;
    background-color: #fff;
}
input[type="date"]:hover:not(:disabled),
input[type="datetime-local"]:hover:not(:disabled),
input[type="time"]:hover:not(:disabled) {
    border-color: #43b77a;
}
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus {
    border-color: #43b77a !important;
    box-shadow: 0 0 0 3px rgba(67, 183, 122, .22) !important;
    outline: none;
}
/* Calendar-icon в WebKit */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: .55;
    padding: 4px;
    border-radius: 4px;
    transition: opacity .15s ease, background-color .15s ease;
    filter: invert(40%) sepia(70%) saturate(380%) hue-rotate(100deg) brightness(.85);
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
    background-color: rgba(67, 183, 122, .12);
}
input[type="date"]:disabled,
input[type="datetime-local"]:disabled,
input[type="time"]:disabled {
    opacity: .55;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

/* === Тёмная тема для всех трёх компонентов === */
body.dark-theme .form-check-input[type="checkbox"]:not([role="switch"]),
body.dark-theme .form-check-input[type="radio"],
[data-bs-theme="dark"] .form-check-input[type="checkbox"]:not([role="switch"]),
[data-bs-theme="dark"] .form-check-input[type="radio"] {
    background-color: #2b2f33 !important;
    border-color: #4a5057 !important;
}
body.dark-theme .form-check-input[type="checkbox"]:not([role="switch"]):checked,
[data-bs-theme="dark"] .form-check-input[type="checkbox"]:not([role="switch"]):checked {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
}
body.dark-theme .form-check-input[type="radio"]:checked,
[data-bs-theme="dark"] .form-check-input[type="radio"]:checked {
    background-color: #2b2f33 !important;
    border-color: #43b77a !important;
}
body.dark-theme .form-switch .form-check-input,
body.dark-theme .form-check-input[role="switch"],
[data-bs-theme="dark"] .form-switch .form-check-input,
[data-bs-theme="dark"] .form-check-input[role="switch"] {
    background-color: #3a3f47 !important;
    border-color: #4a5057 !important;
}
body.dark-theme .form-switch .form-check-input:checked,
body.dark-theme .form-check-input[role="switch"]:checked,
[data-bs-theme="dark"] .form-switch .form-check-input:checked,
[data-bs-theme="dark"] .form-check-input[role="switch"]:checked {
    background-color: #43b77a !important;
    border-color: #43b77a !important;
}
body.dark-theme .btn-group:has(.btn-check),
[data-bs-theme="dark"] .btn-group:has(.btn-check) {
    background-color: #22262e;
    border-color: #353940;
}
body.dark-theme .btn-check + .btn,
[data-bs-theme="dark"] .btn-check + .btn { color: #adb5bd !important; }
body.dark-theme .btn-check + .btn:hover:not(:disabled),
[data-bs-theme="dark"] .btn-check + .btn:hover:not(:disabled) {
    background: rgba(67, 183, 122, .18) !important;
    color: #65d0a0 !important;
}
body.dark-theme input[type="date"],
body.dark-theme input[type="datetime-local"],
body.dark-theme input[type="time"],
[data-bs-theme="dark"] input[type="date"],
[data-bs-theme="dark"] input[type="datetime-local"],
[data-bs-theme="dark"] input[type="time"] {
    background-color: #1e2530;
    border-color: #3a3f47;
    color: #e7eaf0;
    color-scheme: dark;
}
body.dark-theme input[type="date"]:disabled,
body.dark-theme input[type="datetime-local"]:disabled,
[data-bs-theme="dark"] input[type="date"]:disabled,
[data-bs-theme="dark"] input[type="datetime-local"]:disabled {
    background-color: #2b2f33;
}

@media (prefers-reduced-motion: reduce) {
    .form-check-input,
    .btn-check + .btn,
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"] { transition: none !important; }
    .btn-check + .btn { transform: none !important; }
}

/* ════════════════════════════════════════════════════════════════
   jQuery UI datepicker — фирменные цвета (build 858)
   На скриншоте пользователя build 857 не дал эффекта, потому что
   в проекте используется НЕ нативный <input type="date">, а
   jQuery UI datepicker (jquery-ui-1.13.3) — он рисует свой
   календарь .ui-datepicker. Существующий стиль в bs-compat.css
   использует #28a745 (старый Bootstrap success), переопределяем
   на фирменный #43b77a + добавляем dark-theme + скругления.
   ════════════════════════════════════════════════════════════════ */

/* Контейнер календаря */
.ui-datepicker {
    border-radius: 12px !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16),
                0 2px 8px rgba(15, 23, 42, .08) !important;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .08) !important;
}

/* Header — фирменный зелёный */
.ui-datepicker .ui-datepicker-header {
    background: #43b77a !important;
}

/* Today (сегодняшняя дата, не выбранная) — мягкий зелёный фон */
.ui-datepicker .ui-datepicker-today a {
    background: #e8f5e9 !important;
    color: #379963 !important;
}

/* Selected — фирменный fill */
.ui-datepicker .ui-datepicker-current-day a {
    background: #43b77a !important;
    color: #fff !important;
}

/* Hover на ячейке */
.ui-datepicker td a:hover {
    background: rgba(67, 183, 122, .14) !important;
    color: #379963 !important;
}

/* Кнопки «Сегодня / Закрыть» */
.ui-datepicker .ui-datepicker-buttonpane button {
    color: #379963 !important;
    border-radius: 6px !important;
}
.ui-datepicker .ui-datepicker-buttonpane button:hover {
    background: rgba(67, 183, 122, .12) !important;
}

/* === Тёмная тема === */
body.dark-theme .ui-datepicker,
[data-bs-theme="dark"] .ui-datepicker {
    background: #22262e !important;
    border-color: #353940 !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55),
                0 2px 8px rgba(0, 0, 0, .35) !important;
}
body.dark-theme .ui-datepicker .ui-datepicker-header,
[data-bs-theme="dark"] .ui-datepicker .ui-datepicker-header {
    background: #379963 !important;
}
body.dark-theme .ui-datepicker td a,
[data-bs-theme="dark"] .ui-datepicker td a { color: #d8e0e8 !important; }
body.dark-theme .ui-datepicker td span,
[data-bs-theme="dark"] .ui-datepicker td span { color: #6c757d !important; }
body.dark-theme .ui-datepicker td a:hover,
[data-bs-theme="dark"] .ui-datepicker td a:hover {
    background: rgba(67, 183, 122, .22) !important;
    color: #8fdeb5 !important;
}
body.dark-theme .ui-datepicker .ui-datepicker-today a,
[data-bs-theme="dark"] .ui-datepicker .ui-datepicker-today a {
    background: rgba(67, 183, 122, .15) !important;
    color: #65d0a0 !important;
}
body.dark-theme .ui-datepicker .ui-datepicker-current-day a,
[data-bs-theme="dark"] .ui-datepicker .ui-datepicker-current-day a {
    background: #43b77a !important;
    color: #fff !important;
}
body.dark-theme .ui-datepicker th,
[data-bs-theme="dark"] .ui-datepicker th { color: #adb5bd !important; }
body.dark-theme .ui-datepicker .ui-datepicker-buttonpane,
[data-bs-theme="dark"] .ui-datepicker .ui-datepicker-buttonpane {
    background: #1e2530 !important;
    border-top-color: #353940 !important;
}
body.dark-theme .ui-datepicker .ui-datepicker-buttonpane button,
[data-bs-theme="dark"] .ui-datepicker .ui-datepicker-buttonpane button {
    color: #65d0a0 !important;
}
body.dark-theme .ui-datepicker .ui-datepicker-buttonpane button:hover,
[data-bs-theme="dark"] .ui-datepicker .ui-datepicker-buttonpane button:hover {
    background: rgba(67, 183, 122, .22) !important;
}

/* === i-иконки документации на legend'ах hero-блоков (build 861) === */
.smit-doc-link {
    color: rgba(255, 255, 255, .75);
    margin-left: 4px;
    font-size: .8em;
    transition: color .15s ease, transform .12s ease;
    text-decoration: none !important;
    display: inline-block;
}
.smit-doc-link:hover { color: #fff; transform: scale(1.15); }
.smit-doc-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .6);
    outline-offset: 2px;
    border-radius: 3px;
}
/* На светлых legend'ах (.sg-finance / .sg-tarif с пастельной плашкой) — приглушённый зелёный */
.sg-finance > legend .smit-doc-link,
.sg-tarif > legend .smit-doc-link,
.sg-contact > legend .smit-doc-link,
.sg-main > legend .smit-doc-link {
    color: rgba(67, 183, 122, .65);
}
.sg-finance > legend .smit-doc-link:hover,
.sg-tarif > legend .smit-doc-link:hover,
.sg-contact > legend .smit-doc-link:hover,
.sg-main > legend .smit-doc-link:hover {
    color: #379963;
}
body.dark-theme .sg-finance > legend .smit-doc-link,
body.dark-theme .sg-tarif > legend .smit-doc-link,
body.dark-theme .sg-contact > legend .smit-doc-link,
body.dark-theme .sg-main > legend .smit-doc-link,
[data-bs-theme="dark"] .sg-finance > legend .smit-doc-link,
[data-bs-theme="dark"] .sg-tarif > legend .smit-doc-link,
[data-bs-theme="dark"] .sg-contact > legend .smit-doc-link,
[data-bs-theme="dark"] .sg-main > legend .smit-doc-link {
    color: rgba(67, 183, 122, .85);
}
