/* Mobile card layout for data tables.
   Under 768px a table carrying the .schedule-cards class shows every row as
   a stacked card (first cell = card heading, other cells = label + value),
   so the page only scrolls vertically.
   js/schedule-table-mobile.js adds the class and the data-label attributes:
   always for the finance annual / monthly schedule tables, and for any other
   read-only table that is too wide for its container on a phone. */
@media (max-width: 767px) {

    table.schedule-cards,
    table.schedule-cards tbody,
    table.schedule-cards tr,
    table.schedule-cards td,
    table.schedule-cards tbody th {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    table.schedule-cards {
        width: 100% !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        border-radius: 0 !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    /* Column headings move into each card as labels */
    table.schedule-cards thead,
    table.schedule-cards tr.sc-head-row {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
    }

    table.schedule-cards tbody tr,
    table.schedule-cards tbody tr:nth-of-type(even),
    table.schedule-cards tbody tr:hover {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 10px !important;
        margin: 0 0 10px 0 !important;
        padding: 0 12px 6px !important;
        overflow: hidden !important;
    }

    table.schedule-cards tbody td,
    table.schedule-cards tbody th {
        padding: 6px 0 !important;
        border: 0 !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        background: transparent !important;
        font-size: 14px !important;
        line-height: 1.4 !important;
        text-align: right !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        overflow: hidden !important;
    }

    table.schedule-cards tbody td:last-child {
        border-bottom: 0 !important;
    }

    table.schedule-cards tbody td[data-label]::before {
        content: attr(data-label);
        float: left;
        max-width: 48%;
        margin-right: 12px;
        color: #475569;
        font-size: 13px;
        font-weight: 500;
        text-align: left;
        text-transform: none;
        letter-spacing: normal;
        white-space: normal;
    }

    /* First cell (Year / Month / row name) is the card heading */
    table.schedule-cards tbody tr > :first-child {
        margin: 0 -12px 2px !important;
        padding: 8px 12px !important;
        background: #eef5fb !important;
        border-bottom: 1px solid #cbd5e1 !important;
        color: #1e3a5f !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        text-align: left !important;
    }

    table.schedule-cards tbody tr > :first-child::before {
        content: none !important;
    }

    /* Title bars above result tables: keep their dropdowns inside the card */
    .cal-table-header select,
    .pace-table-title select {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .pace-table-title > div {
        flex-wrap: wrap;
        min-width: 0;
        max-width: 100%;
    }

    /* Placeholder / empty-state rows */
    table.schedule-cards tbody td[colspan] {
        background: transparent !important;
        border-bottom: 0 !important;
        margin: 0 !important;
        padding: 12px 0 6px !important;
        font-weight: 400 !important;
        text-align: center !important;
    }
}
