/* ==========================================================================
   AbonPulse — дизайн-система панели управления
   Подключается после Bootstrap 3 / AdminLTE 2 и переопределяет их внешний вид,
   не меняя разметку страниц.
   ========================================================================== */

:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --border: #e5e9f2;
    --border-strong: #d5dbe7;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    --primary: #5b4ff5;
    --primary-hover: #4a3ee3;
    --primary-soft: #eeedff;
    --primary-text: #4338ca;
    --accent: #06b6d4;
    --gradient: linear-gradient(135deg, #6d5efc 0%, #3b82f6 55%, #06b6d4 100%);

    --success: #16a34a;
    --success-soft: #e8f8ee;
    --warning: #d97706;
    --warning-soft: #fff4e0;
    --danger: #e11d48;
    --danger-soft: #ffe8ee;
    --info: #0284c7;
    --info-soft: #e3f4fd;

    --sidebar-bg: #0b1020;
    --sidebar-surface: #141a2e;
    --sidebar-text: #a9b1c7;
    --sidebar-text-strong: #ffffff;
    --sidebar-muted: #5d6784;
    --sidebar-active: rgba(109, 94, 252, .16);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .14);
    --ring: 0 0 0 3px rgba(91, 79, 245, .18);

    --sidebar-w: 256px;
    --sidebar-w-mini: 72px;
    --header-h: 64px;
}

[data-theme="dark"] {
    --bg: #0a0e1a;
    --surface: #111729;
    --surface-2: #151c31;
    --surface-3: #1b233b;
    --border: #232c45;
    --border-strong: #2e3955;
    --text: #e8ecf6;
    --text-2: #c3cadb;
    --muted: #8a94ad;
    --faint: #5f6a85;

    --primary: #7c70ff;
    --primary-hover: #8f85ff;
    --primary-soft: rgba(124, 112, 255, .14);
    --primary-text: #b4adff;

    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, .13);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, .13);
    --danger: #fb4570;
    --danger-soft: rgba(251, 69, 112, .13);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, .13);

    --sidebar-bg: #070a14;
    --sidebar-surface: #10162a;

    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
    --ring: 0 0 0 3px rgba(124, 112, 255, .3);
    color-scheme: dark;
}

/* ---------- База ---------- */

html, body {
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv11', 'ss01';
}

body.hisob { min-height: 100vh; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font);
    color: var(--text);
    font-weight: 650;
    letter-spacing: -.01em;
}

a { color: var(--primary); }
a:hover, a:focus { color: var(--primary-hover); text-decoration: none; }

hr { border-color: var(--border); }

::selection { background: var(--primary-soft); color: var(--text); }

.text-muted { color: var(--muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.text-info { color: var(--info) !important; }

.tabular, .table td, .stat-value { font-variant-numeric: tabular-nums; }

/* иконки Lucide */
.lucide { width: 18px; height: 18px; stroke-width: 1.9; vertical-align: -4px; flex-shrink: 0; }
.ico-sm .lucide, .lucide.ico-sm { width: 16px; height: 16px; }

/* ---------- Каркас ---------- */

.hisob .wrapper { background: var(--bg); min-height: 100vh; overflow: visible; }

.hisob .content-wrapper {
    background: var(--bg);
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - var(--header-h)) !important;
    padding: 0 0 32px;
    transition: margin-left .25s ease;
}

.hisob .content-wrapper > .content,
.hisob .content-wrapper > section.content {
    padding: 8px 28px 0;
    min-height: auto;
}

.hisob .content .container-fluid { padding-left: 0; padding-right: 0; }

/* Шапка */
.hisob .main-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    max-height: none;
    margin-left: var(--sidebar-w);
    height: var(--header-h);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    transition: margin-left .25s ease;
}

.topbar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--muted);
    border: 1px solid transparent;
    background: transparent;
}
.topbar-toggle:hover { background: var(--surface); border-color: var(--border); color: var(--text); }

.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-title small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.topbar-title small:empty { display: none; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-weight: 550;
    font-size: 13px;
}
.topbar-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    cursor: pointer;
    transition: all .15s ease;
}
.icon-btn:hover { color: var(--primary); border-color: var(--border-strong); }

.theme-toggle .ico-dark { display: none; }
[data-theme="dark"] .theme-toggle .ico-dark { display: inline-block; }
[data-theme="dark"] .theme-toggle .ico-light { display: none; }

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 3px 10px 3px 3px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
}
.user-menu-btn:hover, .user-menu-btn:focus { color: var(--text); border-color: var(--border-strong); }
.user-menu-btn .meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-menu-btn .meta b { font-size: 13px; font-weight: 650; }
.user-menu-btn .meta span { font-size: 11.5px; color: var(--muted); }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--gradient);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.hisob .dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    margin-top: 8px;
    min-width: 220px;
}
.hisob .dropdown-menu > li > a,
.hisob .dropdown-menu .dropdown-item {
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}
.hisob .dropdown-menu > li > a:hover { background: var(--surface-3); color: var(--text); }
.hisob .dropdown-menu .divider { background: var(--border); margin: 6px 0; }
.dropdown-head { padding: 10px 12px 8px; }
.dropdown-head b { display: block; font-size: 14px; }
.dropdown-head span { color: var(--muted); font-size: 12px; }
.dropdown-menu button.dropdown-item { width: 100%; border: 0; background: none; text-align: left; }
.dropdown-menu button.dropdown-item:hover { background: var(--danger-soft); color: var(--danger); }

/* Баннер «вход от имени компании» */
.impersonation-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 28px 0;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
    font-weight: 550;
}
.impersonation-bar a { margin-left: auto; color: inherit; text-decoration: underline; }

/* ---------- Боковая панель ---------- */

.hisob .main-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    padding-top: 0;
    min-height: 100%;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, .04);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width .25s ease, transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--header-h);
    padding: 0 20px;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-brand:hover, .sidebar-brand:focus { color: #fff; }
.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(91, 79, 245, .45);
    flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-size: 18px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; }
.brand-name span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

.sidebar-company {
    margin: 4px 14px 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--sidebar-surface);
    border: 1px solid rgba(255, 255, 255, .05);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.sidebar-company .company-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.sidebar-company .company-meta { min-width: 0; line-height: 1.25; }
.sidebar-company b { display: block; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-company span { color: var(--sidebar-muted); font-size: 11.5px; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: #232a44 transparent; }

.hisob .sidebar-menu { list-style: none; margin: 0; padding: 0; white-space: nowrap; }
.hisob .sidebar-menu > li.header {
    color: var(--sidebar-muted);
    background: transparent;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 18px 12px 8px;
}
.hisob .sidebar-menu > li { position: relative; margin: 1px 0; }
.hisob .sidebar-menu > li > a,
.hisob .sidebar-menu .treeview-menu > li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 13.5px;
    border-left: 0 !important;
    transition: background .15s ease, color .15s ease;
}
.hisob .sidebar-menu > li > a:hover,
.hisob .sidebar-menu .treeview-menu > li > a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.hisob .sidebar-menu > li.active > a,
.hisob .sidebar-menu > li.menu-open > a { color: #fff; background: rgba(255, 255, 255, .04); }
.hisob .sidebar-menu > li.active:not(.treeview) > a,
.hisob .sidebar-menu .treeview-menu > li.active > a {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 2px 0 0 #8b7fff;
}
.hisob .sidebar-menu > li > a .lucide { opacity: .9; }
.hisob .sidebar-menu > li.active > a .lucide { color: #a99fff; opacity: 1; }
.hisob .sidebar-menu .chevron { margin-left: auto; transition: transform .2s ease; opacity: .6; width: 16px; height: 16px; }
.hisob .sidebar-menu li.menu-open > a .chevron { transform: rotate(90deg); }
.hisob .sidebar-menu .badge-count {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    padding: 1px 8px;
    font-weight: 650;
}

.hisob .sidebar-menu .treeview-menu {
    display: none;
    list-style: none;
    background: transparent !important;
    margin: 2px 0 6px 21px;
    padding: 0 0 0 10px;
    border-left: 1px solid rgba(255, 255, 255, .08);
}
.hisob .sidebar-menu li.menu-open > .treeview-menu { display: block; }
.hisob .sidebar-menu .treeview-menu > li > a { padding: 7px 12px; font-size: 13px; }

.sidebar-foot {
    padding: 12px 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .05);
    flex-shrink: 0;
}
.sidebar-foot .help-card {
    border-radius: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(109, 94, 252, .22), rgba(6, 182, 212, .12));
    color: #dfe3f1;
    font-size: 12.5px;
    line-height: 1.45;
}
.sidebar-foot .help-card b { color: #fff; display: block; margin-bottom: 2px; font-size: 13px; }
.sidebar-foot .help-card a { color: #c9c3ff; font-weight: 600; }

/* свёрнутая панель */
.hisob.sidebar-collapse .main-sidebar { width: var(--sidebar-w-mini); }
.hisob.sidebar-collapse .content-wrapper,
.hisob.sidebar-collapse .main-header,
.hisob.sidebar-collapse .main-footer { margin-left: var(--sidebar-w-mini); }
.hisob.sidebar-collapse .brand-name,
.hisob.sidebar-collapse .sidebar-company .company-meta,
.hisob.sidebar-collapse .sidebar-menu > li > a > span,
.hisob.sidebar-collapse .sidebar-menu .chevron,
.hisob.sidebar-collapse .sidebar-menu > li.header,
.hisob.sidebar-collapse .sidebar-menu .treeview-menu,
.hisob.sidebar-collapse .sidebar-foot { display: none !important; }
.hisob.sidebar-collapse .sidebar-brand { padding: 0 19px; }
.hisob.sidebar-collapse .sidebar-company { margin: 4px 14px 10px; padding: 6px; justify-content: center; }
.hisob.sidebar-collapse .sidebar-menu > li > a { justify-content: center; padding: 11px 0; }

.sidebar-backdrop { display: none; }

@media (max-width: 991px) {
    .hisob .main-sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
    .hisob .content-wrapper, .hisob .main-header, .hisob .main-footer { margin-left: 0 !important; }
    .hisob.sidebar-open .main-sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .hisob.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(5, 8, 20, .55);
        z-index: 1035;
    }
    .hisob .main-header { padding: 0 16px; }
    .hisob .content-wrapper > .content, .hisob .content-wrapper > section.content { padding: 8px 16px 0; }
    .user-menu-btn .meta, .topbar-chip.hide-sm { display: none; }
    .impersonation-bar { margin: 12px 16px 0; }
}

/* ---------- Заголовок страницы (старый content-header) ---------- */

.hisob .content-header { padding: 24px 28px 4px; }
.hisob .content-header > h1 { display: none; }
.hisob .content-header > .breadcrumb {
    position: static;
    float: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 12.5px;
}
.hisob .content-header > .breadcrumb > li > a { color: var(--muted); }
.hisob .content-header > .breadcrumb > li + li:before { color: var(--faint); }

/* ---------- Карточки (box) ---------- */

.hisob .box,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 1px solid var(--border) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    position: relative;
}
.hisob .box.box-solid > .box-header { color: var(--text); background: transparent !important; }
.hisob .box-header,
.card-header {
    padding: 18px 20px 14px;
    border-bottom: 0;
    color: var(--text);
}
.hisob .box-header.with-border { border-bottom: 1px solid var(--border); }
.hisob .box-header:after { content: ''; display: table; clear: both; }
.hisob .box-header .box-title,
.card-title {
    font-size: 16px;
    font-weight: 650;
    color: var(--text);
    line-height: 38px;
    margin: 0;
}
.hisob .box-body,
.card-body { padding: 16px 20px 20px; }
.hisob .box-footer,
.card-footer {
    padding: 14px 20px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.hisob .box .overlay { background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: var(--radius-lg); }
.hisob .btn-box-tool { color: var(--muted); }

.heading-btn-group { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.heading-btn-group .btn-block { width: auto; margin: 0; }
.heading-btn-group .btn-block + .btn-block { margin-top: 0; }

/* Если страница не обёрнута в box — делаем фон-карточку для content */
.hisob .content-surface {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
}

/* ---------- Кнопки ---------- */

.hisob .btn {
    font-family: var(--font);
    font-weight: 600;
    font-size: 13.5px;
    border-radius: 10px;
    padding: 8px 14px;
    border: 1px solid transparent;
    box-shadow: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .05s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    line-height: 1.45;
}
.hisob .btn:active { transform: translateY(1px); box-shadow: none; }
.hisob .btn:focus, .hisob .btn.focus { outline: none; box-shadow: var(--ring); }
.hisob .btn b { font-weight: inherit; display: inline-flex; }
.hisob .btn-block { display: flex; width: 100%; }
.hisob .btn-flat { border-radius: 10px; }
.hisob .btn-sm, .hisob .btn-group-sm > .btn { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.hisob .btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.hisob .btn-lg { padding: 11px 20px; font-size: 15px; border-radius: 12px; }

.hisob .btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 1px 2px rgba(91, 79, 245, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.hisob .btn-primary:hover, .hisob .btn-primary:focus, .hisob .btn-primary:active, .hisob .btn-primary.active,
.hisob .open > .dropdown-toggle.btn-primary { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.hisob .btn-success { background: var(--primary); color: #fff; border-color: var(--primary); }
.hisob .btn-success:hover, .hisob .btn-success:focus, .hisob .btn-success:active { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.hisob .btn-default, .hisob .btn-secondary {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border-strong);
}
.hisob .btn-default:hover, .hisob .btn-default:focus, .hisob .btn-secondary:hover, .hisob .btn-secondary:focus {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border-strong);
}

.hisob .btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.hisob .btn-danger:hover, .hisob .btn-danger:focus { background: var(--danger); color: #fff; }

.hisob .btn-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.hisob .btn-warning:hover, .hisob .btn-warning:focus { background: var(--warning); color: #fff; }

.hisob .btn-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.hisob .btn-info:hover, .hisob .btn-info:focus { background: var(--info); color: #fff; }

.hisob .btn-link { color: var(--primary); }

/* кнопки-действия внутри таблиц */
.hisob .table .btn { padding: 4px 9px; font-size: 12.5px; border-radius: 8px; }
.hisob .table .btn-primary { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; box-shadow: none; }
.hisob .table .btn-primary:hover { background: var(--primary); color: #fff; }
.hisob .table .btn-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.hisob .table .btn-success:hover { background: var(--success); color: #fff; }

/* ---------- Формы ---------- */

.hisob label, .hisob .control-label, .hisob .form-control-label {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-2);
    margin-bottom: 6px;
}

.hisob .form-control,
.hisob .input-group-addon,
.hisob select.form-control {
    height: 40px;
    border-radius: 10px !important;
    border: 1px solid var(--border-strong);
    background-color: var(--surface);
    color: var(--text);
    font-size: 14px;
    box-shadow: none;
    padding: 8px 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.hisob textarea.form-control { height: auto; min-height: 96px; }
.hisob select[multiple].form-control { height: auto; }
.hisob .form-control::placeholder { color: var(--faint); }
.hisob .form-control:focus { border-color: var(--primary); box-shadow: var(--ring); outline: 0; }
.hisob .form-control[disabled], .hisob .form-control[readonly] { background: var(--surface-2); color: var(--muted); }
.hisob .input-group { display: flex; width: 100%; }
.hisob .input-group .form-control { border-radius: 10px !important; }
.hisob .input-group-addon { width: auto; display: inline-flex; align-items: center; background: var(--surface-2); color: var(--muted); }
.hisob .input-group-addon + .form-control, .hisob .form-control + .input-group-addon { margin-left: 6px; }
.hisob .input-group-btn { width: auto; }
.hisob .has-feedback .form-control { padding-right: 12px; }
.hisob .form-control-feedback, .hisob .has-feedback .glyphicon.form-control-feedback { display: none; }
.hisob .help-block { color: var(--danger); font-size: 12px; margin-top: 5px; }
.hisob .help-block:empty, .hisob .help-block.with-errors:empty { display: none; }
.hisob .has-error .form-control { border-color: var(--danger); }
.hisob .has-error .form-control:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.hisob .has-error label, .hisob .has-error .help-block { color: var(--danger); }
.hisob .has-success .form-control { border-color: var(--border-strong); }
.hisob .form-group { margin-bottom: 18px; }
.hisob .checkbox label, .hisob .radio label { font-weight: 500; }
.hisob input[type=checkbox], .hisob input[type=radio] { accent-color: var(--primary); }

/* ---------- Таблицы ---------- */

.hisob .table {
    color: var(--text-2);
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}
.hisob .table > thead > tr > th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border) !important;
    border-top: 1px solid var(--border) !important;
    padding: 11px 12px;
    white-space: nowrap;
    vertical-align: middle;
}
.hisob .table > thead > tr > th:first-child { border-left: 1px solid var(--border); border-radius: 10px 0 0 10px; }
.hisob .table > thead > tr > th:last-child { border-right: 1px solid var(--border); border-radius: 0 10px 10px 0; }
.hisob .table > tbody > tr > td,
.hisob .table > tfoot > tr > td,
.hisob .table > tfoot > tr > th {
    border-top: 0;
    border-bottom: 1px solid var(--border);
    padding: 12px;
    vertical-align: middle;
    font-size: 13.5px;
}
.hisob .table > tbody > tr:last-child > td { border-bottom: 0; }
.hisob .table-bordered,
.hisob .table-bordered > thead > tr > th,
.hisob .table-bordered > tbody > tr > td,
.hisob .table-bordered > tfoot > tr > td { border-left: 0; border-right: 0; }
.hisob .table-bordered { border: 0; }
.hisob .table-striped > tbody > tr:nth-of-type(odd) { background: transparent; }
.hisob .table-hover > tbody > tr:hover, .hisob .table > tbody > tr:hover { background: var(--surface-2); }
.hisob .table > tbody > tr > td > a:not(.btn) { font-weight: 600; }
.hisob .table-responsive { border: 0; }

/* ---------- DataTables ---------- */

.hisob .dataTables_wrapper { font-size: 13px; color: var(--muted); }
.hisob .dataTables_wrapper .row { margin: 0; }
.hisob .dataTables_wrapper .row > [class*=col-] { padding: 0; }
.hisob .dataTables_wrapper .dataTables_length,
.hisob .dataTables_wrapper .dataTables_filter { margin-bottom: 14px; }
.hisob .dataTables_wrapper .dataTables_filter { text-align: right; }
.hisob .dataTables_wrapper .dataTables_length label,
.hisob .dataTables_wrapper .dataTables_filter label { font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.hisob .dataTables_wrapper .dataTables_filter input {
    margin-left: 0;
    width: 260px;
    padding-left: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}
.hisob .dataTables_wrapper .dataTables_length select { width: auto; padding-right: 28px; }
.hisob .dataTables_wrapper .dataTables_info { padding-top: 18px; color: var(--muted); }
.hisob .dataTables_wrapper .dataTables_paginate { padding-top: 12px; }
.hisob .dataTables_wrapper .dataTables_processing {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    color: var(--text);
    padding: 14px !important;
    height: auto;
    font-weight: 600;
}
.hisob table.dataTable { margin-top: 4px !important; margin-bottom: 4px !important; }
.hisob table.dataTable thead .sorting:after,
.hisob table.dataTable thead .sorting_asc:after,
.hisob table.dataTable thead .sorting_desc:after { opacity: .35; font-size: 10px; }
.hisob .dt-buttons { margin-bottom: 12px; display: inline-flex; gap: 6px; }
.hisob .dt-buttons .btn { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }

/* ---------- Пагинация ---------- */

.hisob .pagination { display: inline-flex; gap: 4px; margin: 0; }
.hisob .pagination > li > a,
.hisob .pagination > li > span {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    border-radius: 8px !important;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 550;
    margin: 0;
}
.hisob .pagination > li > a:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.hisob .pagination > .active > a,
.hisob .pagination > .active > a:hover,
.hisob .pagination > .active > span { background: var(--primary); border-color: var(--primary); color: #fff; }
.hisob .pagination > .disabled > a, .hisob .pagination > .disabled > span { background: var(--surface); color: var(--faint); border-color: var(--border); }

/* ---------- Метки, статусы ---------- */

.hisob .label, .hisob .badge, .pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 5px 9px;
    border-radius: 999px;
    letter-spacing: 0;
    white-space: nowrap;
}
.hisob .label-success, .hisob .bg-green, .pill-success { background: var(--success-soft) !important; color: var(--success) !important; }
.hisob .label-danger, .hisob .bg-red, .pill-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.hisob .label-warning, .hisob .bg-yellow, .pill-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.hisob .label-info, .hisob .bg-aqua, .pill-info { background: var(--info-soft) !important; color: var(--info) !important; }
.hisob .label-primary, .hisob .bg-blue, .hisob .bg-light-blue, .pill-primary { background: var(--primary-soft) !important; color: var(--primary-text) !important; }
.hisob .label-default, .pill-muted { background: var(--surface-3) !important; color: var(--muted) !important; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Уведомления ---------- */

.hisob .alert {
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 12px 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}
.hisob .alert .icon { margin-right: 0; }
.hisob .alert .close { order: 3; margin-left: auto; opacity: .5; color: inherit; text-shadow: none; float: none; }
.hisob .alert-success { background: var(--success-soft) !important; color: var(--success) !important; border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.hisob .alert-danger, .hisob .alert-error { background: var(--danger-soft) !important; color: var(--danger) !important; border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.hisob .alert-warning { background: var(--warning-soft) !important; color: var(--warning) !important; border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.hisob .alert-info { background: var(--info-soft) !important; color: var(--info) !important; border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.flash-zone { padding: 16px 28px 0; }
.flash-zone > [class*=col-] { float: none; padding: 0 !important; width: auto; }
.flash-zone .alert { margin-bottom: 0; }
@media (max-width: 991px) { .flash-zone { padding: 12px 16px 0; } }

/* ---------- Модальные окна ---------- */

.hisob .modal-backdrop.in { opacity: .55; background: #050814; }
.hisob .modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text);
}
.hisob .modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.hisob .modal-title { font-weight: 650; font-size: 17px; }
.hisob .modal-header .close { color: var(--muted); opacity: .7; text-shadow: none; font-size: 24px; margin-top: -4px; }
.hisob .modal-body { padding: 20px 22px; }
.hisob .modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; justify-content: flex-end; gap: 8px; }
.hisob .modal-footer .btn + .btn { margin-left: 0; }

/* ---------- Вкладки ---------- */

.hisob .nav-tabs-custom { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow); }
.hisob .nav-tabs-custom > .nav-tabs { border-bottom: 1px solid var(--border); padding: 0 12px; }
.hisob .nav-tabs-custom > .nav-tabs > li { border-top: 0; margin-bottom: -1px; }
.hisob .nav-tabs-custom > .nav-tabs > li > a { color: var(--muted); font-weight: 600; padding: 14px 12px; border: 0; border-bottom: 2px solid transparent; }
.hisob .nav-tabs-custom > .nav-tabs > li.active > a { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.hisob .nav-tabs-custom > .tab-content { background: transparent; padding: 16px 20px; }

/* ---------- Плитки AdminLTE (small-box / info-box) ---------- */

.hisob .small-box, .hisob .info-box {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.hisob .small-box .icon { color: var(--surface-3); }
.hisob .small-box > .small-box-footer { background: var(--surface-2); color: var(--muted); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.hisob .info-box-icon { border-radius: 12px; }

/* ---------- Сторонние виджеты ---------- */

/* select2 */
.hisob .select2-container--default .select2-selection--single,
.hisob .select2-container--default .select2-selection--multiple {
    min-height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
}
.hisob .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 38px; color: var(--text); padding-left: 12px; }
.hisob .select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }
.hisob .select2-container--default.select2-container--focus .select2-selection--multiple,
.hisob .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--primary); box-shadow: var(--ring); }
.hisob .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--primary-soft);
    color: var(--primary-text);
    border: 0;
    border-radius: 7px;
    padding: 2px 8px;
}
.select2-dropdown { background: var(--surface); border-color: var(--border) !important; border-radius: 10px !important; box-shadow: var(--shadow-lg); overflow: hidden; color: var(--text); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--primary) !important; }
.select2-container--default .select2-search--dropdown .select2-search__field { border-radius: 8px; border-color: var(--border-strong); background: var(--surface); color: var(--text); }

/* vanillaSelectBox */
.hisob .vsb-main button {
    min-height: 40px;
    border-radius: 10px !important;
    border: 1px solid var(--border-strong) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    width: 100%;
}
.hisob .vsb-menu { background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: 10px !important; box-shadow: var(--shadow-lg); color: var(--text); }
.hisob .vsb-menu li:hover { background: var(--surface-3) !important; }

/* datepicker / daterangepicker / jquery-ui */
.datepicker, .daterangepicker, .ui-datepicker {
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    font-family: var(--font) !important;
    padding: 8px !important;
}
.datepicker table tr td.active, .datepicker table tr td.active:hover,
.datepicker table tr td span.active, .daterangepicker td.active,
.ui-datepicker .ui-state-active { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; border-radius: 8px; }
.datepicker table tr td.day:hover, .datepicker table tr td span:hover { background: var(--surface-3) !important; border-radius: 8px; }
.ui-datepicker .ui-widget-header { background: transparent; border: 0; color: var(--text); }

/* sweetalert */
.swal-overlay { background-color: rgba(5, 8, 20, .55); }
.swal-modal { border-radius: 18px; background: var(--surface); font-family: var(--font); }
.swal-title { color: var(--text); font-weight: 700; font-size: 20px; }
.swal-text { color: var(--muted); text-align: center; }
.swal-button { border-radius: 10px; font-weight: 600; padding: 10px 20px; font-family: var(--font); }
.swal-button--confirm { background: var(--primary); }
.swal-button--confirm:not([disabled]):hover { background: var(--primary-hover); }
.swal-button--danger { background: var(--danger); }
.swal-button--cancel { background: var(--surface-3); color: var(--text-2); }
.swal-footer { text-align: center; }

/* jGrowl */
.jGrowl-notification { border-radius: 12px !important; font-family: var(--font) !important; }

/* загрузчики отчётов */
.statistics-loader { border-radius: var(--radius-lg); }

/* ---------- Подвал ---------- */

.hisob .main-footer {
    margin-left: var(--sidebar-w);
    background: transparent;
    border-top: 0;
    color: var(--faint);
    padding: 8px 28px 20px;
    font-size: 12.5px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    transition: margin-left .25s ease;
}
.hisob .main-footer a { color: var(--muted); }

/* ==========================================================================
   Компоненты новых страниц (дашборды, панель платформы)
   ========================================================================== */

.page { padding: 24px 28px 0; }
@media (max-width: 991px) { .page { padding: 16px 16px 0; } }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1199px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 767px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 550; }
.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
}
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin-top: 10px; line-height: 1.1; color: var(--text); }
.stat-value small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.stat-foot { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.trend-up { color: var(--success); font-weight: 650; }
.trend-down { color: var(--danger); font-weight: 650; }

.stat.hero { background: var(--gradient); border: 0; color: #fff; box-shadow: 0 12px 32px rgba(91, 79, 245, .28); }
.stat.hero .stat-label, .stat.hero .stat-foot { color: rgba(255, 255, 255, .82); }
.stat.hero .stat-value { color: #fff; }
.stat.hero .stat-icon { background: rgba(255, 255, 255, .18); color: #fff; }

.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; }
.chart-box { position: relative; height: 280px; padding: 8px 16px 16px; }
.chart-box.sm { height: 220px; }

.list { list-style: none; margin: 0; padding: 4px 8px 10px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.list li + li { border-top: 1px solid var(--border); }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sub { color: var(--muted); font-size: 12.5px; }
.list .num { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text); }

.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .lucide { width: 28px; height: 28px; color: var(--faint); margin-bottom: 8px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.toolbar .form-control { width: auto; min-width: 220px; }
.search-input { position: relative; }
.search-input .lucide { position: absolute; left: 12px; top: 11px; color: var(--faint); width: 17px; height: 17px; }
.search-input .form-control { padding-left: 38px; }

.co-cell { display: flex; align-items: center; gap: 12px; }
.co-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    font-size: 13px;
}
.co-cell b { display: block; color: var(--text); font-weight: 650; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; padding: 4px 20px 20px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); font-weight: 550; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 767px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.form-section { padding: 20px; }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-section h4 { margin: 0 0 4px; font-size: 15px; }
.form-section > p { color: var(--muted); margin: 0 0 16px; font-size: 13px; }

.plan-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 991px) { .plan-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.plan-option { position: relative; margin: 0; cursor: pointer; }
.plan-option input { position: absolute; opacity: 0; }
.plan-option .plan-card {
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--surface);
    transition: all .15s ease;
    display: block;
}
.plan-option .plan-card b { display: block; color: var(--text); font-size: 14px; }
.plan-option .plan-card span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.plan-option input:checked + .plan-card { border-color: var(--primary); box-shadow: var(--ring); background: var(--primary-soft); }

/* ==========================================================================
   Страница входа
   ========================================================================== */

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-visual {
    position: relative;
    overflow: hidden;
    background: #070a16;
    color: #fff;
    padding: 44px 56px;
    display: flex;
    flex-direction: column;
}
.auth-visual:before {
    content: '';
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(40% 40% at 20% 25%, rgba(109, 94, 252, .55), transparent 70%),
        radial-gradient(35% 35% at 80% 70%, rgba(6, 182, 212, .40), transparent 70%),
        radial-gradient(30% 30% at 60% 15%, rgba(59, 130, 246, .35), transparent 70%);
    filter: blur(20px);
    animation: auth-drift 18s ease-in-out infinite alternate;
}
.auth-visual:after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes auth-drift { to { transform: translate3d(4%, -3%, 0) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .auth-visual:before { animation: none; } }
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual .sidebar-brand { padding: 0; height: auto; }
.auth-pitch { margin-top: auto; max-width: 520px; }
.auth-pitch h2 { color: #fff; font-size: 38px; line-height: 1.12; font-weight: 750; letter-spacing: -.03em; margin: 0 0 16px; }
.auth-pitch p { color: rgba(255, 255, 255, .72); font-size: 16px; line-height: 1.6; margin: 0; }
.auth-metrics { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; }
.auth-metric {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    backdrop-filter: blur(8px);
    min-width: 150px;
}
.auth-metric b { display: block; font-size: 22px; font-weight: 750; }
.auth-metric span { color: rgba(255, 255, 255, .65); font-size: 12.5px; }

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; position: relative; }
.auth-form { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin: 0 0 8px; }
.auth-form > p { color: var(--muted); margin: 0 0 28px; }
.auth-form .form-control { height: 46px; font-size: 15px; }
.auth-form .btn-primary { height: 46px; font-size: 15px; width: 100%; }
.auth-form .input-icon { position: relative; }
.auth-form .input-icon .lucide { position: absolute; left: 14px; top: 14px; color: var(--faint); }
.auth-form .input-icon .form-control { padding-left: 42px; }
.auth-form .pass-toggle { position: absolute; right: 8px; top: 7px; border: 0; background: none; color: var(--faint); padding: 6px; border-radius: 8px; }
.auth-form .pass-toggle .lucide { position: static; }
.auth-form .pass-toggle:hover { color: var(--text); }
.auth-foot { margin-top: 28px; color: var(--faint); font-size: 12.5px; text-align: center; }
.auth-roles { display: flex; gap: 6px; margin-bottom: 22px; padding: 4px; background: var(--surface-3); border-radius: 12px; }
.auth-roles a { flex: 1; text-align: center; padding: 8px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; }
.auth-roles a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-theme { position: absolute; top: 20px; right: 20px; }
@media (max-width: 991px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { padding: 24px; min-height: auto; }
    .auth-pitch, .auth-metrics { display: none; }
}

/* ==========================================================================
   Тёмная тема: доп. правки для сторонних компонентов
   ========================================================================== */

[data-theme="dark"] .hisob .form-control option { background: var(--surface); }
[data-theme="dark"] .close { color: var(--text); }
[data-theme="dark"] .table > tbody > tr > td { color: var(--text-2); }
[data-theme="dark"] .content { background: transparent !important; }
[data-theme="dark"] .bg-white, [data-theme="dark"] .hisob [style*="background: #fff"], [data-theme="dark"] .hisob [style*="background-color: #fff"],
[data-theme="dark"] .hisob [style*="background:#fff"], [data-theme="dark"] .hisob [style*="background-color: white"] { background: var(--surface) !important; }
[data-theme="dark"] .vsb-menu li { color: var(--text); }
[data-theme="dark"] .daterangepicker .calendar-table { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .daterangepicker td.off { background: transparent; color: var(--faint); }
[data-theme="dark"] .daterangepicker td.available:hover { background: var(--surface-3); }
[data-theme="dark"] .daterangepicker .ranges li:hover { background: var(--surface-3); }
[data-theme="dark"] .dropdown-menu > li > a { color: var(--text-2); }
[data-theme="dark"] .popover { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .well { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .list-group-item { background: var(--surface); border-color: var(--border); color: var(--text-2); }
[data-theme="dark"] .panel { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .panel-heading { background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border) !important; }

/* печать */
@media print {
    .main-sidebar, .main-header, .main-footer, .flash-zone { display: none !important; }
    .content-wrapper { margin: 0 !important; }
}

/* ---------- Улучшения старых таблиц ---------- */

.hisob .heading-btn-group .btn-block { width: auto; display: inline-flex; margin: 0; }
.hisob .box-header > .pull-right { margin-left: 12px; }

.hisob td.actions-compact { white-space: nowrap; }
.hisob td.actions-compact .btn {
    font-size: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0 2px 0 0;
    gap: 0;
}
.hisob td.actions-compact .btn i, .hisob td.actions-compact .btn .lucide { font-size: 14px; }

/* цветной тип клиента, который сервер отдаёт как <div style="background: …"> */
.hisob .table td > div[style*="background"] {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px !important;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
}

.hisob .dataTables_wrapper .dataTables_filter input { margin-left: 0 !important; }

/* ---------- Правки по итогам ревью экранов ---------- */

.grid > .card, .grid > .stat { margin-bottom: 0; }
.grid > .card { display: flex; flex-direction: column; }
.grid > .card > .chart-box { flex: 1; min-height: 280px; }
.grid > .card > .chart-box.sm { min-height: 220px; }
.stat.hero .stat-value small { color: rgba(255, 255, 255, .78); }
.co-cell > div > span { color: var(--muted); font-size: 12.5px; }
.co-cell span { color: inherit; font-size: inherit; }
.co-cell .co-logo, .co-cell .avatar { color: #fff; }
.hisob .table td.text-right, .hisob .table th.text-right { white-space: nowrap; }
.hisob code { background: var(--surface-3); color: var(--primary-text); border-radius: 6px; padding: 2px 6px; font-size: 12.5px; }
.hisob .has-success label, .hisob .has-success .control-label { color: var(--text-2); }
.hisob .form-group.input-group { display: block; }
.hisob .form-group.input-group > label { display: block; }
.hisob .btn.disabled, .hisob .btn[disabled] { opacity: .55; }

/* страницы отчётов: .content > .container-fluid превращаем в карточку */
.hisob .content-wrapper > .content { background: transparent !important; }
.hisob .content-wrapper > .content > .container-fluid {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px 20px 4px !important;
    margin-top: 16px;
}
.hisob .content-wrapper > .content > .container-fluid .content_reports { margin-top: 4px; }
.hisob .content-wrapper > .content > .container-fluid input[type=checkbox] { margin-right: 6px; }

/* кнопки экспорта DataTables */
.hisob .dt-buttons { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.hisob .dt-button, .hisob a.dt-button, .hisob button.dt-button {
    background: var(--surface) !important;
    background-image: none !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 8px !important;
    color: var(--text-2) !important;
    font: 600 12.5px var(--font) !important;
    padding: 6px 12px !important;
    margin: 0 !important;
    box-shadow: none !important;
}
.hisob .dt-button:hover { background: var(--surface-3) !important; color: var(--text) !important; }

/* ==========================================================================
   Переключатель языка
   ========================================================================== */

.locale-switch { position: relative; }
.locale-switch > summary { list-style: none; width: auto; padding: 0 10px; gap: 6px; font-weight: 650; font-size: 12.5px; }
.locale-switch > summary::-webkit-details-marker { display: none; }
.locale-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1050;
    min-width: 200px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: grid;
    gap: 2px;
}
.locale-menu a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; }
.locale-menu a:hover { background: var(--surface-3); color: var(--text); }
.locale-menu a.active { background: var(--primary-soft); color: var(--primary-text); }
.locale-menu em { font-style: normal; font-size: 11px; color: var(--faint); font-weight: 650; }
.auth-locale { position: absolute; top: 20px; right: 68px; }

/* ==========================================================================
   Письмо справа налево (fa, ar, ps)
   ========================================================================== */

[dir="rtl"] body, [dir="rtl"] .hisob { font-family: 'Vazirmatn', 'Noto Naskh Arabic', Tahoma, var(--font); }
[dir="rtl"] .hisob .main-sidebar { left: auto; right: 0; border-right: 0; border-left: 1px solid rgba(255, 255, 255, .04); }
[dir="rtl"] .hisob .content-wrapper,
[dir="rtl"] .hisob .main-header,
[dir="rtl"] .hisob .main-footer { margin-left: 0; margin-right: var(--sidebar-w); }
[dir="rtl"] .hisob.sidebar-collapse .content-wrapper,
[dir="rtl"] .hisob.sidebar-collapse .main-header,
[dir="rtl"] .hisob.sidebar-collapse .main-footer { margin-right: var(--sidebar-w-mini); margin-left: 0; }
[dir="rtl"] .topbar-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .hisob .sidebar-menu .chevron,
[dir="rtl"] .hisob .sidebar-menu .badge-count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .hisob .sidebar-menu .chevron { transform: scaleX(-1); }
[dir="rtl"] .hisob .sidebar-menu li.menu-open > a .chevron { transform: rotate(90deg); }
[dir="rtl"] .hisob .sidebar-menu .treeview-menu { margin: 2px 21px 6px 0; padding: 0 10px 0 0; border-left: 0; border-right: 1px solid rgba(255, 255, 255, .08); }
[dir="rtl"] .hisob .sidebar-menu > li.active:not(.treeview) > a,
[dir="rtl"] .hisob .sidebar-menu .treeview-menu > li.active > a { box-shadow: inset -2px 0 0 #8b7fff; }
[dir="rtl"] .locale-menu { right: auto; left: 0; }
[dir="rtl"] .hisob .dropdown-menu-right { right: auto; left: 0; }
[dir="rtl"] .hisob .dropdown-menu > li > a, [dir="rtl"] .dropdown-menu button.dropdown-item { text-align: right; }
[dir="rtl"] .page-head .actions, [dir="rtl"] .card-head .actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .hisob .text-right { text-align: left !important; }
[dir="rtl"] .hisob .text-left { text-align: right !important; }
[dir="rtl"] .hisob .pull-right { float: left !important; }
[dir="rtl"] .hisob .pull-left { float: right !important; }
[dir="rtl"] .hisob .box-header > .pull-right { margin-left: 0; margin-right: 12px; }
[dir="rtl"] .hisob .table > thead > tr > th:first-child { border-left: 0; border-right: 1px solid var(--border); border-radius: 0 10px 10px 0; }
[dir="rtl"] .hisob .table > thead > tr > th:last-child { border-right: 0; border-left: 1px solid var(--border); border-radius: 10px 0 0 10px; }
[dir="rtl"] .hisob .table th, [dir="rtl"] .hisob .table td { text-align: right; }
[dir="rtl"] .hisob .dataTables_wrapper .dataTables_filter { text-align: left; }
[dir="rtl"] .hisob .dataTables_wrapper .dataTables_filter input { padding-left: 12px; padding-right: 36px; background-position: calc(100% - 12px) center; }
[dir="rtl"] .hisob .dataTables_wrapper .dataTables_paginate { float: left; }
[dir="rtl"] .hisob .dataTables_wrapper .dataTables_info { float: right; }
[dir="rtl"] .hisob .col-xs-1, [dir="rtl"] .hisob .col-xs-2, [dir="rtl"] .hisob .col-xs-3, [dir="rtl"] .hisob .col-xs-4, [dir="rtl"] .hisob .col-xs-5, [dir="rtl"] .hisob .col-xs-6,
[dir="rtl"] .hisob .col-xs-7, [dir="rtl"] .hisob .col-xs-8, [dir="rtl"] .hisob .col-xs-9, [dir="rtl"] .hisob .col-xs-10, [dir="rtl"] .hisob .col-xs-11, [dir="rtl"] .hisob .col-xs-12 { float: right; }
@media (min-width: 768px) { [dir="rtl"] .hisob [class*="col-sm-"] { float: right; } }
@media (min-width: 992px) { [dir="rtl"] .hisob [class*="col-md-"] { float: right; } }
@media (min-width: 1200px) { [dir="rtl"] .hisob [class*="col-lg-"] { float: right; } }
[dir="rtl"] .search-input .lucide { left: auto; right: 12px; }
[dir="rtl"] .search-input .form-control { padding-left: 12px; padding-right: 38px; }
[dir="rtl"] .auth-form .input-icon .lucide { left: auto; right: 14px; }
[dir="rtl"] .auth-form .input-icon .form-control { padding-left: 42px; padding-right: 42px; }
[dir="rtl"] .auth-form .pass-toggle { right: auto; left: 8px; }
[dir="rtl"] .auth-theme { right: auto; left: 20px; }
[dir="rtl"] .auth-locale { right: auto; left: 68px; }
[dir="rtl"] .kv { direction: rtl; }
[dir="rtl"] .impersonation-bar a { margin-left: 0; margin-right: auto; }
[dir="rtl"] .lucide[data-lucide^="arrow-right"], [dir="rtl"] .lucide-arrow-right { transform: scaleX(-1); }
@media (max-width: 991px) {
    [dir="rtl"] .hisob .main-sidebar { transform: translateX(100%); }
    [dir="rtl"] .hisob.sidebar-open .main-sidebar { transform: none; }
    [dir="rtl"] .hisob .content-wrapper, [dir="rtl"] .hisob .main-header, [dir="rtl"] .hisob .main-footer { margin-right: 0 !important; }
}

/* карточка поддержки в сайдбаре */
.sidebar-foot .help-card { display: grid; gap: 4px; }
.sidebar-foot .help-card > span { color: #aab1c8; font-size: 12px; }
.sidebar-foot .help-line { display: flex; align-items: center; gap: 8px; color: #fff !important; font-weight: 600; font-size: 12.5px; }
.sidebar-foot .help-line .lucide { width: 14px; height: 14px; color: #c9c3ff; }
.sidebar-foot .help-actions { display: flex; gap: 6px; margin-top: 6px; }
.sidebar-foot .help-actions a { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; border-radius: 8px; background: rgba(255, 255, 255, .08); color: #fff !important; font-size: 12px; font-weight: 600; }
.sidebar-foot .help-actions a:hover { background: rgba(255, 255, 255, .14); }
.sidebar-foot .help-actions .lucide { width: 14px; height: 14px; }
.auth-vendor { display: inline-block; margin-top: 10px; }

/* Закрытая мобильная панель не должна расширять страницу (особенно в RTL) */
@media (max-width: 991px) {
    .hisob:not(.sidebar-open) .main-sidebar { visibility: hidden; }
    .hisob .main-sidebar { transition: transform .25s ease, visibility .25s; }
}

/* Колонки сетки не должны растягиваться по ширине вложенных таблиц на узких экранах */
@media (max-width: 1199px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.grid > * { min-width: 0; }
.hisob .pagination { flex-wrap: wrap; }
.hisob .dataTables_wrapper .dataTables_paginate { max-width: 100%; }

/* Демо-доступ на странице входа */
.demo-access { margin-top: 24px; padding: 16px; border-radius: 16px; border: 1px dashed var(--border); background: var(--surface-2, var(--bg)); display: grid; gap: 8px; }
.demo-head { display: grid; gap: 6px; margin-bottom: 4px; }
.demo-head p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.demo-badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 3px 10px; border-radius: 999px; background: var(--warning-soft, rgba(217, 119, 6, .12)); color: var(--warning, #d97706); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.demo-badge .lucide { width: 14px; height: 14px; }
.demo-account { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface, #fff); color: var(--text); text-align: start; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; }
.demo-account:hover, .demo-account:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft, rgba(91, 79, 245, .15)); outline: 0; }
.demo-account:active { transform: translateY(1px); }
.demo-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft, #eeedff); color: var(--primary); }
.demo-icon .lucide { width: 18px; height: 18px; }
.demo-meta { display: grid; gap: 1px; min-width: 0; flex: 1; }
.demo-meta b { font-size: 14px; }
.demo-cred { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.demo-cred > span { white-space: nowrap; }
.demo-meta em { font-style: normal; }
.demo-meta code { padding: 0 4px; border-radius: 4px; background: var(--primary-soft, #eeedff); color: var(--text); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: isolate; }
.demo-go { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.demo-account:hover .demo-go { color: var(--primary); }
[dir="rtl"] .demo-go { transform: scaleX(-1); }

