/* ============================================================
   Responsive layer — tablet & mobile
   Sidebar becomes an off-canvas drawer, everything stacks.
   ============================================================ */

/* ---------- Mobile navigation drawer ---------- */
.scrim {
    display: none;
}

@media (max-width: 960px) {
    .menu-btn {
        display: inline-flex;
    }

    .topbar {
        padding: 8px 14px;
        gap: 10px;
        min-height: 60px;
    }

    .brand {
        font-size: 15.5px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        font-size: 17px;
        border-radius: 10px;
    }

    .app-shell {
        display: block;
        min-height: calc(100vh - 60px);
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        width: min(300px, 86vw);
        flex: none;
        height: 100dvh;
        max-height: 100dvh;
        transform: translateX(-105%);
        transition: transform .25s ease;
        border-radius: 0 18px 18px 0;
        box-shadow: var(--shadow-lg);
        padding-top: 14px;
    }

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

    body.nav-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(10, 28, 63, .5);
        backdrop-filter: blur(2px);
    }

    body.nav-open {
        overflow: hidden;
    }

    .drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 4px 8px 14px;
        margin-bottom: 6px;
        border-bottom: 1px solid rgba(255, 255, 255, .12);
        color: #fff;
    }

    .drawer-head .who {
        min-width: 0;
    }

    .drawer-head .who strong {
        display: block;
        font-size: 14.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .drawer-head .who span {
        font-size: 12px;
        color: #8fa5c8;
        text-transform: capitalize;
    }

    .drawer-close {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        min-height: 0;
        padding: 0;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, .2);
        background: rgba(255, 255, 255, .08);
        color: #fff;
        font-size: 19px;
        line-height: 1;
        box-shadow: none;
    }

    .drawer-close:hover {
        background: rgba(255, 255, 255, .16);
        transform: none;
    }

    .sidebar a,
    .sidebar .logout-form button {
        padding: 12px 14px;
        font-size: 15px;
    }

    .content {
        padding: 18px 16px 34px;
    }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
    body {
        font-size: 14.5px;
    }

    h1 {
        font-size: 21px;
        margin-bottom: 16px;
    }

    h2 {
        font-size: 17px;
    }

    .user-chip {
        display: none;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .card {
        padding: 17px;
        margin-bottom: 14px;
    }

    .card p {
        font-size: 22px;
    }

    .form-card {
        grid-template-columns: 1fr;
        padding: 18px;
        gap: 14px;
    }

    .form-card > button,
    .form-card > .button,
    .form-card > .btn {
        width: 100%;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head .actions {
        width: 100%;
    }

    .page-head .actions .button,
    .page-head .actions .btn,
    .page-head .actions button {
        flex: 1 1 auto;
    }

    .filter-bar {
        padding: 12px;
    }

    .filter-bar input,
    .filter-bar select,
    .filter-bar button,
    .filter-bar .button {
        flex: 1 1 100%;
        max-width: none;
        width: 100%;
    }

    table {
        font-size: 13.5px;
        min-width: 620px;
    }

    th,
    td {
        padding: 10px 11px;
    }

    .report-links {
        grid-template-columns: 1fr;
    }

    .login-page {
        padding: 16px;
    }

    .login-card {
        padding: 26px 22px;
    }

    .receipt {
        padding: 20px;
    }

    .alert {
        font-size: 14px;
    }

    button,
    .button,
    .btn {
        min-height: 44px;
    }
}

/* ---------- Very small ---------- */
@media (max-width: 380px) {
    .brand strong {
        display: none;
    }

    .content {
        padding: 14px 12px 30px;
    }
}
