:root {
    --system-color: #dc3545;
    --app-bg: #f8fafc;
    --app-surface: #ffffff;
    --app-surface-soft: #f9fafb;
    --app-border: #e5e7eb;
    --app-text: #111827;
    --app-muted: #6b7280;
    --app-ring: rgba(37, 99, 235, 0.14);
    --app-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    --app-radius: 8px;
}

html,
body {
    color: var(--app-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0;
}

body:not(.login-page),
.content-wrapper {
    background: var(--app-bg);
}

a {
    color: var(--system-color);
}

a:hover {
    color: var(--system-color);
    filter: brightness(0.9);
}

.content-header {
    padding: 18px 0 8px;
}

.content-header h1,
.content-header .m-0.text-dark {
    color: var(--app-text) !important;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0;
}

.breadcrumb {
    background: transparent;
    font-size: 13px;
    margin: 0;
    padding: 0;
}

.main-header.navbar {
    background-color: var(--system-color);
    border-bottom-color: var(--system-color);
}

.main-header.navbar .nav-link,
.main-header.navbar .navbar-nav .nav-link {
    color: #ffffff;
}

.main-header.navbar .nav-link:hover,
.main-header.navbar .nav-link:focus {
    color: rgba(255, 255, 255, 0.86);
}

.main-header .dropdown-menu {
    border: 0;
    border-radius: 8px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.main-sidebar {
    box-shadow: none !important;
}

.sidebar-dark-danger,
.sidebar-dark-danger .sidebar {
    background-color: #111827;
}

.nav-sidebar .nav-header {
    color: #9ca3af;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    margin-top: 8px;
    text-transform: uppercase;
}

.sidebar-profile {
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex !important;
    gap: 12px;
    margin: 12px 8px 16px;
    padding: 12px;
}

.sidebar-profile-logo {
    align-items: center;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    flex: 0 0 46px;
    height: 46px;
    justify-content: center;
    overflow: hidden;
    padding: 5px;
    width: 46px;
}

.sidebar-profile-logo img {
    display: block;
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.sidebar-profile-info {
    min-width: 0;
}

.sidebar-profile-link {
    color: #ffffff;
    display: grid;
    gap: 2px;
    grid-template-columns: 12px minmax(0, 1fr);
    line-height: 1.2;
}

.sidebar-profile-link:hover {
    color: #ffffff;
    filter: none;
}

.sidebar-online-dot {
    align-self: center;
    background: #22c55e;
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.65);
    display: inline-block;
    height: 8px;
    position: relative;
    width: 8px;
}

.sidebar-online-dot::after {
    animation: sidebarPulse 1.8s ease-out infinite;
    background: rgba(34, 197, 94, 0.35);
    border-radius: inherit;
    content: "";
    inset: -5px;
    position: absolute;
}

.sidebar-profile-name {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-profile-role {
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    grid-column: 2;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.sidebar-collapse .sidebar-profile {
    background: transparent;
    border-color: transparent;
    display: flex !important;
    justify-content: center;
    margin: 12px auto 14px;
    padding: 0;
    width: 100%;
}

body.sidebar-collapse .sidebar-profile-logo {
    border-radius: 8px;
    flex-basis: 42px;
    height: 42px;
    padding: 5px;
    width: 42px;
}

body.sidebar-collapse .sidebar-profile-info {
    display: none;
}

body.sidebar-collapse .main-sidebar:hover .sidebar-profile,
body.sidebar-collapse .main-sidebar.sidebar-focused .sidebar-profile {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    justify-content: flex-start;
    margin: 12px 8px 16px;
    padding: 12px;
    width: auto;
}

body.sidebar-collapse .main-sidebar:hover .sidebar-profile-logo,
body.sidebar-collapse .main-sidebar.sidebar-focused .sidebar-profile-logo {
    flex-basis: 46px;
    height: 46px;
    width: 46px;
}

body.sidebar-collapse .main-sidebar:hover .sidebar-profile-info,
body.sidebar-collapse .main-sidebar.sidebar-focused .sidebar-profile-info {
    display: block;
}

@keyframes sidebarPulse {
    0% {
        opacity: 0.8;
        transform: scale(0.45);
    }

    70% {
        opacity: 0;
        transform: scale(1.45);
    }

    100% {
        opacity: 0;
        transform: scale(1.45);
    }
}

.nav-sidebar .nav-link {
    border-radius: 8px;
    margin-bottom: 3px;
}

.nav-sidebar > .nav-item > .nav-link.active,
.nav-sidebar > .nav-item.menu-open > .nav-link,
.sidebar-dark-danger .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-light-danger .nav-sidebar > .nav-item > .nav-link.active {
    background-color: var(--system-color);
    color: #ffffff;
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--system-color);
    color: #ffffff !important;
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link.active i,
.nav-sidebar .nav-treeview > .nav-item > .nav-link.active p {
    color: #ffffff !important;
}

.nav-sidebar .nav-link:not(.active):hover {
    color: #ffffff;
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link:not(.active) {
    color: #cbd5e1;
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link:not(.active):hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.card,
.small-box,
.modal-content,
.dropdown-menu,
.swal2-popup {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow);
}

.card {
    background: var(--app-surface);
    margin-bottom: 18px;
}

.card[class*="card-"] {
    border-top: 1px solid var(--app-border);
}

.card-header,
.modal-header,
.modal-footer,
.card-footer {
    background: var(--app-surface);
    border-color: var(--app-border);
}

.card-header {
    align-items: center;
    min-height: 54px;
    padding: 14px 18px;
}

.card-title,
.modal-title {
    color: var(--app-text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
}

.card-body {
    padding: 18px;
}

.card-danger:not(.card-outline) > .card-header,
.card-dark:not(.card-outline) > .card-header,
.card-primary:not(.card-outline) > .card-header {
    background: var(--app-surface);
    border-bottom-color: var(--app-border);
    color: var(--app-text);
}

.card-danger:not(.card-outline) > .card-header .card-title,
.card-danger:not(.card-outline) > .card-header h1,
.card-danger:not(.card-outline) > .card-header h2,
.card-danger:not(.card-outline) > .card-header h3,
.card-danger:not(.card-outline) > .card-header h4,
.card-danger:not(.card-outline) > .card-header h5,
.card-danger:not(.card-outline) > .card-header h6,
.card-dark:not(.card-outline) > .card-header .card-title,
.card-dark:not(.card-outline) > .card-header h1,
.card-dark:not(.card-outline) > .card-header h2,
.card-dark:not(.card-outline) > .card-header h3,
.card-dark:not(.card-outline) > .card-header h4,
.card-dark:not(.card-outline) > .card-header h5,
.card-dark:not(.card-outline) > .card-header h6 {
    color: var(--app-text) !important;
}

.card-header .text-white {
    color: var(--app-text) !important;
}

.small-box {
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
    overflow: hidden;
}

.small-box > .inner {
    padding: 18px;
}

.small-box h3 {
    color: var(--app-text);
    font-size: 26px;
    font-weight: 700;
}

.small-box p {
    color: var(--app-muted);
    font-weight: 600;
}

.small-box .icon {
    color: var(--system-color);
    opacity: 0.12;
}

.small-box .small-box-footer {
    background: var(--app-surface-soft);
    border-top: 1px solid var(--app-border);
    color: var(--app-muted) !important;
}

.form-group label,
.col-form-label {
    color: #374151;
    font-size: 13px;
    font-weight: 700;
}

.form-control,
.custom-select,
.select2-container--bootstrap4 .select2-selection,
.input-group-text {
    background-color: var(--app-surface);
    border-color: #d1d5db;
    border-radius: 8px;
    color: var(--app-text);
    min-height: 40px;
}

.input-group > .form-control:not(:last-child),
.input-group > .custom-select:not(:last-child) {
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

.input-group > .input-group-append > .input-group-text {
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

.form-control:focus,
.custom-select:focus,
.select2-container--bootstrap4.select2-container--focus .select2-selection {
    border-color: var(--system-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--system-color) 18%, transparent);
}

.form-control[readonly],
.form-control:disabled {
    background: #f3f4f6;
    color: #6b7280;
}

.invalid-feedback {
    font-size: 12px;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0;
}

.btn-primary,
.btn-danger,
.page-item.active .page-link {
    background-color: var(--system-color);
    border-color: var(--system-color);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-danger:hover,
.btn-danger:focus {
    background-color: var(--system-color);
    border-color: var(--system-color);
    filter: brightness(0.92);
}

.btn-dark,
.btn-secondary {
    background: #111827;
    border-color: #111827;
}

.btn-info,
.btn-warning {
    border-color: transparent;
}

.btn-success {
    background-color: #39954e !important;
    background-image: none !important;
    border-color: #39954e !important;
    color: #ffffff !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-success.focus,
.btn-success:not(:disabled):not(.disabled):active,
.btn-success:not(:disabled):not(.disabled).active,
.show > .btn-success.dropdown-toggle {
    background-color: #2f7f42 !important;
    background-image: none !important;
    border-color: #2f7f42 !important;
    color: #ffffff !important;
}

.btn-success:focus,
.btn-success.focus {
    box-shadow: 0 0 0 0.2rem rgba(57, 149, 78, 0.28) !important;
}

.btn-success.disabled,
.btn-success:disabled {
    background-color: #39954e !important;
    background-image: none !important;
    border-color: #39954e !important;
    color: #ffffff !important;
}

.btn-warning {
    background-color: #f59e0b;
    color: #ffffff;
}

.btn-warning:hover,
.btn-warning:focus {
    background-color: #d97706;
    color: #ffffff;
}

.table {
    color: var(--app-text);
    margin-bottom: 0;
}

.table thead th {
    background: var(--app-surface-soft);
    border-bottom: 1px solid var(--app-border);
    color: #374151;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    vertical-align: middle;
}

.table td,
.table th {
    border-color: var(--app-border);
    vertical-align: middle;
}

.table-bordered {
    border-color: var(--app-border);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #fbfdff;
}

.table-hover tbody tr:hover {
    background-color: #f3f4f6;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    min-height: 36px;
    padding: 6px 10px;
}

.dataTables_wrapper .dataTables_length label {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

.dataTables_wrapper .dataTables_length select {
    flex: 0 0 auto;
    min-width: 86px;
    padding-left: 14px;
    padding-right: 32px;
    width: 86px !important;
}

.page-link {
    border-color: var(--app-border);
    color: var(--app-muted);
}

.page-link:hover {
    color: var(--system-color);
}

.alert {
    border-radius: 8px;
    border-width: 1px;
    box-shadow: none;
}

.badge {
    border-radius: 999px;
    font-weight: 700;
    padding: 5px 9px;
}

.modal-content {
    overflow: hidden;
}

.modal-header .close {
    align-items: center;
    background: #f3f4f6;
    border-radius: 8px;
    display: inline-flex;
    float: none;
    height: 34px;
    justify-content: center;
    line-height: 1;
    margin: -6px -6px -6px auto;
    opacity: 1;
    padding: 0;
    text-shadow: none;
    width: 34px;
}

.modal-header .close span {
    display: block;
    line-height: 1;
}

.dropdown-item {
    font-weight: 600;
}

.dropdown-item:active {
    background: var(--system-color);
}

.text-primary,
.setting-section-title i {
    color: var(--system-color) !important;
}

.setting-status {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--system-color);
    color: var(--system-color);
}

.modern-login-page {
    background-image: linear-gradient(180deg, rgba(17, 24, 39, 0.72), rgba(17, 24, 39, 0.82)), var(--login-background, url("../img/bg.jpeg"));
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.login-box {
    width: min(420px, calc(100% - 32px));
}

.login-logo h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
}

.login-brand-logo {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    display: block;
    height: 86px;
    /* margin: 0 auto 16px; */
    object-fit: contain;
    padding: 10px;
    width: 86px;
}

.login-page .card {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.96);
}

.login-page .card-header {
    justify-content: flex-start;
}

.login-page .btn {
    width: 100%;
}

.login-page .btn-toggle-password {
    border-left: 0;
    color: #6b7280;
    cursor: pointer;
}

.login-page .btn-toggle-password:hover,
.login-page .btn-toggle-password:focus {
    background: #f9fafb;
    color: var(--system-color);
    outline: none;
}

@media (max-width: 575.98px) {
    .content-header h1,
    .content-header .m-0.text-dark {
        font-size: 21px;
    }

    .card-body,
    .card-header,
    .modal-body {
        padding: 14px;
    }

    .btn {
        white-space: normal;
    }
}
