/* ==========================================
   Hub Tables — Tabelas Operacionais e Heatmap
   Tokens: var(--hub-*) como fonte da verdade
   ========================================== */

/* --- .hub-table / .beto-table (Tabela Operacional Canônica) --- */
.hub-table,
.beto-table {
    width: 100%;
    border-collapse: collapse;
}
.hub-table th,
.hub-table td,
.beto-table th,
.beto-table td {
    white-space: nowrap;
    text-align: left;
    padding: 9.5px 10px;
    font-size: var(--hub-text-table);
    line-height: var(--hub-leading-snug);
    font-weight: var(--hub-weight-extralight);
}
.hub-table th,
.beto-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--hub-surface-soft);
    box-shadow: inset 0 -1px 0 var(--hub-border);
}

/* --- .hub-table-wrap / .beto-table-wrap (Container de Tabela Canônico) --- */
.hub-table-wrap,
.beto-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    max-height: 100%;
}

/* --- Sub-componentes Internos Canônicos e Legados --- */
.hub-table__primary-cell,
.beto-table__primary-cell {
    font-weight: var(--hub-weight-bold)
}
.hub-table-action,
.beto-table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border: 1px solid var(--hub-border-strong);
    border-radius: 6px;
    background: var(--hub-surface-hover);
    color: var(--hub-text-muted);
    font: inherit;
    font-size: var(--hub-text-eyebrow);
    font-weight: var(--hub-weight-bold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
}
.hub-table-action:hover,
.beto-table-action:hover {
    border-color: rgba(203, 123, 55, 0.48);
    background: rgba(203, 123, 55, 0.08);
    color: var(--hub-text);
}

.hub-table-badge,
.beto-table-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid rgba(68, 122, 203, 0.28);
    border-radius: 999px;
    background: rgba(68, 122, 203, 0.12);
    color: var(--hub-info);
    font-size: var(--hub-text-eyebrow);
    font-weight: var(--hub-weight-bold);
    text-transform: uppercase;
}

/* --- Linhas Clicáveis --- */
.hub-table tbody tr[data-reservation-row],
.hub-table tbody tr[data-unit-row],
.hub-table tbody tr[data-application-row],
.hub-table tbody tr[data-task-id],
.hub-table tbody tr[data-report-row],
.hub-table tbody tr[data-edit-record],
.beto-table tbody tr[data-reservation-row],
.beto-table tbody tr[data-unit-row],
.beto-table tbody tr[data-application-row],
.beto-table tbody tr[data-task-id],
.beto-table tbody tr[data-report-row],
.beto-table tbody tr[data-edit-record] {
    cursor: pointer;
}

/* --- Hover de Linha --- */
.hub-table tbody tr:hover td,
.hub-table tbody tr[data-reservation-row]:hover td,
.hub-table tbody tr[data-unit-row]:hover td,
.hub-table tbody tr[data-application-row]:hover td,
.hub-table tbody tr[data-task-id]:hover td,
.hub-table tbody tr[data-report-row]:hover td,
.hub-table tbody tr[data-edit-record]:hover td,
.beto-table tbody tr:hover td,
.beto-table tbody tr[data-reservation-row]:hover td,
.beto-table tbody tr[data-unit-row]:hover td,
.beto-table tbody tr[data-application-row]:hover td,
.beto-table tbody tr[data-task-id]:hover td,
.beto-table tbody tr[data-report-row]:hover td,
.beto-table tbody tr[data-edit-record]:hover td {
    background: rgba(203, 123, 55, 0.055) !important;
}

/* --- Hover em Coluna Sticky (primeira coluna) --- */
.hub-table tbody tr[data-reservation-row]:hover td:first-child,
.hub-table tbody tr[data-unit-row]:hover td:first-child,
.hub-table tbody tr[data-application-row]:hover td:first-child,
.hub-table tbody tr[data-task-id]:hover td:first-child,
.hub-table tbody tr[data-report-row]:hover td:first-child,
.hub-table tbody tr[data-edit-record]:hover td:first-child,
.beto-table tbody tr[data-reservation-row]:hover td:first-child,
.beto-table tbody tr[data-unit-row]:hover td:first-child,
.beto-table tbody tr[data-application-row]:hover td:first-child,
.beto-table tbody tr[data-task-id]:hover td:first-child,
.beto-table tbody tr[data-report-row]:hover td:first-child,
.beto-table tbody tr[data-edit-record]:hover td:first-child {
    background: #1e1813 !important;
}

/* --- .hub-table-panel / .beto-panel--table (Painel de Tabela Canônico) --- */
.hub-table-panel,
.beto-panel--table {
    width: 100%;
    padding: var(--space-s);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
        var(--hub-surface-raised);
    overflow-y: auto;
}

@media (min-width: 861px) {
    .hub-table-panel,
    .beto-panel--table {
        border-color: var(--hub-border);
        border-radius: var(--hub-radius);
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 68%),
            var(--hub-surface-soft);
        max-height: calc(100vh - (var(--hub-view-section-gap) * 2) - var(--hub-shell-header-height) - var(--hub-view-section-gap) - 2px);
    }
}

/* --- Heatmap (Matrizes) --- */
.beto-heatmap {
    border-collapse: separate !important;
    border-spacing: 4px !important;
}

.beto-heatmap th,
.beto-heatmap td {
    border: none !important;
}

.beto-heatmap th:not(:first-child),
.beto-heatmap td.hm-cell {
    width: 60px;
    text-align: center;
    font-weight: var(--hub-weight-semibold);
}

.beto-heatmap td.hm-cell {
    border-radius: 4px;
    font-size: var(--hub-text-eyebrow);
    line-height: 1.2;
    padding: 6px 4px;
}

.beto-heatmap td.hm-cell:hover {
    filter: brightness(1.3);
    cursor: default;
}

/* --- Table Wrap para Matrizes --- */
.hub-table-wrap:has(#beto-matrix-checkin),
.hub-table-wrap:has(#beto-matrix-booking),
.hub-table-wrap:has(#beto-matrix-active),
.beto-table-wrap:has(#beto-matrix-checkin),
.beto-table-wrap:has(#beto-matrix-booking),
.beto-table-wrap:has(#beto-matrix-active) {
    max-height: 420px;
    overflow-y: auto;
}
