/**
 * Energy Gym - Custom Styles
 */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 76px;
    --navbar-height: 68px;
    --footer-height: 44px;
    --primary-color: #ffc107;
    --dark-bg: #212529;
    --sidebar-bg: #1d2329;
    --sidebar-bg-alt: #161b20;
    --card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Layout */
body {
    min-height: 100vh;
    background-color: #f8f9fa;
    overflow-x: hidden;
    padding-bottom: var(--footer-height);
    color: #1f2937;
}

body.sidebar-open {
    overflow: hidden;
}

.wrapper {
    display: flex;
    min-height: calc(100vh - var(--navbar-height) - var(--footer-height));
    padding-top: var(--navbar-height);
}

.navbar {
    min-height: var(--navbar-height);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
    z-index: 1030;
}

.navbar .container-fluid {
    gap: 1rem;
    flex-wrap: nowrap;
}

.navbar-toggler {
    border-radius: 14px;
    border-color: rgba(255, 255, 255, 0.18);
    padding: 0.45rem 0.65rem;
    box-shadow: none !important;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.22) !important;
}

.sidebar-trigger {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex: 0 0 auto;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.sidebar-trigger:hover,
.sidebar-trigger:focus-visible {
    transform: translateY(-1px);
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-trigger i {
    font-size: 1.15rem;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.35rem;
    flex-shrink: 0;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.navbar-context {
    min-width: 0;
}

.navbar-context-title {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.15;
}

.navbar-context-meta {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.8rem;
    white-space: nowrap;
}

.navbar-clock {
    white-space: nowrap;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: var(--navbar-height);
    bottom: var(--footer-height);
    left: 0;
    height: calc(100vh - var(--navbar-height) - var(--footer-height));
    z-index: 1020;
    transition: width 0.28s ease, transform 0.28s ease, box-shadow 0.28s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-alt) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 1.25rem 2.5rem rgba(15, 23, 42, 0.18);
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar .nav-link span {
    display: none;
}

body.sidebar-collapsed .sidebar .sidebar-brand .fw-semibold,
body.sidebar-collapsed .sidebar .sidebar-brand .sidebar-brand-copy {
    display: none;
}

body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    text-align: center;
    padding: 0.75rem;
}

body.sidebar-collapsed .sidebar .nav-link i {
    margin-right: 0;
    font-size: 1.25rem;
}

body.sidebar-collapsed .sidebar .sidebar-logo {
    width: 40px;
    height: 40px;
    padding: 0.25rem;
}

body.sidebar-collapsed .sidebar .sidebar-brand {
    justify-content: center;
}

.sidebar-content {
    padding: 0.85rem 0 1.25rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.95rem 1rem !important;
    margin: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
}

.sidebar-brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.3rem;
}

.sidebar-brand-copy,
.sidebar-brand-title,
.sidebar-brand-meta {
    transition: opacity 0.2s ease;
}

.sidebar-brand-copy {
    min-width: 0;
}

.sidebar-brand-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.15;
    color: #fff;
}

.sidebar-brand-meta {
    display: block;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.76rem;
    line-height: 1.2;
}

.sidebar .nav {
    gap: 0.25rem;
    padding: 0.75rem 0 2rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, color 0.2s ease, background-color 0.2s ease;
    border-left: 3px solid transparent;
    border-radius: 0.95rem;
    margin: 0 0.75rem;
    font-weight: 500;
    min-height: 48px;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(255, 193, 7, 0.12);
    border-left-color: var(--primary-color);
    box-shadow: inset 0 0 0 1px rgba(255, 193, 7, 0.15);
}

.sidebar .nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.sidebar .nav-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 1.25rem;
}

.sidebar-backdrop {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 18, 28, 0.55);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    z-index: 1031;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    min-height: calc(100vh - var(--navbar-height) - var(--footer-height));
    padding-bottom: calc(var(--footer-height) + 1.5rem);
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    min-height: var(--footer-height);
    transition: all 0.3s ease;
    z-index: 99;
}

body.sidebar-collapsed .footer {
    left: var(--sidebar-collapsed-width);
}

/* Cards */
.card {
    border: none;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    border-radius: 1.15rem;
    overflow: hidden;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.alert {
    border-radius: 1rem;
    padding: 0.95rem 1rem;
}

/* Stats Cards */
.stat-card {
    border-radius: 0.5rem;
    padding: 1.25rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.stat-card.bg-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.bg-success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.stat-card.bg-warning { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-card.bg-info { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-card.bg-danger { background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%); }
.stat-card.bg-dark { background: linear-gradient(135deg, #434343 0%, #000000 100%); }

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-lg {
    width: 100px;
    height: 100px;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Buttons */
.btn-group-sm > .btn, .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

.btn-group {
    gap: 0.35rem;
}

.btn-group > .btn {
    border-radius: 0.75rem !important;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.form-control,
.form-select,
.input-group-text,
.btn {
    border-radius: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
}

.page-header p {
    max-width: 60ch;
}

.table-responsive {
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: #fff;
}

/* Access Control */
.access-result {
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
}

.access-result.success {
    background-color: #d4edda;
    border: 2px solid #28a745;
}

.access-result.danger {
    background-color: #f8d7da;
    border: 2px solid #dc3545;
}

.access-result .member-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid currentColor;
    margin-bottom: 1rem;
}

.access-result h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
}

/* Quick Actions */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    border-radius: 0.5rem;
    background-color: #fff;
    box-shadow: var(--card-shadow);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.quick-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    color: inherit;
}

.quick-action i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Operator Dashboard */
.operator-hero {
    background:
        radial-gradient(circle at top right, rgba(255, 193, 7, 0.18), transparent 30%),
        linear-gradient(135deg, #102a43 0%, #173f5f 52%, #1f6f78 100%);
    color: #fff;
    box-shadow: 0 1.5rem 3rem rgba(16, 42, 67, 0.18);
}

.operator-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 0.85rem;
}

.operator-title {
    font-size: clamp(1.65rem, 3vw, 2.3rem);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 0.85rem;
}

.operator-copy {
    color: rgba(255, 255, 255, 0.82);
    max-width: 60ch;
    margin-bottom: 0;
}

.operator-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.operator-status-pill.success {
    background: rgba(56, 239, 125, 0.18);
    color: #dcfce7;
}

.operator-status-pill.warning {
    background: rgba(255, 193, 7, 0.2);
    color: #fff3cd;
}

.operator-status-pill.dark {
    background: rgba(15, 23, 42, 0.28);
}

.operator-status-pill.light {
    background: rgba(255, 255, 255, 0.14);
}

.operator-hero-panel {
    background: rgba(255, 255, 255, 0.92);
    color: #102a43;
    border-radius: 1.35rem;
    padding: 1.5rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.operator-hero-panel-label {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    color: #486581;
    margin-bottom: 0.45rem;
}

.operator-hero-panel-value {
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    line-height: 1;
    font-weight: 800;
    margin-bottom: 0.85rem;
}

.operator-hero-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.operator-hero-metrics div {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    padding: 0.9rem;
    background: #f8fafc;
}

.operator-hero-metrics span {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.operator-hero-metrics strong {
    font-size: 1rem;
    color: #0f172a;
}

.operator-kpi-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.15rem;
    padding: 1.2rem 1.2rem 1.15rem;
    color: #fff;
    min-height: 180px;
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.12);
}

.operator-kpi-card.primary { background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%); }
.operator-kpi-card.success { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.operator-kpi-card.warning { background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%); }
.operator-kpi-card.danger { background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%); }

.operator-kpi-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.82;
    margin-bottom: 0.45rem;
}

.operator-kpi-value {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.55rem;
}

.operator-kpi-note {
    max-width: 22ch;
    opacity: 0.9;
}

.operator-kpi-icon {
    position: absolute;
    right: 1rem;
    bottom: 0.85rem;
    font-size: 3rem;
    opacity: 0.18;
}

.operator-panel {
    border-radius: 1.2rem;
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.08);
}

.operator-panel .card-header {
    border-radius: 1.2rem 1.2rem 0 0 !important;
}

.operator-action-card {
    display: block;
    height: 100%;
    text-decoration: none;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.1rem;
    padding: 1.15rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.operator-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 1rem 1.75rem rgba(15, 23, 42, 0.1);
    color: #0f172a;
}

.operator-action-card.primary:hover { border-color: rgba(37, 99, 235, 0.35); }
.operator-action-card.success:hover { border-color: rgba(5, 150, 105, 0.35); }
.operator-action-card.warning:hover { border-color: rgba(245, 158, 11, 0.35); }
.operator-action-card.danger:hover { border-color: rgba(220, 38, 38, 0.35); }
.operator-action-card.info:hover { border-color: rgba(8, 145, 178, 0.35); }
.operator-action-card.dark:hover { border-color: rgba(15, 23, 42, 0.35); }

.operator-action-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.9rem;
    font-size: 1.4rem;
    background: rgba(255, 193, 7, 0.18);
    color: #9a6700;
}

.operator-action-card.primary .operator-action-icon { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.operator-action-card.success .operator-action-icon { background: rgba(5, 150, 105, 0.12); color: #047857; }
.operator-action-card.warning .operator-action-icon { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.operator-action-card.danger .operator-action-icon { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.operator-action-card.info .operator-action-icon { background: rgba(8, 145, 178, 0.12); color: #0e7490; }
.operator-action-card.dark .operator-action-icon { background: rgba(15, 23, 42, 0.08); color: #111827; }

.operator-action-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.operator-action-description {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
}

.operator-mini-stat {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.operator-mini-stat:first-child {
    padding-top: 0;
}

.operator-mini-stat:last-of-type {
    border-bottom: 0;
}

.operator-mini-stat span {
    color: #64748b;
}

.operator-mini-stat strong {
    color: #0f172a;
}

.operator-callout {
    border-radius: 1rem;
    padding: 1rem;
}

.operator-callout.success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.operator-callout.warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

.operator-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.85rem;
}

.operator-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.operator-list-row:last-child {
    border-bottom: 0;
}

.operator-inline-empty {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: #f8fafc;
    color: #64748b;
}

.operator-empty {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 2rem;
    text-align: center;
    color: #64748b;
}

.operator-empty i {
    font-size: 2.5rem;
    color: #94a3b8;
}

.operator-placeholder {
    text-align: center;
    padding: 1.5rem 1.25rem;
    border: 1px dashed rgba(15, 23, 42, 0.18);
    border-radius: 1.15rem;
    background: linear-gradient(180deg, #fffdf5 0%, #f8fafc 100%);
}

.operator-placeholder i {
    font-size: 2rem;
    color: #c98931;
    margin-bottom: 0.85rem;
}

.operator-placeholder h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.65rem;
}

.scanner-card .card-body,
.search-card .card-body,
.access-result-card .card-body {
    padding: 1.35rem;
}

.scanner-input {
    min-height: 64px;
    font-size: 1.15rem;
    border-width: 2px;
    border-color: rgba(255, 193, 7, 0.55);
    box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.08);
}

.scanner-actions {
    flex-wrap: wrap;
}

.scanner-actions .btn {
    min-width: 170px;
    min-height: 52px;
    border-radius: 1rem;
}

.access-stream-card .card-body {
    padding: 0;
}

.report-filter-card .card-body {
    padding: 1.25rem;
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Responsive */
@media (max-width: 991.98px) {
    :root {
        --footer-height: 0px;
    }

    body {
        padding-bottom: 0;
    }

    .navbar-context {
        display: none !important;
    }

    .sidebar {
        transform: translateX(calc(-100% - 1rem));
        width: min(320px, calc(100vw - 1rem)) !important;
        bottom: 0;
        height: calc(100vh - var(--navbar-height));
        z-index: 1035;
        border-top-right-radius: 1.15rem;
        border-bottom-right-radius: 1.15rem;
        box-shadow: 0 2rem 3rem rgba(15, 23, 42, 0.32);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar .nav-link:hover {
        transform: none;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .footer {
        left: 0 !important;
        position: static;
        min-height: auto;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }

    .navbar-collapse {
        position: fixed;
        top: calc(var(--navbar-height) + 0.35rem);
        left: 0.75rem;
        right: 0.75rem;
        z-index: 1032;
        padding: 0.8rem;
        border-radius: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(17, 24, 39, 0.98);
        box-shadow: 0 1.5rem 2.5rem rgba(15, 23, 42, 0.32);
    }

    .navbar-collapse .navbar-nav {
        gap: 0.35rem;
    }

    .navbar-collapse .nav-link {
        border-radius: 0.85rem;
        padding: 0.8rem 0.9rem;
    }

    .navbar-collapse .dropdown-menu {
        position: static !important;
        transform: none !important;
        margin-top: 0.35rem;
        border-radius: 0.9rem;
        border: 1px solid rgba(148, 163, 184, 0.2);
        box-shadow: none;
    }
}

@media (max-width: 767.98px) {
    :root {
        --navbar-height: 62px;
    }

    body {
        background: #f4f6f8;
    }

    .wrapper {
        min-height: calc(100vh - var(--navbar-height));
    }

    .navbar .container-fluid {
        gap: 0.65rem;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .navbar-brand {
        min-width: 0;
        flex: 1 1 auto;
        max-width: 60vw;
    }

    .navbar-brand span {
        display: inline-block;
        max-width: calc(100% - 44px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .navbar .nav-link {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
        font-size: 0.92rem;
    }

    .navbar-clock {
        display: none !important;
    }

    .main-content .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-top: 0.9rem !important;
        padding-bottom: 1rem !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.9rem;
        margin-bottom: 1.1rem;
        padding-bottom: 0.85rem;
    }

    .page-header > div,
    .page-header .btn-group,
    .page-header .d-flex {
        width: 100%;
        flex-wrap: wrap;
    }

    .page-header .btn,
    .page-header .btn-group > .btn {
        flex: 1 1 auto;
        min-height: 44px;
    }

    .page-header .badge {
        align-self: flex-start;
    }

    .page-header h1 {
        font-size: 1.18rem;
    }

    .card {
        border-radius: 1rem;
        margin-bottom: 1rem;
    }

    .card-body,
    .card-header {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .table-responsive {
        border-radius: 1rem;
    }

    .table th,
    .table td {
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 1rem;
        min-height: 142px;
        border-radius: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.45rem;
    }

    .stat-card .stat-icon {
        right: 0.85rem;
        font-size: 2.35rem;
    }

    .quick-action {
        padding: 1.15rem;
    }

    .operator-kpi-card {
        min-height: 150px;
    }

    .operator-title {
        font-size: 1.55rem;
    }

    .operator-copy {
        font-size: 0.96rem;
    }

    .operator-hero-panel {
        padding: 1.15rem;
    }

    .operator-hero-metrics {
        grid-template-columns: 1fr;
    }

    .operator-list-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .sidebar-brand {
        margin: 0.65rem;
        padding: 0.85rem !important;
    }

    .sidebar-brand-mark {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .sidebar-logo {
        width: 38px;
        height: 38px;
    }

    .sidebar .nav {
        padding-top: 0.5rem;
    }

    .sidebar .nav-link {
        margin: 0 0.55rem;
        padding: 0.78rem 1rem;
        border-radius: 0.9rem;
    }

    .footer .row {
        gap: 0.25rem;
    }

    .footer .text-md-end {
        text-align: left !important;
    }

    .list-group-item.d-flex.justify-content-between,
    .list-group-item.d-flex.justify-content-between.px-0.bg-transparent {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.25rem;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    .btn-group,
    .btn-toolbar {
        flex-wrap: wrap;
    }

    .btn-group.btn-group-sm {
        display: flex;
    }

    .btn-group.btn-group-sm > .btn {
        flex: 1 1 auto;
        min-width: 44px;
    }

    .chart-container {
        height: 240px;
    }

    .quick-action {
        min-height: 138px;
        justify-content: center;
        border-radius: 1rem;
    }

    .quick-action span {
        text-align: center;
    }

    .scanner-card .card-body,
    .search-card .card-body,
    .access-result-card .card-body {
        padding: 1rem;
    }

    .scanner-input {
        min-height: 58px;
        font-size: 1.05rem;
    }

    .scanner-actions .btn {
        flex: 1 1 100%;
        min-width: 0;
    }

    #membreSearchResults .btn-group {
        width: 100%;
        margin-top: 0.75rem;
    }

    #membreSearchResults .btn-group > .btn,
    #membreSearchResults .btn-group > a {
        flex: 1 1 0;
    }

    .report-filter-card .card-body .row > div:last-child {
        gap: 0.5rem !important;
    }

    .report-filter-card .btn {
        flex: 1 1 calc(50% - 0.5rem);
    }
}

@media (min-width: 992px) {
    body.sidebar-open .sidebar-backdrop {
        opacity: 0;
        pointer-events: none;
    }
}

@media (max-width: 575.98px) {
    .main-content .container-fluid {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .sidebar {
        width: calc(100vw - 0.85rem) !important;
    }

    .sidebar-content {
        padding-bottom: 1rem;
    }

    .sidebar-brand {
        margin: 0.55rem;
        padding: 0.75rem !important;
    }

    .sidebar-brand-title {
        font-size: 0.94rem;
    }

    .sidebar-brand-meta {
        font-size: 0.72rem;
    }

    .page-header h1 {
        font-size: 1.08rem;
    }

    .page-header p,
    .text-muted {
        line-height: 1.45;
    }

    .stat-card {
        min-height: 132px;
    }

    .stat-card .stat-value {
        font-size: 1.32rem;
    }

    .table-responsive {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .table.table-mobile-ready {
        background: transparent;
        border: 0;
        margin-bottom: 0;
    }

    .table.table-mobile-ready thead {
        display: none;
    }

    .table.table-mobile-ready,
    .table.table-mobile-ready tbody,
    .table.table-mobile-ready tr,
    .table.table-mobile-ready td {
        display: block;
        width: 100%;
    }

    .table.table-mobile-ready tbody {
        display: grid;
        gap: 0.85rem;
    }

    .table.table-mobile-ready tr {
        padding: 0.2rem 0.9rem;
        border-radius: 1rem;
        background: #fff;
        border: 1px solid rgba(148, 163, 184, 0.18);
        box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.06);
    }

    .table.table-mobile-ready td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.85rem;
        padding: 0.65rem 0;
        text-align: right;
        white-space: normal;
        border-top: 0;
        border-bottom: 1px dashed rgba(148, 163, 184, 0.3);
    }

    .table.table-mobile-ready td:last-child {
        border-bottom: 0;
    }

    .table.table-mobile-ready td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 42%;
        text-align: left;
        font-weight: 700;
        color: #64748b;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .table.table-mobile-ready td .btn,
    .table.table-mobile-ready td .btn-group,
    .table.table-mobile-ready td .badge {
        margin-left: auto;
    }

    .table.table-mobile-ready td .btn-group {
        justify-content: flex-end;
        width: 100%;
    }

    .table.table-mobile-ready td img.avatar-sm,
    .table.table-mobile-ready td img.avatar {
        margin-right: 0.5rem !important;
    }

    .operator-action-card {
        padding: 1rem;
    }

    .operator-action-title {
        font-size: 0.96rem;
    }

    .operator-action-description {
        font-size: 0.86rem;
    }

    .hikvision-widget-dock {
        width: min(290px, calc(100vw - 1rem));
    }
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    z-index: 1100;
}

/* Hikvision widget */
.hikvision-widget-dock {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1085;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    width: min(360px, calc(100vw - 1.5rem));
    max-width: calc(100vw - 1.5rem);
}

.hikvision-widget-card {
    width: 100%;
    border-radius: 1rem;
}

.hikvision-widget-launcher {
    border-radius: 999px;
    padding: 0.7rem 0.95rem;
    max-width: 100%;
    white-space: nowrap;
}

.hikvision-widget-launcher .badge {
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .hikvision-widget-dock {
        right: 0.75rem;
        bottom: 0.75rem;
        width: min(320px, calc(100vw - 1rem));
        max-width: calc(100vw - 1rem);
    }

    .hikvision-widget-launcher {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }
}
