:root {
    --tblr-primary: #1f6feb;
    --tblr-body-bg: #f4f7fb;
    --erp-sidebar-width: 18rem;
}

html.erp-sidebar-collapsed {
    --erp-sidebar-width: 5.75rem;
}

body {
    background: radial-gradient(circle at top, rgba(31, 111, 235, 0.08), transparent 30%), var(--tblr-body-bg);
}

html,
body {
    height: 100%;
}

.auth-shell {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(31, 111, 235, 0.1), rgba(255, 255, 255, 0)),
        linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 12rem;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.08);
    color: var(--tblr-primary);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-logo {
    display: block;
    width: min(18rem, 78vw);
    height: auto;
    margin: 0 auto 1.25rem;
}

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

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #1f6feb, #0f3d91);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.erp-brand-logo {
    display: block;
    object-fit: contain;
}

.erp-brand-logo-full {
    width: 16rem;
    max-height: 3.25rem;
}

.erp-brand-logo-compact {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
}

html.erp-sidebar-collapsed .erp-brand-logo-full {
    display: none;
}

html.erp-sidebar-collapsed .erp-brand-logo-compact {
    display: block;
}

.sidebar-card {
    top: 1.5rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
}

.list-group-item.active {
    background: rgba(31, 111, 235, 0.08);
    border-color: rgba(31, 111, 235, 0.15);
    color: var(--tblr-primary);
    font-weight: 600;
}

.erp-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(16px);
}

.erp-topbar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 4.25rem;
    padding-inline: 1rem;
}

.erp-page-wrapper {
    min-height: calc(100vh - 4.25rem);
}

.erp-layout-container {
    padding: 1rem;
}

.erp-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.erp-layout-sidebar,
.erp-layout-content {
    min-width: 0;
}

.erp-layout-content {
    display: grid;
    gap: 1rem;
}

.erp-toast-stack {
    z-index: 1095;
}

.erp-toast {
    min-width: min(24rem, calc(100vw - 2rem));
    box-shadow: 0 0.85rem 2rem rgba(15, 23, 42, 0.14);
    opacity: 1;
    transition: opacity 0.18s ease, transform 0.18s ease;
    transform: translateY(0);
}

.erp-toast .toast-header {
    border-bottom: 0;
}

.erp-toast:not(.show) {
    opacity: 0;
    transform: translateY(-0.25rem);
}

.erp-toast.text-bg-danger .toast-header,
.erp-toast.text-bg-success .toast-header,
.erp-toast.text-bg-warning .toast-header,
.erp-toast.text-bg-info .toast-header {
    background: transparent;
    color: inherit;
}

.erp-toast.text-bg-warning .btn-close {
    filter: none;
}

.erp-footer {
    margin-top: 0.25rem;
    border-top: 1px solid rgba(98, 105, 118, 0.16);
    padding: 1rem 0 1.5rem;
}

.erp-footer__body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: var(--tblr-secondary);
    font-size: 0.875rem;
}

.erp-footer__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.erp-footer__text {
    color: var(--tblr-body-color);
    font-weight: 500;
}

.erp-footer__year,
.erp-footer__meta {
    color: var(--tblr-secondary);
}

.erp-icon {
    vertical-align: middle;
}

.erp-sidebar {
    position: relative;
}

.erp-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1.25rem;
    background:
        linear-gradient(145deg, rgba(31, 111, 235, 0.12), rgba(31, 111, 235, 0.02)),
        #fff;
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.06);
}

.erp-sidebar-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #1f6feb, #0f3d91);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.erp-sidebar-brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.erp-sidebar-brand-copy {
    font-size: 0.875rem;
    color: #64748b;
}

.erp-sidebar-nav {
    display: grid;
    gap: 0.875rem;
    padding-bottom: 3rem;
}

.erp-sidebar-section {
    overflow: hidden;
    border-radius: 1.25rem;
}

.erp-sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    border: 0;
    background: #fff;
    text-align: left;
}

.erp-sidebar-section-toggle.is-expanded {
    background: rgba(15, 23, 42, 0.02);
}

.erp-sidebar-section-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.erp-sidebar-section-chevron {
    display: inline-flex;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.erp-sidebar-section-chevron.is-open {
    transform: rotate(90deg);
}

.erp-sidebar-section-toggle[aria-expanded="true"] .erp-sidebar-section-chevron {
    transform: rotate(90deg);
}

.erp-sidebar .nav {
    padding: 0 0.75rem 0.9rem;
    gap: 0.2rem;
}

.erp-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 0.95rem;
    color: #334155;
    font-weight: 600;
}

.erp-sidebar .nav-link:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
}

.erp-sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(31, 111, 235, 0.14), rgba(31, 111, 235, 0.05));
    color: var(--tblr-primary);
    box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.12);
}

.erp-sidebar .nav-link-icon {
    display: inline-flex;
    color: inherit;
    flex: 0 0 auto;
}

.erp-sidebar .nav-link-title {
    flex: 1;
}

.erp-header {
    background:
        linear-gradient(145deg, rgba(31, 111, 235, 0.12), rgba(31, 111, 235, 0.03)),
        #fff;
}

.erp-list-toolbar {
    display: grid;
    gap: 0.5rem;
    justify-items: end;
}

.erp-list-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.erp-section-label {
    margin-bottom: 0.35rem;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.erp-data-table thead th {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    white-space: nowrap;
}

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

.erp-bulk-column {
    width: 3rem;
    text-align: center;
}

.erp-bulk-column .form-check {
    display: flex;
    justify-content: center;
}

.erp-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
}

.erp-sort-link:hover {
    color: var(--tblr-primary);
}

.erp-sort-link.is-active {
    color: var(--tblr-primary);
}

.erp-sort-icon {
    display: inline-flex;
    color: #94a3b8;
}

.erp-sort-link.is-active .erp-sort-icon {
    color: currentColor;
}

.erp-data-table-filters th {
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
    background: rgba(15, 23, 42, 0.015);
}

.erp-data-table-filters .form-control,
.erp-data-table-filters .form-select {
    min-width: 6rem;
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: none;
}

.erp-data-table-filters .form-control::placeholder {
    color: #94a3b8;
}

.erp-data-table-filters .btn {
    white-space: nowrap;
}

.erp-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.erp-row-actions .dropdown-menu form {
    margin: 0;
}

.table-responsive.erp-row-actions-dropdown-open {
    overflow: visible;
}

.erp-auth-permissions {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
}

.erp-auth-permission-item {
    margin: 0;
    min-width: 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.erp-auth-permission-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.625rem;
    min-width: 0;
}

.erp-auth-permission-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.erp-auth-permission-input {
    margin: 0.2rem 0 0;
    float: none;
    flex: 0 0 auto;
}

.erp-auth-permission-copy {
    min-width: 0;
}

.erp-auth-permission-label {
    display: block;
    margin: 0;
    color: var(--tblr-body-color);
    font-weight: 500;
    cursor: pointer;
    min-width: 0;
    overflow-wrap: anywhere;
}

.erp-auth-permission-code {
    margin-top: 0.15rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.erp-form-grid {
    display: grid;
    gap: 1rem;
}

.erp-flash {
    border: 0;
    box-shadow: 0 0.5rem 1rem rgba(15, 23, 42, 0.06);
}

.erp-pagination .page-link {
    min-width: 2.25rem;
    text-align: center;
    border-color: rgba(148, 163, 184, 0.25);
}

.erp-pagination .page-item.active .page-link {
    background: rgba(var(--tblr-primary-rgb), 1);
    border-color: rgba(var(--tblr-primary-rgb), 1);
}

.ts-wrapper.form-select,
.ts-wrapper.single {
    min-height: calc(2.5rem + 2px);
}

.erp-datetime-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 5.5rem 5.5rem;
    gap: 0.75rem;
    align-items: center;
}

.erp-datetime-picker .litepicker {
    z-index: 1060;
}

.erp-datetime-field {
    position: relative;
}

.erp-datetime-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    z-index: 1070;
    width: min(22rem, 100%);
}

.erp-datetime-popover .litepicker {
    z-index: 1071;
}

.erp-datetime-preview {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
    background: rgba(var(--tblr-primary-rgb), 0.04);
    color: var(--tblr-body-color);
    font-size: 0.875rem;
}

@media (max-width: 767.98px) {
    .erp-datetime-picker {
        grid-template-columns: 1fr;
    }

    .erp-datetime-popover {
        width: 100%;
    }
}

.ts-wrapper.form-select .ts-control,
.ts-wrapper.single .ts-control {
    border-color: var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
    box-shadow: none;
    min-height: calc(2.5rem + 2px);
    padding-block: 0.5rem;
}

.ts-wrapper.focus .ts-control {
    border-color: rgba(var(--tblr-primary-rgb), 0.5);
    box-shadow: 0 0 0 0.25rem rgba(var(--tblr-primary-rgb), 0.16);
}

.ts-dropdown {
    background: var(--tblr-bg-surface);
    border-color: var(--tblr-border-color);
    box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.08);
    border-radius: var(--tblr-border-radius);
    opacity: 1;
    z-index: 1085;
}

.ts-dropdown .ts-dropdown-content {
    background: inherit;
}

.ts-dropdown .option,
.ts-dropdown .no-results {
    background: transparent;
}

@media (min-width: 992px) {
    body {
        overflow: hidden;
    }

    .erp-page-wrapper,
    .page-body,
    .erp-layout-container,
    .erp-layout {
        height: calc(100vh - 4.25rem);
    }

    .erp-layout {
        grid-template-columns: var(--erp-sidebar-width) minmax(0, 1fr);
        align-items: stretch;
    }

    .erp-layout-sidebar,
    .erp-layout-content {
        max-height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .erp-layout-sidebar {
        padding-right: 0.125rem;
    }

    .erp-layout-content {
        padding-right: 0.125rem;
        align-content: start;
    }
}

.ts-dropdown .active {
    background: rgba(var(--tblr-primary-rgb), 0.08);
}

.erp-profile-grid {
    display: grid;
    gap: 1rem;
}

.erp-profile-card .form-control[readonly] {
    background-color: var(--tblr-bg-surface-secondary);
}

@media (min-width: 1200px) {
    .erp-profile-grid {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
        align-items: start;
    }
}

@media (min-width: 992px) {
    .erp-layout {
        grid-template-columns: var(--erp-sidebar-width) minmax(0, 1fr);
    }

    .erp-layout-sidebar {
        position: sticky;
        top: calc(4.25rem + 1rem);
        align-self: start;
        max-height: calc(100vh - 6.25rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    html.erp-sidebar-collapsed .erp-sidebar-brand {
        justify-content: center;
        padding-inline: 0.75rem;
    }

    html.erp-sidebar-collapsed .erp-sidebar-brand-copy-wrap,
    html.erp-sidebar-collapsed .erp-sidebar-section-toggle,
    html.erp-sidebar-collapsed .erp-sidebar-section-label,
    html.erp-sidebar-collapsed .erp-sidebar-section-chevron,
    html.erp-sidebar-collapsed .erp-sidebar .nav-link-title {
        display: none;
    }

    html.erp-sidebar-collapsed .erp-sidebar-section {
        overflow: visible;
    }

    html.erp-sidebar-collapsed .erp-sidebar-section .collapse {
        display: block !important;
    }

    html.erp-sidebar-collapsed .erp-sidebar .nav {
        padding: 0.5rem;
        align-items: center;
    }

    html.erp-sidebar-collapsed .erp-sidebar .nav-link {
        justify-content: center;
        padding-inline: 0.5rem;
    }
}

@media (max-width: 991.98px) {
    .erp-topbar-container {
        gap: 0.5rem;
        min-height: 3.75rem;
        padding-inline: 0.75rem;
    }

    .erp-brand-copy {
        display: none;
    }

    .erp-brand-logo-full {
        display: none;
    }

    .erp-brand-logo-compact {
        display: block;
    }

    .erp-sidebar-offcanvas {
        width: min(21rem, 88vw);
        max-width: 100%;
    }

    .erp-sidebar-offcanvas .offcanvas-header {
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    }

    .erp-sidebar-offcanvas .offcanvas-body {
        padding: 1rem;
    }

    .erp-sidebar[data-sidebar-instance="mobile"] .erp-sidebar-brand {
        margin-bottom: 0.75rem;
    }
}
