/**
 * Table → card fallback for list pages (requests + queries).
 * Fixes queries page where mobile-card-cell was hidden.
 */

body[data-app-page="dashboard"] .dashboard-recent-section .requests-table,
body[data-app-page="requests"] .requests-table,
body[data-app-page="queries"] .requests-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto !important;
}

body[data-app-page="dashboard"] .dashboard-recent-section .requests-table thead,
body[data-app-page="requests"] .requests-table thead,
body[data-app-page="queries"] .requests-table thead {
    display: none !important;
}

body[data-app-page="requests"] .requests-table,
body[data-app-page="requests"] .requests-table thead,
body[data-app-page="requests"] .requests-table tbody,
body[data-app-page="requests"] .requests-table tr,
body[data-app-page="requests"] .requests-table th,
body[data-app-page="requests"] .requests-table td,
body[data-app-page="queries"] .requests-table,
body[data-app-page="queries"] .requests-table thead,
body[data-app-page="queries"] .requests-table tbody,
body[data-app-page="queries"] .requests-table tr,
body[data-app-page="queries"] .requests-table th,
body[data-app-page="queries"] .requests-table td {
    width: auto !important;
    max-width: none !important;
}

body[data-app-page="requests"] .requests-table th:nth-child(n),
body[data-app-page="requests"] .requests-table td:nth-child(n),
body[data-app-page="queries"] .requests-table th:nth-child(n),
body[data-app-page="queries"] .requests-table td:nth-child(n) {
    position: static !important;
    left: auto !important;
    right: auto !important;
    white-space: normal !important;
    word-break: normal !important;
}

body[data-app-page="requests"] .requests-table tr,
body[data-app-page="queries"] .requests-table tr {
    display: block;
    margin-bottom: var(--m-space-md);
    border: none;
    background: transparent;
    padding: 0;
}

body[data-app-page="requests"] .requests-table td.desktop-cell,
body[data-app-page="queries"] .requests-table td.desktop-cell {
    display: none !important;
}

body[data-app-page="requests"] .requests-table td.mobile-card-cell,
body[data-app-page="queries"] .requests-table td.mobile-card-cell {
    display: block !important;
    padding: 0 !important;
    border: none !important;
}

body[data-app-page="requests"] .requests-table td.requests-table-empty,
body[data-app-page="queries"] .requests-table td.requests-table-empty {
    display: block !important;
    text-align: center;
    padding: var(--m-space-xl) !important;
    background: var(--tg-bg-card);
    border-radius: var(--m-radius-lg);
}

/* Dashboard home: active requests / queries (no data-app-page on index historically) */
.dashboard-recent-section .requests-table-wrap,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table-wrap {
    overflow: visible !important;
    border: none !important;
}

.dashboard-recent-section .requests-table,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto !important;
    display: block !important;
}

.dashboard-recent-section .requests-table thead,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table thead {
    display: none !important;
}

.dashboard-recent-section .requests-table,
.dashboard-recent-section .requests-table thead,
.dashboard-recent-section .requests-table tbody,
.dashboard-recent-section .requests-table tr,
.dashboard-recent-section .requests-table th,
.dashboard-recent-section .requests-table td,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table thead,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table tbody,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table tr,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table th,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td {
    width: auto !important;
    max-width: none !important;
}

.dashboard-recent-section .requests-table th:nth-child(n),
.dashboard-recent-section .requests-table td:nth-child(n),
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table th:nth-child(n),
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td:nth-child(n) {
    position: static !important;
    left: auto !important;
    right: auto !important;
    white-space: normal !important;
    word-break: normal !important;
}

.dashboard-recent-section .requests-table tr,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table tr {
    display: block !important;
    margin-bottom: var(--m-space-md);
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.dashboard-recent-section .requests-table td.desktop-cell,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td.desktop-cell {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    border: none !important;
}

.dashboard-recent-section .requests-table td.mobile-card-cell,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td.mobile-card-cell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
    gap: 0 !important;
    overflow: visible !important;
}

.dashboard-recent-section .requests-table td.mobile-card-cell::before,
.dashboard-recent-section .requests-table td.mobile-card-cell:before,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td.mobile-card-cell::before,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td.mobile-card-cell:before {
    content: none !important;
    display: none !important;
}

.dashboard-recent-section .requests-table td.requests-table-empty,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td.requests-table-empty {
    display: block !important;
    text-align: center;
    padding: var(--m-space-xl) !important;
    background: var(--tg-bg-card);
    border-radius: var(--m-radius-lg);
}

.dashboard-recent-section .requests-table td.requests-table-empty::before,
.dashboard-recent-section .requests-table td.requests-table-empty:before,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td.requests-table-empty::before,
body[data-app-page="dashboard"] .dashboard-recent-section .requests-table td.requests-table-empty:before {
    content: none !important;
    display: none !important;
}

.dashboard-recent-section .mobile-req-card,
body[data-app-page="dashboard"] .dashboard-recent-section .mobile-req-card {
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Generic overflow tables on mobile */
.profile-table-wrap,
.fleet-table-wrap,
.accounts-table-wrap,
.tariffs-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--m-radius-md);
}

.profile-table-wrap table,
.fleet-table-wrap table {
    min-width: 0 !important;
}
