html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
    overflow-x: hidden;
    background-color: var(--bs-secondary-bg, #f5f6f8);
}

.modal-content.modal-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
}

    .modal-content.modal-form .modal-body {
        flex: 1 1 auto;
        overflow-y: auto;
        max-height: calc(100vh - 10rem);
    }

    .modal-content.modal-form .modal-footer {
        flex-shrink: 0;
    }

.modal-form-body {
    max-height: calc(100vh - 8rem);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}


.form-label {
    font-weight: 500;
    font-size: .875rem;
    margin: 0;
    margin-bottom: 3px;
}

/* =================================================================
   Sidebar Layout
   ================================================================= */

:root {
    --tf-sidebar-width: 260px;
    --tf-sidebar-bg: #1e2a3a;
    --tf-sidebar-color: rgba(255,255,255,.72);
    --tf-sidebar-active-color: #fff;
    --tf-sidebar-active-bg: rgba(255,255,255,.12);
    --tf-sidebar-hover-bg: rgba(255,255,255,.07);
    --tf-topbar-height: 56px;
    --tf-topbar-bg: #ffffff;
    --tf-transition: .22s ease-in-out;
}

.tf-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ----- Sidebar ----- */

.tf-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--tf-sidebar-width);
    height: 100vh;
    background-color: var(--tf-sidebar-bg);
    color: var(--tf-sidebar-color);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--tf-transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.tf-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    min-height: var(--tf-topbar-height);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.tf-sidebar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
}

.tf-sidebar-brand:hover { color: #fff; }

.tf-sidebar-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    cursor: pointer;
    padding: .25rem;
    border-radius: .25rem;
    line-height: 1;
    font-size: 1.2rem;
    transition: color .15s;
}

.tf-sidebar-close-btn:hover { color: #fff; }

.tf-sidebar-nav {
    flex: 1;
    padding: .75rem 0;
}

.tf-nav-section-title {
    padding: .9rem 1.25rem .3rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.35);
    font-weight: 600;
}

.tf-nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem 1.25rem;
    color: var(--tf-sidebar-color);
    text-decoration: none;
    font-size: .875rem;
    transition: background-color .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
}

.tf-nav-link i {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.tf-nav-link:hover {
    background-color: var(--tf-sidebar-hover-bg);
    color: var(--tf-sidebar-active-color);
}

.tf-nav-link.active {
    background-color: var(--tf-sidebar-active-bg);
    color: var(--tf-sidebar-active-color);
    font-weight: 500;
}

.tf-nav-link.disabled {
    opacity: .4;
    pointer-events: none;
    cursor: default;
}

.tf-sidebar-footer {    
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.tf-sidebar-icon-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    cursor: pointer;
    padding: .3rem;
    border-radius: .25rem;
    font-size: 1rem;
    line-height: 1;
    transition: color .15s;
    text-decoration: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.tf-sidebar-icon-btn:hover { color: #fff; }

/* ----- Sidebar overlay (mobile) ----- */

.tf-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1039;
    backdrop-filter: blur(1px);
}

/* ----- Main area ----- */

.tf-main {
    flex: 1;
    margin-left: var(--tf-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--tf-transition);
    min-width: 0;
}

/* ----- Topbar ----- */

.tf-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--tf-topbar-height);
    background: var(--tf-topbar-bg);
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: .75rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.tf-topbar-toggle {
    background: none;
    border: none;
    color: var(--bs-secondary-color, #6c757d);
    padding: .3rem .45rem;
    cursor: pointer;
    border-radius: .375rem;
    line-height: 1;
    transition: background-color .15s, color .15s;
    flex-shrink: 0;
}

.tf-topbar-toggle:hover {
    background-color: var(--bs-secondary-bg, #e9ecef);
    color: var(--bs-body-color, #212529);
}

.tf-topbar-search { max-width: 380px; }

.tf-topbar-search .input-group-text { border-right: 0; }

.tf-topbar-search .form-control { border-left: 0; }

.tf-topbar-search .form-control:focus {
    box-shadow: none;
    border-color: var(--bs-border-color, #dee2e6);
}

.tf-topbar-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.tf-topbar-icon-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--bs-secondary-color, #6c757d);
    padding: .375rem .5rem;
    border-radius: .375rem;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, color .15s;
}

.tf-topbar-icon-btn:hover {
    background-color: var(--bs-secondary-bg, #e9ecef);
    color: var(--bs-body-color, #212529);
}

.tf-icon-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    background-color: var(--bs-danger, #dc3545);
    color: #fff;
    border-radius: 8px;
    font-size: .62rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

.tf-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--bs-secondary, #6c757d);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
    user-select: none;
    letter-spacing: .03em;
}

.tf-user-avatar-sm {
    width: 30px;
    height: 30px;
    font-size: .7rem;
}

.tf-topbar-user-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: .2rem .5rem;
    border-radius: .375rem;
    transition: background-color .15s;
    color: var(--bs-body-color, #212529);
}

.tf-topbar-user-btn:hover {
    background-color: var(--bs-secondary-bg, #e9ecef);
}

/* ----- Page content ----- */

.tf-page-content {
    flex: 1;
    padding: 1.5rem;
}

/* ----- Footer ----- */

.tf-footer {
    padding: .75rem 1.5rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    color: var(--bs-secondary-color, #6c757d);
    font-size: .8rem;
    flex-shrink: 0;
}

/* =================================================================
   Responsive Sidebar Behavior
   ================================================================= */

/* Desktop: sidebar visible by default, collapsible via toggle */
body.tf-sidebar-collapsed .tf-sidebar {
    transform: translateX(calc(-1 * var(--tf-sidebar-width)));
}

body.tf-sidebar-collapsed .tf-main {
    margin-left: 0;
}

/* Mobile (< lg): sidebar hidden by default, overlays on open */
@media (max-width: 991.98px) {
    .tf-sidebar {
        transform: translateX(calc(-1 * var(--tf-sidebar-width)));
    }

    .tf-main {
        margin-left: 0;
    }

    body.tf-sidebar-open .tf-sidebar {
        transform: translateX(0);
    }

    body.tf-sidebar-open .tf-sidebar-overlay {
        display: block;
    }

    body.tf-sidebar-open {
        overflow: hidden;
    }
}
