/* B-only inspector cards. Orientation changes are CSS-only: no reload or DOM swaps. */
.pf-dashboard .pf-mobile-only { display: none; }

@media screen and (max-width: 900px) and (orientation: portrait) {
    /* Keep the original search in the DOM for the shared controller, but show
       only the compact search when B cards are mounted. Empty/error views retain it. */
    #tableContent .pf-dashboard .pf-table,
    #tableContent .pf-dashboard .pf-table > tbody,
    #tableContent .pf-dashboard .pf-table > tbody > tr,
    #tableContent .pf-dashboard .pf-table > tbody > tr > .pf-cell,
    #tableContent .pf-dashboard .pf-row {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100%;
        box-sizing: border-box;
    }
    #tableContent .pf-dashboard .pf-table > tbody > tr { border: 0 !important; background: transparent; box-shadow: none; }
    .reports-table:has(.pf-dashboard) { background: transparent; box-shadow: none; border: 0; }
    .pf-dashboard .pf-table-scroll { overflow: visible; }
    .pf-dashboard .pf-column-headings,
    .pf-dashboard .pf-columns-menu { display: none !important; }
    .pf-dashboard .pf-row { margin-bottom: 12px !important; }
    #tableContent .pf-dashboard .pf-cell > .pf-row { margin-bottom: 12px !important; }
    .pf-dashboard .pf-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas: "progress progress" "property property" "inspection author" "pictures sketch" "details details";
        gap: 10px;
        padding: 1.5px 14px 8px;
    }
    .pf-dashboard .pf-mobile-details-open .pf-body { grid-template-areas: "progress progress" "property property" "inspection author" "pictures sketch" "details details" "notes notes" "team team" "actions actions"; }
    /* Desktop visibility choices must never remove a field worker's controls. */
    .pf-dashboard .pf-body > .pf-column-hidden { display: flex !important; }
    .pf-dashboard .pf-mobile-only { display: inline; }
    .pf-dashboard .pf-body > .pf-due-cell,
    .pf-dashboard .pf-desktop-address,
    .pf-dashboard .pf-loan-number,
    .pf-dashboard .pf-zone-tile > .pf-date { display: none !important; }
    .pf-dashboard .pf-body > .pf-property {
        grid-area: property;
        width: 100%;
        min-height: 0;
        height: auto;
        padding: 0;
    }
    .pf-dashboard .pf-body > .pf-timeline {
        display: grid;
        grid-area: progress;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        height: 11px;
        gap: 4px;
        margin: 1.5px 0;
    }
    .pf-dashboard .pf-body .pf-node {
        height: 11px;
        min-height: 11px;
        font-size: 11px;
        line-height: 10px;
        padding: 0 2px;
    }
    .pf-dashboard .pf-node:not([data-pf-step="POC"]):not([data-pf-step="SCH"]):not([data-pf-step="CPS"]):not([data-pf-step="UPL"]) { display: none; }
    .pf-dashboard .pf-body > .pf-property .pf-address-line { margin: 0 0 6px; }
    .pf-dashboard .pf-body .pf-address { font-size: 20px; white-space: normal; overflow-wrap: anywhere; text-align: left; }
    .pf-dashboard .pf-property > .pf-badges { margin: 0; gap: 5px; align-items: center; }
    .pf-dashboard .pf-mobile-city { font-size: 12px; color: #75766b; }
    .pf-dashboard .pf-property .pf-badge { font-size: 11.5px; }
    .pf-dashboard .pf-body > .pf-zone-tile {
        grid-area: inspection;
        width: 100%;
        min-width: 0;
        min-height: 34px;
        padding: 7px;
        border-radius: 6px;
        background: #eef3f4;
        color: #5c7177;
        font-size: 12px;
        overflow-wrap: anywhere;
    }
    .pf-dashboard .pf-mobile-author {
        grid-area: author;
        align-self: center;
        justify-self: end;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 5px 8px;
        border-radius: 5px;
        background: #efefec;
        color: #666962;
        font-size: 12px;
        overflow-wrap: anywhere;
    }
    .pf-dashboard .pf-body > .pf-photostrip { grid-area: pictures; }
    .pf-dashboard .pf-body > .pf-sketch-tile-cell { grid-area: sketch; }
    .pf-dashboard .pf-photostrip,
    .pf-dashboard .pf-sketch-tile-cell { padding: 0; min-width: 0; }
    .pf-dashboard .pf-body .pf-photo,
    .pf-dashboard .pf-body .pf-sketch-tile {
        width: 100%;
        height: 58px;
        gap: 8px;
        border: 1px solid #e6e1d6;
        border-radius: 9px;
        background: #f5f3ed;
        color: #746d60;
        box-shadow: none;
        font-size: 14px;
        font-weight: 600;
    }
    .pf-dashboard .pf-body .pf-sketch-tile { background: #f4f7f7; border-color: #dce3e3; color: #5c7177; }
    .pf-dashboard .pf-photo > img { width: 28px; height: 28px; border-radius: 4px; }
    .pf-dashboard .pf-photo > .pf-badge { display: none; }
    .pf-dashboard .pf-sketch-tile img { width: 28px; height: 28px; }
    .pf-dashboard .pf-body .pf-mobile-details-toggle {
        grid-area: details;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px;
        width: 100%;
        padding: 0;
        font-size: 13px;
        color: #74786d;
    }
    .pf-dashboard .pf-body > .pf-notes { grid-area: notes; }
    .pf-dashboard .pf-body > .pf-collaborators { grid-area: team; }
    .pf-dashboard .pf-body > .pf-row-actions { grid-area: actions; }
    .pf-dashboard .pf-body > .pf-notes,
    .pf-dashboard .pf-body > .pf-collaborators,
    .pf-dashboard .pf-body > .pf-row-actions { display: none !important; }
    .pf-dashboard .pf-mobile-details-open .pf-body > .pf-notes,
    .pf-dashboard .pf-mobile-details-open .pf-body > .pf-collaborators,
    .pf-dashboard .pf-mobile-details-open .pf-body > .pf-row-actions {
        display: flex !important;
        width: 100%;
        height: auto;
        min-height: 44px;
        max-height: 180px;
        overflow-y: auto;
    }
    .pf-dashboard .pf-mobile-details-open .pf-notes { border-radius: 6px; padding: 10px; }
    .pf-dashboard .pf-mobile-details-open .pf-collaborators { padding: 0; }
    .pf-dashboard .pf-mobile-details-open .pf-row-actions { justify-content: flex-start; gap: 6px; }
    .pf-dashboard .pf-body .pf-row-actions button { width: 44px; height: 44px; }
    .pf-dashboard .pf-mobile-full-report { flex-basis: 100%; }
    .pf-dashboard .pf-body .pf-mobile-full-report button { width: auto; padding: 8px 10px; border: 1px solid #e6e3da; font-size: 13px; opacity: 1; }
    .pf-dashboard .pf-toolbar { gap: 8px; padding: 8px 0 14px; }
    .pf-dashboard .pf-toolbar strong { display: none; }
    .pf-dashboard .pf-toolbar input { font-size: 16px; min-width: 0; min-height: 44px; box-sizing: border-box; }
    .pf-dashboard .pf-toolbar button { min-height: 44px; }
}
