:root {
    --app-bg: #f4f7fb;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-border: #d8e0ea;
    --app-text: #182230;
    --app-muted: #667085;
    --app-primary: #1f6feb;
    --app-primary-dark: #134fb7;
    --app-success: #15803d;
    --app-danger: #c2410c;
    --app-warning: #b7791f;
    --app-sidebar: #121826;
    --app-sidebar-2: #1f2937;
    --app-accent: #0f766e;
    --app-shadow: 0 14px 34px rgba(18, 24, 38, .10);
    --app-shadow-soft: 0 6px 18px rgba(18, 24, 38, .07);
    --app-radius: 8px;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    letter-spacing: 0;
}

.card,
.modal-content,
.topbar {
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
}

.card-header {
    background: var(--app-surface) !important;
    border-bottom: 1px solid var(--app-border) !important;
    color: var(--app-text) !important;
    font-weight: 700;
    border-radius: var(--app-radius) var(--app-radius) 0 0 !important;
}

.card.bg-primary,
.card.bg-success,
.card.bg-warning,
.card.bg-danger,
.card.bg-dark {
    border: 0 !important;
    box-shadow: var(--app-shadow-soft) !important;
}

.bg-primary {
    background-color: var(--app-primary) !important;
}

.bg-success {
    background-color: var(--app-success) !important;
}

.bg-danger {
    background-color: var(--app-danger) !important;
}

.bg-dark {
    background-color: #253044 !important;
}

.btn,
.form-control,
.form-select,
.input-group-text,
.badge {
    border-radius: 6px !important;
}

.btn {
    font-weight: 650;
    box-shadow: none !important;
}

.btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
}

.form-control,
.form-select,
.input-group-text,
.select2-container--default .select2-selection--single {
    border-color: var(--app-border) !important;
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(31, 111, 235, .55) !important;
    box-shadow: 0 0 0 .22rem rgba(31, 111, 235, .14) !important;
}

label,
.form-label {
    color: #344054;
    font-size: .86rem;
    font-weight: 650;
}

.alert {
    border-radius: var(--app-radius);
}

.table {
    --bs-table-hover-bg: #f8fafc;
    margin-bottom: 0;
    color: var(--app-text);
}

.table thead th {
    white-space: nowrap;
    background: #f8fafc;
    color: #344054;
    border-bottom: 1px solid var(--app-border);
    font-size: .78rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.table tbody td {
    border-color: #edf1f6;
    vertical-align: middle;
}

.stat-card {
    min-height: 112px;
}

.app-page-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.report-summary .card-body {
    min-height: 112px;
}

body.dark-mode {
    --app-bg: #101623;
    --app-surface: #1f2937;
    --app-surface-soft: #111827;
    --app-border: #334155;
    --app-text: #f8fafc;
    --app-muted: #cbd5e1;
    --app-sidebar: #0b1120;
}

body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .topbar,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .input-group-text {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

body.dark-mode .table {
    color: var(--app-text);
}

body.dark-mode .card-header,
body.dark-mode .table thead th {
    background: #182235 !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
}

.sidebar {
    box-shadow: 10px 0 30px rgba(18, 24, 38, .16);
}

.sidebar-brand {
    padding: 0 18px 18px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.10);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    color: #ffffff;
    margin-bottom: 10px;
}

.brand-title {
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

.brand-subtitle {
    color: #b9c4d4;
    font-size: .78rem;
}

.sidebar a {
    margin-inline: 10px;
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 650;
}

.sidebar a i {
    width: 20px;
    text-align: center;
}

.sidebar a.active {
    background: var(--app-primary) !important;
    box-shadow: inset 3px 0 0 rgba(255,255,255,.45);
}

.sidebar hr {
    border-color: rgba(255,255,255,.12);
    margin-inline: 18px;
}

.main-content {
    min-height: 100vh;
}

.topbar {
    min-height: 62px;
}

.topbar-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #253044;
}

body.dark-mode .topbar-title {
    color: var(--app-text);
}

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.dashboard-heading {
    color: #182230;
    font-weight: 800;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
}

body.dark-mode .dashboard-heading {
    color: var(--app-text);
}

.dt-buttons .btn {
    margin-right: .35rem;
    margin-bottom: .35rem;
}

.dataTables_filter input {
    min-height: 38px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
    background:
        linear-gradient(135deg, rgba(18, 24, 38, .96), rgba(15, 118, 110, .82)),
        repeating-linear-gradient(135deg, rgba(255,255,255,.10) 0 1px, transparent 1px 28px),
        linear-gradient(90deg, #121826, #0f766e);
    background-size: auto;
}

.login-aside {
    color: #ffffff;
    padding: clamp(28px, 7vw, 72px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.login-aside h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 850;
    max-width: 720px;
    margin-bottom: 14px;
}

.login-aside p {
    max-width: 560px;
    color: rgba(255,255,255,.78);
    font-size: 1.02rem;
    margin: 0;
}

.login-panel {
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px;
}

.login-card {
    width: 100%;
    max-width: 390px;
    background: transparent;
    box-shadow: none !important;
    border: 0 !important;
}

.login-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--app-radius);
    background: #eef4ff;
    color: var(--app-primary);
}

@media (max-width: 767.98px) {
    .main-content {
        margin-left: 0 !important;
        padding: 12px !important;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .login-shell {
        display: block;
        background: var(--app-bg);
    }

    .login-aside {
        display: none;
    }

    .login-panel {
        min-height: 100vh;
    }
}
