:root {
    --sidebar-w: 240px;
}

/* Password fields with a show/hide "eye" toggle - see password_field() in
   includes/functions.php and assets/js/password-toggle.js. */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    padding: 0;
    color: #6c757d;
    cursor: pointer;
}

.password-toggle-btn:hover {
    color: #212529;
}

.password-toggle-btn svg {
    width: 20px;
    height: 20px;
}

.password-toggle-btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
    border-radius: 4px;
}

body {
    background-color: #f5f6f8;
}

.thumb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.thumb-item {
    position: relative;
    width: 120px;
}

.thumb-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.thumb-item .thumb-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 1;
    padding: 0;
}

.thumb-item .thumb-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
}

.thumb-pdf-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 120px;
    height: 120px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: #fdf2f2;
    text-decoration: none;
    color: inherit;
}

.thumb-pdf-icon {
    font-weight: 700;
    font-size: 13px;
    color: #dc3545;
    border: 2px solid #dc3545;
    border-radius: 4px;
    padding: 2px 8px;
}

.thumb-pdf-label {
    font-size: 11px;
    color: #6c757d;
}

.stat-card {
    border-radius: 10px;
}

/* Dashboard "Spend by month" bar chart: on a narrow (mobile) viewport a
   full financial year's worth of bars (up to 12) is wider than the card,
   since each bar's month-label text has a minimum width that can't shrink
   to fit. Rather than letting that push the whole page wider (the reported
   bug), the chart scrolls horizontally within its own box - the same
   "contain the overflow inside the component" fix as .table-responsive
   already does for wide tables elsewhere in this app. */
.month-chart-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.month-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 180px;
}

.month-chart-bar {
    flex: 0 0 48px;
}

.dropzone {
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    background: #fff;
    cursor: pointer;
}

.dropzone.dragover {
    background: #eef4ff;
    border-color: #0d6efd;
}

/* =======================================================================
   V14 left-hand navigation sidebar (replaces the old top navbar)
   ======================================================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: #212529;
    color: #e9ecef;
    display: flex;
    flex-direction: column;
    z-index: 1030;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand a {
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.25;
    text-decoration: none;
}

/* Only shown on mobile, inside the off-canvas panel - see the
   max-width: 991.98px block below. */
.sidebar-close-btn {
    display: none;
}

.sidebar-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #868e96;
    padding: 16px 18px 6px;
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 6px 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    color: #ced4da;
    text-decoration: none;
    font-size: 14.5px;
    margin-bottom: 2px;
}

.sidebar-link svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    opacity: .85;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link.active {
    background: #0d6efd;
    color: #fff;
}

.sidebar-link.active svg {
    opacity: 1;
}

.sidebar-sub {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
}

.sidebar-sub .sidebar-link {
    font-size: 13.5px;
    padding: 7px 12px;
    color: #adb5bd;
}

.sidebar-sub hr.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.08);
    margin: 6px 12px;
}

.sidebar-foot {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 18px 16px;
    font-size: 13px;
}

.sidebar-foot .form-select {
    font-size: 12.5px;
}

.sidebar-company-text {
    color: #adb5bd;
    margin-bottom: 8px;
}

.sidebar-user-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: #fff;
    font-weight: 500;
    font-size: 13.5px;
    text-decoration: none;
    background: transparent;
    border: 0;
    padding: 6px 2px;
}

.sidebar-user-btn:hover {
    color: #fff;
    opacity: .85;
}

.sidebar-foot .dropdown-menu {
    min-width: 200px;
}

.app-main {
    transition: margin-left .15s ease;
}

body.has-sidebar .app-main {
    margin-left: var(--sidebar-w);
}

/* Account menu (username / change password / log out / language) at the
   bottom of the sidebar: opens on hover as well as the default Bootstrap
   click-to-toggle, as long as the viewport is wide enough for the sidebar
   to be permanently visible (below that width there's no mouse hover to
   speak of on a touch device, and the off-canvas menu already opens on
   tap). */
@media (min-width: 992px) {
    .sidebar .dropdown-hover:hover > .dropdown-menu {
        display: block;
        /* This menu sits inside a .dropup, whose upward-opening position
           (top: auto; bottom: 100%) is normally set by Bootstrap's own
           ".dropup .dropdown-menu[data-bs-popper]" rule - but that
           attribute selector only matches once Bootstrap's JS/Popper has
           positioned the menu, which only happens on a real click. Pure
           CSS :hover never runs that JS, so without this override the
           menu falls back to no vertical offset at all and opens
           downward from the button instead - for a button this close to
           the bottom of the screen, that ran the menu off the bottom of
           the page. Repeating the dropup's own offset here (not gated on
           [data-bs-popper]) makes hover match the click-triggered
           position exactly. Same root cause/fix shape as the right/left
           override this app's account-menu dropdown needed back when it
           lived in the top navbar (see assets/css/app.css history) - that
           one was ".dropdown-menu-end" needing [data-bs-popper] for
           right-alignment; this one is ".dropup" needing it for
           upward-opening. */
        top: auto;
        bottom: 100%;
        margin-bottom: .125rem;
    }
}

/* =======================================================================
   Mobile: the sidebar becomes an off-canvas panel behind a hamburger
   button instead of staying permanently on screen.
   ======================================================================= */

.mobile-topbar {
    display: none;
    align-items: center;
    gap: 14px;
    background: #212529;
    color: #fff;
    padding: 10px 16px;
}

.mobile-topbar-brand {
    font-weight: 600;
    font-size: 15px;
}

.hamburger-btn {
    background: transparent;
    border: 0;
    padding: 6px;
    margin: -6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
}

@media (max-width: 991.98px) {
    body.has-sidebar .mobile-topbar {
        display: flex;
    }

    body.has-sidebar .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1050;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

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

    body.has-sidebar.sidebar-open .sidebar-backdrop {
        display: block;
    }

    body.has-sidebar .app-main {
        margin-left: 0;
    }

    body.has-sidebar .sidebar-close-btn {
        display: block;
    }
}
