:root {
    --app-primary: #3157d5;
    --app-primary-dark: #2446b8;
    --app-sidebar: #14213d;
    --app-sidebar-hover: #1d2d50;
    --app-sidebar-text: #b8c2d6;
    --app-bg: #f5f7fb;
    --app-text: #1f2937;
    --app-muted: #667085;
    --app-border: #e5e7eb;
    --app-success: #198754;
    --app-warning: #f0ad4e;
    --app-danger: #dc3545;
}

body {
    color: var(--app-text);
    background: var(--app-bg);
}

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

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    background: var(--app-sidebar);
    color: var(--app-sidebar-text);
    transition: transform .2s ease, width .2s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding: .25rem .75rem;
}

.app-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn .app-icon {
    width: 1rem;
    height: 1rem;
}

.stat-icon .app-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.app-nav {
    flex: 1;
}

.app-nav-label {
    margin: 1.25rem .75rem .5rem;
    color: #7f8ca6;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.app-nav-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem 1rem;
    margin-bottom: .25rem;
    color: var(--app-sidebar-text);
    text-decoration: none;
    border-radius: .5rem;
    font-weight: 600;
    text-align: left;
}

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

.app-nav-link.active {
    background: var(--app-primary);
}

.app-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: .45rem;
    background: rgba(255, 255, 255, .08);
    font-size: .7rem;
    font-weight: 800;
    color: #fff;
}

.app-nav-icon .app-icon {
    width: 1rem;
    height: 1rem;
}

.btn-reset {
    border: 0;
    background: transparent;
}

.app-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    border-radius: .75rem;
    background: rgba(255, 255, 255, .05);
}

.app-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    color: #fff;
    background: var(--app-primary);
    border-radius: 50%;
    font-weight: 800;
}

.app-user-name,
.app-user-role {
    margin: 0;
}

.app-user-name {
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-user-role {
    color: var(--app-sidebar-text);
    font-size: .75rem;
}

.min-w-0 {
    min-width: 0;
}

.app-main {
    min-height: 100vh;
    margin-left: 280px;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid var(--app-border);
    backdrop-filter: blur(10px);
}

.app-breadcrumb {
    color: var(--app-muted);
    font-size: .9rem;
}

.app-breadcrumb span {
    margin: 0 .5rem;
}

.app-breadcrumb strong {
    color: var(--app-text);
}

.app-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

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

.page-header.compact {
    margin-top: 2rem;
}

.page-header h1,
.page-header h2 {
    margin: 0;
    font-weight: 800;
}

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

.page-header h2 {
    font-size: 1.4rem;
}

.page-header p {
    margin: .25rem 0 0;
    color: var(--app-muted);
}

.app-card {
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    overflow: hidden;
}

.card-header {
    border-bottom-color: var(--app-border);
}

.table {
    --bs-table-hover-bg: #f8fafc;
}

.table th {
    padding: 1rem 1.25rem;
    color: var(--app-muted);
    background: #f8fafc;
    font-size: .75rem;
    text-transform: uppercase;
}

.table td {
    padding: 1rem 1.25rem;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
}

.btn-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: .8rem;
    font-weight: 700;
}

.search-field {
    width: min(100%, 320px);
}

.company-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: .5rem;
    background: #eef2ff;
    color: var(--app-primary);
    font-weight: 800;
}

.contact-code {
    display: inline-block;
    padding: .15rem .4rem;
    border-radius: .25rem;
    background: #f1f5f9;
    font-size: .75rem;
}

.policy-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-primary {
    background: var(--app-primary);
}

.dot-success {
    background: var(--app-success);
}

.dot-warning {
    background: var(--app-warning);
}

.stat-card {
    min-height: 112px;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
}

.stat-card p {
    margin: 0 0 .25rem;
    color: var(--app-muted);
    font-size: .9rem;
    font-weight: 600;
}

.stat-card h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: .75rem;
    font-weight: 800;
}

.stat-primary {
    color: var(--app-primary);
    background: #eef2ff;
}

.stat-success {
    color: var(--app-success);
    background: #eaf7ef;
}

.stat-warning {
    color: #9a6700;
    background: #fff6df;
}

.stat-danger {
    color: var(--app-danger);
    background: #fff0f0;
}

.help-panel {
    padding: 1.25rem;
    border: 1px dashed var(--app-border);
    border-radius: .75rem;
    background: #f8fafc;
}

.help-panel p {
    margin: 0 0 1rem;
    color: var(--app-muted);
    text-align: center;
}

.info-label {
    margin-bottom: .35rem;
    color: var(--app-muted);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.info-value {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.loader {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 3px solid rgba(49, 87, 213, .25);
    border-top-color: var(--app-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.toast-message {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 2000;
    min-width: 260px;
    max-width: calc(100vw - 3rem);
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--app-success);
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
    font-weight: 600;
    transform: translateX(120%);
    opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
}

.toast-message.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-message.danger,
.toast-message.error {
    border-left-color: var(--app-danger);
}

.login-page,
.welcome-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #14213d;
}

.login-card,
.welcome-panel {
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 24px 50px rgba(0, 0, 0, .28);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: .75rem;
    border-radius: .9rem;
    color: var(--app-primary);
    background: #eef2ff;
    font-weight: 800;
}

.login-brand h1,
.login-title,
.welcome-panel h1 {
    font-weight: 800;
}

.login-brand h1 {
    font-size: 1.5rem;
}

.login-title {
    font-size: 1.5rem;
    text-align: center;
}

.login-subtitle,
.login-footer,
.welcome-panel p {
    color: var(--app-muted);
    text-align: center;
}

.login-footer {
    margin: 2rem 0 0;
    font-size: .85rem;
}

.welcome-panel {
    text-align: center;
}

.welcome-panel p {
    margin: .75rem 0 1.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.mobile-active {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .app-topbar,
    .app-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .page-header > .d-flex {
        flex-direction: column;
    }

    .login-card,
    .welcome-panel {
        padding: 2rem 1.25rem;
    }
}

/* Custom Checkbox Dropdown */
.dropdown-checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 0.375rem;
    user-select: none;
    transition: background-color 0.15s ease;
}

.dropdown-checkbox-item:hover {
    background-color: var(--app-bg);
}

.dropdown-checkbox-item input[type="checkbox"] {
    cursor: pointer;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0;
}

.dropdown-checkbox-item label {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--app-text);
    margin-bottom: 0;
}

/* Sidebar Backdrop for Mobile/Tablet Drawer */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(10, 15, 30, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

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

@media (max-width: 575.98px) {
    .app-breadcrumb {
        font-size: 0.8rem;
    }
}


