/* ═══════════════════════════════════════════════════════════
   TCAM — Custom Design System
   Overrides Bootstrap 5.3 defaults. Never edit Bootstrap source.
   ═══════════════════════════════════════════════════════════ */

/* ── 1. CSS Custom Properties ── */

:root {
    /* Brand Palette */
    --clr-1: #2E2466;
    --clr-2: #2D6A9F;
    --clr-3: #3AACB8;
    --clr-4: #3DD68C;
    --clr-5: #6EE7A0;

    /* Semantic */
    --clr-success: #3DD68C;
    --clr-success-bg: #EBF9F3;
    --clr-warning: #F5A623;
    --clr-warning-bg: #FEF5E7;
    --clr-danger: #E05252;
    --clr-danger-bg: #FDECEC;
    --clr-info: #3AACB8;
    --clr-info-bg: #EAF7F9;

    /* Neutrals */
    --clr-bg: #F5F7FA;
    --clr-surface: #FFFFFF;
    --clr-surface-2: #F0F4F8;
    --clr-border: #DDE3EE;
    --clr-text: #1C2333;
    --clr-text-2: #5A6478;
    --clr-text-3: #9BA3B5;

    /* Sidebar */
    --clr-sidebar: #1A1540;
    --clr-sidebar-hover: #2E2466;
    --clr-sidebar-active: #2D6A9F;
    --clr-sidebar-text: #C5CBDA;
    --clr-sidebar-muted: #5A5680;

    /* Shape */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(30, 25, 75, 0.06);
    --shadow-md: 0 4px 12px rgba(30, 25, 75, 0.08);
    --shadow-lg: 0 8px 30px rgba(30, 25, 75, 0.12);

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}


/* ── 2. Global Resets ── */

body {
    font-family: var(--font-family);
    background-color: var(--clr-bg);
    color: var(--clr-text);
    font-size: 0.9rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--clr-2);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--clr-1);
}

::selection {
    background: var(--clr-3);
    color: #fff;
}


/* ── 3. Card Overrides ── */

.card {
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--clr-surface);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}


/* ── 4. Button Overrides ── */

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--clr-1);
    border-color: var(--clr-1);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #241c54;
    border-color: #241c54;
    box-shadow: 0 4px 14px rgba(46, 36, 102, 0.35);
}

.btn-secondary {
    background: var(--clr-surface-2);
    border-color: var(--clr-border);
    color: var(--clr-text);
}

.btn-secondary:hover {
    background: var(--clr-border);
    border-color: var(--clr-border);
    color: var(--clr-text);
}

.btn-success {
    background: var(--clr-success);
    border-color: var(--clr-success);
}

.btn-success:hover {
    background: #2fc47a;
    border-color: #2fc47a;
}

.btn-danger {
    background: var(--clr-danger);
    border-color: var(--clr-danger);
}

.btn-danger:hover {
    background: #c94444;
    border-color: #c94444;
}

.btn-info {
    background: var(--clr-info);
    border-color: var(--clr-info);
    color: #fff;
}

.btn-info:hover {
    background: #2f97a3;
    border-color: #2f97a3;
    color: #fff;
}

.btn-outline-primary {
    color: var(--clr-1);
    border-color: var(--clr-1);
}

.btn-outline-primary:hover {
    background: var(--clr-1);
    color: #fff;
}

.btn-xs {
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}


/* ── 5. Form Overrides ── */

.form-control,
.form-select {
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    color: var(--clr-text);
    background: var(--clr-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--clr-3);
    box-shadow: 0 0 0 3px rgba(58, 172, 184, 0.15);
}

.form-control::placeholder {
    color: var(--clr-text-3);
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--clr-text-2);
    margin-bottom: 0.35rem;
}

.form-check-input:checked {
    background-color: var(--clr-1);
    border-color: var(--clr-1);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(46, 36, 102, 0.15);
}

.text-danger {
    color: var(--clr-danger) !important;
    font-size: 0.8rem;
}


/* ── 6. Badge Overrides ── */

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.3em 0.7em;
    border-radius: 50px;
    letter-spacing: 0.02em;
}

.badge-success {
    background: var(--clr-success-bg);
    color: #1a7a4a;
}

.badge-warning {
    background: var(--clr-warning-bg);
    color: #8a5a00;
}

.badge-danger {
    background: var(--clr-danger-bg);
    color: #a33030;
}

.badge-info {
    background: var(--clr-info-bg);
    color: #1a7a85;
}

.badge-muted {
    background: var(--clr-surface-2);
    color: var(--clr-text-3);
}


/* ── 7. Auth Pages ── */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1A1540 0%, #2E2466 30%, #2D6A9F 60%, #3AACB8 80%, #3DD68C 100%);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.auth-header {
    background: var(--clr-sidebar);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}

.auth-header .brand-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.auth-header .brand-tagline {
    font-size: 0.8rem;
    color: var(--clr-sidebar-text);
    letter-spacing: 0.03em;
}

.auth-form {
    padding: 2rem;
}

.auth-form .form-control {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
}

.auth-form .form-control:focus {
    border-color: var(--clr-2);
    box-shadow: 0 0 0 3px rgba(45, 106, 159, 0.15);
}

.auth-form .btn-primary {
    width: 100%;
    padding: 0.7rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--clr-1), var(--clr-2));
    border: none;
    letter-spacing: 0.02em;
}

.auth-form .btn-primary:hover {
    background: linear-gradient(135deg, #241c54, #245d8a);
    box-shadow: 0 6px 20px rgba(46, 36, 102, 0.4);
    transform: translateY(-1px);
}

.auth-footer {
    text-align: center;
    padding: 0 2rem 1.5rem;
}

.auth-footer a {
    font-size: 0.8125rem;
    color: var(--clr-2);
}

.auth-footer a:hover {
    color: var(--clr-1);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--clr-text-3);
    font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--clr-border);
}

.auth-divider span {
    padding: 0 0.75rem;
}

/* Password toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper .toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--clr-text-3);
    cursor: pointer;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
}

.password-wrapper .toggle-password:hover {
    color: var(--clr-text-2);
}


/* ── 8. Skeleton Loaders ── */

.skeleton {
    background: linear-gradient(90deg, var(--clr-surface-2) 25%, #e8ecf2 50%, var(--clr-surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
    width: 100%;
}

.skeleton-line:last-child {
    width: 60%;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-bar {
    height: 8px;
    border-radius: 4px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ── 9. Scrollbar ── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--clr-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--clr-text-3);
}


/* ── 10. Utilities ── */

.text-muted-2 {
    color: var(--clr-text-2) !important;
}

.text-muted-3 {
    color: var(--clr-text-3) !important;
}

.bg-surface-2 {
    background: var(--clr-surface-2) !important;
}

.border-brand {
    border-color: var(--clr-border) !important;
}

.rounded-brand-sm { border-radius: var(--radius-sm) !important; }
.rounded-brand-md { border-radius: var(--radius-md) !important; }
.rounded-brand-lg { border-radius: var(--radius-lg) !important; }

.shadow-brand-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-brand-md { box-shadow: var(--shadow-md) !important; }
.shadow-brand-lg { box-shadow: var(--shadow-lg) !important; }

/* Score colours */
.score-green { color: var(--clr-success) !important; }
.score-amber { color: var(--clr-warning) !important; }
.score-red { color: var(--clr-danger) !important; }
.score-grey { color: var(--clr-text-3) !important; }

.bg-score-green { background: var(--clr-success-bg) !important; }
.bg-score-amber { background: var(--clr-warning-bg) !important; }
.bg-score-red { background: var(--clr-danger-bg) !important; }


/* ── 11. Transitions ── */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ── 12. App Layout ── */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-area {
    flex: 1;
    padding: 1.5rem;
}


/* ── 13. Sidebar ── */

.sidebar {
    width: 240px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    background: var(--clr-sidebar);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

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

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--clr-2), var(--clr-3));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.06em;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--clr-sidebar-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
}

/* Sidebar Switcher */
.sidebar-switcher {
    padding: 0.35rem 1.25rem;
}

.sidebar-switcher-label {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--clr-sidebar-muted);
    margin-bottom: 0.2rem;
}

.sidebar-select {
    width: 100%;
    background: var(--clr-sidebar-hover);
    border: 1px solid var(--clr-sidebar-muted);
    border-radius: var(--radius-sm);
    color: var(--clr-sidebar-text);
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
}

.sidebar-select option {
    background: var(--clr-sidebar);
    color: var(--clr-sidebar-text);
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: var(--clr-sidebar-text);
    font-size: 0.8125rem;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: var(--clr-sidebar-hover);
    color: #fff;
}

.nav-item.active a {
    background: rgba(45, 106, 159, 0.15);
    color: #fff;
    border-left-color: var(--clr-sidebar-active);
    font-weight: 500;
}

.nav-item a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    opacity: 0.7;
}

.nav-item.active a i {
    opacity: 1;
    color: var(--clr-3);
}

.nav-divider {
    height: 1px;
    background: var(--clr-sidebar-muted);
    margin: 0.5rem 1.25rem;
    opacity: 0.3;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(90, 86, 128, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-2), var(--clr-3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

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

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.65rem;
    color: var(--clr-sidebar-muted);
    text-transform: capitalize;
}

.sidebar-logout {
    background: none;
    border: none;
    color: var(--clr-sidebar-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.sidebar-logout:hover {
    color: var(--clr-danger);
}


/* ── 14. Topbar ── */

.topbar {
    height: 52px;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--clr-text);
    cursor: pointer;
    padding: 0;
}

.topbar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--clr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}


/* ── 15. Sidebar Overlay (Mobile) ── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

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


/* ── 16. Stat Cards ── */

.stat-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-card-icon.primary { background: rgba(46, 36, 102, 0.1); color: var(--clr-1); }
.stat-card-icon.info { background: var(--clr-info-bg); color: var(--clr-info); }
.stat-card-icon.success { background: var(--clr-success-bg); color: var(--clr-success); }
.stat-card-icon.warning { background: var(--clr-warning-bg); color: var(--clr-warning); }
.stat-card-icon.danger { background: var(--clr-danger-bg); color: var(--clr-danger); }

.stat-card-body {
    min-width: 0;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--clr-text);
    line-height: 1.2;
}

.stat-card-label {
    font-size: 0.75rem;
    color: var(--clr-text-2);
    margin-top: 0.15rem;
}


/* ── 17. Responsive ── */

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

    .sidebar.open {
        transform: translateX(0);
    }

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

@media (max-width: 767.98px) {
    .content-area {
        padding: 1rem;
    }

    .topbar {
        padding: 0 1rem;
    }
}


/* ── 18. Select2 Overrides ── */

.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid var(--clr-border) !important;
    border-radius: var(--radius-sm) !important;
    min-height: 38px !important;
    font-size: 0.875rem !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--clr-text) !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--clr-3) !important;
    box-shadow: 0 0 0 3px rgba(58, 172, 184, 0.15) !important;
}

.select2-dropdown {
    border: 1px solid var(--clr-border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-md) !important;
}

.select2-results__option--selected {
    background-color: var(--clr-surface-2) !important;
}

.select2-results__option--highlighted {
    background-color: var(--clr-1) !important;
}


/* ── 19. Flatpickr Overrides ── */

.flatpickr-calendar {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--clr-border) !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--clr-1) !important;
    border-color: var(--clr-1) !important;
}

.flatpickr-day:hover {
    background: var(--clr-surface-2) !important;
}


/* ── 20. SweetAlert2 Overrides ── */

.swal2-popup {
    border-radius: var(--radius-md) !important;
    font-family: var(--font-family) !important;
}

.swal2-confirm {
    background: var(--clr-1) !important;
    border-radius: var(--radius-sm) !important;
}

.swal2-cancel {
    border-radius: var(--radius-sm) !important;
}

.swal2-toast {
    border-radius: var(--radius-sm) !important;
}


/* ── 21. Modal Overrides ── */

.modal-content {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--clr-border);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--clr-border);
    padding: 0.75rem 1.25rem;
}


/* ── 22. Progress Bars (Score Bars) ── */

.score-bar {
    height: 8px;
    background: var(--clr-surface-2);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.score-bar-fill.green { background: var(--clr-success); }
.score-bar-fill.amber { background: var(--clr-warning); }
.score-bar-fill.red { background: var(--clr-danger); }
.score-bar-fill.grey { background: var(--clr-text-3); }


/* ── 23. Initials Avatar ── */

.avatar-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.avatar-initials.sm { width: 30px; height: 30px; font-size: 0.7rem; }
.avatar-initials.lg { width: 48px; height: 48px; font-size: 1rem; }


/* ── 24. Email Template Editor ── */

.email-editor {
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    background: var(--clr-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.email-editor:focus {
    border-color: var(--clr-3);
    box-shadow: 0 0 0 3px rgba(58, 172, 184, 0.15);
    outline: none;
}

.email-editor p {
    margin-bottom: 0.5rem;
}

.email-editor a {
    color: var(--clr-2);
    text-decoration: underline;
}


/* ── Summernote Overrides ── */

/* ── Summernote ── */
.note-editable p,
.email-preview p {
    margin-bottom: 4px;
}
