/* Shared mobile/tablet corrections; full desktop legacy layout stays unchanged. */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .theme-klasszikus #customers-page .record-details {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }
}
@media (max-width: 991.98px) {
    .theme-klasszikus #calendar-page .calendar-view {
        max-width: 100%;
        overflow-x: auto;
    }
    .theme-klasszikus #calendar .calendar-view > div,
    .theme-klasszikus #calendar .calendar-view .date-column {
        width: 100% !important;
        min-width: 100% !important;
    }
    .theme-klasszikus #calendar .calendar-view .provider-column {
        flex: 1 1 0;
        width: 0;
        min-width: 0;
        max-width: none;
    }
    .theme-klasszikus #calendar .calendar-view .provider-column h6 {
        height: auto;
        min-height: 48px;
        padding: 4px 2px;
        overflow-wrap: anywhere;
    }
    .theme-klasszikus #calendar .calendar-view .provider-column:first-of-type {
        flex-basis: 70px;
    }
}
@media (max-width: 991.98px) {
    #header #header-logo {
        min-width: 0;
        max-width: calc(100% - 64px);
    }
    #header .backend-company-name {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        font-size: 14px;
        line-height: 1.3;
    }
    #header .backend-company-logo {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
    }
    #header .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
        margin-left: auto;
    }
    #header-menu {
        flex-basis: 100%;
        width: 100%;
    }
    #header #header-menu .nav-link {
        min-height: 44px;
        height: auto;
    }
    .backend-page,
    .backend-page .record-details,
    .backend-page .filter-records,
    .tab-content,
    .tab-pane,
    fieldset {
        min-width: 0;
    }
    .theme-klasszikus #customers-page #customers {
        flex-wrap: wrap;
    }
    .theme-klasszikus #customers-page .filter-records,
    .theme-klasszikus #customers-page .record-details {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }
    .classic-work-order-grid,
    .classic-work-order-columns {
        grid-template-columns: minmax(0, 1fr);
    }
    .classic-work-order-toolbar,
    .legacy-users-page .btn-toolbar,
    .user-section-tabs,
    .legacy-settings-page > .nav-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }
    .table-responsive {
        position: relative;
        max-width: 100%;
        overflow-x: auto;
    }
    .classic-work-order-fields input,
    .classic-work-order-fields textarea,
    .classic-item-form input {
        min-height: 44px;
        max-width: 100%;
        font-size: 16px;
    }
    .backend-page .btn,
    .modal .btn,
    .account-page .btn {
        min-height: 44px;
        white-space: normal;
    }
    .backend-page input.form-control,
    .backend-page select.form-select,
    .backend-page textarea.form-control,
    .modal .form-control,
    .modal .form-select,
    .account-page .form-control {
        max-width: 100%;
        min-height: 44px;
        font-size: 16px !important;
    }
    .modal .modal-dialog {
        width: calc(100% - 16px);
        max-width: calc(100% - 16px);
        margin: 8px auto;
        min-height: 0;
        height: calc(100% - 16px);
    }
    .modal .modal-content {
        max-height: 100%;
        min-width: 0;
    }
    .modal .modal-body {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .modal .modal-header,
    .modal .modal-footer {
        flex-shrink: 0;
    }
    .modal .modal-header {
        position: relative;
        padding-right: 56px !important;
    }
    .modal .modal-title {
        font-size: 20px !important;
        overflow-wrap: anywhere;
    }
    .modal .modal-header .btn-close {
        position: absolute;
        top: 50%;
        right: 8px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 10px !important;
        margin: 0 !important;
        transform: translateY(-50%);
        box-sizing: border-box;
    }
    .modal .modal-footer {
        flex-wrap: wrap;
        gap: 6px;
    }
    .popover {
        max-width: min(340px, calc(100vw - 24px)) !important;
    }
    .classic-popover-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    .classic-popover-actions .btn {
        min-height: 40px;
    }
    .classic-popover-row span {
        min-width: 0;
        overflow-wrap: anywhere;
    }
    #footer {
        flex-wrap: wrap;
        gap: 4px 12px;
        font-size: 11px;
    }
}
@media (max-width: 767.98px) {
    .theme-klasszikus #calendar-toolbar {
        display: none !important;
    }
    body > .flatpickr-calendar.open {
        left: 8px !important;
        right: auto !important;
        width: calc(100vw - 16px);
        max-width: 308px;
    }
    .flatpickr-calendar .flatpickr-days,
    .flatpickr-calendar .dayContainer {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .flatpickr-calendar .flatpickr-day {
        flex-basis: 14.285714%;
        max-width: 14.285714%;
    }
    .theme-klasszikus #calendar .calendar-header .btn,
    .theme-klasszikus #calendar-actions .btn {
        min-width: 32px;
        min-height: 30px;
        height: 30px;
        width: 32px;
        padding: 4px 6px;
        margin: 0 !important;
        flex: 0 0 auto;
    }
    .theme-klasszikus #calendar .calendar-header {
        flex-wrap: nowrap;
        gap: 3px;
        padding-bottom: 12px;
    }
    .theme-klasszikus .classic-calendar-date-title {
        position: static;
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        margin: 0 0 0 4px;
        transform: none;
        text-align: center;
        white-space: nowrap;
        font-size: 14px;
        line-height: 1.4;
    }
    #calendar .fc-header-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    #calendar .fc-toolbar-title {
        font-size: 18px;
        white-space: normal;
        text-align: center;
    }
    #calendar .fc-toolbar-chunk {
        min-width: 0;
    }
    #calendar .fc-view-harness {
        overflow-x: auto;
        overscroll-behavior-x: contain;
    }
    #calendar .fc-view-harness .fc-timeGridWeek-view {
        min-width: 840px;
    }
    .theme-klasszikus #calendar-page .calendar-view {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }
    .theme-klasszikus #calendar .calendar-view > div,
    .theme-klasszikus #calendar .calendar-view .date-column {
        width: 100% !important;
        min-width: 100% !important;
    }
    .theme-klasszikus #calendar .calendar-view .provider-column {
        flex: 1 1 0;
        width: 0;
        min-width: 0;
        max-width: none;
    }
    .theme-klasszikus #calendar .provider-column:first-of-type .fc-timegrid-axis,
    .theme-klasszikus #calendar .provider-column:first-of-type .fc-timegrid-slot-label {
        width: 48px !important;
        min-width: 48px !important;
    }
    .theme-klasszikus #calendar .calendar-view .provider-column:first-of-type {
        flex-basis: 48px;
    }
    #calendar .fc-event-title,
    #calendar .fc-event-time {
        overflow-wrap: anywhere;
    }
    .backend-page .filter-records .results,
    .classic-work-order-results {
        max-height: 240px !important;
    }
    .backend-page .record-details {
        margin-top: 8px;
    }
    .backend-page .btn-toolbar,
    .legacy-users-page .switch-view {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .legacy-users-page .switch-view {
        clear: both;
    }
    .legacy-settings-page legend {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: wrap;
    }
    .classic-work-order-fields .classic-work-order-field {
        grid-template-columns: minmax(0, 1fr);
    }
    .account-page .account-frame {
        max-width: 100% !important;
    }
    .account-page .account-frame .card-body {
        padding: 24px 16px !important;
    }
    .account-page .account-shell {
        padding: 12px;
    }
}
@media (min-width: 360px) and (max-width: 767.98px) {
    .theme-klasszikus .classic-calendar-date-title {
        font-size: 18px;
    }
}
