:root {
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --brand: #4f46e5;
    --brand-soft: #eef2ff;
}

[data-bs-theme="dark"] {
    --brand-soft: #312e81;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: #f4f6fb;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] .auth-body {
    background: #0f172a;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

[data-bs-theme="dark"] .sidebar {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .sidebar-brand {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .sidebar-nav .nav-link {
    color: #fff;
}

[data-bs-theme="dark"] .sidebar-nav .nav-link .bi {
    color: #fff;
}

[data-bs-theme="dark"] .sidebar-nav .nav-link:hover,
[data-bs-theme="dark"] .sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

[data-bs-theme="dark"] .sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.18);
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    line-height: 0;
}

.brand-logo--auth {
    display: flex;
    justify-content: center;
    align-items: center;
}

.brand-logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
}

.brand-logo--auth img {
    max-height: 100px;
    max-width: 100px;
}

.brand-logo--sidebar img {
    max-height: 50px;
    max-width: 50px;
}

.sidebar-nav .nav-link {
    color: #475569;
    border-radius: 0.5rem;
    margin: 0.1rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.submenu .nav-link {
    font-size: 0.875rem;
    padding-left: 0.5rem;
}

.submenu .nav-link .submenu-icon {
    font-size: 0.95rem;
    opacity: 0.88;
    flex-shrink: 0;
    width: 1.15rem;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    transition: margin 0.25s ease;
}

.main-content.expanded {
    margin-left: 0;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

[data-bs-theme="dark"] .topbar {
    background: #1e293b;
}

.page-content {
    padding: 1.5rem;
}

.stat-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.stat-card .icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #e0e7ff 100%);
}

.auth-card-wrapper {
    width: min(440px, 92vw);
}


.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    display: grid;
    place-items: center;
    z-index: 2000;
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.65);
}

.table-card {
    border-radius: 1rem;
    overflow: hidden;
    border: none;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.cliente-foto-preview {
    max-height: 200px;
    object-fit: cover;
}

.cliente-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
}

.cliente-thumb-placeholder {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand);
}

.cliente-camera-overlay {
    position: fixed;
    inset: 0;
    z-index: 1070;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cliente-camera-panel {
    width: min(520px, 100%);
    background: #fff;
    border-radius: 0.75rem;
    padding: 1rem;
}

[data-bs-theme="dark"] .cliente-camera-panel {
    background: #1e293b;
}

.cliente-camera-panel video {
    width: 100%;
    max-height: 60vh;
    border-radius: 0.5rem;
    background: #000;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}
