/* Keep cafe filters on the page and give multi-column reports their own scroll area. */
@media (max-width: 768px) {
    .cafe-stats-subtabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding-bottom: 8px;
    }

    .cafe-stats-subtab {
        min-width: 0;
        min-height: 44px;
        margin: 0;
        line-height: 1.35;
        text-align: center;
        word-break: keep-all;
    }

    .cafe-stats-subtab:last-child {
        grid-column: 1 / -1;
    }

    .cafe-stats-toolbar {
        margin-bottom: 16px;
    }

    .cafe-stats-toolbar > label[for="cafe-roster-scope"] {
        display: block;
        margin-bottom: 6px;
    }

    #cafe-roster-scope,
    .cafe-stats-toolbar .filter-select {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        min-height: 44px;
    }

    .cafe-stats-filter-row {
        align-items: stretch;
    }

    .cafe-stats-cafe-filter,
    .cafe-stats-date-group,
    .cafe-entry-toolbar .cafe-stats-date-group {
        flex: 0 1 auto;
        width: 100%;
        max-width: none;
    }

    .cafe-stats-date-line {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 6px;
    }

    .cafe-stats-date-step {
        width: 44px;
        height: 44px;
    }

    .cafe-stats-date-shortcuts,
    .cafe-digest-window-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .cafe-stats-date-shortcut,
    .cafe-product-filter-btn,
    .cafe-digest-window-tab,
    .cafe-digest-strip-btn {
        min-width: 0;
        max-width: 100%;
        min-height: 44px;
        padding: 6px 10px;
        line-height: 1.35;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: keep-all;
    }

    .cafe-digest-strip-btn {
        flex-wrap: wrap;
        column-gap: 4px;
        text-align: left;
    }

    /* Touch layouts show the explanation with the selected result. */
    .cafe-digest-strip-btn[data-tooltip]::before,
    .cafe-digest-strip-btn[data-tooltip]::after {
        display: none;
    }

    .cafe-stats-section-title {
        flex-wrap: wrap;
    }

    .cafe-stats-date-badge {
        white-space: nowrap;
    }

    .cafe-stats-info {
        display: block;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    .cafe-stats-table-wrap {
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }

    .cafe-stats-kw-table {
        width: 100%;
    }

    .cafe-stats-kw-table:not(:has(.cafe-stats-empty)),
    .cafe-digest-table {
        min-width: 34rem;
    }

    .cafe-digest-table .col-num {
        width: 5.75rem;
    }

    .cafe-stats-table th .cafe-entry-sort {
        min-height: 40px;
    }

    .cafe-stats-table th,
    .cafe-stats-keyword,
    .cafe-digest-cafe,
    .cafe-digest-kw-main,
    .cafe-digest-comment,
    .cafe-cannibal-kw {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: keep-all;
    }

    .cafe-stats-keyword,
    .cafe-digest-cafe,
    .cafe-digest-kw,
    .cafe-digest-comment {
        overflow: visible;
    }

    .cafe-stats-table .cafe-stats-empty {
        text-align: left;
    }

    .cafe-entry-table,
    .cafe-channel-table {
        min-width: 36rem;
    }

    .cafe-channel-comparison,
    .cafe-exposure-panel {
        padding: 12px;
    }

    .cafe-exposure-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .cafe-exposure-controls label,
    .cafe-exposure-controls input,
    .cafe-exposure-controls select,
    .cafe-exposure-controls button {
        min-width: 0;
    }

    .cafe-exposure-controls input,
    .cafe-exposure-controls select,
    .cafe-exposure-controls button {
        width: 100%;
        min-height: 44px;
    }

    .cafe-exposure-controls label:first-child,
    .cafe-exposure-controls button.btn-primary {
        grid-column: 1 / -1;
    }

    /* Arrows keep the 44px side tracks; start/end stack inside the middle track and a long span wraps at "~". */
    .cafe-exposure-controls .exposure-date-nav,
    .cafe-exposure-controls .exposure-date-nav--custom {
        grid-column: 1 / -1;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        min-width: 0;
    }

    .exposure-date-range {
        grid-template-columns: minmax(0, 1fr);
        min-width: 0;
    }

    .exposure-date-tilde {
        display: none;
    }

    .exposure-date-span {
        white-space: normal;
        text-align: center;
    }

    .cafe-exposure-kpis {
        gap: 6px;
    }

    .cafe-exposure-kpis > div {
        min-width: 0;
        padding: 10px 6px;
    }

    .cafe-exposure-kpis strong {
        overflow-wrap: anywhere;
    }

    .cafe-exposure-results {
        min-width: 46rem;
    }

    .cafe-exposure-results td:last-child {
        min-width: 12rem;
    }

    .yozm-rank-table {
        min-width: 42rem;
    }

    .yozm-rank-table td:first-child {
        min-width: 8rem;
        overflow-wrap: anywhere;
    }
}
