﻿/* ============================
   PLATFORMA TABLES (tenants/users-lists etc)
   ============================ */

.platforma-table-wrapper {
    background: var(--platforma-white);
    /* WAVE0-F2b (2026-09-09): demo10 flat — 8px (was 12px) + micro-shadow (was the
       heavy --platforma-shadow) + hairline. */
    border-radius: var(--pf-radius-lg, 8px);
    box-shadow: var(--platforma-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    border: 1px solid var(--pf-color-border-subtle, var(--platforma-gray-200));
    overflow-x: auto;
    margin-bottom: var(--platforma-space-8);
}

/* Horisontal scroll på små skærme */
.platforma-table-scroll {
    width: 100%;
    overflow-x: auto;
}

/* Selve tabellen */
.platforma-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--platforma-text-sm);
}

/* Columns hidden on mobile — add this class to th/td */
.platforma-table-col-hide-mobile {
    /* visible by default */
}

    .platforma-table thead {
        background: var(--platforma-gray-50);
    }

    /* DENSITY-STOP-01 step 3 (2026-11-07) — the bridge for table cells. VERTICAL padding only:
       0.75rem was exactly --pf-cell-pad-y's comfortable value (12px), so this is pixel-identical.
       The horizontal 1rem stays a literal on purpose — the density decision does not band
       horizontal cell padding, because that is wide-table readability rather than density
       (plan §3a, pinned by PfDensitySpacingBandsDensityStop01Tests).
       This is the one adoption in the step that reaches every admin table at once, and it is
       still INERT until a layout stamps the attribute (see platforma-buttons.css for why).
       It also has NO vertical effect below 1024px even then: three narrower overrides at
       1024 / 767.98 / 480px follow with the same specificity and win on source order, and at
       767.98px the literal is already 8px, which IS the compact value. */
    .platforma-table th,
    .platforma-table td {
        padding: var(--pf-cell-pad-y, 0.75rem) 1rem;
        text-align: left;
    }

    .platforma-table th {
        /* WAVE0-F2b (2026-09-09): demo10 table headers are MUTED normal-ish weight,
           NOT uppercase-600 with tracking. */
        font-weight: 500;
        color: var(--platforma-gray-600);
        border-bottom: 1px solid var(--platforma-gray-200);
        font-size: var(--platforma-text-xs);
        text-transform: none;
        letter-spacing: normal;
        white-space: nowrap;
    }

    /* Allow text wrapping in data cells for long values. MOBILE-FIX (2026-09-21): word-break:break-word broke
       multi-word names letter-by-letter on phones ("Fahad Naser ApS" → F/a/h/a/d…). overflow-wrap:break-word wraps
       at spaces normally and only breaks a genuinely unbreakable token. */
    .platforma-table td {
        overflow-wrap: break-word;
        word-break: normal;
        max-width: 250px;
    }

    /* Keep compact columns from wrapping (badges, dates, numbers) */
    .platforma-table td .platforma-badge,
    .platforma-table .platforma-table-actions {
        white-space: nowrap;
    }

    /* Sortable column headers */
    .platforma-table th[data-sortable] {
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 1.5rem;
    }

    .platforma-table th[data-sortable]:hover {
        color: var(--platforma-gray-900);
        background: var(--platforma-gray-100);
    }

    .platforma-table th[data-sortable]::after {
        content: '';
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid var(--platforma-gray-300);
        transition: transform 0.15s ease, border-color 0.15s ease;
    }

    .platforma-table th[data-sortable][data-sort-dir="asc"]::after {
        border-top-color: var(--platforma-primary);
        transform: translateY(-50%) rotate(180deg);
    }

    .platforma-table th[data-sortable][data-sort-dir="desc"]::after {
        border-top-color: var(--platforma-primary);
    }

    /* Polish (2026-04-26) — Genbrug samme sortable-pattern på wp-pages-table
       (WebsitePages bruger custom .wp-table CSS i stedet for .platforma-table,
       men sort-arrow-mønstret skal være konsistent på tværs af alle admin-
       tabeller). */
    .wp-pages-table th[data-sortable] {
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 1.5rem;
    }

    .wp-pages-table th[data-sortable]:hover {
        color: var(--platforma-gray-900, #0f172a);
        background: rgba(11, 13, 22, 0.03);
    }

    .wp-pages-table th[data-sortable]::after {
        content: '';
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid var(--platforma-gray-300, #cbd5e1);
        transition: transform 0.15s ease, border-color 0.15s ease;
    }

    .wp-pages-table th[data-sortable][data-sort-dir="asc"]::after {
        border-top-color: var(--platforma-warm, #C7A55F);
        transform: translateY(-50%) rotate(180deg);
    }

    .wp-pages-table th[data-sortable][data-sort-dir="desc"]::after {
        border-top-color: var(--platforma-warm, #C7A55F);
    }

    .platforma-table tbody tr {
        border-bottom: 1px solid var(--platforma-gray-100);
    }

        .platforma-table tbody tr:last-child {
            border-bottom: none;
        }

        /* AUDIT-HOVER-1 — same invisible-in-dark hover as the admin-chrome rule; same fix. The
           twice-declared-alias theory in my first pass was measured and refuted. */
        .platforma-table tbody tr:hover {
            background: var(--pf-color-surface-hover);
            transition: background var(--platforma-transition, 0.15s ease);
        }

        /* DS-Consolidation (2026-09-22) — clickable rows. A row carrying data-pf-row-href is a
           MOUSE affordance to its primary action (opened by platforma-tables.js initRowNav); the
           name-cell .pf-row-link anchor is the real keyboard/AT path. The anchor inherits the
           cell's text colour (not the generic blue td-a tint below) so the row reads as plain text
           with only a hover underline as the cue. Scoped to out-rank the generic .platforma-table
           td a:hover rule. */
        .platforma-table tbody tr[data-pf-row-href] {
            cursor: pointer;
        }

    .platforma-table td a.pf-row-link {
        color: inherit;
        text-decoration: none;
    }

        .platforma-table td a.pf-row-link:hover {
            color: inherit;
            text-decoration: underline;
        }

    /* Clickable row title links */
    .platforma-table td a {
        transition: color var(--platforma-transition, 0.15s ease);
    }

        .platforma-table td a:hover {
            color: var(--platforma-primary, #009EF7);
        }

/* Celler med “primary” tekst */
.platforma-table-cell-primary {
    font-weight: 600;
    color: var(--platforma-gray-900);
}

/* Light muted cell */
.platforma-table-cell-muted {
    color: var(--platforma-gray-500);
}

/* SA-04a — server-side sort links in sortable column headers (Del-4 list standard).
   color:inherit keeps the header's own colour (theme-safe, no hardcoded token); the
   underline is the hover/focus affordance. Reused across the per-page list rollout. */
.platforma-table-sort-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.platforma-table-sort-link:hover,
.platforma-table-sort-link:focus-visible {
    text-decoration: underline;
}

/* Badges til status/plan */
.platforma-table-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: var(--platforma-text-xs);
    font-weight: 600;
    border: 1px solid transparent;
}

.platforma-table-badge-success {
    background: var(--platforma-success-light);
    color: var(--platforma-success);
    border-color: rgba(80,205,137,0.4);
}

.platforma-table-badge-warning {
    background: var(--platforma-warning-light);
    color: var(--platforma-warning);
    border-color: rgba(255,199,0,0.4);
}

.platforma-table-badge-danger {
    background: var(--platforma-danger-light);
    color: var(--platforma-danger);
    border-color: rgba(241,65,108,0.4);
}

.platforma-table-badge-neutral {
    background: var(--platforma-gray-100);
    color: var(--platforma-gray-700);
    border-color: var(--platforma-gray-200);
}

/* Info — the fourth tone the family was missing. /Contracts already asked for it (Signed) and
   PROTO-DESIGN's prototype marker asks for it again, so until now both rendered as an unstyled
   .platforma-table-badge. Uses the same semantic info token the status chips use, so the three
   badge families agree. */
.platforma-table-badge-info {
    background: var(--pf-color-status-info-soft);
    color: var(--pf-color-status-info-fg);
    border-color: var(--pf-color-status-info-border);
}

/* Actions kolonne */
.platforma-table-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ACTIONS-CELL-1 (2026-09-27, found by the SA-14a card pass, measured on /tenants at 1440px) — ~40 views put this
   class on the <td> ITSELF (the TABLE-CARDS-1 action row needs it there). inline-flex took that cell out of table
   layout on desktop: the cell shrank to its buttons (81px in a 120px column), so the row divider stopped short under
   the column and a right-aligned header sat over left-aligned buttons. A td stays a table cell (the gap becomes a
   margin); the phone card tier (≤767.98px) still turns it into its flex action row. The class on a <div> inside a
   cell is unaffected. */
.platforma-table td.platforma-table-actions {
    display: table-cell;
}
.platforma-table td.platforma-table-actions > * + * {
    margin-left: var(--platforma-space-1);
}

.platforma-table-action-link {
    font-size: var(--platforma-text-xs);
    color: var(--platforma-primary);
    text-decoration: none;
    font-weight: 500;
}

    .platforma-table-action-link:hover {
        text-decoration: underline;
    }

/* Kebab icon-knap */
.platforma-table-action-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--platforma-gray-200);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--platforma-white);
    cursor: pointer;
}

/* Table empty state */
.platforma-table-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--platforma-gray-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.platforma-table-empty svg {
    width: 48px;
    height: 48px;
    color: var(--platforma-gray-300);
    margin-bottom: 0.25rem;
}

.platforma-table-empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--platforma-gray-600);
}

.platforma-table-empty-text {
    font-size: 0.85rem;
    /* SA-14a (2026-09-27): gray-400 is the DISABLED role (2.56:1 on white) — this is real text. */
    color: var(--platforma-gray-500);
    max-width: 28rem;
}

.platforma-table-empty .platforma-btn {
    margin-top: 0.5rem;
}

/* WAVE0-D (2026-09-09): 8 views (Apartments, Facilities/Locations, MemberActivations,
   SuperAdminEntitlement Index/Tenants, SuperAdminSettings, TenantDefaults, Translations/
   MissingAtRuntime) render their "no rows" panel with a bare `.platforma-empty-state` div,
   but only .platforma-table-empty was ever defined → those eight showed as plain left-aligned
   text. Alias to the canonical empty-state (centered, padded, muted) so every empty state
   reads the same. Removed from FormClassConsistencyTests.BaselineKnownOrphans in the same
   commit. */
.platforma-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--platforma-gray-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* Actions column */
.platforma-table-actions-column {
    text-align: right;
}

/* ─── Slice C (2026-04-26) — Standardiserede row-actions ───
   _RowActions.cshtml partial bruger disse klasser. Konsistent på alle
   admin data-pages: Vis · Redigér · Dupliker · Slet i samme rækkefølge
   med samme stil. Compact-variant viser kun ikoner; verbose viser ikon + label. */
.platforma-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.platforma-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--pf-color-surface-sunken, rgba(11, 13, 22, 0.04));
    color: var(--pf-color-text-secondary, #475569);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    transition: all 0.12s ease;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
}
.platforma-row-action svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.platforma-row-action:hover {
    background: var(--pf-color-surface-raised, #fff);
    border-color: var(--pf-color-border-strong, rgba(11, 13, 22, 0.14));
    color: var(--pf-color-text-primary, #0B0D16);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(11, 13, 22, 0.08);
    text-decoration: none;
}
/* PL-3 (2026-09-08): the four hover tones ride the status foreground roles so they hold AA in
   both themes (light: sky/amber/emerald/red-800 on white ≥ 7:1; dark: the -300 steps ≥ 7.7:1). */
.platforma-row-action--view:hover    { color: var(--pf-color-status-info-fg, #2563eb); border-color: rgba(37, 99, 235, 0.30); }
.platforma-row-action--edit:hover    { color: var(--pf-color-status-warning-fg, #C7A55F); border-color: rgba(199, 165, 95, 0.40); }
.platforma-row-action--duplicate:hover { color: var(--pf-color-status-success-fg, #6BA68F); border-color: rgba(107, 166, 143, 0.40); }
.platforma-row-action--delete:hover  { color: var(--pf-color-status-danger-fg, #B23A3A); border-color: rgba(178, 58, 58, 0.40); }

/* Verbose-variant: ikon + label, bredere knapper. */
.platforma-row-actions--verbose .platforma-row-action {
    width: auto;
    padding: 0 10px;
    height: 30px;
}
.platforma-row-action-label {
    font-size: 0.78rem;
    line-height: 1;
    font-weight: 500;
}

/* Form-wrapper må ikke bryde flex-row. */
.platforma-row-action-form {
    display: inline-flex;
    margin: 0;
}

/* JS confirm-dialog hook: data-confirm-message attribute trigger
   window.confirm() før form submitter. Implementeret i platforma-tables.js
   eller globalt i layout. */

/* Filter bar (used above tables) */
.platforma-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

/* TS.test-orchestrator (2026-05-18) — pre-existing __group child used in
   TenantAuditLog filter bar; ratchets the governance test off this orphan. */
.platforma-filter-bar__group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

    .platforma-filter-bar .platforma-select {
        min-width: 0;
        flex: 1 1 130px;
        max-width: 180px;
        font-size: 0.8125rem;
        padding: 0.4rem 2rem 0.4rem 0.75rem;
    }

/* Task count below filters */
.platforma-filter-count {
    font-size: 0.8125rem;
    color: var(--platforma-gray-500);
    margin-bottom: 0.5rem;
}

/* Tablet (768–1024px) */
@media (max-width: 1024px) {
    .platforma-table th,
    .platforma-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8125rem;
    }

    .platforma-filter-bar .platforma-select {
        flex: 1 1 calc(33% - 0.5rem);
        max-width: none;
    }
}

/* Mobile (<768px) */
@media (max-width: 767.98px) {
    .platforma-table-wrapper {
        border-radius: 8px;
        margin-bottom: var(--platforma-space-4);
    }

    .platforma-table th,
    .platforma-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.75rem;
    }

    .platforma-table-col-hide-mobile {
        display: none;
    }

    .platforma-filter-bar .platforma-select {
        flex: 1 1 calc(50% - 0.25rem);
        max-width: none;
    }

    .platforma-table-actions {
        gap: 0.25rem;
    }
}

/* Small mobile (<480px) */
@media (max-width: 480px) {
    .platforma-filter-bar .platforma-select {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .platforma-table th,
    .platforma-table td {
        padding: 0.4rem 0.3rem;
        font-size: 0.6875rem;
    }
}

/* ============================================================
   Wide-table support — migreret fra platforma-admin-ux.css
   (Fase 3). Progressive column-hiding + word-wrap + opt-in
   nowrap. Lever sammen med tabellerne fordi de kun giver
   mening i kontekst af en .platforma-table. */

/* Wide-table responsive wrapper — lang admin-tabel kan scrolle
   horisontalt hvis kolonnerne er uundgåelige, men
   platforma-table-col-prio-N bør bruges først så vi kun falder
   tilbage på scroll i reelle edge cases. */
.platforma-table-wrapper--wide {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.platforma-table-wrapper--wide > table {
    min-width: auto;
}

/* Data-cells: word-wrap så lange values gør ROW højere
   (vertikal plads) i stedet for at tvinge horizontal scroll.

   A11Y-MOBILE-1 (2026-09-17) — `word-break: break-word` was the cause of tenant names
   rendering one character per line at 390px. It is the deprecated alias that computes to
   `word-break: normal` PLUS `overflow-wrap: anywhere`, and the distinction that matters is
   that `anywhere` contributes soft-wrap opportunities to MIN-CONTENT intrinsic sizing while
   `break-word` does not. So each cell's min-content width collapsed to a single character;
   with `table-layout: auto` and seven columns competing for 390px, the auto-table algorithm
   allocated near min-content and "Fahad Naser ApS" stacked vertically, letter by letter.

   `overflow-wrap: break-word` below is kept deliberately — it still breaks a long unbroken
   token that would otherwise overflow, WITHOUT feeding min-content sizing. That is the
   behaviour the original comment was reaching for.

   Applies to all 11 views using --wide; every one of them had the same latent defect. */
.platforma-table-wrapper--wide td {
    word-break: normal;
    overflow-wrap: break-word;
    vertical-align: top;
}

/* Celler der eksplicit opt-in til nowrap (datoer, badges,
   action-buttons) bliver på én linje; alt andet wrapper frit. */
.platforma-table-wrapper--wide td:not(.platforma-table-col-nowrap):not(.platforma-table-actions),
.platforma-table-wrapper--wide th:not(.platforma-table-col-nowrap) {
    white-space: normal;
}

/* Header-rækker må ombrydes (fx NÆSTE FAKTURERING, PRØVE SLUTTER) */
.platforma-table-wrapper--wide th {
    white-space: normal;
    vertical-align: bottom;
    line-height: 1.25;
}

/* Eksplicit single-line-celler (nowrap-kolonnen) */
.platforma-table td.platforma-table-col-nowrap,
.platforma-table th.platforma-table-col-nowrap {
    white-space: nowrap;
}

/* Progressive column-hiding for wide tables.
   Marker hver th + matchende td med én af disse klasser; de
   lavest-prioriterede kolonner forsvinder først når viewport
   bliver smallere. Prio 1 = altid synlig; højere tal = falder
   først væk.

   Breakpoints tuned for admin-shell (~220px sidebar + main):
     ≥ 1600px → alle kolonner synlige
     < 1600px → prio 4 skjult
     < 1280px → prio 3+4 skjult
     <  900px → prio 2+3+4 skjult
*/
@media (max-width: 1599px) {
    .platforma-table-col-prio-4 { display: none; }
}
@media (max-width: 1279px) {
    .platforma-table-col-prio-3 { display: none; }
}
@media (max-width: 899px) {
    .platforma-table-col-prio-2 { display: none; }
}

/* ──────────────────────────────────────────────────────────────────
   TABLE-CARDS-1 (2026-09-17) — phone tier: one card per row.
   Opt-in with `platforma-table-cards` ALONGSIDE the priority classes above,
   never instead of them. The tiers are complementary: priority columns handle
   the desktop-to-tablet squeeze by dropping low-value columns, and this handles
   the phone, where even three columns will not fit. Applied without priority
   classes it would render every column as a card row — seven lines per record,
   which is worse than the table it replaces.

   THE ARIA IS NOT OPTIONAL AND NOT HERE. Setting `display: block` on
   table/tr/td makes browsers DROP the implicit table, row and cell roles from
   the accessibility tree, and the <th>-to-<td> association goes with them: a
   screen reader gets an undifferentiated run of text. A card flip that only
   changes `display` is a net accessibility REGRESSION over the table it
   replaces. The consuming view must therefore carry role="table" /
   "rowgroup" / "row" / "columnheader" / "cell" in its MARKUP — a media query
   cannot add roles. With them intact, assistive technology announces
   "Tenant: Fahad Naser ApS" natively and needs no data-label at all.

   Which is what makes the visible label below safe to use: `content:
   attr(data-label)` is inconsistently exposed to AT across engines, and as the
   ONLY labelling mechanism that would be a defect. Layered over correct roles
   it is decoration, and its unreliability stops mattering.

   767.98px matches the shell's drawer tier and platforma-layout.js's
   MOBILE_BREAKPOINT, rather than inventing an eighth threshold.
   ────────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .platforma-table.platforma-table-cards {
        border: 0;
    }

    /* Headers stay in the accessibility tree — hidden, never removed. */
    .platforma-table.platforma-table-cards thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        border: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* TABLE-CARDS-2 (2026-09-17) — reported from a screenshot: every card's text landed on top of
       the card below it.

       WHAT HAPPENED, in the past tense: the since-retired `platforma-density.css` set
       `html[data-pf-density] .platforma-table tbody tr { height: var(--pf-row-height) }`. On a
       `display: table-row` that height is a MINIMUM and the row grows to fit its cells, which is why
       it was harmless on every desktop table. On the block box this card flip creates it is
       ABSOLUTE: the card was pinned at 44px while its content measured 173px, so 129px of every card
       spilled onto the next one. Density was stamped by default then, so this was the ordinary state
       rather than an edge case.

       WHAT IS TRUE NOW: DS-13 (`7325d755`, 2026-09-22) retired the density toggle and deleted
       `platforma-density.css`, and no stylesheet sets a fixed row height any more —
       `CardFlipSurvivesRowHeightTableCards2Tests` keeps `KnownRowHeightRules` EMPTY to enforce that.
       This override is KEPT on purpose all the same: it is the guard that makes the next fixed row
       height safe instead of a repeat of the incident. `height: auto` has to outrank (0,2,3), hence
       the explicit `html[data-pf-density]` arm; the bare arm covers the ordinary case where no
       density attribute is set, which is every admin page today.

       Adding a row-height rule later is allowed, but read this before you try: the pin's own failure
       message offers two escapes, and ONLY THE SECOND ONE ACTUALLY WORKS. Its `unexpected` set is
       computed purely from `KnownRowHeightRules` membership, so neutralising your rule inside this
       card block has zero effect on it — the pin will still fail and name your rule. You must add a
       `KnownRowHeightRules` entry with the reason it is safe. Neutralising here is what makes the
       rule SAFE; the entry is what makes the pin AGREE. Do both, and do not delete the pin.
       (Corrected 2026-11-03: the earlier wording here copied the pin's message and presented the two
       as alternatives, which would send the next session to fight the pin.) */
    /* CARDS-CELL-1 (2026-09-27): a flex COLUMN rather than a block, so the identity cell can head the card
       (order, below) — the cells still stack full-width exactly as the block did. */
    .platforma-table.platforma-table-cards tr,
    html[data-pf-density] .platforma-table.platforma-table-cards tbody tr {
        display: flex;
        flex-direction: column;
        height: auto;
        margin-bottom: var(--platforma-space-3);
        padding: var(--platforma-space-3);
        border: 1px solid var(--pf-color-border-subtle);
        border-radius: var(--platforma-radius);
        background: var(--pf-color-surface-raised);
    }

    .platforma-table.platforma-table-cards td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: var(--platforma-space-3);
        width: auto;
        /* CARDS-CELL-1 (2026-09-27, measured at 375px on every card list): the desktop cap (max-width: 250px on
           every .platforma-table td) also capped each CARD row, so every label/value row stopped at 250px inside
           a ~321px card — values right-aligned 70px short of the card's edge. */
        max-width: none;
        padding: var(--platforma-space-2) 0;
        border: 0;
        text-align: right;
    }

    /* The decorative label. Real labelling comes from the roles in markup. */
    .platforma-table.platforma-table-cards td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        text-align: left;
        font-size: var(--pf-text-2sm);
        font-weight: 600;
        color: var(--pf-color-text-secondary);
    }

    /* CARDS-CELL-1 — a labelled cell with SEVERAL children (a link + an e-mail line, a value + "of cap", a badge + a
       note, chips) spread them across the whole card under justify-content:space-between. Now the label takes the
       free space (margin-right:auto) and the values cluster at the right edge, wrapping onto further right-aligned
       lines when they do not fit. A single value renders exactly as before; inline fragments ("A · B") stay together.
       (A grid that stacks every child was tried first and rejected: bare text nodes are anonymous items that
       auto-placement drops into the label column, and "A · B" would break into three lines.) */
    .platforma-table.platforma-table-cards td[data-label] {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: var(--platforma-space-1) var(--platforma-space-2);
    }
    .platforma-table.platforma-table-cards td[data-label]::before {
        margin-right: auto;
        padding-right: var(--platforma-space-2);
    }
    .platforma-table.platforma-table-cards td[data-label] > * {
        max-width: 100%;
    }
    /* A badge may wrap inside its card cell (a verbatim provider error is longer than any card). */
    .platforma-table.platforma-table-cards td .platforma-badge {
        white-space: normal;
    }

    /* A cell with no label is a full-width block — the identity cell and the
       action row read better spanning the card than as a label/value pair. */
    .platforma-table.platforma-table-cards td:not([data-label]) {
        display: block;
        text-align: left;
    }

    /* CARDS-CELL-1 — the identity cell HEADS the card even when a column precedes it on desktop (a score, a match
       kind, a tenant id). Several unlabeled cells keep their source order among themselves (CrmLeads: checkbox,
       then name); the action row is excluded and stays at the foot. */
    .platforma-table.platforma-table-cards td:not([data-label]):not(.platforma-table-actions) {
        order: -1;
    }

    /* Priority-hidden columns stay hidden here: a card should show what
       survived the squeeze, not resurrect what the tiers above dropped. */
    /* CARDS-CELL-1: the td-qualified arms matter — the td:not([data-label]) display:block rule above is (0,3,1)
       and out-ranked the bare (0,3,0) arms, so a priority column WITHOUT a data-label (CrmLeads' source, city,
       count and date) was shown in every card as an unlabelled value. Same (0,3,1), later in source → hidden. */
    .platforma-table.platforma-table-cards .platforma-table-col-prio-2,
    .platforma-table.platforma-table-cards .platforma-table-col-prio-3,
    .platforma-table.platforma-table-cards .platforma-table-col-prio-4,
    .platforma-table.platforma-table-cards td.platforma-table-col-prio-2,
    .platforma-table.platforma-table-cards td.platforma-table-col-prio-3,
    .platforma-table.platforma-table-cards td.platforma-table-col-prio-4 {
        display: none;
    }

    /* MOBILE-FIX 2026-09-21 (#24): the action row is the last cell in a card. Give it a hairline
       separator from the values above and lay the buttons out as a wrapping flex row with room to
       breathe, so a fingertip is not aiming at two tiny pills crammed against the card edge.
       Same (0,3,1) specificity as the td:not([data-label]) rule above — it must therefore come
       AFTER it in source order to win. */
    .platforma-table.platforma-table-cards td.platforma-table-actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--platforma-space-2);
        margin-top: var(--platforma-space-2);
        padding-top: var(--platforma-space-3);
        border-top: 1px solid var(--pf-color-border-subtle);
    }
    /* The desktop margin (ACTIONS-CELL-1) is the flex gap here. */
    .platforma-table.platforma-table-cards td.platforma-table-actions > * + * {
        margin-left: 0;
    }
}

/* MOBILE-FIX 2026-09-21 (#14) — a reusable single-line clamp for a table cell (was ad-hoc inline
   styles on the portal dashboard's subject column). On the desktop table the value truncates with an
   ellipsis at 180px; once the row becomes a full-width card there is room, so the clamp lifts and the
   whole value shows. Kept out of the @media block above so the base clamp applies on every width. */
.pf-cell-clamp {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 767.98px) {
    .platforma-table.platforma-table-cards .pf-cell-clamp {
        max-width: none;
        overflow: visible;
        white-space: normal;
    }
}

/* ──────────────────────────────────────────────────────────────────
   S5.7 — _AdminListPanel cockpit chrome (2026-04-27)
   ──────────────────────────────────────────────────────────────────
   Senior Frontend Design System Engineer: ÉN standard wrapper for alle
   admin-list-Index-views. Erstatter mix af platforma-welcome-section +
   ad-hoc filter-form + bare table-wrapper.

   Struktur:
     .platforma-admin-list                ← root (ingen visual chrome)
       _AdminPageHeader                   ← rendered by partial
       _HelpPanel                         ← optional
       BannerSlot                         ← optional alerts
       .platforma-list-panel-card         ← unified card-shell
         .platforma-list-panel-filter     ← filter-bar-slot
         PreTableSlot                     ← optional details/banners
         .platforma-list-panel-body       ← table eller empty-state
         .platforma-list-panel-footer     ← pagination
   ────────────────────────────────────────────────────────────────── */
.platforma-admin-list {
    display: block;
}

.platforma-list-panel-card {
    background: var(--platforma-surface, var(--platforma-white));
    border: 1px solid var(--platforma-surface-line, var(--platforma-gray-200));
    border-radius: var(--platforma-radius-lg, 10px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin-top: var(--platforma-space-4, 1rem);
}

.platforma-list-panel-filter {
    padding: var(--platforma-space-3, .75rem) var(--platforma-space-4, 1rem);
    border-bottom: 1px solid var(--platforma-surface-line, var(--platforma-gray-100));
    background: var(--platforma-parchment-50, var(--platforma-gray-50));
}

.platforma-list-panel-filter form {
    display: flex;
    gap: var(--platforma-space-3, .75rem);
    flex-wrap: wrap;
    align-items: flex-end;
    margin: 0;
}

.platforma-list-panel-filter .platforma-form-group,
.platforma-list-panel-filter > div {
    margin: 0;
}

.platforma-list-panel-body {
    /* Tables sit flush with card edges — no extra padding so headers
       align with the filter-bar above. */
    padding: 0;
}

.platforma-list-panel-body > .platforma-table-wrapper,
.platforma-list-panel-body > table {
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.platforma-list-panel-body > .platforma-table-empty,
.platforma-list-panel-body p.platforma-text-muted {
    padding: var(--platforma-space-4, 1rem) var(--platforma-space-4, 1rem);
    margin: 0;
}

/* A11Y-3 (2026-09-13) — the action slot under an empty panel's EmptyState.
   The component draws its own icon, title and hint; this rule only places the
   caller's button beneath them, centred on the same axis, and gives it room to
   breathe without a second border or background competing with the card. */
.platforma-list-panel-empty-cta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--platforma-space-2, .5rem);
    padding: 0 var(--platforma-space-4, 1rem) var(--platforma-space-5, 1.25rem);
    margin: 0;
}

.platforma-list-panel-footer {
    padding: var(--platforma-space-3, .75rem) var(--platforma-space-4, 1rem);
    border-top: 1px solid var(--platforma-surface-line, var(--platforma-gray-100));
    background: var(--platforma-parchment-50, var(--platforma-gray-50));
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--platforma-space-3, .75rem);
    font-size: var(--platforma-text-sm, .85rem);
    color: var(--platforma-gray-600, #525866);
}

.platforma-list-panel-footer:empty {
    display: none;
}

/* Filter-chip badges (active filters indicator) */
.platforma-list-panel-active-filters {
    margin-top: var(--platforma-space-2, .5rem);
    font-size: var(--platforma-text-xs, .78rem);
    color: var(--platforma-gray-500);
    display: flex;
    gap: var(--platforma-space-2, .5rem);
    flex-wrap: wrap;
    align-items: center;
}

.platforma-list-panel-active-filters strong {
    color: var(--platforma-gray-700);
    margin-right: var(--platforma-space-1, .25rem);
}

/* P2-S3 (2026-05-29) — paginated-list footer pager. Reusable across any
   server-paged table (introduced for the Contracts list, ADR-013 #4.C). */
.platforma-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--platforma-space-3, .75rem);
    margin-top: var(--platforma-space-4, 1rem);
}

.platforma-pager__status {
    color: var(--platforma-gray-500, #6b7280);
    font-size: var(--platforma-text-sm, .875rem);
}

/* ─────────────────────────────────────────────────────────────
   DS-29 (2026-09-23, design-consolidation) — per-row ⋯ overflow menu.
   Collapses a wall of per-row action buttons into ONE compact ⋯ that
   opens a vertical menu of the SAME actions (each stays a real link/form,
   so antiforgery, confirm dialogs and danger styling are preserved). Reuses
   initKebabMenus() in platforma-tables.js; [data-kebab-fixed] makes the JS
   position the menu FIXED so the wrapper's overflow-x:auto cannot clip it.
   ───────────────────────────────────────────────────────────── */
.pf-row-kebab {
    position: relative;
    display: inline-flex;
}
.pf-row-kebab__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--pf-radius-md, 6px);
    border: 1px solid var(--pf-color-border-subtle, var(--platforma-gray-200, #e5e7eb));
    background: var(--pf-color-surface, var(--platforma-white, #fff));
    color: var(--pf-color-text-secondary, var(--platforma-gray-600, #475569));
    cursor: pointer;
    line-height: 0;
}
.pf-row-kebab__toggle:hover {
    background: var(--pf-color-surface-hover, var(--platforma-gray-50, rgba(0, 0, 0, 0.04)));
    color: var(--pf-color-text-primary, var(--platforma-gray-900, #0f172a));
    border-color: var(--pf-color-border-strong, var(--platforma-gray-300, #cbd5e1));
}
.pf-row-kebab__toggle:focus-visible {
    outline: 2px solid var(--pf-color-focus, var(--platforma-primary, #2E5C8A));
    outline-offset: 2px;
}
.pf-row-kebab[aria-expanded="true"] .pf-row-kebab__toggle {
    background: var(--pf-color-surface-hover, var(--platforma-gray-50, rgba(0, 0, 0, 0.06)));
    border-color: var(--pf-color-border-strong, var(--platforma-gray-300, #cbd5e1));
}
.pf-row-kebab__menu {
    position: absolute; /* JS swaps to fixed when [data-kebab-fixed] */
    top: calc(100% + 4px);
    right: 0;
    z-index: 60;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 6px;
    background: var(--pf-color-surface-raised, var(--platforma-white, #fff));
    border: 1px solid var(--pf-color-border-strong, var(--platforma-gray-300, #cbd5e1));
    border-radius: var(--pf-radius-md, 8px);
    box-shadow: var(--platforma-shadow, 0 10px 28px rgba(0, 0, 0, 0.16));
}
.pf-row-kebab__menu[hidden] { display: none; }
/* Each menu row hosts one action (a link, or a form wrapping a submit). Forms go full-width
   so their button fills the row; the shared .pf-row-kebab__item class gives every action the
   same menu-item look regardless of whether it is an <a> or a <button>. */
.pf-row-kebab__menu > form { display: block; width: 100%; margin: 0; }
.pf-row-kebab__item {
    display: flex !important;
    align-items: center;
    gap: var(--platforma-space-2, 0.5rem);
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    padding: 7px 10px;
    border: 0;
    border-radius: var(--pf-radius-sm, 5px);
    background: transparent;
    color: var(--pf-color-text-primary, var(--platforma-gray-800, #1f2937));
    font-size: var(--platforma-text-sm, 0.875rem);
    white-space: nowrap;
    cursor: pointer;
}
.pf-row-kebab__item:hover:not([disabled]) {
    background: var(--pf-color-surface-hover, var(--platforma-gray-100, rgba(0, 0, 0, 0.05)));
}
.pf-row-kebab__item[disabled] { opacity: 0.5; cursor: not-allowed; }
.pf-row-kebab__item--danger {
    color: var(--pf-color-status-danger-fg, #b23a3a);
}
.pf-row-kebab__item--danger:hover:not([disabled]) {
    background: var(--pf-color-status-danger-soft, rgba(178, 58, 58, 0.08));
}
