:root {
    --brand-primary: #6d28d9;
    --brand-primary-hover: #5b21b6;
    --brand-light: #f5f3ff;
    --brand-soft: #ede9fe;
    --brand-text: #4c1d95;
    --bg-body: #f8fafc;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 76px;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border-soft: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

body {
    font-family: "Inter", sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: #ffffff;
    border-right: 1px solid var(--border-soft);
    z-index: 1050;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;

    flex-shrink: 0;
}

.logo-box {
    width: 40px;
    height: 40px;
    background: var(--brand-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.2);
}

.auth-logo-box {
    width: 56px;
    height: 56px;
    background: var(--brand-primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto 1.5rem;
}

.sidebar-nav {
    padding: 1rem;

    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-bottom: 1rem;

    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.58) rgba(148, 163, 184, 0.14);
}

.sidebar-nav::-webkit-scrollbar {
    width: 10px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.14);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.58);
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.92);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.78);
}

.sidebar-collapse-toggle {
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar-collapse-toggle:hover {
    background: var(--brand-light);
    color: var(--brand-primary);
}

.sidebar-collapse-toggle svg {
    width: 18px;
    height: 18px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--brand-light);
    color: var(--brand-primary);
}

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

.nav-link i,
.nav-link svg {
    width: 20px;
    height: 20px;
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 700;
    margin: 1.5rem 1rem 0.5rem;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 2rem;
    transition: all 0.3s;
}

.main-content.no-sidebar {
    margin-left: 0;
}

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

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

body.sidebar-collapsed .sidebar-header {
    padding: 1.25rem 1rem;
    justify-content: center;
}

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

body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .nav-section-title {
    display: none;
}

body.sidebar-collapsed .sidebar-collapse-toggle {
    position: absolute;
    right: -17px;
    top: 24px;
    z-index: 2;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

body.sidebar-collapsed .sidebar-nav {
    padding: 1rem 0.75rem;
}

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

body.sidebar-collapsed .nav-link svg {
    margin: 0;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.search-box {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-box input {
    padding-left: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    height: 42px;
}

.search-box i,
.search-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    width: 18px;
    height: 18px;
}

.mobile-toggle {
    display: none;
    background: white;
    border: 1px solid var(--border-soft);
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--text-muted);
}

.stat-card,
.kpi-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-soft);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.icon-purple {
    background: #f5f3ff;
    color: #6d28d9;
}

.icon-amber {
    background: #fffbeb;
    color: #d97706;
}

.icon-emerald {
    background: #ecfdf5;
    color: #059669;
}

.icon-rose {
    background: #fff1f2;
    color: #e11d48;
}

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

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.table-container,
.panel-box,
.leaderboard-card,
.hero-card,
.info-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-container {
    overflow: hidden;
    margin-top: 2rem;
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table thead th {
    background: var(--surface-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 1rem 1.5rem;
    border: none;
}

.table tbody td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.badge-status,
.status-pill,
.tenant-chip,
.eyebrow {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    border-radius: 999px;
}

.badge-status {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-valid {
    background: #d1fae5;
    color: #065f46;
}

.badge-suspended {
    background: #fee2e2;
    color: #991b1b;
}

.btn-brand {
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-brand:hover {
    background: var(--brand-primary-hover);
    color: white;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}

.btn-outline-brand {
    border: 1px solid var(--border-soft);
    background: white;
    color: #475569;
    border-radius: 10px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
}

.btn-outline-brand:hover {
    background: var(--surface-muted);
    border-color: #cbd5e1;
}

.leaderboard-card {
    padding: 1.5rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.rank-1 {
    background: #fef3c7;
    color: #d97706;
}

.rank-2 {
    background: #f1f5f9;
    color: #64748b;
}

.rank-3 {
    background: #fff7ed;
    color: #c2410c;
}

.hero-card {
    padding: 2rem;
}

.tenant-chip {
    background: var(--brand-light);
    color: var(--brand-text);
    border: 1px solid rgba(109, 40, 217, 0.12);
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
}

.eyebrow {
    color: var(--brand-text);
    background: var(--brand-soft);
    gap: 0.5rem;
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
}

.muted-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    max-width: 400px;
    width: 100%;
    background: white;
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-soft);
}

.form-control {
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--border-soft);
}

.tenant-search {
    max-width: 280px;
}

.status-pill {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #f1f5f9;
    color: #475569;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.65rem 0.45rem 0.8rem;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-main);
    font-weight: 700;
}

.tag-chip-action {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-muted);
}

.tag-chip-action:hover {
    color: var(--brand-primary);
}

.tag-chip-action svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 992px) {
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-width);
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    body.sidebar-collapsed .sidebar-label,
    body.sidebar-collapsed .nav-section-title {
        display: initial;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-toggle {
        display: block;
    }

    .top-header {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .header-actions {
        display: none !important;
    }

    .search-box,
    .tenant-search {
        max-width: 100%;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(100, 116, 139, 0.46);
        border-color: rgba(255, 255, 255, 0.88);
    }

    .sidebar-nav::-webkit-scrollbar-thumb:hover {
        background: rgba(71, 85, 105, 0.7);
    }

    .file-name-nowrap {
        white-space: nowrap;
    }
}
