/* Mobile workflows share the same data and form inputs as their desktop views. */
[hidden] { display: none !important; }
.mobile-only { display: none; }
.profile-details, .registration-heading, .student-schedule { width: 100%; box-sizing: border-box; }
.profile-details > summary, .responsive-details > summary { display: none; }
.schedule-filter-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 12px 0; }
.schedule-filter-fields label { display: grid; gap: 6px; flex: 1 1 180px; text-align: left; }
.schedule-filter-fields :is(input, select) { width: 100%; box-sizing: border-box; min-height: 44px; font-size: 16px; }
.lesson-filters { margin: 12px 0; text-align: left; }
.lesson-filters button, .schedule-periods button, .next-lesson > button,
.attendance-details-toggle, .record-details-toggle {
    border: 1px solid #c9c5d3; border-radius: 8px; background: #fff; color: #61378c;
    padding: 10px 12px; min-height: 44px; font: 600 16px "Segoe UI", sans-serif; cursor: pointer;
}
.schedule-periods { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.schedule-periods.mobile-only { display: none; }
.schedule-periods button { flex: 1 1 auto; }
.schedule-periods button[aria-pressed="true"], .attendance-filter[aria-pressed="true"] { background: #6b3fa0; color: #fff; border-color: #6b3fa0; }
.attendance-filter { margin-bottom: 8px; }
[data-backlog-count] { border-radius: 20px; padding: 2px 8px; background: #eee6f5; color: #61378c; }
.schedule-status { display: inline-block; font-size: 14px; padding: 4px 8px; border-radius: 6px; background: #eee6f5; color: #49256e; }
.attendance-needed { color: #9d2525; font-weight: 600; }
.schedule-empty { padding: 12px; background: #f4edf8; border-radius: 8px; text-align: left; }
.registration-heading { margin: 16px 0 8px; text-align: left; }
.registration-heading :is(h3, p) { margin: 6px 0; }
.student-grades-table :is(td, th) { padding: 10px; border: 1px solid #ddd; }
.applied-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.applied-filter { background: #eee6f5; border-radius: 6px; padding: 6px 8px; font-size: 14px; }
.mobile-nav [aria-current="page"] { background: #eee6f5; font-weight: 700; }
@media (max-width: 1100px) {
    .mobile-semester { position: relative; box-sizing: border-box; padding: 8px 28px 8px 0; border-bottom: 1px solid #c9c5d3; }
    .mobile-semester::after { content: '⌄'; position: absolute; right: 8px; top: 18px; pointer-events: none; color: #61378c; }
    .mobile-semester select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
    .mobile-semester:focus-within { outline: 2px solid #6b3fa0; outline-offset: 3px; }
    .mobile-semester-label { margin: 0; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
    .mobile-semester-label span { font-size: 14px; font-weight: 400; }
    .mobile-account-details { font-family: "Segoe UI", sans-serif; }
}
@media (max-width: 768px) {
    .card-content, .mobile-site-header { font-family: 'Segoe UI', sans-serif; }
    .mobile-only { display: block; }
    .attendance-full-title { display: none; }
    .tab-home-header:has(> :only-child) { display: none; }
    .lesson-filters .schedule-periods button { flex: 1 1 0; min-width: 0; padding: 10px 6px; font-size: 14px; }
    .schedule-periods.mobile-only { display: flex; }
    .home-container > .center-content { order: 0; }
    .home-container > .right-sidebar { order: 1; }
    .home-container > .left-sidebar { order: 2; }
    .own-profile .left-sidebar .user-avatar { display: none; }
    .card-content:has(> .student-guidance) { display: flex; flex-direction: column; }
    .card-content > .student-guidance { order: 2; margin-top: 16px; }
    .card-content > .home-container { order: 1; }
    .profile-details > summary, .responsive-details > summary,
    .schedule-extra-filters > summary, .lesson-secondary-actions > summary,
    .inactive-registrations > summary {
        display: list-item; cursor: pointer; padding: 12px; min-height: 44px;
        box-sizing: border-box; border: 1px solid #c9c5d3; border-radius: 8px;
        font: 600 16px "Segoe UI", sans-serif; color: #61378c; text-align: left;
    }
    .profile-details[open] > summary, .responsive-details[open] > summary { margin-bottom: 12px; }
    .mobile-profile-summary { width: 100%; text-align: left; }
    .mobile-profile-summary:empty { display: none; }
    .mobile-profile-summary p { margin: 4px 0 10px; }
    .mobile-profile-summary h2 { font-size: 18px; }
    .home-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin: 8px 0 16px; }
    .home-shortcuts .btn { margin: 0; flex: 1 1 auto; }
    .lesson-day-card, .student-lesson-card { text-align: left; }
    .lesson-day-card .lesson-day-time { font-size: 18px; }
    .lesson-day-card .schedule-status { margin-top: 8px; }
    .lesson-day-card h4 a { color: #61378c; text-decoration: none; }
    .lesson-day-actions > .btn { width: 100%; }
    .lesson-secondary-actions .btn { display: block; margin: 8px 0 0; text-align: center; }
    .schedule-filter-fields { flex-direction: column; align-items: stretch; }
    .schedule-filter-fields label { flex: auto; width: 100%; }
    .student-schedule-table { display: none; }
    .student-lesson-card { padding: 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; margin-bottom: 12px; }
    .student-lesson-card :is(h4, p) { margin: 6px 0; }
    .student-lesson-card strong { font-size: 18px; }
    .inactive-registrations { margin-top: 12px; }
    /* Remove generic table minimum widths only for explicitly adapted tables. */
    .table-wrap:has(> :is(.attendance-table, .student-results-table, .employees-table, .activity-table)) { overflow: visible; }
    .card-content .table-wrap > :is(.attendance-table, .student-results-table, .employees-table, .activity-table) {
        display: block; min-width: 0; width: 100%; max-width: 100%; border: 0;
    }
    :is(.attendance-table, .student-results-table, .employees-table, .activity-table) thead { display: none; }
    :is(.attendance-table, .student-results-table, .employees-table, .activity-table) tbody { display: block; width: 100%; }
    :is(.attendance-table, .student-results-table, .employees-table, .activity-table) tbody > tr {
        display: flex; flex-direction: column; box-sizing: border-box; min-width: 0;
        border: 1px solid #ddd; border-radius: 12px; padding: 12px; margin-bottom: 12px;
        background: #fff; text-align: left;
    }
    :is(.attendance-table, .student-results-table, .employees-table, .activity-table) td {
        display: block; box-sizing: border-box; width: 100%; max-width: 100%;
        border: 0; padding: 6px 0; text-align: left; overflow-wrap: anywhere;
    }
    .attendance-table .attendance-student { order: 0; }
    .attendance-table .attendance-grade { order: 1; }
    .attendance-table .attendance-detail { order: 2; }
    .attendance-table .attendance-number { display: none; }
    .attendance-table tr:not(.details-expanded) .attendance-detail,
    .student-results-table tr:not(.details-expanded) .record-detail,
    .student-results-table tr:not(.details-expanded) :is(.cert-meta, .cert-body, .cert-actions, .cert-type, .cert-dates) { display: none; }
    .attendance-detail::before, .attendance-grade::before, .activity-table td::before {
        content: attr(data-label); display: block; font-weight: 600; margin-bottom: 6px;
    }
    .attendance-table .attendance-grade-select { display: block; width: 100%; min-height: 44px; }
    .attendance-table tr.table-success { border-left: 4px solid #2d7a45; }
    .attendance-table tr.table-warning { border-left: 4px solid #a76b00; }
    .attendance-table tr.table-danger { border-left: 4px solid #b33636; }
    .attendance-details-toggle, .record-details-toggle { display: block; margin-top: 8px; }
    .attendance-save-bar {
        position: sticky; bottom: 0; z-index: 20; padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
        background: #fbf5f8; border-top: 1px solid #c9c5d3; box-shadow: 0 -3px 12px #0001;
    }
    .attendance-progress { flex-basis: 100%; text-align: left; }
    .attendance-progress p { margin: 4px 0; }
    [data-attendance-hint] { font-size: 14px; }
    .attendance-save-bar .btn { flex: 1 1 9rem; }
    .student-results-table td .mobile-only { display: inline; }
    .student-results-table td .record-details-toggle { display: block; }
    .employees-table .employee-role { width: auto; display: inline-block; padding: 5px 8px; margin: 4px 4px 0 0; border-radius: 6px; background: #eee6f5; }
    .employees-table .employee-role::before { content: attr(data-label); }
    .employees-table .employee-role p, .employees-table .employee-role.role-inactive { display: none; }
    .employees-table tbody > tr { display: block; }
    .student-search-filters { width: 100%; }
    .student-search-filters form, .student-search-filters form > .ctr-flex { padding: 8px; }
}
