/* ============================================================
   Responsive Data Tables -> Card layout on phones (<=767.98px)
   Auto-applied (via scripts.php) to data tables inside
   .table-responsive. Add class "no-card" on a <table> to opt out.
   Desktop & tablet layouts are intentionally untouched.
   ============================================================ */
@media (max-width: 767.98px) {
    .table-responsive table.rwd-card-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        border-collapse: separate;
        border-spacing: 0;
    }
    .table-responsive table.rwd-card-table thead {
        position: absolute !important;
        width: 1px; height: 1px;
        padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0, 0, 0, 0);
        white-space: nowrap; border: 0;
    }
    .table-responsive table.rwd-card-table tbody { display: block; width: 100%; }
    .table-responsive table.rwd-card-table tbody > tr {
        display: block;
        width: 100%;
        margin: 0 0 14px 0;
        padding: 4px 16px;
        border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.10));
        border-radius: 18px;
        background: var(--glass-bg, rgba(255, 255, 255, 0.03));
        box-shadow: var(--shadow-card, 0 6px 18px rgba(0, 0, 0, 0.14));
    }
    .table-responsive table.rwd-card-table tbody > tr:last-child { margin-bottom: 0; }
    .table-responsive table.rwd-card-table tbody > tr > td {
        display: block;
        position: relative;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 44px;
        text-align: right !important;
        white-space: normal !important;
        word-break: break-word;
        padding: 12px 2px 12px 38% !important;
        border: 0 !important;
        border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.07)) !important;
        border-radius: 0 !important;
        background: transparent !important;
    }
    .table-responsive table.rwd-card-table tbody > tr > td:last-child { border-bottom: 0 !important; }
    .table-responsive table.rwd-card-table tbody > tr > td::before {
        content: attr(data-label);
        position: absolute;
        left: 2px;
        top: 12px;
        width: 34%;
        text-align: left;
        white-space: normal;
        font-size: 0.66rem;
        font-weight: 700;
        line-height: 1.3;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted, rgba(255, 255, 255, 0.45));
        /* Cap the absolutely-positioned label to 2 lines so a long column
           heading can't grow taller than the cell and overlap the next row. */
        max-height: 2.6em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    /* Empty-state / summary rows (colspan) span the full card, centered */
    .table-responsive table.rwd-card-table tbody > tr > td[colspan] {
        padding: 12px 8px !important;
        text-align: center !important;
    }
    .table-responsive table.rwd-card-table tbody > tr > td[colspan]::before { content: ""; }
    /* Action cells: keep controls reachable & aligned right */
    .table-responsive table.rwd-card-table tbody > tr > td .btn,
    .table-responsive table.rwd-card-table tbody > tr > td .btn-group,
    .table-responsive table.rwd-card-table tbody > tr > td .btn-group-sm { vertical-align: middle; }
}

/* ============================================================
   Brand logo (navbar / sidebar) — theme-aware (white on dark, black on light)
   ============================================================ */
.brand-logo { height: 30px; width: auto; max-width: 165px; display: inline-block; vertical-align: middle; object-fit: contain; }
.sidebar-brand .brand-logo { height: 40px; max-width: 200px; }
[data-theme="dark"] .brand-logo-light { display: none !important; }
[data-theme="light"] .brand-logo-dark { display: none !important; }
@media (max-width: 575px) { .brand-logo { height: 26px; max-width: 140px; } }
