@media screen {
    .detail-heading-start { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
    .detail-heading-start > div { min-width: 0; }
    .icon-button.detail-back-arrow {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        padding: 0;
    }
    .icon-button.detail-back-arrow svg { width: 21px; height: 21px; }
    .print-toolbar .detail-back-arrow { color: #51477c; border: 1px solid #e4e0f1; }
    .print-toolbar > .print-toolbar-options { flex-wrap: wrap; }

    .app-content {
        container: workspace / inline-size;
        min-width: 0;
    }

    .workspace-split,
    .workspace-panels {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        gap: 20px;
    }

    .workspace-split > *,
    .workspace-panels > *,
    .employee-today-page > * { min-width: 0; }

    .desktop-records { display: none; }
    .record-table-wrap {
        margin-block: 16px;
        overflow-x: auto;
        border: 1px solid #e4e0f1;
        border-radius: 18px;
        background: #ffffffdc;
        box-shadow: var(--soft-shadow);
    }
    .record-table {
        width: 100%;
        border-collapse: collapse;
        text-align: left;
        font-size: 14px;
    }
    .record-table th, .record-table td {
        padding: 12px;
        overflow-wrap: anywhere;
        vertical-align: middle;
    }
    .record-table thead {
        color: #534c72;
        background: #eeebf9;
    }
    .record-table tbody tr + tr { border-top: 1px solid #eeecf5; }
    .record-table tbody tr:hover { background: #f6f4ff; }
    .record-table small { display: block; margin-top: 4px; color: var(--muted); }
    .record-table .record-numeric { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
    .record-link { color: #4d39b7; text-decoration: underline; text-underline-offset: 3px; }
    .record-secondary { display: none; }
    .app-content :focus-visible { outline: 2px solid #6752e3; outline-offset: 2px; }
    .workspace-tabbar { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 14px; }
    .workspace-tabbar .button { min-height: 44px; }
    .workspace-tabbar [aria-pressed="true"],
    .mapping-branches [aria-pressed="true"],
    .review-queue [aria-pressed="true"] {
        background: #e5dfff;
        color: #4430ac;
    }
    .mapping-branches {
        display: flex;
        flex-wrap: wrap;
        align-items: start;
        gap: 8px;
        padding: 14px;
    }
    .mapping-branches h2 { width: 100%; margin: 0; font-size: 16px; }
    .mapping-group h2 { margin: 14px 0 8px; font-size: 18px; }
    .form-card h2 { margin: 0 0 12px; font-size: 18px; }
    .employee-editor form, .employee-editor fieldset { min-inline-size: 0; }
    .employee-editor-new { max-width: 780px; }
    .employee-editor .form-card + .form-card { margin-top: 14px; }
    .workspace-panel {
        min-width: 0;
        padding: clamp(14px, 2vw, 24px);
        border: 1px solid #e4e0f1;
        border-radius: 18px;
        background: #ffffffd9;
    }
    .workspace-panel h2:first-child { margin-top: 0; }
    .workspace-panel > .section-title:first-child { margin-top: 0; }
    .workspace-panel.panel-inactive { display: none; }
    .workspace-tabbar + .workspace-panel,
    .workspace-panels { margin-block: 16px; }
    .workspace-panel label { overflow-wrap: anywhere; }
    .workspace-panel > :last-child { margin-bottom: 0; }
    .review-queue { display: grid; gap: 8px; align-content: start; }
    .review-queue button { justify-content: flex-start; text-align: left; min-height: 44px; }
    .review-queue button span { display: grid; min-width: 0; gap: 3px; overflow-wrap: anywhere; }
    .review-queue small { color: var(--muted); }
    .review-detail .approval-actions { margin-top: 16px; flex-wrap: wrap; }
    .review-detail .evidence-link { display: inline-block; }
    .review-detail h2 { overflow-wrap: anywhere; }
    .review-detail .back-to-list { margin-bottom: 14px; }
    .review-reason { white-space: pre-wrap; overflow-wrap: anywhere; }
    .review-detail > label:not(.check-line) {
        display: grid;
        gap: 6px;
        margin-block: 12px;
        font-weight: 650;
    }
    .review-detail > label input:not([type="checkbox"]),
    .review-detail > label textarea {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        border: 1px solid #ddd7ef;
        border-radius: 12px;
        background: white;
    }
    .review-comparison { display: grid; gap: 8px; margin-block: 14px; }
    .review-comparison div { padding: 10px; border-radius: 10px; background: #f3f0ff; }
    .review-comparison dt { font-weight: 750; }
    .review-comparison dd { margin: 4px 0 0; }
    .review-with-selection > .review-queue,
    .review-with-selection > .review-list { display: none; }
    .review-placeholder { display: none; }
    .workspace-panel.security-editor { width: auto; max-height: none; overflow: visible; }
    .form-two > *,
    .filter-bar > * { min-width: 0; }
    .form-two input, .form-two select, .filter-bar input { max-width: 100%; }
    .admin-breadcrumb, .payroll-actions, .subnav, .sticky-action-bar { flex-wrap: wrap; }
    .rule-group + .rule-group { margin-top: 24px; }
    .rule-group h2 { font-size: 18px; }
    .payroll-table { min-width: 740px; }
    .payroll-actions .button { min-width: 0; }
    .report-grid.workspace-split { grid-template-columns: minmax(0, 1fr); }
    .report-tile .form-two { width: 100%; margin-block: 12px; }
    .report-tile .button { margin-top: auto; }
    .report-tile .button[aria-disabled="true"] { opacity: .55; cursor: default; }
    .employee-editor .employee-photo-card { align-self: start; }
    .scanner-shell { min-height: 0; height: clamp(300px, 90vw, 480px); }
    .scan-workspace .segmented { margin-bottom: 12px; }
    .request-workspace .balance-orbit { min-width: 0; }
    .daily-report-summary > :last-child { margin-bottom: 0; }
    .daily-report-actions { display: contents; }
    .daily-report-actions .sticky-action-bar {
        bottom: calc(72px + env(safe-area-inset-bottom));
    }
    .kiosk-page .qr-placeholder {
        width: min(330px, 100%);
        height: auto;
        aspect-ratio: 1;
    }
    .kiosk-control { flex-wrap: wrap; }
    .kiosk-control label { min-width: 0; }
    .kiosk-control select { max-width: 100%; }
    .access-card, .app-content > .route-loading { max-width: 42rem; margin-inline: auto; }
    .app-content .access-card p { overflow-wrap: anywhere; }
}

@media screen and (max-width: 767px) {
    body .print-toolbar {
        flex-wrap: wrap;
        margin-inline: 12px;
    }
    body .print-payslip {
        margin: 16px 12px;
        padding: clamp(14px, 4vw, 30px);
    }
    body .print-payslip th, body .print-payslip td { padding: 10px 6px; }
    body .print-payslip footer { flex-wrap: wrap; }
}

@media screen and (min-width: 768px) {
    .workspace-frame.with-sidebar .app-shell {
        width: 100%;
        max-width: none;
        box-shadow: none;
    }

    .workspace-frame.with-sidebar .app-content {
        padding-inline: clamp(18px, 2.6vw, 44px);
    }
    .workspace-frame.with-sidebar .daily-report-actions .sticky-action-bar { bottom: 12px; }
    .workspace-frame.with-sidebar .kiosk-page { max-width: none; }
}

@media screen {
    @container workspace (width < 720px) {
        .app-content .form-two { grid-template-columns: minmax(0, 1fr); }
        .workspace-split .report-grid,
        .app-content .pay-columns { grid-template-columns: minmax(0, 1fr); }
        .dashboard-filters { grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); }
        .dashboard-filter { min-width: 0; gap: 6px; padding-inline: 10px; }
        .dashboard-filter strong { overflow-wrap: anywhere; }
    }

    @container workspace (width >= 720px) {
        .desktop-records { display: block; }
        .compact-records { display: none; }
        .directory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
        .directory-toolbar .page-heading { flex: 1; }
        .directory-toolbar .filter-bar { flex: 0 1 380px; margin: 0; }
        .directory-toolbar .filter-bar input { flex: 1 1 0; }
        .workspace-split .form-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .report-grid.workspace-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .review-comparison { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .workforce-satellite.present, .workforce-satellite.leave { left: 6%; }
        .workforce-satellite.late, .workforce-satellite.absent { right: 6%; }
    }

    @container workspace (width >= 960px) {
        .workspace-split { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
        .workspace-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .workspace-panels > .workspace-panel:first-child { grid-row: span 2; }
        .mapping-workspace, .employee-editor, .profile-workspace {
            grid-template-columns: minmax(215px, .72fr) minmax(0, 1.6fr);
        }
        .employee-editor-new { grid-template-columns: minmax(0, 1fr); }
        .mapping-branches { flex-direction: column; align-items: stretch; }
        .dashboard-overview { align-items: stretch; }
        .dashboard-overview .workforce-orbit-stage { height: 390px; margin: 0; }
        .dashboard-overview .workforce-core { width: 200px; height: 200px; }
        .dashboard-overview .workforce-core strong { font-size: 48px; }
        .dashboard-overview .workforce-core span { font-size: 17px; }
        .dashboard-overview .workforce-satellite { width: 105px; height: 105px; border-width: 4px; }
        .dashboard-overview .workforce-satellite svg { width: 25px; height: 25px; }
        .dashboard-overview .workforce-satellite span { font-size: 14px; }
        .dashboard-overview .workforce-satellite strong { font-size: 27px; }
        .dashboard-overview .dashboard-trend-reference { height: auto; }
        .dashboard-overview .dashboard-trend-reference > svg { height: 290px; margin-top: 20px; }
        .dashboard-bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .dashboard-bottom-grid.single { grid-template-columns: minmax(0, 1fr); }
        .dashboard-review-button { width: min(360px, 100%); height: 76px; padding-inline: 20px; font-size: 23px; }
        .record-secondary { display: table-cell; }
        .record-table .record-compact-detail { display: none; }
        .workspace-panels .workspace-panel.panel-inactive { display: block; }
        .calendar-tabs { display: none; }
        .calendar-setup-card {
            max-width: none;
            display: grid;
            grid-template-columns: auto minmax(0, 1fr) minmax(220px, .75fr) auto;
            align-items: end;
            gap: 14px;
        }
        .calendar-setup-card > .form-error, .calendar-setup-card > .form-success { grid-column: 1 / -1; }
        .review-with-selection > .review-queue { display: grid; }
        .review-with-selection > .review-list, .review-placeholder { display: block; }
        .review-detail .back-to-list { display: none; }
        .review-layout { grid-template-columns: minmax(250px, .85fr) minmax(0, 1.4fr); }
        .scan-workspace .scanner-shell { min-height: 400px; height: 480px; }
        .kiosk-workspace { grid-template-areas: "qr controls"; }
        .kiosk-settings { grid-area: controls; }
        .kiosk-workspace .qr-display { grid-area: qr; }
        .kiosk-workspace:not(:has(.qr-display)) { grid-template-areas: "controls controls"; }
        .kiosk-workspace:not(:has(.qr-display)) .kiosk-settings { max-width: 42rem; }
        .workspace-side-overlay { place-items: stretch end; padding: 12px; }
        .workspace-side-overlay .modal-card { width: min(490px, 100%); max-height: none; }
        .employee-today-page {
            display: grid;
            grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
            grid-template-areas: "heading heading" "shift attendance" "shift shortcuts" "scan shortcuts" "info info";
            align-items: start;
            gap: 20px;
        }
        .today-reference-heading { grid-area: heading; }
        .employee-shift-stage { grid-area: shift; height: 390px; }
        .employee-shift-stage .employee-shift-core { width: 185px; height: 185px; }
        .employee-shift-stage .employee-shift-core > strong { font-size: 25px; }
        .employee-shift-stage .shift-edge { top: 48%; }
        .employee-shift-stage .shift-edge strong { font-size: 16px; }
        .today-attendance-reference { grid-area: attendance; }
        .today-scan-reference { grid-area: scan; }
        .today-shortcut-orbits { grid-area: shortcuts; grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .today-shortcut-orbits a > span { width: 78px; height: 78px; }
        .today-info-grid { grid-area: info; }
        .daily-report-workspace {
            display: grid;
            grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
            grid-template-areas: "activities summary" "activities actions";
            grid-template-rows: auto 1fr;
            align-items: start;
            gap: 16px 20px;
        }
        .daily-report-summary { grid-area: summary; min-width: 0; }
        .daily-report-activities { grid-area: activities; min-width: 0; }
        .daily-report-activities .section-title { margin-top: 0; }
        .daily-report-actions { grid-area: actions; }
        .daily-report-actions { display: block; }
        .daily-report-workspace .sticky-action-bar { position: static; margin: 0; }
    }
}

@media print {
    .desktop-records { display: none; }
}

@media screen {
    .mapping-workspace { min-width: 0; }
    .mapping-matrix-wrap {
        max-height: min(60dvh, 580px);
        overflow: auto;
        scrollbar-width: thin;
    }
    .mapping-matrix { border-collapse: separate; border-spacing: 0; }
    .mapping-matrix th, .mapping-matrix td {
        min-width: 104px;
        text-align: center;
        border-bottom: 1px solid #eeecf5;
    }
    .mapping-matrix th:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        min-width: clamp(112px, 28vw, 184px);
        max-width: 200px;
        text-align: left;
        background: #faf8ff;
        border-right: 1px solid #e4e0f1;
    }
    .mapping-matrix thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #eeebf9;
    }
    .mapping-matrix thead th:first-child { z-index: 3; background: #eeebf9; }
    .mapping-matrix td { padding: 4px; }
    .mapping-matrix .mapping-cell-changed { background: #eae4ff; }
    .mapping-cell-control {
        display: grid;
        place-content: center;
        justify-items: center;
        min-height: 44px;
        cursor: pointer;
    }
    .mapping-cell-control:has(input:disabled) { cursor: default; }
    .mapping-cell-control input { width: 20px; height: 20px; margin: 0; accent-color: #6652e5; }
    .mapping-cell-control small { margin-top: 3px; font-size: 11px; }
    .mapping-actions { align-items: center; }
    .mapping-actions span { flex: 1 0 140px; color: var(--muted); font-size: 13px; }
}
