/* Shared records retain a single set of actions and their existing approval rules. */
.vacation-page,
.approvals-page {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

.approvals-mobile-nav { display: none; }

:where(html[data-display-mode="mobile"]) .vacation-page,
:where(html[data-display-mode="mobile"]) .approvals-page { gap: 1rem; }

:where(html[data-display-mode="mobile"]) .vacation-page .view-header,
:where(html[data-display-mode="mobile"]) .approvals-page .view-header {
    align-items: stretch;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 0;
}

:where(html[data-display-mode="mobile"]) .vacation-page .view-actions,
:where(html[data-display-mode="mobile"]) .vacation-page .view-actions .btn { width: 100%; }

:where(html[data-display-mode="mobile"]) .vacation-page .vacation-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

:where(html[data-display-mode="mobile"]) .vacation-page .vacation-quota-card { grid-column: 1 / -1; }
:where(html[data-display-mode="mobile"]) .vacation-page .stat-box { min-width: 0; padding: 1rem; }
:where(html[data-display-mode="mobile"]) .vacation-page .stat-value { font-size: 1.55rem; overflow-wrap: anywhere; }
:where(html[data-display-mode="mobile"]) .vacation-page .stat-label,
:where(html[data-display-mode="mobile"]) .vacation-page .stat-sub { overflow-wrap: anywhere; }

:where(html[data-display-mode="mobile"]) .vacation-page > .card,
:where(html[data-display-mode="mobile"]) .approvals-page .card { min-width: 0; padding: 1rem; }

:where(html[data-display-mode="mobile"]) .vacation-page .card-title,
:where(html[data-display-mode="mobile"]) .approvals-page .card-title { overflow-wrap: anywhere; flex-wrap: wrap; }

:where(html[data-display-mode="mobile"]) .approvals-mobile-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}

:where(html[data-display-mode="mobile"]) .approval-section-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    min-width: 0;
    min-height: 48px;
    padding: .6rem .7rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-medium);
    font-size: .85rem;
    font-weight: 600;
    overflow-wrap: anywhere;
    text-align: left;
}

:where(html[data-display-mode="mobile"]) .approval-section-button[aria-pressed="true"] {
    border-color: var(--primary);
    background: var(--primary-glow);
    color: var(--primary);
}

:where(html[data-display-mode="mobile"]) .approval-section-button .badge { flex-shrink: 0; }

:where(html[data-display-mode="mobile"]) .approvals-page[data-mobile-section="leave"] [data-approval-section]:not([data-approval-section="leave"]),
:where(html[data-display-mode="mobile"]) .approvals-page[data-mobile-section="corrections"] [data-approval-section]:not([data-approval-section="corrections"]),
:where(html[data-display-mode="mobile"]) .approvals-page[data-mobile-section="time"] [data-approval-section]:not([data-approval-section="time"]),
:where(html[data-display-mode="mobile"]) .approvals-page[data-mobile-section="history"] [data-approval-section]:not([data-approval-section="history"]),
:where(html[data-display-mode="mobile"]) .approvals-page[data-mobile-section="time"] .approvals-section,
:where(html[data-display-mode="mobile"]) .approvals-page[data-mobile-section="history"] .approvals-section { display: none; }

:where(html[data-display-mode="mobile"]) .approvals-page .approvals-section { display: block; }
:where(html[data-display-mode="mobile"]) .approvals-page [data-approval-section] { margin-top: 0 !important; }

:where(html[data-display-mode="mobile"]) .approval-request-card { min-width: 0; overflow-wrap: anywhere; }
:where(html[data-display-mode="mobile"]) .approval-request-heading { flex-wrap: wrap; gap: .5rem; }
:where(html[data-display-mode="mobile"]) .approval-request-heading > strong { min-width: 0; }
:where(html[data-display-mode="mobile"]) .approvals-page .correction-compare { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
:where(html[data-display-mode="mobile"]) .approvals-page .compare-column { min-width: 0; }
:where(html[data-display-mode="mobile"]) .approvals-page .compare-arrow { justify-self: center; transform: rotate(90deg); }

/* A readable card layout instead of sideways scrolling to the final action column. */
:where(html[data-display-mode="mobile"]) .vacation-page .table-responsive,
:where(html[data-display-mode="mobile"]) .approvals-page .table-responsive { overflow: visible; border: 0; }

:where(html[data-display-mode="mobile"]) .mobile-request-table,
:where(html[data-display-mode="mobile"]) .mobile-request-table tbody { display: block; width: 100%; }
:where(html[data-display-mode="mobile"]) .mobile-request-table { position: relative; }

:where(html[data-display-mode="mobile"]) .mobile-request-table thead {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

:where(html[data-display-mode="mobile"]) .mobile-request-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: .8rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
}

:where(html[data-display-mode="mobile"]) .mobile-request-table tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left !important;
}

:where(html[data-display-mode="mobile"]) .mobile-request-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .2rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-medium);
}

:where(html[data-display-mode="mobile"]) .mobile-request-table .request-card-wide,
:where(html[data-display-mode="mobile"]) .mobile-request-table td[colspan] { grid-column: 1 / -1; }
:where(html[data-display-mode="mobile"]) .mobile-request-table .request-card-title { font-size: .95rem; }
:where(html[data-display-mode="mobile"]) .mobile-request-table .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
:where(html[data-display-mode="mobile"]) .mobile-request-table .request-card-actions { padding-top: .5rem; border-top: 1px solid var(--border-color); }
:where(html[data-display-mode="mobile"]) .mobile-request-table td.request-card-actions::before { display: none; }
:where(html[data-display-mode="mobile"]) .mobile-request-table .request-card-actions > .btn { width: 100%; }

:where(html[data-display-mode="mobile"]) .approval-card-actions { flex-wrap: wrap; }
:where(html[data-display-mode="mobile"]) .approval-card-actions .btn { flex: 1 1 90px; }
:where(html[data-display-mode="mobile"]) .vacation-page .btn,
:where(html[data-display-mode="mobile"]) .approvals-page .btn { min-height: 44px; white-space: normal; }
:where(html[data-display-mode="mobile"]) .approvals-page .form-control { min-width: 0; min-height: 44px; font-size: 1rem !important; }

:where(html[data-display-mode="mobile"]) .vacation-dialog {
    display: flex;
    flex-direction: column;
    width: calc(100% - 1rem);
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    min-height: 0;
}

:where(html[data-display-mode="mobile"]) .vacation-dialog > form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .modal-header { flex-shrink: 0; gap: .5rem; padding: .85rem 1rem; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .modal-title { min-width: 0; overflow-wrap: anywhere; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .modal-close { min-width: 44px; min-height: 44px; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .modal-body { min-height: 0; max-height: none; overflow-y: auto; padding: 1rem; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .modal-footer { flex-shrink: 0; flex-wrap: wrap; padding: .75rem 1rem; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .modal-footer .btn { flex: 1 1 95px; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
:where(html[data-display-mode="mobile"]) .vacation-dialog .form-control { min-width: 0; min-height: 44px; font-size: 1rem; }
:where(html[data-display-mode="mobile"]) .vacation-dialog input[type="checkbox"] + label { display: flex; align-items: center; min-height: 44px; }

:where(html[data-display-mode="mobile"]) .vacation-page :is(button, input, select):focus-visible,
:where(html[data-display-mode="mobile"]) .approvals-page :is(button, input, select):focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
