:root {
    --admin-sidebar-bg: #1a1d29;
    --admin-sidebar-hover: rgba(255, 255, 255, 0.08);
    --admin-sidebar-active: #4f46e5;
    --admin-sidebar-text: rgba(255, 255, 255, 0.72);
    --admin-sidebar-muted: rgba(255, 255, 255, 0.45);
    --admin-topbar-h: 56px;
    --admin-content-bg: #f4f6fb;
}

body.admin-app {
    min-height: 100vh;
    background: var(--admin-content-bg);
}

.admin-topbar {
    height: var(--admin-topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 1030;
}

.admin-sidebar {
    --bs-offcanvas-width: 190px;
    width: 190px !important;
    max-width: 190px !important;
    min-width: 190px !important;
    flex: 0 0 190px !important;
    background-color: #1a1d29 !important;
    background: #1a1d29 !important;
    --bs-offcanvas-bg: #1a1d29;
    --bs-offcanvas-color: #fff;
    color: #fff !important;
    overflow-x: hidden;
}

.admin-sidebar .offcanvas-header {
    background-color: #1a1d29;
    color: #fff;
}

.admin-sidebar .offcanvas-body {
    background-color: #1a1d29;
    color: #fff;
    overflow-x: hidden;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.88) !important;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link:focus {
    color: #fff !important;
}

.admin-sidebar .nav-link.active {
    color: #fff !important;
}

.admin-sidebar .text-secondary {
    color: rgba(255, 255, 255, 0.5) !important;
}

.admin-sidebar .form-select {
    background-color: #12141c;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
}

.admin-sidebar .form-select option {
    background-color: #12141c;
    color: #fff;
}

@media (min-width: 992px) {
    .admin-sidebar.offcanvas-lg {
        position: sticky;
        top: 0;
        height: 100vh;
        width: 190px !important;
        max-width: 190px !important;
        min-width: 190px !important;
        flex: 0 0 190px !important;
        --bs-offcanvas-width: 190px;
        transform: none !important;
        visibility: visible !important;
        border-right: 1px solid rgba(255, 255, 255, 0.06);
        flex-shrink: 0;
    }

    .admin-sidebar.offcanvas-lg.show {
        transform: none !important;
    }

    .admin-layout {
        min-height: 100vh;
    }

    .admin-main {
        min-width: 0;
    }
}

.admin-brand {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    text-decoration: none;
    font-size: 0.82rem;
    line-height: 1.25;
    word-break: break-word;
}

.admin-brand:hover {
    color: #fff;
    opacity: 0.9;
}

.admin-nav .nav-link {
    color: var(--admin-sidebar-text);
    border-radius: 0.5rem;
    padding: 0.45rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-nav .nav-link:hover {
    background: var(--admin-sidebar-hover);
    color: #fff;
}

.admin-nav .nav-link.active {
    background: var(--admin-sidebar-active);
    color: #fff !important;
    font-weight: 600;
}

.admin-nav-badge {
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    min-width: 1.35rem;
    padding: 0.2em 0.45em;
}

.admin-nav .nav-link.active .admin-nav-badge {
    background: #fff;
    color: var(--admin-sidebar-active);
}

.admin-nav .nav-link .bi {
    font-size: 1.05rem;
    opacity: 0.95;
}

.admin-nav-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0.75rem 0;
}

.admin-bot-switch label {
    color: var(--admin-sidebar-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-main {
    padding: 1.25rem;
}

@media (min-width: 768px) {
    .admin-main {
        padding: 1.75rem 2rem;
    }
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.page-header .breadcrumb {
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
}

.admin-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.875rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.admin-card .card-body {
    padding: 1.25rem;
}

.stat-card {
    border: 0;
    border-radius: 0.875rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    height: 100%;
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.table-admin {
    margin: 0;
}

.table-admin thead th {
    background: #f8fafc;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.table-admin tbody td {
    vertical-align: middle;
}

.table-responsive {
    border-radius: 0.875rem;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chat-box {
    height: min(480px, 58vh);
    overflow-y: auto;
}

.chat-panel {
    min-height: min(560px, 70vh);
}

.chat-users-list {
    max-height: min(520px, 65vh);
    overflow-y: auto;
}

.chat-user-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
}

.chat-msg {
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.65rem;
    border-radius: 0.75rem;
    max-width: 92%;
}

.chat-msg.msg-in {
    background: #f1f5f9;
    margin-right: auto;
}

.chat-msg.msg-out {
    background: #dcfce7;
    margin-left: auto;
}

.chat-msg-meta {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.chat-msg-text {
    word-break: break-word;
}

.chat-attachment-img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.chat-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
    background: #fff;
    color: #334155;
    text-decoration: none;
    max-width: 100%;
    transition: background 0.15s, border-color 0.15s;
}

.chat-attachment-file:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.chat-attachment-file .bi {
    font-size: 1.75rem;
    color: #64748b;
    flex-shrink: 0;
}

.chat-attachment-file .bi-file-earmark-pdf {
    color: #dc2626;
}

.chat-attachment-file span {
    font-size: 0.875rem;
    font-weight: 500;
    word-break: break-word;
}

.chat-user {
    border-left: 3px solid transparent;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.chat-user-name {
    color: #1e293b;
}

.chat-user-meta {
    color: #64748b !important;
}

.chat-user-badges .badge {
    font-size: 0.68rem;
    font-weight: 600;
}

.chat-user-selected {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    border-left-color: #4f46e5 !important;
    color: inherit !important;
}

.chat-user-selected .chat-user-name {
    color: #1e293b !important;
}

.chat-user-selected .chat-user-meta {
    color: #64748b !important;
}

.chat-user-selected .badge {
    color: #fff !important;
}

.video-preview-box {
    position: relative;
    background: #0f172a;
    border-radius: 0.75rem;
    overflow: hidden;
    min-height: 180px;
}

.video-preview-badge {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    z-index: 2;
}

.video-preview-poster {
    position: relative;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    background: #000;
}

.video-preview-poster img,
.video-preview-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
}

.video-play-btn {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1e293b;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.video-play-btn:hover {
    transform: scale(1.05);
}

.workout-video {
    display: block;
    width: 100%;
    max-height: 320px;
    background: #000;
}

.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 45%, #f1f5f9 100%);
}

.auth-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.webhook-preview {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    word-break: break-all;
}

.bot-actions .btn {
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .bot-actions {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .bot-actions .btn,
    .bot-actions form {
        width: 100%;
    }

    .bot-actions form .btn {
        width: 100%;
    }
}
