/* ──────────────────────────────────────────────────────────────────────
   SuperAdmin Portal IA refactor — shared chrome for the cross-tenant
   SA list pages.

   Used by /admin/system-administrators (S1/5) and inherited by
   S2-S5 (Practice Manager, Practice Groups, Practices, Doctors).
   Anything reused across two or more SA list pages belongs here so
   visual drift between them is impossible by construction.

   Convention: any MudTable on an SA list page should opt in by adding
   Class="gpc-sa-table" — the matching `.gpc-sa-table .mud-table-head
   .mud-table-cell` selector below applies the PSR Case Library header
   style (soft blue gradient, uppercase letter-spaced 0.7rem text,
   #565C82 colour, 32px height) so the SA portal reads as a single
   visual family with the analytics surface.
   ────────────────────────────────────────────────────────────────────── */

/* Table head: matches .psr-cases-table-wrap .mud-table-head .mud-table-cell.
   Keep these two rules in sync — the SA portal and the PSR Case
   Library are deliberately twinned visually. */
.gpc-sa-table .mud-table-head .mud-table-cell {
    background: linear-gradient(180deg, #F4F5FA 0%, #ECEEF6 100%);
    color: #565C82;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 12px;
    height: 32px;
    border-bottom: 1px solid #D7DBEB;
    vertical-align: middle;
}

/* ──────────────────────────────────────────────────────────────────────
   table-layout: fixed forces the browser to honour declared TH widths
   strictly, not as hints. Without this, auto-layout distributes
   leftover space based on cell content - which causes parent rows
   and child rows (rendered into the SAME tbody via ChildRowContent)
   to drift out of column alignment even when widths match on paper.

   width: 100% so the table fills its card. Exactly ONE column is
   left without a declared width (Email) so the leftover (card-width
   minus sum-of-fixed-columns) flows entirely into that column. This
   keeps every other column at its declared width while the layout
   stays edge-to-edge across the card - no awkward empty padding on
   the table's sides.

   Trade-off: cell content that exceeds its column width is clipped
   rather than expanding the column. We accept that and add ellipsis
   on the cells where overflow is realistic (Name, Manager, Email).
   ────────────────────────────────────────────────────────────────────── */
.gpc-sa-table table {
    table-layout: fixed;
    width: 100%;
}

/* MudBlazor's dense table ships an ASYMMETRIC body-cell padding:
   `.mud-table-dense * .mud-table-row .mud-table-cell { padding: 6px 24px
   6px 16px; }`. Padding-left 16px, padding-right 24px - an 8px right-
   bias. Visible consequences:
     1. Centered cell content sits 4px LEFT of the cell's true centre
        (text-align centres inside the post-padding content box, which
        is itself off-centre). Most visible on the narrow 40px chevron
        column where 16+24=40 leaves zero content area, so the icon
        falls out at the left padding edge.
     2. Left-aligned text sits 16px from the cell edge, but the header
        row uses our own symmetric `padding: 0 12px`, so headers and
        their data sit on different vertical rails (off by 4px).
   We re-apply symmetric `6px 12px` padding (matching the header rule)
   so column headers, their data cells and any centred content all share
   the same left/right rails. !important defeats MudBlazor's same-or-
   higher-specificity selectors. */
.gpc-sa-table .mud-table-row .mud-table-cell,
.gpc-sa-table .mud-table-row .mud-table-cell:last-child {
    padding: 6px 12px !important;
    padding-inline-start: 12px !important;
    padding-inline-end: 12px !important;
}

/* ──────────────────────────────────────────────────────────────────────
   Accordion sub-header row: renders inline inside the parent table
   (via ChildRowContent) above each expanded group's child rows.
   Same column rails as the rest of the table by construction.

   Visual hierarchy intent:
     PARENT header (.mud-table-head) = primary, soft-blue gradient
     SUB-header (.gpc-sa-subheader)  = subordinate, much LIGHTER pale
                                       slate at 0.58rem in #9499A8

   The sub-header reads as a column-label cue for the practice rows
   below it, not as a competing header to the parent table's head.
   ────────────────────────────────────────────────────────────────────── */
.gpc-sa-subheader > .mud-table-cell {
    background: rgba(115, 120, 160, 0.06) !important;
    color: #9499A8 !important;
    font-size: 0.58rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 12px !important;
    height: 26px !important;
    border-bottom: 1px solid rgba(115, 120, 160, 0.18) !important;
    border-top: 1px solid rgba(115, 120, 160, 0.22) !important;
    vertical-align: middle;
}

/* Practice rows inside an expanded group. Subtler tint than the
   default row background so they read as part of the parent group's
   "block", not as standalone top-level rows. */
.gpc-sa-childrow > .mud-table-cell {
    background: rgba(115, 120, 160, 0.025);
    border-bottom: 1px solid rgba(115, 120, 160, 0.06) !important;
}

/* Last child row in a group's block gets a slightly stronger bottom
   border so the boundary between this group's children and the next
   group's parent row reads cleanly. */
.gpc-sa-childrow-last > .mud-table-cell {
    border-bottom: 1px solid rgba(115, 120, 160, 0.18) !important;
}

/* ──────────────────────────────────────────────────────────────────────
   Audit-log diff view (C3 / MVP commit 6/8).

   Lives on /admin/audit-log inside the inline-expansion row beneath
   each audit row. The diff is structured (top-level object key set,
   union of Before + After) and the row colour highlights the
   change axis at a glance:
     - Changed (yellow): present in both, values differ
     - Added   (green) : present only in After
     - Removed (red)   : present only in Before
     - Same    (dim)   : present in both, values equal

   Field-status order in ComputeKeys puts changed-first so the eye
   snaps to the diff on rows like Site.PriceOverride.Set without
   scrolling past 12 unchanged columns.
   ────────────────────────────────────────────────────────────────────── */

.audit-diff-view {
    padding: 12px 16px;
    background: rgba(115, 120, 160, 0.025);
    border-top: 1px solid rgba(115, 120, 160, 0.12);
    border-bottom: 1px solid rgba(115, 120, 160, 0.12);
}

.audit-diff-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.78rem;
}

.audit-diff-table thead th {
    text-align: left;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(115, 120, 160, 0.18);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9499A8;
}

.audit-diff-table .audit-diff-field-col { width: 200px; }
.audit-diff-table .audit-diff-value-col { width: calc(50% - 100px); }

.audit-diff-table td {
    padding: 4px 12px;
    border-bottom: 1px solid rgba(115, 120, 160, 0.06);
    vertical-align: top;
    word-break: break-word;
}

.audit-diff-field {
    color: #565C82;
    font-weight: 600;
}

.audit-diff-null {
    color: #b0b3c2;
    font-style: italic;
}

.audit-diff-json {
    background: rgba(115, 120, 160, 0.08);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.72rem;
}

/* Row colour by status. Same wins via fall-through (default tone);
   changed / added / removed each get a left-edge accent + cell
   background tint so the row reads the change axis at a glance. */
.audit-diff-row-same .audit-diff-value {
    color: #999;
}

.audit-diff-row-changed .audit-diff-value {
    background: rgba(255, 196, 0, 0.10);
    border-left: 2px solid rgba(255, 158, 0, 0.55);
}

.audit-diff-row-changed .audit-diff-field {
    color: #b06b00;
}

.audit-diff-row-added .audit-diff-value {
    background: rgba(63, 142, 152, 0.10);
    border-left: 2px solid rgba(63, 142, 152, 0.55);
}

.audit-diff-row-added .audit-diff-field {
    color: #2d6970;
}

.audit-diff-row-removed .audit-diff-value {
    background: rgba(196, 68, 68, 0.10);
    border-left: 2px solid rgba(196, 68, 68, 0.55);
}

.audit-diff-row-removed .audit-diff-field {
    color: #983131;
}

/* Reason banner above the diff - when the SA wrote a reason at
   suspend / clear time, surface it prominently above the table.
   Stays within the audit-diff-view padded block so it reads as
   part of the same expansion. */
.audit-diff-reason {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(63, 142, 152, 0.06);
    border-left: 3px solid #3F8E98;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
}

.audit-diff-reason-label {
    color: #565C82;
    font-weight: 700;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-right: 8px;
}
