*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
}

img,
svg,
video {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

@media screen and (max-width: 760px) {
    body {
        padding: 1rem !important;
    }

    nav {
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
        padding: .75rem !important;
    }

    nav .logo {
        text-align: center;
        font-size: 1.25rem;
    }

    nav .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: .5rem 1rem;
        padding: 0;
        margin: 0;
    }

    nav a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    main,
    .form-container,
    .view-container,
    .dashboard-container {
        width: 100%;
        max-width: 100%;
        margin: .5rem auto;
        padding: 1rem !important;
    }

    header,
    .header,
    .toolbar,
    .bottom-buttons,
    .actions,
    .filters {
        flex-wrap: wrap;
        gap: .75rem;
    }

    form > div[style*="grid-template-columns"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .student-details,
    .summary {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    input,
    select,
    textarea {
        width: 100%;
        min-width: 0 !important;
        font-size: 16px;
    }

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

    .bottom-buttons > *,
    .actions > *,
    .toolbar > * {
        flex: 1 1 auto;
    }

    .action-btn {
        min-width: 0;
        width: 100%;
    }

    .buttons-grid {
        align-items: stretch;
    }

    .filters > label {
        flex: 1 1 100%;
        min-width: 0;
    }

    .table-wrap,
    #users-table,
    #subjects-table-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table,
    #users-table table,
    #subjects-table-container table {
        min-width: 620px;
    }

    .report-card {
        min-height: 0;
        padding: 1rem;
        overflow-wrap: anywhere;
    }

    .signatures {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: .5rem !important;
    }

    main,
    .form-container,
    .view-container,
    .dashboard-container {
        padding: .75rem !important;
    }

    h1 {
        font-size: clamp(1.35rem, 7vw, 1.7rem);
        overflow-wrap: anywhere;
    }

    header,
    .header,
    .toolbar {
        align-items: stretch;
    }

    .bottom-buttons,
    .actions,
    .toolbar {
        flex-direction: column;
    }

    .bottom-buttons > *,
    .actions > *,
    .toolbar > * {
        width: 100%;
        flex: 1 1 auto;
    }

    .student-details {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .summary,
    .signatures {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    table th,
    table td {
        padding: .5rem;
    }
}
