        body.admin-pending main,
        body.admin-pending [id$="-modal"],
        body.admin-pending #toast {
            display: none !important;
        }

        body.admin-ready #admin-access-gate {
            display: none !important;
        }

        body.admin-ready {
            --admin-bg: #111318;
            --admin-panel: #0f1117;
            --admin-border: #2b313c;
            --admin-text: #f4f4f5;
            --admin-muted: #9aa4b2;
            --admin-accent: #2688eb;
            --admin-accent-hover: #1f7bdd;
            background: var(--admin-bg);
            color: var(--admin-text);
        }

        html[data-theme="light"] body.admin-ready {
            --admin-bg: #f7f7f4;
            --admin-panel: #ffffff;
            --admin-border: #d9dee7;
            --admin-text: #1f2328;
            --admin-muted: #697383;
        }

        .inline-service-link {
            color: var(--admin-accent);
            text-decoration: underline;
            text-underline-offset: 2px;
        }

        .inline-service-link:hover,
        .inline-service-link:focus-visible {
            color: var(--admin-accent-hover);
            outline: none;
        }

        /* Лейаут админки в стиле Stripe / Vercel */
        .admin-app-layout {
            display: flex;
            min-height: 100vh;
            width: 100%;
            background: var(--admin-bg);
            color: var(--admin-text);
        }

        .admin-sidebar {
            width: 270px;
            flex: 0 0 270px;
            height: 100vh;
            position: sticky;
            top: 0;
            display: flex;
            flex-direction: column;
            background: var(--admin-panel);
            border: 1px solid var(--admin-border);
            border-left: 0;
            border-top: 0;
            border-bottom: 0;
            z-index: 45;
            overflow-y: auto;
        }

        .admin-sidebar-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1.25rem 1rem 1rem;
            border-bottom: 1px solid var(--admin-border);
            flex-shrink: 0;
        }

        .admin-sidebar-nav {
            flex: 1 1 auto;
            padding: 1rem 0.75rem;
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
            overflow-y: auto;
        }

        .admin-nav-group {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            background: var(--admin-panel);
            border: 1px solid var(--admin-border);
            border-radius: 0.5rem;
            padding: 0.5rem;
        }

        .admin-nav-group-title {
            padding: 0.25rem 0.5rem 0.25rem;
            color: var(--admin-muted);
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .admin-nav-group [hidden] {
            display: none !important;
        }

        .admin-nav-item {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            width: 100%;
            padding: 0.45rem 0.65rem;
            border-radius: var(--iiai-radius-control, 8px);
            font-size: 0.8125rem;
            font-weight: 500;
            color: var(--admin-text);
            background: color-mix(in srgb, var(--admin-panel) 96%, transparent);
            border: 1px solid transparent;
            text-decoration: none;
            cursor: pointer;
            text-align: left;
            transition: all var(--iiai-duration-fast, 120ms) ease;
        }

        .admin-nav-item:hover {
            background: color-mix(in srgb, var(--admin-text) 8%, transparent);
            color: #ffffff;
            border-color: var(--admin-border);
        }

        .admin-nav-item-primary {
            background: var(--admin-accent, #2563eb) !important;
            color: #ffffff !important;
            font-weight: 600;
            border-color: transparent !important;
        }

        .admin-nav-item-primary:hover {
            background: var(--admin-accent-hover, #1d4ed8) !important;
        }

        .admin-sidebar-footer {
            padding: 0.75rem;
            border-top: 1px solid var(--admin-border);
            flex-shrink: 0;
        }

        .admin-sidebar-return-btn {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            width: 100%;
            padding: 0.5rem 0.75rem;
            border-radius: var(--iiai-radius-control, 8px);
            font-size: 0.8125rem;
            font-weight: 500;
            color: var(--admin-muted);
            background: transparent;
            border: 1px solid transparent;
            text-decoration: none;
            transition: all 120ms ease;
        }

        .admin-sidebar-return-btn:hover {
            background: color-mix(in srgb, var(--admin-text) 8%, transparent);
            color: var(--admin-text);
        }

        .admin-main {
            flex: 1 1 0%;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            padding: 1.5rem 2rem;
            max-width: 1600px;
        }

        .admin-main-header {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            border-bottom: 1px solid var(--admin-border);
            padding-bottom: 1.25rem;
        }

        @media (min-width: 640px) {
            .admin-main-header {
                flex-direction: row;
                align-items: center;
                justify-content: space-between;
            }
        }

        .admin-mobile-menu-btn {
            display: none;
            align-items: center;
            justify-content: center;
            width: 38px;
            height: 38px;
            border-radius: 8px;
            border: 1px solid var(--admin-border);
            background: var(--admin-panel);
            color: var(--admin-text);
            cursor: pointer;
        }

        .admin-sidebar-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.65);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            z-index: 55;
        }

        @media (max-width: 1024px) {
            .admin-sidebar {
                position: fixed;
                top: 0;
                bottom: 0;
                left: 0;
                width: 280px;
                transform: translateX(-105%);
                transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
                z-index: 60;
                box-shadow: 1.5rem 0 3rem rgba(0, 0, 0, 0.5);
            }

            .admin-sidebar.admin-sidebar-open {
                transform: translateX(0);
            }

            .admin-sidebar-backdrop.admin-sidebar-open {
                display: block;
            }

            .admin-mobile-menu-btn {
                display: inline-flex;
            }

            .admin-main {
                padding: 1rem 0.75rem;
                gap: 1rem;
            }
        }

        .admin-header-actions {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-end;
            gap: 0.5rem;
        }

        body.admin-modal-open {
            overflow: hidden;
        }

        /* ==========================================================================
           ПРЕМИАЛЬНЫЕ ДИАЛОГИ АДМИНИСТРАТОРА (ФАЗА 6: IIAIDialog & Compact Density)
           ========================================================================== */
        @keyframes iiai-admin-dialog-fade {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes iiai-admin-dialog-scale {
            from {
                opacity: 0;
                transform: scale(0.96) translateY(6px);
            }
            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }

        body.admin-ready [id$="-modal"] {
            z-index: 100;
            background-color: rgba(0, 0, 0, 0.65) !important;
            backdrop-filter: blur(16px) saturate(180%) !important;
            -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
            animation: iiai-admin-dialog-fade 160ms var(--iiai-ease-spring-smooth, ease-out) forwards;
            overflow-y: auto !important;
            -webkit-overflow-scrolling: touch;
        }

        body.admin-ready [id$="-modal"] > div {
            max-height: min(92vh, 92dvh) !important;
            border-radius: var(--iiai-radius-dialog, 20px) !important;
            border: 1px solid var(--iiai-border-subtle, rgba(255, 255, 255, 0.12)) !important;
            background-color: var(--admin-panel, #0f1117) !important;
            box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.1) !important;
            animation: iiai-admin-dialog-scale 180ms var(--iiai-ease-spring-smooth, cubic-bezier(0.16, 1, 0.3, 1)) forwards;
            overflow-y: auto !important;
            overscroll-behavior: contain;
            scrollbar-width: thin;
            display: flex;
            flex-direction: column;
        }

        body.admin-ready [id$="-modal"] > div::-webkit-scrollbar,
        body.admin-ready [id$="-modal"] form::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        body.admin-ready [id$="-modal"] > div::-webkit-scrollbar-thumb,
        body.admin-ready [id$="-modal"] form::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 9999px;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] > div {
            background-color: var(--iiai-surface-panel, #ffffff) !important;
            border-color: var(--iiai-line-subtle, #e2e8f0) !important;
            box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12), inset 0 1px 0 0 rgba(255, 255, 255, 0.8) !important;
        }

        body.admin-ready [id$="-modal"] input:not([type="checkbox"]):not([type="radio"]),
        body.admin-ready [id$="-modal"] select,
        body.admin-ready [id$="-modal"] textarea {
            border-radius: var(--iiai-radius-control, 10px) !important;
            border: 1px solid var(--iiai-line-subtle, rgba(255, 255, 255, 0.12)) !important;
            background-color: var(--iiai-surface-card, #090d16) !important;
            color: var(--admin-text, #ffffff) !important;
            font-variant-numeric: tabular-nums;
            transition: border-color var(--iiai-duration-fast, 120ms) ease, box-shadow var(--iiai-duration-fast, 120ms) ease;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] input:not([type="checkbox"]):not([type="radio"]),
        html[data-theme="light"] body.admin-ready [id$="-modal"] select,
        html[data-theme="light"] body.admin-ready [id$="-modal"] textarea {
            background-color: var(--iiai-surface-card, #f8fafc) !important;
            border-color: var(--iiai-line-subtle, #cbd5e1) !important;
            color: var(--admin-text, #0f172a) !important;
        }

        body.admin-ready [id$="-modal"] input:focus,
        body.admin-ready [id$="-modal"] select:focus,
        body.admin-ready [id$="-modal"] textarea:focus {
            border-color: var(--admin-accent, #3b82f6) !important;
            box-shadow: 0 0 0 2px var(--iiai-accent-soft, rgba(59, 130, 246, 0.25)) !important;
            outline: none !important;
        }

        /* Высокая плотность Compact Density */
        [data-density="compact"] body.admin-ready [id$="-modal"] input:not([type="checkbox"]):not([type="radio"]),
        [data-density="compact"] body.admin-ready [id$="-modal"] select {
            height: 32px !important;
            font-size: 13px !important;
            padding-top: 0.25rem !important;
            padding-bottom: 0.25rem !important;
        }

        [data-density="compact"] body.admin-ready [id$="-modal"] button {
            height: 32px !important;
            font-size: 13px !important;
            padding-left: 0.75rem !important;
            padding-right: 0.75rem !important;
        }

        [data-density="compact"] body.admin-ready [id$="-modal"] form {
            gap: 0.65rem !important;
        }

        /* Нормализация полноэкранных дашбордов (Нагрузка, Доступы, IIR, Платежи, Почта) */
        body.admin-ready [id$="-modal"].items-stretch,
        body.admin-ready #external-mail-modal {
            align-items: center !important;
            justify-content: center !important;
            padding: clamp(1rem, 2.5vw, 2.5rem) !important;
        }

        body.admin-ready [id$="-modal"].items-stretch > div,
        body.admin-ready #external-mail-modal .mail-dialog {
            width: 100% !important;
            max-width: clamp(640px, 94vw, 1540px) !important;
            height: calc(100dvh - clamp(2rem, 5vw, 5rem)) !important;
            max-height: 94dvh !important;
            border-radius: var(--iiai-radius-dialog, 20px) !important;
            border: 1px solid var(--admin-border, rgba(255, 255, 255, 0.12)) !important;
            box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.1) !important;
            overflow: hidden !important;
        }

        /* Единые кнопки закрытия (крестики) для ВСЕХ модальных окон */
        body.admin-ready [id$="-modal"] [data-close-modal],
        body.admin-ready [id$="-modal"] button[title="Закрыть"],
        body.admin-ready [id$="-modal"] button[aria-label*="акрыть"] {
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            width: 36px !important;
            height: 36px !important;
            min-width: 36px !important;
            min-height: 36px !important;
            padding: 0 !important;
            border-radius: 50% !important;
            background: transparent !important;
            color: var(--admin-muted, #94a3b8) !important;
            border: 0 !important;
            cursor: pointer !important;
            transition: all 120ms ease !important;
        }

        body.admin-ready [id$="-modal"] [data-close-modal]:hover,
        body.admin-ready [id$="-modal"] button[title="Закрыть"]:hover,
        body.admin-ready [id$="-modal"] button[aria-label*="акрыть"]:hover {
            background-color: rgba(255, 255, 255, 0.08) !important;
            color: #ffffff !important;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] [data-close-modal]:hover,
        html[data-theme="light"] body.admin-ready [id$="-modal"] button[title="Закрыть"]:hover,
        html[data-theme="light"] body.admin-ready [id$="-modal"] button[aria-label*="акрыть"]:hover {
            background-color: rgba(0, 0, 0, 0.06) !important;
            color: #0f172a !important;
        }

        /* Все карточки метрик и блоки внутри модалок (IIR, Нагрузка, Доступы, Платежи) */
        body.admin-ready [id$="-modal"] .grid > div,
        body.admin-ready [id$="-modal"] article,
        body.admin-ready [id$="-modal"] .bg-slate-950,
        body.admin-ready [id$="-modal"] .border-slate-800 {
            border-radius: var(--iiai-radius-card, 14px) !important;
            transition: all var(--iiai-duration-fast, 120ms) ease;
        }

        /* Светлая тема для карточек метрик IIR и дашбордов */
        html[data-theme="light"] body.admin-ready [id$="-modal"] .grid > div,
        html[data-theme="light"] body.admin-ready [id$="-modal"] article,
        html[data-theme="light"] body.admin-ready [id$="-modal"] .bg-slate-950,
        html[data-theme="light"] body.admin-ready [id$="-modal"] .bg-slate-900,
        html[data-theme="light"] body.admin-ready [id$="-modal"] [class*="bg-emerald-950"],
        html[data-theme="light"] body.admin-ready [id$="-modal"] [class*="bg-sky-950"],
        html[data-theme="light"] body.admin-ready [id$="-modal"] [class*="bg-amber-950"],
        html[data-theme="light"] body.admin-ready [id$="-modal"] [class*="bg-slate-800"] {
            background-color: var(--iiai-surface-card, #ffffff) !important;
            border: 1px solid var(--iiai-line-subtle, #e2e8f0) !important;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
        }

        /* Тексты и числа в светлой теме */
        html[data-theme="light"] body.admin-ready [id$="-modal"] .text-white,
        html[data-theme="light"] body.admin-ready [id$="-modal"] h2.text-white,
        html[data-theme="light"] body.admin-ready [id$="-modal"] h3.text-white,
        html[data-theme="light"] body.admin-ready [id$="-modal"] h4.text-white {
            color: #0f172a !important;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] .text-slate-300,
        html[data-theme="light"] body.admin-ready [id$="-modal"] .text-slate-400,
        html[data-theme="light"] body.admin-ready [id$="-modal"] .text-slate-500 {
            color: #64748b !important;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] .text-emerald-400 {
            color: #059669 !important;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] .text-sky-400 {
            color: #0284c7 !important;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] .text-amber-400 {
            color: #d97706 !important;
        }

        /* Кнопки и фильтры в светлой теме внутри модалок */
        html[data-theme="light"] body.admin-ready [id$="-modal"] button:not(.bg-blue-600):not([data-close-modal]) {
            background-color: #ffffff !important;
            color: #0f172a !important;
            border-color: #e2e8f0 !important;
        }

        html[data-theme="light"] body.admin-ready [id$="-modal"] button:not(.bg-blue-600):not([data-close-modal]):hover {
            background-color: #f8fafc !important;
            border-color: #cbd5e1 !important;
        }

        /* Почта администратора: правая панель без зелени */
        html[data-theme="light"] body.admin-ready #admin-external-mail-detail,
        html[data-theme="light"] body.admin-ready .mail-detail,
        html[data-theme="light"] body.admin-ready .mail-columns {
            background-color: #f8fafc !important;
            background-image: none !important;
        }

        /* ==========================================================================
           СВЕТЛАЯ ТЕМА ДЛЯ ВСЕЙ АДМИНИСТРАТИВНОЙ ПАНЕЛИ (ВКЛЮЧАЯ МОБИЛЬНЫЙ ВИД)
           ========================================================================== */
        html[data-theme="light"] body.admin-ready {
            --admin-bg: #f8fafc;
            --admin-panel: #ffffff;
            --admin-border: #e2e8f0;
            --admin-text: #0f172a;
            --admin-muted: #64748b;
            background-color: var(--admin-bg) !important;
            color: var(--admin-text) !important;
        }

        /* 1. Шапка и хлебные крошки */
        html[data-theme="light"] body.admin-ready main > header {
            background-color: rgba(255, 255, 255, 0.94) !important;
            border-bottom-color: #e2e8f0 !important;
        }

        html[data-theme="light"] body.admin-ready main > header h1 {
            color: #0f172a !important;
        }

        html[data-theme="light"] body.admin-ready nav[aria-label="Хлебные крошки"] a,
        html[data-theme="light"] body.admin-ready nav[aria-label="Хлебные крошки"] span {
            color: #64748b !important;
        }

        /* 2. Навигационные группы и кнопки действий в шапке */
        html[data-theme="light"] body.admin-ready .admin-nav-group {
            background-color: #ffffff !important;
            border-color: #e2e8f0 !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
        }

        html[data-theme="light"] body.admin-ready .admin-nav-group-title {
            color: #64748b !important;
        }

        html[data-theme="light"] body.admin-ready .admin-nav-group button,
        html[data-theme="light"] body.admin-ready .admin-header-action {
            background-color: #f8fafc !important;
            border: 1px solid #e2e8f0 !important;
            color: #1e293b !important;
            border-radius: var(--iiai-radius-control, 10px) !important;
        }

        html[data-theme="light"] body.admin-ready .admin-nav-group button:hover,
        html[data-theme="light"] body.admin-ready .admin-header-action:hover {
            background-color: #f1f5f9 !important;
            border-color: #cbd5e1 !important;
            color: #0f172a !important;
        }

        /* 3. Карточки метрик дашборда (#stats-grid) */
        html[data-theme="light"] body.admin-ready #stats-grid article {
            background-color: #ffffff !important;
            border: 1px solid #e2e8f0 !important;
            border-radius: var(--iiai-radius-card, 16px) !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
        }

        html[data-theme="light"] body.admin-ready #stats-grid article p.text-slate-400 {
            color: #64748b !important;
        }

        html[data-theme="light"] body.admin-ready #stats-grid article span.bg-slate-950 {
            background-color: #f1f5f9 !important;
            color: #334155 !important;
            border-radius: 8px !important;
        }

        html[data-theme="light"] body.admin-ready #stats-grid article p.text-white {
            color: #0f172a !important;
        }

        /* 4. Секция пользователей и фильтры (#users-section) */
        html[data-theme="light"] body.admin-ready #users-section {
            background-color: #ffffff !important;
            border: 1px solid #e2e8f0 !important;
            border-radius: var(--iiai-radius-card, 16px) !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
        }

        html[data-theme="light"] body.admin-ready #users-section > div:first-child {
            border-bottom-color: #e2e8f0 !important;
        }

        html[data-theme="light"] body.admin-ready #search-input,
        html[data-theme="light"] body.admin-ready #role-filter,
        html[data-theme="light"] body.admin-ready #status-filter {
            background-color: #ffffff !important;
            border: 1px solid #cbd5e1 !important;
            color: #0f172a !important;
            border-radius: var(--iiai-radius-control, 10px) !important;
        }

        html[data-theme="light"] body.admin-ready #search-input::placeholder {
            color: #94a3b8 !important;
        }

        html[data-theme="light"] body.admin-ready #clear-filters-btn {
            background-color: #f8fafc !important;
            border: 1px solid #cbd5e1 !important;
            color: #334155 !important;
            border-radius: var(--iiai-radius-control, 10px) !important;
        }

        html[data-theme="light"] body.admin-ready #clear-filters-btn:hover {
            background-color: #f1f5f9 !important;
            color: #0f172a !important;
        }

        /* 5. Мобильные карточки пользователей (#users-table-body tr) в светлой теме */
        html[data-theme="light"] body.admin-ready #users-table-body tr {
            background-color: #ffffff !important;
            border: 1px solid #e2e8f0 !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02) !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td {
            color: #0f172a !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td::before {
            color: #64748b !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td:first-child {
            border-bottom: 1px solid #e2e8f0 !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td:last-child {
            border-top: 1px solid #f1f5f9 !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td .text-white {
            color: #0f172a !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td .text-slate-300,
        html[data-theme="light"] body.admin-ready #users-table-body td .text-slate-400 {
            color: #475569 !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td .text-slate-500,
        html[data-theme="light"] body.admin-ready #users-table-body td .text-slate-600 {
            color: #64748b !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td p.font-mono.text-xs {
            color: #1d4ed8 !important;
        }

        /* 6. Кнопки действий внутри мобильных карточек пользователей в светлой теме */
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button {
            background-color: #f8fafc !important;
            border: 1px solid #cbd5e1 !important;
            color: #334155 !important;
        }

        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button:hover {
            background-color: #f1f5f9 !important;
            border-color: #94a3b8 !important;
            color: #0f172a !important;
        }

        /* Кнопка кабинета (глаз) */
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button.border-amber-800\/70,
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button[data-action="eye"] {
            background-color: #fffbeb !important;
            border-color: #fde68a !important;
            color: #b45309 !important;
        }

        /* Кнопка доступов (ключ) */
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button.border-blue-900\/70,
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button[data-action="key-round"] {
            background-color: #eff6ff !important;
            border-color: #bfdbfe !important;
            color: #1d4ed8 !important;
        }

        /* Кнопка сооснователя (щит) */
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button.border-cyan-900\/70,
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button[data-action="shield"] {
            background-color: #ecfeff !important;
            border-color: #a5f3fc !important;
            color: #0e7490 !important;
        }

        /* Кнопка удаления (корзина) */
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button.border-red-900\/70,
        html[data-theme="light"] body.admin-ready #users-table-body td:last-child button[data-action="trash-2"] {
            background-color: #fef2f2 !important;
            border-color: #fecaca !important;
            color: #dc2626 !important;
        }

        /* 7. Статусные бейджи в светлой теме */
        html[data-theme="light"] body.admin-ready .bg-slate-700\/60,
        html[data-theme="light"] body.admin-ready span[data-tone="user"] {
            background-color: #f1f5f9 !important;
            color: #334155 !important;
            border-color: #cbd5e1 !important;
        }

        html[data-theme="light"] body.admin-ready .bg-blue-500\/15,
        html[data-theme="light"] body.admin-ready span[data-tone="admin"] {
            background-color: #eff6ff !important;
            color: #1d4ed8 !important;
            border-color: #bfdbfe !important;
        }

        html[data-theme="light"] body.admin-ready .bg-cyan-500\/15,
        html[data-theme="light"] body.admin-ready span[data-tone="cofounder"] {
            background-color: #ecfeff !important;
            color: #0e7490 !important;
            border-color: #a5f3fc !important;
        }

        html[data-theme="light"] body.admin-ready .bg-emerald-500\/15,
        html[data-theme="light"] body.admin-ready span[data-tone="active"] {
            background-color: #ecfdf5 !important;
            color: #047857 !important;
            border-color: #a7f3d0 !important;
        }

        html[data-theme="light"] body.admin-ready .bg-red-500\/15,
        html[data-theme="light"] body.admin-ready span[data-tone="blocked"] {
            background-color: #fef2f2 !important;
            color: #b91c1c !important;
            border-color: #fecaca !important;
        }

        /* 8. Десктопная таблица пользователей в светлой теме */
        html[data-theme="light"] body.admin-ready table thead {
            background-color: #f8fafc !important;
            border-bottom: 1px solid #e2e8f0 !important;
        }

        html[data-theme="light"] body.admin-ready table thead th {
            color: #64748b !important;
        }

        html[data-theme="light"] body.admin-ready table tbody tr:hover {
            background-color: #f8fafc !important;
        }


        body.admin-ready [data-close-modal] {
            display: inline-flex;
            min-width: 2.5rem;
            min-height: 2.5rem;
            flex: 0 0 auto;
            align-items: center;
            justify-content: center;
        }

        @media (max-width: 900px) {
            html {
                overflow-x: hidden;
            }

            body.admin-ready {
                overflow: auto;
                overflow-x: hidden;
            }

            body.admin-ready main,
            body.admin-ready section,
            body.admin-ready aside,
            body.admin-ready article,
            body.admin-ready div,
            body.admin-ready form,
            body.admin-ready label {
                min-width: 0;
            }

            main {
                min-height: 100dvh;
                gap: 0.9rem !important;
                padding: 0.75rem !important;
                overflow-x: hidden;
            }

            main > header {
                position: sticky;
                top: 0;
                z-index: 30;
                flex-direction: column;
                align-items: stretch;
                gap: 0.75rem !important;
                margin: -0.75rem -0.75rem 0;
                background: color-mix(in srgb, var(--admin-panel) 96%, transparent);
                padding: 0.75rem !important;
                padding-bottom: 0.9rem !important;
            }

            main > header h1 {
                font-size: 1.25rem !important;
                line-height: 1.6rem !important;
            }

            .admin-header-action {
                flex: 1 1 10rem;
                min-height: 2.75rem;
                justify-content: center;
                padding-left: 0.55rem !important;
                padding-right: 0.55rem !important;
                white-space: normal;
                text-align: center;
                line-height: 1.15rem;
                overflow-wrap: anywhere;
            }

            .admin-header-actions {
                width: 100%;
                justify-content: stretch;
            }

            .admin-nav-grid {
                grid-template-columns: 1fr;
            }

            .admin-nav-group {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .admin-nav-group-title {
                grid-column: 1 / -1;
            }

            .admin-nav-group button {
                width: 100%;
                height: auto !important;
                min-height: 2.75rem;
                justify-content: center;
                padding: 0.55rem !important;
                white-space: normal;
                line-height: 1.15rem;
                text-align: center;
            }

            #stats-grid {
                grid-template-columns: 1fr !important;
            }

            #stats-grid > * {
                padding: 0.85rem !important;
            }

            section.rounded-md.border.border-slate-800.bg-slate-900 > .grid {
                grid-template-columns: 1fr !important;
                padding: 0.75rem !important;
            }

            section.rounded-md.border.border-slate-800.bg-slate-900 > .overflow-x-auto {
                overflow-x: visible !important;
            }

            #users-section {
                overflow: hidden;
                border-radius: 0.75rem;
            }

            input,
            select,
            textarea,
            button,
            a {
                min-width: 0;
                max-width: 100%;
            }

            table {
                min-width: 0 !important;
                width: 100% !important;
            }

            table thead {
                display: none;
            }

            table,
            table tbody,
            table tr,
            table td {
                display: block;
            }

            #users-table-body {
                display: grid;
                gap: 0.75rem;
                padding: 0.75rem;
            }

            #users-table-body tr {
                border: 1px solid var(--admin-border, rgb(30 41 59));
                border-radius: var(--iiai-radius-card, 16px);
                background: var(--admin-panel, rgb(2 6 23 / 0.68));
                padding: 1rem;
                overflow: hidden;
                box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
                transition: background var(--iiai-duration-fast, 120ms) ease, border-color var(--iiai-duration-fast, 120ms) ease;
            }

            #users-table-body td {
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: 1rem;
                padding: 0.45rem 0 !important;
                color: var(--admin-text, rgb(203 213 225));
                min-width: 0;
                overflow-wrap: anywhere;
            }

            #users-table-body td::before {
                content: attr(data-label);
                flex: 0 0 7.4rem;
                color: var(--admin-muted, rgb(100 116 139));
                font-size: 0.72rem;
                font-weight: 650;
                letter-spacing: 0.05em;
                text-transform: uppercase;
            }

            #users-table-body td:first-child {
                display: block;
                border-bottom: 1px solid var(--admin-border, rgb(30 41 59));
                padding-bottom: 0.85rem !important;
                margin-bottom: 0.45rem;
            }

            #users-table-body td:first-child::before {
                display: block;
                margin-bottom: 0.35rem;
            }

            #users-table-body td:last-child {
                display: block;
                padding-top: 0.85rem !important;
                border-top: 1px solid var(--admin-border, rgb(30 41 59 / 0.5));
                margin-top: 0.45rem;
            }

            #users-table-body td:last-child::before {
                display: block;
                margin-bottom: 0.6rem;
            }

            #users-table-body td:last-child > div {
                display: grid !important;
                grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
                gap: 0.5rem !important;
            }

            #users-table-body td:last-child button {
                width: 100%;
                min-height: 2.75rem;
                height: 2.75rem;
                border-radius: var(--iiai-radius-control, 10px);
                touch-action: manipulation;
                transition: transform var(--iiai-duration-fast, 120ms) ease, background var(--iiai-duration-fast, 120ms) ease;
            }

            #users-table-body td:last-child button:active {
                transform: scale(0.95);
            }

            #users-table-body td > *,
            #users-table-body p,
            #users-table-body span {
                min-width: 0;
                max-width: 100%;
                overflow-wrap: anywhere;
            }

            #users-table-body .font-mono,
            .font-mono,
            pre {
                overflow-wrap: anywhere;
                word-break: break-word;
            }

            div[id$="-modal"],
            body.admin-ready [id$="-modal"] {
                align-items: flex-end !important;
                justify-content: flex-end !important;
                padding: 0 !important;
            }

            div[id$="-modal"] > div,
            body.admin-ready [id$="-modal"] > div {
                width: 100% !important;
                max-width: 100% !important;
                max-height: calc(100dvh - max(1rem, env(safe-area-inset-top, 0px))) !important;
                border-radius: var(--iiai-radius-sheet, 24px 24px 0 0) !important;
                border-bottom: 0 !important;
                border-left: 0 !important;
                border-right: 0 !important;
                border-top: 1px solid var(--iiai-line-subtle, rgba(255, 255, 255, 0.12)) !important;
                box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5) !important;
            }

            div[id$="-modal"] > div > div:first-child {
                position: sticky;
                top: 0;
                z-index: 5;
                background: rgb(15 23 42);
            }

            div[id$="-modal"] h2,
            div[id$="-modal"] h3,
            div[id$="-modal"] p,
            div[id$="-modal"] span,
            div[id$="-modal"] option {
                overflow-wrap: anywhere;
            }

            #user-modal > div,
            #delete-modal > div {
                align-self: center;
                max-height: 100dvh;
                overflow-y: auto;
            }

            #chats-modal > div,
            #files-modal > div,
            #gallery-modal > div,
            #logs-modal > div,
            #billing-modal > div,
            #mlm-modal > div,
            #mlm-log-modal > div,
            #aitunnel-modal > div,
            #permissions-modal > div {
                height: 100dvh !important;
            }

            #access-modal {
                padding: 0 !important;
            }

            #access-modal > div,
            #mlm-modal > div,
            #permissions-modal > div,
            #mlm-log-modal > div {
                overflow-y: auto !important;
            }

            #access-modal > div > .grid,
            #mlm-modal > div > .grid {
                display: flex !important;
                flex-direction: column;
                min-height: auto !important;
                overflow: visible !important;
            }

            #access-modal aside,
            #access-modal section,
            #mlm-modal aside,
            #mlm-modal section {
                min-height: auto !important;
                max-height: none !important;
                overflow: visible !important;
                border-right-width: 0 !important;
            }

            #access-modal section > .min-h-0.flex-1.overflow-y-auto,
            #access-usage-list,
            #access-entitlements-list,
            #cofounder-permissions-list,
            #mlm-tree-list,
            #mlm-log-list {
                max-height: none !important;
                overflow: visible !important;
            }

            #access-grant-list {
                grid-template-columns: 1fr !important;
            }

            #access-product-list {
                max-height: 12rem;
                overflow-y: auto !important;
                padding-right: 0.15rem;
            }

            #access-product-list article {
                padding: 0.75rem !important;
            }

            #access-product-list article p:nth-child(2) {
                display: none;
            }

            #access-grant-list article {
                min-height: auto !important;
            }

            #access-grant-form button[type="submit"] {
                width: 100%;
                margin-top: 0 !important;
            }

            #permissions-modal > div {
                overflow-y: auto !important;
            }

            #cofounder-permissions-list article > div {
                display: grid !important;
                grid-template-columns: 1fr auto;
                gap: 0.85rem !important;
            }

            #chats-modal > div {
                display: flex !important;
                flex-direction: column;
                overflow: hidden !important;
            }

            #chats-modal aside {
                flex: 0 0 auto;
                max-height: 38dvh !important;
                overflow: hidden;
            }

            #admin-chat-list {
                max-height: calc(38dvh - 4.75rem) !important;
                overflow-y: auto !important;
            }

            #chats-modal section {
                min-height: 0;
                flex: 1 1 auto;
            }

            #mlm-tree-list button {
                margin-left: 0 !important;
                max-width: 100% !important;
            }

            #admin-chat-list,
            #admin-message-list,
            #admin-file-list,
            #admin-gallery-list,
            #admin-log-list,
            #admin-billing-list,
            #mlm-tree-list,
            #mlm-log-list,
            #admin-sync-list,
            #cofounder-permissions-list {
                padding: 0.8rem !important;
            }

            #billing-modal > div {
                display: flex !important;
                flex-direction: column;
                overflow-x: hidden !important;
                overflow-y: auto !important;
                -webkit-overflow-scrolling: touch;
            }

            #admin-billing-summary,
            #admin-billing-list {
                flex: 0 0 auto !important;
            }

            #admin-billing-list {
                min-height: auto !important;
                overflow: visible !important;
            }

            #billing-modal .admin-billing-card-head {
                display: grid !important;
                grid-template-columns: 1fr;
            }

            #billing-modal .admin-billing-amount {
                width: 100%;
                justify-content: center;
                text-align: center;
            }

            #billing-modal .admin-billing-card {
                padding: 0.9rem !important;
            }

            #logs-modal .grid,
            #billing-modal .grid,
            #mlm-modal .grid,
            #permissions-modal .grid {
                grid-template-columns: 1fr !important;
            }

            #admin-gallery-list .grid,
            #admin-file-list .grid,
            #admin-message-list .grid {
                grid-template-columns: 1fr !important;
            }

            #toast {
                left: 0.75rem !important;
                right: 0.75rem !important;
                bottom: 0.75rem !important;
                max-width: none !important;
            }
        }

        @media (max-width: 480px) {
            .admin-nav-group {
                grid-template-columns: 1fr;
            }

            #users-table-body td {
                display: block;
            }

            #users-table-body td::before {
                display: block;
                margin-bottom: 0.35rem;
            }

            #users-table-body td:last-child > div {
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
                gap: 0.5rem !important;
            }
        }
