/* --- AI Chat Drawer --- */
.ai-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff, #d4d4d4);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 1), 0 6px 20px rgba(0, 0, 0, 0.5);
    color: #000000;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2000;
}

.ai-fab:hover {
    transform: scale(1.1);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 1), 0 8px 25px rgba(255, 255, 255, 0.2);
}

.ai-chat-drawer {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 400px;
    height: 600px;
    max-height: 80vh;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 2001;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-chat-drawer.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.ai-chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px 16px 0 0;
}

.ai-chat-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-chat-title i {
    color: #ffffff;
}

.ai-chat-close {
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
}

.ai-chat-close:hover {
    color: white;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 0.95rem;
    word-break: break-word;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--accent-color);
    color: #000000;
    border-bottom-right-radius: 2px;
}

.chat-bubble.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

.chat-bubble.ai pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.chat-bubble.ai code {
    font-family: monospace;
    font-size: 0.85rem;
}

.ai-chat-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 16px 16px;
    display: flex;
    gap: 0.5rem;
}

.ai-chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: 0.2s;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #ffffff;
    background: rgba(0, 0, 0, 0.3);
}

.ai-chat-submit {
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 8px;
    width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.ai-chat-submit:hover {
    background: #e0e0e0;
}

.ai-chat-submit:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- SNMP Network Devices Section --- */
.snmp-section {
    margin-top: 3rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.snmp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.snmp-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.snmp-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.snmp-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.snmp-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-scan, .btn-config {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: linear-gradient(145deg, rgba(60, 60, 60, 0.4), rgba(20, 20, 20, 0.6));
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-scan:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.btn-config:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-scan.scanning {
    pointer-events: none;
    opacity: 0.6;
}

.btn-scan.scanning svg {
    animation: spin 1s linear infinite;
}

.btn-users:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

/* Device Type Badges */
.device-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.device-type-badge.printer { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.device-type-badge.switch { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.device-type-badge.router { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.device-type-badge.gateway { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.device-type-badge.network-device { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.device-type-badge.access-point { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.device-type-badge.nas { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.device-type-badge.ups { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.device-type-badge.firewall { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.device-type-badge.server { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.device-type-badge.unknown { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }

/* SNMP Config Modal Form */
.config-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.config-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.config-field label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.config-field input[type="text"],
.config-field input[type="number"],
.config-field textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.config-field input:focus,
.config-field textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.config-field textarea {
    resize: vertical;
    font-family: 'Inter', monospace;
}

.config-row {
    display: flex;
    gap: 1rem;
}

.btn-save-config {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(145deg, #ffffff, #d4d4d4);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 1), 0 4px 15px rgba(0, 0, 0, 0.5);
    color: #000000;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.btn-save-config:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background: var(--success);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

#snmp-table-container {
    min-height: 200px;
}

#snmp-table-container .empty-state, #cyber-no-data, #cyber-alerts-empty {
    position: static;
    transform: none;
    padding: 3rem;
    text-align: center;
}

/* --- Command Center / Tenant Grid --- */
.tenants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.tenant-card {
    padding: 1.5rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tenant-card:hover {
    transform: translateY(-4px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.tenant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tenant-card-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    background: linear-gradient(180deg, #ffffff 0%, #888888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tenant-delete {
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    line-height: 1;
}

.tenant-card:hover .tenant-delete {
    opacity: 1;
}

.tenant-delete:hover {
    color: var(--danger);
}

.tenant-card-stats {
    display: flex;
    gap: 1.5rem;
}

.tenant-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tenant-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.tenant-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Chat Layout --- */
#chat-dashboard {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
}

.chat-layout {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.chat-sidebar {
    width: 300px;
    flex-shrink: 0;
}

.chat-main {
    flex: 1;
}

/* --- Mobile Responsiveness Overhaul --- */
@media (max-width: 768px) {
    /* 1. Global Containers & Headers */
    .container, .dashboard-container {
        padding: 0.8rem 12px !important;
    }
    
    #chat-dashboard {
        height: calc(100dvh - 1.6rem) !important;
    }
    
    header {
        flex-shrink: 0 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.8rem !important;
        margin-bottom: 0.8rem !important;
    }
    
    .header-content {
        width: 100% !important;
    }
    
    header .stats {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    
    header .stats button {
        width: 100% !important;
        justify-content: center !important;
    }

    .nav-tabs {
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
    
    .nav-tab {
        flex: 1 1 auto !important;
        text-align: center !important;
        padding: 0.6rem 0.8rem !important;
    }

    /* 2. Tables (Horizontally Scrollable) */
    table {
        display: block !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
    }
    
    .activity-grid-top, .activity-grid-bottom {
        grid-template-columns: 1fr !important;
    }

    /* 3. Base Styling for ALL Modals */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 92vh !important;
        padding: 1rem !important;
        margin: auto !important;
        box-sizing: border-box !important;
    }

    .modal-header {
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    .modal-title-group {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .modal-title-group h2 {
        font-size: 1.1rem !important;
        word-break: break-word !important;
    }

    /* 4. Endpoint Manager Modal Specifics */
    #endpoint-manager-modal .modal-content {
        padding: 1rem !important;
    }

    #endpoint-manager-filter-bar {
        padding: 0.6rem !important;
    }

    #endpoint-manager-filter-bar > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    #endpoint-manager-board {
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .endpoint-column {
        min-width: 82vw !important;
        max-width: 82vw !important;
    }

    /* 5. Tab Bars in Inventory & Security Modals */
    .modal-tabs, 
    #view-information .modal-tabs,
    #ep-sec-content > div:first-child {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        padding-bottom: 6px !important;
        margin-bottom: 1rem !important;
        gap: 0.4rem !important;
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }

    .modal-tabs::-webkit-scrollbar,
    #ep-sec-content > div:first-child::-webkit-scrollbar {
        display: none !important;
    }

    .modal-tab-btn,
    .cyber-tab-btn {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* 6. Grids & Lists Inside Modals */
    .detail-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }

    .data-list-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.4rem !important;
    }

    .data-list-item > div,
    .data-list-item > span {
        width: 100% !important;
        word-break: break-word !important;
    }

    /* 7. Cybersecurity Layout */
    .cyber-layout {
        flex-direction: column !important;
    }

    .tenants-grid,
    #tenant-features-list {
        grid-template-columns: 1fr !important;
    }

    /* 8. AI Chat & Floating Action Button */
    .ai-fab {
        bottom: 1rem !important;
        right: 1rem !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 1.1rem !important;
    }

    /* 9. Live Chat Responsiveness */
    .chat-layout {
        flex-direction: column !important;
        flex: 1 !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }
    
    .chat-sidebar {
        width: 100% !important;
        flex: 1 !important;
        display: flex !important;
    }
    
    .chat-main {
        width: 100% !important;
        flex: 1 !important;
        display: none !important;
        min-height: 0 !important;
    }
    
    .chat-layout.chat-active .chat-sidebar {
        display: none !important;
    }
    
    .chat-layout.chat-active .chat-main {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        z-index: 9999 !important;
        background: var(--bg-color) !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        padding-left: env(safe-area-inset-left) !important;
        padding-right: env(safe-area-inset-right) !important;
        box-sizing: border-box !important;
    }
    
    .chat-mobile-back-btn {
        display: block !important;
    }
    .ai-chat-drawer {
        width: 100% !important;
        height: 75vh !important;
        max-height: 75vh !important;
        bottom: 0 !important;
        right: 0 !important;
        border-radius: 20px 20px 0 0 !important;
    }
}

/* ===================================================================
   Command Center (SuperAdmin tenant overview) - responsive layout
   =================================================================== */
#command-center .cc-header {
    flex-wrap: wrap;
    gap: 1.25rem 2rem;
}

/* The brand block never shrinks below its content (it used to, and the buttons slid over the title);
   the action buttons wrap onto their own row instead. */
#command-center .cc-brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1 0 auto;
    min-width: 0;
    max-width: 100%;
}

#command-center .cc-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    flex-shrink: 0;
}

#command-center .cc-title {
    margin: 0;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

#command-center .cc-subtitle {
    margin: 0.35rem 0 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

#command-center .cc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
    flex: 0 1 auto;
}

#command-center .cc-btn {
    font-size: 0.95rem;
    padding: 0.7rem 1.2rem;
    white-space: nowrap;
}

#command-center .tenants-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
}

#command-center .tenant-card-stats {
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

/* On-premise tenant info modal: header and footer stay put, the body scrolls */
#on-premise-modal .op-modal {
    display: flex;
    flex-direction: column;
    max-height: min(90vh, 90dvh);
}

#on-premise-modal .op-modal-header,
#on-premise-modal .op-modal-footer {
    flex-shrink: 0;
}

#on-premise-modal .op-modal-body {
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
}

#on-premise-modal .op-modal-row {
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

#on-premise-modal .op-modal-row code {
    word-break: break-all;
    text-align: right;
}

@media (max-width: 1500px) {
    #command-center .cc-logo { width: 80px; height: 80px; }
    #command-center .cc-title { font-size: 1.75rem; }
    #command-center .cc-btn { font-size: 0.88rem; padding: 0.6rem 1rem; }
}

@media (max-width: 1200px) {
    /* Buttons get their own row, aligned under the brand */
    #command-center .cc-actions { flex: 1 1 100%; justify-content: flex-start; }
}

@media (max-width: 768px) {
    #command-center .cc-brand { gap: 1rem; }
    #command-center .cc-logo { width: 60px; height: 60px; }
    #command-center .cc-title { font-size: 1.4rem; }
    #command-center .cc-subtitle { font-size: 0.82rem; }

    /* Two-column button grid instead of the global one-button-per-row stack */
    #command-center header .cc-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    #command-center header .cc-actions .cc-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
        justify-content: center;
    }
    #command-center header .cc-actions #logout-btn { grid-column: 1 / -1; }

    #on-premise-modal .modal-content { padding: 0 !important; }
    #on-premise-modal .op-modal-header,
    #on-premise-modal .op-modal-body,
    #on-premise-modal .op-modal-footer { padding-left: 1rem !important; padding-right: 1rem !important; }
    #server-diagnostics-modal { padding: 0.75rem !important; }
}

@media (max-width: 480px) {
    #command-center .cc-title { font-size: 1.2rem; }
    #command-center .cc-logo { width: 48px; height: 48px; }
    #on-premise-modal .op-modal-stats { grid-template-columns: 1fr !important; }
    #on-premise-modal .op-modal-footer { flex-direction: column-reverse; align-items: stretch !important; }
    #on-premise-modal .op-modal-footer > * { justify-content: center; }
}

/* NCM SNMP credentials manager: stack the profile list above the form on narrow screens */
@media (max-width: 860px) {
    .ncm-snmp-grid { grid-template-columns: 1fr !important; }
}

/* ---------- Backup Monitor (backup.js) ---------- */
.bk-tab-btn { background: transparent; border: 1px solid transparent; color: #94a3b8; padding: 8px 22px; border-radius: 8px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.bk-tab-btn.active { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.1); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.bk-stats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.bk-stat { padding: 0.9rem 1rem; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.bk-stat:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.2); }
.bk-stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.bk-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.bk-toolbar { display: flex; gap: 0.6rem; padding: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.bk-toolbar input, .bk-toolbar select { padding: 0.5rem 0.65rem; border-radius: 8px; background: rgba(0, 0, 0, 0.5); color: white; border: 1px solid var(--panel-border); font-size: 0.85rem; }
.bk-toolbar input { flex: 1 1 220px; min-width: 0; }
.bk-table-wrap { overflow-x: auto; }
.bk-table td { vertical-align: top; }
.bk-badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 6px; font-size: 0.76rem; font-weight: 600; border: 1px solid; white-space: nowrap; }
.bk-strip { display: flex; gap: 3px; align-items: center; min-height: 18px; }
.bk-run { width: 9px; height: 18px; border-radius: 2px; display: inline-block; opacity: 0.9; }
.bk-msg { font-size: 0.75rem; color: #fca5a5; margin-top: 0.2rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.bk-sources-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 1rem; }
.bk-source { padding: 1.1rem; }
.bk-source code, .bk-hint code, .bk-ok code, .bk-section code, #bk-editor-modal label code { background: rgba(255, 255, 255, 0.07); padding: 0 0.3rem; border-radius: 4px; color: #93c5fd; font-size: 0.78rem; }
.bk-kind { color: #a78bfa; }
.bk-sm { padding: 0.3rem 0.65rem !important; font-size: 0.78rem !important; }
.bk-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; padding: 0.55rem 0.75rem; border-radius: 8px; font-size: 0.82rem; overflow-wrap: anywhere; margin-bottom: 0.6rem; }
.bk-ok { background: rgba(74, 222, 128, 0.08); border: 1px solid rgba(74, 222, 128, 0.3); color: #bbf7d0; padding: 0.55rem 0.75rem; border-radius: 8px; font-size: 0.84rem; margin-bottom: 0.6rem; }
.bk-hint { background: rgba(59, 130, 246, 0.07); border: 1px solid rgba(59, 130, 246, 0.2); color: #cbd5e1; padding: 0.55rem 0.75rem; border-radius: 8px; font-size: 0.8rem; margin: 0.6rem 0; line-height: 1.5; }
.bk-section { margin: 1.1rem 0 0.5rem; font-weight: 600; color: #e2e8f0; font-size: 0.92rem; border-bottom: 1px solid var(--panel-border); padding-bottom: 0.3rem; }
.bk-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; }
.bk-rule { border: 1px solid var(--panel-border); border-radius: 10px; padding: 0.7rem; margin-bottom: 0.6rem; background: rgba(0, 0, 0, 0.2); }
.bk-rule-head { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.5rem; }
.bk-rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.bk-checklist { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.3rem 1rem; max-height: 180px; overflow-y: auto; padding: 0.5rem; border: 1px solid var(--panel-border); border-radius: 8px; font-size: 0.85rem; }
.bk-checklist label { display: flex; align-items: center; gap: 0.4rem; }
.bk-preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.7rem; margin-bottom: 1rem; }
.bk-preset { border: 1px solid var(--panel-border); border-radius: 10px; padding: 0.85rem; cursor: pointer; background: rgba(0, 0, 0, 0.25); transition: border-color 0.15s, background 0.15s; }
.bk-preset:hover { border-color: #3b82f6; background: rgba(59, 130, 246, 0.08); }
.bk-pre { padding: 0.8rem; border-radius: 8px; background: rgba(0, 0, 0, 0.45); color: #e2e8f0; font-size: 0.76rem; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; margin: 0.4rem 0; }
.bk-job-settings { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: 0.75rem; border: 1px solid var(--panel-border); border-radius: 10px; margin-bottom: 0.8rem; background: rgba(0, 0, 0, 0.2); }

@media (max-width: 1200px) {
    .bk-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .bk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bk-sources-grid { grid-template-columns: 1fr; }
    .bk-form-grid { grid-template-columns: 1fr 1fr; }
    .bk-form-grid > div { grid-column: auto !important; }
    .bk-rule-grid { grid-template-columns: 1fr; }
    .bk-tab-btn { padding: 6px 12px; }
}
@media (max-width: 480px) {
    .bk-form-grid { grid-template-columns: 1fr; }
}
