/* =========================================================================================
   OAuth 2.0 Server -- admin pages on the Inspinia theme.

   Loaded LAST by Views/Shared/Partials/_HeadCSS.cshtml so these overrides win without
   !important. The sign-in pages (_BaseLayout) do not load this file; they use css/auth.css.

   Inspinia rebuilds Bootstrap with $prefix: theme, so every custom property is --theme-*. A
   var(--bs-...) or SmartAdmin var(--primary-500) reference is silently dropped (half a rule
   applies: e.g. white text on a background that never painted) -- there are none left here, and
   there should not be any again. Rules ported from the sibling apps (BI, Valuables) carry their
   reasoning; the measured contrast figures come from those apps' re-skins.
   ========================================================================================= */

/* ── Root size ─────────────────────────────────────────────────────────────────────────────
   Every size in the theme is rem-based, so this one value sets card padding, control heights,
   radii and the sidebar's type all at once. 16px x 0.9 = 14.4px matches BI and Valuables.
   The scale is a custom property so the topbar's A- / A / A+ control (AppFont in _HeadCSS)
   multiplies it instead of replacing it; the 0.9 fallback IS the default and must stay equal
   to DEFAULT in that script. */
html {
    font-size: calc(16px * var(--app-font-scale, 0.9));
    position: relative;
    min-height: 100%;
}

/* ── Small legacy utilities still used by the views ──────────────────────────────────────── */
.hide {
    display: none;
}

/* Truncates the topbar / sidenav greeting. It used to widen to 500px on hover as well, which in
   the application grids (full client secret in this span) re-laid out the table under the
   pointer: the hover ended, the cell shrank, the hover started again -- the flicker users saw.
   Secrets are masked now (.secret-cell below) and nothing here changes size on hover. */
.text-overflow {
    max-width: 130px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: block;
}

/* Top bar company picker (Super Admin): the picked name is cut short in the bar, and a long list of
   companies scrolls inside the menu. */
.company-picker-label {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-picker-menu {
    width: 320px;
}
.company-picker-list {
    max-height: 60vh;
    overflow-y: auto;
}

/* Integration guides (Edit user > API keys, Applications > Guide; Views/Shared/Partials/_GuideCode):
   code scrolls inside its own box instead of widening the modal. */
.guide-facts th {
    width: 11rem;
    color: var(--theme-secondary-color);
    font-weight: 600;
    white-space: nowrap;
}
.guide-facts code {
    word-break: break-all;
}
.guide-steps li {
    margin-bottom: .4rem;
}
.guide-file-head {
    padding: .2rem .5rem;
    border: var(--theme-border-width) solid var(--theme-border-color);
    border-bottom: 0;
    border-radius: var(--theme-border-radius) var(--theme-border-radius) 0 0;
    background: var(--theme-secondary-bg);
}
.guide-code {
    max-height: 420px;
    overflow: auto;
    padding: .75rem;
    background: var(--theme-tertiary-bg);
    border: var(--theme-border-width) solid var(--theme-border-color);
    border-radius: var(--theme-border-radius);
    font-size: .78rem;
    line-height: 1.5;
    white-space: pre;
}
.guide-file .guide-code {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.guide-code code {
    color: var(--theme-body-color);
    background: none;
    padding: 0;
}

/* Masked client secret + copy button (site.js renderSecretCell, _SecretCell partial). */
.secret-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.secret-cell .secret-mask {
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

.secret-cell .copy-secret {
    width: 1.75rem;
    height: 1.75rem;
}

/* Profile / company picture with an "Update" caption on hover (Profile pages). */
a.darken {
    display: inline-block;
    padding: 0;
    position: relative;
    cursor: pointer;
}

    a.darken img {
        display: block;
        transition: all 0.2s linear;
    }

    a.darken:hover img {
        opacity: 0.3;
    }

    a.darken span {
        visibility: hidden;
        font-size: 16px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        line-height: 100%;
    }

    a.darken:hover span {
        visibility: visible;
        transition: all 0.2s linear;
    }

.profile-image1 {
    height: 3.125rem;
}

/* Profile picture and company logo (profile page). A fixed square with the whole image inside
   it: the picture used to be .rounded-circle at its natural size, so any image that was not
   square -- most logos -- showed as a stretched oval. contain keeps a logo whole; the tinted
   background fills the margins of a wide or tall one. */
.profile-picture {
    width: 9rem;
    height: 9rem;
    object-fit: contain;
    background-color: var(--theme-tertiary-bg);
}

/* SmartAdmin font-weight utilities still used inside headings (fw-300 is the italic "List!"
   half of the card titles). Bootstrap has fw-light / fw-semibold / fw-bold, but not these. */
.fw-300 { font-weight: 300 !important; }
.fw-500 { font-weight: 500 !important; }
.fw-700 { font-weight: 700 !important; }

/* Company-code look-up dropdown (bootstrap-autocomplete on Add New Company). */
.bootstrap-autocomplete {
    overflow: auto;
    min-height: auto;
    max-height: 280px;
}

/* ── Card titles ────────────────────────────────────────────────────────────────────────────
   The card headers keep their SmartAdmin-era <h2> ("Company <i>List!</i>"); it is styled here as
   Inspinia's .card-title rather than renaming every heading (BI did the same). */
.card-header > h2,
.card-header > h2.card-title {
    margin-bottom: 0;
    font-size: 1.03125rem;
    font-weight: var(--theme-font-weight-semibold, 600);
    line-height: 1.5;
}

/* ── Page heading icon (_PageTitle.cshtml) ──────────────────────────────────────────────────
   Tinted toward the brand but mixed with the body colour: --theme-primary alone is 2.65:1 on
   the light card. Sized in em so it tracks the heading. */
.page-title-icon {
    color: color-mix(in srgb, var(--theme-primary) 65%, var(--theme-body-color));
    margin-right: 0.45rem;
    font-size: 1.05em;
    vertical-align: -0.06em;
}

/* ── Flash alerts (_AlertPartial.cshtml) ────────────────────────────────────────────────────
   The icon inherits the alert's text colour. The text itself is mixed toward the body colour:
   this build's *-text-emphasis is barely darker than the base, which measured 2.4-2.6:1 on the
   pale alert backgrounds; 40% toward body colour clears 4.5:1 on all four, in both schemes. */
.alert-icon {
    font-size: 1.15em;
    vertical-align: -0.1em;
    margin-right: 0.4rem;
}

.alert {
    color: color-mix(in srgb, var(--theme-alert-color) 40%, var(--theme-body-color));
}

/* ── Tables ─────────────────────────────────────────────────────────────────────────────────
   Header row: a neutral tint, not the primary fill. --theme-primary is skin-dependent and the
   default skin's (#1ab394) gives white text 2.65:1; these tokens measure 7.8:1 and flip with the
   scheme and every skin. The :not() keeps an explicit bg-* on a thead in charge if one is added. */
.dt-bootstrap5 thead:not([class*="bg-"]) th,
.table > thead:not([class*="bg-"]) > tr > th {
    background-color: var(--theme-tertiary-bg);
    color: var(--theme-body-color);
}

/* ...and when a thead DOES carry a bg-* class, let it show through: a th paints over its thead
   and Bootstrap sets a colour on every cell, so neither the colour nor the text would reach it. */
.dt-bootstrap5 thead[class*="bg-"] th,
.table > thead[class*="bg-"] > tr > th {
    background-color: transparent;
    color: inherit;
}

/* Compact rows (BI / Valuables density): these are lists meant to be scanned. */
.table > :not(caption) > * > * {
    padding-top: .3rem;
    padding-bottom: .3rem;
}

.table > thead > tr > th {
    padding-top: .4rem;
    padding-bottom: .4rem;
}

/* The Company profile page shows each application's URIs and keys inside a one-item
   <ol class="breadcrumb"> per cell. Inspinia's breadcrumb carries padding and a bottom margin
   meant for the page heading, which made every row about twice as tall as its text. */
.table td > .breadcrumb {
    margin-bottom: 0;
    padding: 0;
    background-color: transparent;
}

/* ── DataTables ─────────────────────────────────────────────────────────────────────────────
   Our own DataTables build (ColReorder + FixedColumns + Buttons + altEditor). Its accent colours
   were SmartAdmin's fixed pinks and greens; they now follow the skin. */
.dt-paging {
    float: right;
}

.dataTables_empty {
    color: var(--theme-secondary-color);
}

/* The export buttons are a btn-group, which squares their inner corners into one segmented
   control; spaced apart, each reads as its own action. */
.dt-buttons.btn-group {
    gap: 0.375rem;
}

.dt-buttons.btn-group > .btn {
    border-radius: var(--theme-border-radius) !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > th:first-child:before,
table.dataTable.dtr-column > tbody > tr > td.control:before,
table.dataTable.dtr-column > tbody > tr > th.control:before {
    background-color: var(--theme-primary);
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before,
table.dataTable.dtr-column > tbody > tr.parent td.control:before,
table.dataTable.dtr-column > tbody > tr.parent th.control:before {
    background-color: var(--theme-success);
}

/* KeyTable focus and Select highlight */
table.dataTable tbody th.focus,
table.dataTable tbody td.focus,
table.dataTable tbody > tr.selected,
table.dataTable tbody > tr > .selected {
    box-shadow: inset 0 0 0 1px var(--theme-primary);
    background: rgba(var(--theme-primary-rgb), 0.1);
}

/* FixedColumns: the pinned first column is the SAME cells held in place with position:sticky,
   so without a background the scrolling row shows through and the text overlaps. The plugin
   paints them from --dtfc-* / --bs-table-bg, neither of which exists in this build. */
table.dataTable > thead > tr > .dtfc-fixed-start,
table.dataTable > thead > tr > .dtfc-fixed-end,
table.dataTable > tfoot > tr > .dtfc-fixed-start,
table.dataTable > tfoot > tr > .dtfc-fixed-end {
    background-color: var(--theme-tertiary-bg) !important;
}

table.dataTable > tbody > tr > .dtfc-fixed-start,
table.dataTable > tbody > tr > .dtfc-fixed-end {
    background-color: var(--theme-secondary-bg) !important;
    background-image: none !important;
}

table.dataTable.table-hover > tbody > tr:hover > .dtfc-fixed-start,
table.dataTable.table-hover > tbody > tr:hover > .dtfc-fixed-end {
    background-color: var(--theme-tertiary-bg) !important;
}

table.dataTable > thead > tr > .dtfc-fixed-start,
table.dataTable > tbody > tr > .dtfc-fixed-start {
    border-inline-end: 1px solid var(--theme-border-color) !important;
}

.dtfc-bottom-blocker,
.dtfc-top-blocker {
    background-color: var(--theme-secondary-bg) !important;
}

/* ── Buttons ────────────────────────────────────────────────────────────────────────────────
   The theme puts white text on every solid button, but on the default skin white measures
   2.65:1 on primary, 2.02:1 on success and 2.10:1 on info. Dark text measures 4.3-5.7:1, so only
   the label changes -- the button colours stay. --theme-btn-* are the theme's own per-button
   properties, so hover and active states follow. */
.btn-primary,
.btn-success,
.btn-info {
    --theme-btn-color: #313a46;
    --theme-btn-hover-color: #313a46;
    --theme-btn-active-color: #313a46;
    --theme-btn-disabled-color: #313a46;
}

/* ── Forms ──────────────────────────────────────────────────────────────────────────────────
   Read-only fields (the e-mail on the profile pages) read as not editable. */
.form-control:read-only {
    background-color: var(--theme-tertiary-bg);
    opacity: 1;
}

/* ── Select2 in the Inspinia palette ────────────────────────────────────────────────────────
   Select2 ships its own white theme with two-class selectors, which outrank a plain override;
   these match its specificity and use --theme-* so the control follows both schemes and every
   skin (in dark mode its multi-select tags were white text on #e4e4e4, i.e. invisible). */
.select2 {
    width: 100% !important;
}

.select2-container {
    z-index: 1060;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background-color: var(--theme-secondary-bg);
    border: var(--theme-border-width) solid var(--theme-border-color);
    border-radius: var(--theme-border-radius);
    color: var(--theme-body-color);
    min-height: calc(1.5em + .9064rem + 2px);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--theme-body-color);
    line-height: calc(1.5em + .9064rem);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + .9064rem);
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--theme-secondary-color);
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--theme-body-color) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--theme-body-color) transparent;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--theme-tertiary-bg);
    border: var(--theme-border-width) solid var(--theme-border-color);
    color: var(--theme-body-color);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--theme-secondary-color);
    border-color: var(--theme-border-color);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--theme-danger);
    background-color: transparent;
}

.select2-dropdown {
    background-color: var(--theme-secondary-bg);
    border: var(--theme-border-width) solid var(--theme-border-color);
}

.select2-results__options li {
    min-height: 31.11px;
}

.select2-container--default .select2-results__option {
    color: var(--theme-body-color);
}

/* Dark text on the highlight: white on the default skin's primary is 2.65:1. */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted[data-selected] {
    background-color: var(--theme-primary);
    color: #313a46;
}

.select2-container--default .select2-results__option[aria-selected="true"],
.select2-container--default .select2-results__option[data-selected="true"] {
    background-color: var(--theme-tertiary-bg);
    color: var(--theme-body-color);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--theme-secondary-bg);
    border: var(--theme-border-width) solid var(--theme-border-color);
    color: var(--theme-body-color);
}

.select2-container--default .select2-selection--multiple .select2-search__field {
    background-color: transparent;
    color: var(--theme-body-color);
}

.select2-search__field::placeholder {
    color: var(--theme-secondary-color);
    opacity: 1;
}

/* ── .text-dark on a background that does NOT follow the theme ──────────────────────────────
   Bootstrap 5.3 made .text-dark theme-responsive (near-white in dark mode), which is right on a
   dark surface. It goes wrong only on a surface that stays light in both schemes: .bg-warning
   (1.46:1) and .bg-white (1.30:1). Pinned per background -- never globally. #313a46 is what
   .text-dark computes to in light mode, so light mode is unchanged. */
html[data-bs-theme="dark"] .bg-warning.text-dark,
html[data-bs-theme="dark"] .bg-warning.text-dark:hover,
html[data-bs-theme="dark"] .bg-white.text-dark,
html[data-bs-theme="dark"] .bg-white.text-dark:hover {
    color: #313a46 !important;
}

/* ── Luxe skin ─────────────────────────────────────────────────────────────────────────────
   Luxe paints a 150px banner behind .page-title-head and forces the heading white when the
   topbar is dark. Our headings sit in a bar the banner only partly covers, so drop the banner
   and keep the normal heading colour (same fix as BI and Valuables). */
html[data-skin="luxe"] .page-title-head::before {
    content: none;
}

html[data-skin="luxe"][data-topbar-color="dark"] .page-title-head,
html[data-skin="luxe"][data-topbar-color="gradient"] .page-title-head,
html[data-skin="luxe"][data-topbar-color="dark"] .page-title-head .breadcrumb-item a,
html[data-skin="luxe"][data-topbar-color="gradient"] .page-title-head .breadcrumb-item a {
    color: var(--theme-body-color);
}

/* ── Muted text and the current breadcrumb ──────────────────────────────────────────────────
   Both use --theme-secondary-color, which measured 2.46:1 (.text-muted) and 2.38:1 (the active
   breadcrumb) on the light card -- too faint for the stat-tile labels and page subtitles. Mixed
   45% toward the body colour it clears 4.5:1, and in dark mode it lightens rather than darkens,
   so one rule serves both (the same mix BI uses for its chart labels). */
.text-muted {
    color: color-mix(in srgb, var(--theme-secondary-color) 45%, var(--theme-body-color)) !important;
}

.breadcrumb-item.active {
    color: color-mix(in srgb, var(--theme-secondary-color) 45%, var(--theme-body-color));
}

/* ── Text-size buttons (A- / A / A+) in the topbar ──────────────────────────────────────────
   btn-outline-secondary paints them in the theme's blue "secondary" (4.07:1 light, 3.69:1 dark).
   They sit in the topbar, whose colour is chosen independently of the page (data-topbar-color),
   so they take the topbar's own item colour -- the one its icons already use -- rather than the
   body colour, which would be dark-on-dark on a dark topbar. */
.app-topbar .btn-group[aria-label="Text size"] > .btn {
    --theme-btn-color: var(--theme-topbar-item-color);
    --theme-btn-border-color: color-mix(in srgb, var(--theme-topbar-item-color) 45%, transparent);
    --theme-btn-hover-color: var(--theme-topbar-item-hover-color);
    --theme-btn-hover-bg: transparent;
    --theme-btn-hover-border-color: var(--theme-topbar-item-hover-color);
    --theme-btn-active-color: var(--theme-topbar-item-hover-color);
    --theme-btn-active-bg: transparent;
    --theme-btn-active-border-color: var(--theme-topbar-item-hover-color);
}

/* ── Sidebar icon centring ──────────────────────────────────────────────────────────────────
   The theme centres .menu-icon content with text-align, which gives no vertical centring;
   flex centres the icon on both axes in every sidenav size. */
.side-nav .side-nav-item .side-nav-link .menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

html[data-sidenav-size="condensed"] .sidenav-menu .side-nav .side-nav-item .side-nav-link .menu-icon,
html[data-sidenav-size="compact"] .sidenav-menu .side-nav .side-nav-item .side-nav-link .menu-icon {
    align-items: center;
}

/* ── Sidebar brand (the logo above the menu, beside the topbar) ─────────────────────────────
   The theme sizes the logo for its own wordmark: 55px tall (--theme-logo-lg-height) in the 65px
   bar, and indented 41px -- 12px padding on BOTH nested .logo elements plus 17px on .logo-lg.
   The dnata wordmark filled the bar edge to edge and sat ~20px right of the menu icons and user
   block below it, so the left pane and the top bar did not line up. Measured after this: 40px
   tall, centred on the topbar's middle line, left edge at 20px like the menu icons. The
   condensed size (logo-sm, centred by the theme with padding 0) is unaffected. */
.sidenav-menu > .logo > .logo {
    padding: 0;
}

.sidenav-menu .logo span.logo-lg {
    padding-left: 8px;
}

.sidenav-menu .logo span.logo-lg img {
    height: 40px;
}

/* User pictures (sidebar user block, topbar). They were circles with object-fit: cover, which cut
   any picture that is not a square portrait -- a company logo used as the picture lost both ends.
   A rounded square showing the whole image on a tinted background works for photos and logos
   alike. Same treatment as .profile-picture on the profile page. */
.user-avatar {
    object-fit: contain;
    border-radius: var(--theme-border-radius);
    background-color: var(--theme-tertiary-bg);
}

/* ── Charts (ApexCharts via js/apex-theme.js) ───────────────────────────────────────────────
   app.min.css fills axis/title text with --theme-secondary-color, 2.46:1 on the light card for
   11px labels. Mixed toward the body colour it measures 4.59:1 and lightens in dark mode. It has
   to be CSS: Apex writes SVG presentation attributes, which any CSS rule beats. */
.apexcharts-title-text,
.apexcharts-subtitle-text,
.apexcharts-xaxis text,
.apexcharts-yaxis text {
    fill: color-mix(in srgb, var(--theme-secondary-color) 45%, var(--theme-body-color));
}

/* ── Theme customizer: font type + font colour ──────────────────────────────────────────────
   Driven by _Customizer.cshtml, config.js (applyThemeFont) and app.js -- same as BI. The
   attributes are only on <html> once the user picks something, so the default look is untouched.
   Font family: no !important, so semantic colours/classes keep their meaning. */
html[data-font="inter"] body { font-family: "Inter", system-ui, -apple-system, sans-serif; }
html[data-font="serif"] body { font-family: Georgia, "Times New Roman", serif; }
html[data-font="mono"] body { font-family: "Courier New", ui-monospace, monospace; }
html[data-font="rounded"] body { font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; }

/* Font colour is four independent settings, each active only while its marker attribute is set. */
html[data-user-text-color] body { color: var(--user-text-color); }

html[data-user-text-color] .table > :not(caption) > * > *,
html[data-user-text-color] table.dataTable > tbody > tr > td,
html[data-user-text-color] table.dataTable > thead > tr > th { color: var(--user-text-color) !important; }

html[data-user-label-color] .control-label,
html[data-user-label-color] label,
html[data-user-label-color] .form-label,
html[data-user-label-color] .form-check-label { color: var(--user-label-color) !important; }

html[data-user-input-color] .form-control,
html[data-user-input-color] .form-select,
html[data-user-input-color] textarea.form-control { color: var(--user-input-color) !important; }

html[data-user-nav-color] .sidenav-menu .side-nav-link,
html[data-user-nav-color] .sidenav-menu .side-nav-link .menu-text,
html[data-user-nav-color] .sidenav-menu .side-nav-title { color: var(--user-nav-color) !important; }

/* ── Stat tiles (Applications, Audit Log, Dashboard) ────────────────────────────────────────
   A thin accent on the left in the tile's colour; the tile is otherwise a plain theme card,
   so it follows light / dark and every skin. */
.stat-tile {
    border-left: 3px solid var(--stat-accent, var(--theme-primary));
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--theme-box-shadow);
}

.stat-tile-primary { --stat-accent: var(--theme-primary); }
.stat-tile-success { --stat-accent: var(--theme-success); }
.stat-tile-danger { --stat-accent: var(--theme-danger); }
.stat-tile-warning { --stat-accent: var(--theme-warning); }
.stat-tile-info { --stat-accent: var(--theme-info); }
.stat-tile-secondary { --stat-accent: var(--theme-secondary); }

.min-w-0 { min-width: 0; }

/* ── Audit log (Views/AuditLog, js/audit-log.js) ───────────────────────────────────────────── */
.audit-views .nav-link {
    padding: 0.3rem 0.8rem;
    font-size: 0.8125rem;
}

.audit-table tbody tr { cursor: pointer; }

.audit-table .audit-sub {
    max-width: 24rem;
    color: color-mix(in srgb, var(--theme-secondary-color) 45%, var(--theme-body-color));
}

.audit-action { max-width: 22rem; }

/* Category chip: an icon in a tinted square, one hue per category. */
.audit-cat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: var(--theme-border-radius);
    font-size: 1rem;
    color: var(--audit-cat, var(--theme-secondary));
    background-color: color-mix(in srgb, var(--audit-cat, var(--theme-secondary)) 15%, transparent);
}

.audit-cat-authentication { --audit-cat: var(--theme-success); }
.audit-cat-token { --audit-cat: var(--theme-primary); }
.audit-cat-authorization { --audit-cat: var(--theme-purple, var(--theme-primary)); }
.audit-cat-account { --audit-cat: var(--theme-info); }
.audit-cat-admin { --audit-cat: var(--theme-warning); }
.audit-cat-data { --audit-cat: var(--theme-danger); }
.audit-cat-security { --audit-cat: var(--theme-danger); }
.audit-cat-api { --audit-cat: var(--theme-info); }
.audit-cat-navigation,
.audit-cat-request { --audit-cat: var(--theme-secondary); }

/* ISO country code as a small tag (flag images are not part of this app). */
.audit-cc {
    display: inline-block;
    min-width: 1.75rem;
    padding: 0 0.3rem;
    border: 1px solid var(--theme-border-color);
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.3rem;
    text-align: center;
    color: var(--theme-body-color);
}

.audit-map {
    height: 230px;
    position: relative;
}

.audit-share {
    width: 3.5rem;
    height: 0.35rem;
}

.audit-toplist li.audit-pick { cursor: pointer; }
.audit-toplist li.audit-pick:hover { background-color: var(--theme-tertiary-bg); }

.audit-outcome { font-weight: 600; }

/* ── Dashboard (Views/Home/Index.cshtml) ───────────────────────────────────────────────────
   Welcome header: the theme's primary washed into the card from the left, and a large faint
   shield on the right. Built from tokens, so it follows light / dark and every skin. */
.dash-hero {
    background-image: linear-gradient(110deg,
        color-mix(in srgb, var(--theme-primary) 16%, var(--theme-card-bg, var(--theme-body-bg))) 0%,
        var(--theme-card-bg, var(--theme-body-bg)) 65%);
    border-left: 3px solid var(--theme-primary);
}

.dash-hero-meta {
    color: color-mix(in srgb, var(--theme-secondary-color) 45%, var(--theme-body-color));
    font-size: 0.8125rem;
}

.dash-hero-mark {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%) rotate(-12deg);
    font-size: 6.5rem;
    line-height: 1;
    color: var(--theme-primary);
    opacity: 0.07;
    pointer-events: none;
}

/* The buttons sit above the watermark. */
.dash-hero .btn { position: relative; z-index: 1; }

.dash-feed .list-group-item {
    background: transparent;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

/* ── App Users (Views/AppUser, js/app-users.js, js/modal-crud.js) ──────────────────────────
   Photos are square crops (object-fit: cover) so any upload fills its circle; the empty
   background shows while a lazy one loads. */
.user-photo {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 50%;
    background-color: var(--theme-tertiary-bg);
}

.user-photo-lg {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: var(--theme-border-radius-lg);
}

/* The form's photo: a ring in the modal's own background colour sets it off the panel. */
.user-photo-xl {
    width: 7.5rem;
    height: 7.5rem;
    box-shadow: 0 0 0 4px var(--theme-modal-bg, var(--theme-body-bg)), 0 0 0 5px var(--theme-border-color);
}

.user-form-aside {
    background-color: var(--theme-tertiary-bg);
}

/* Section headings inside the form. --theme-secondary-color alone is 2.5:1 on the modal;
   mixed toward the body colour it reads like the chart labels (4.5:1+). */
.user-form-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px dashed var(--theme-border-color);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--theme-secondary-color) 45%, var(--theme-body-color));
}

.user-form-section .ti {
    font-size: 1rem;
    color: var(--theme-primary);
}

.user-search {
    width: 17rem;
    max-width: 100%;
}

.user-chips .nav-link {
    padding: 0.3rem 0.8rem;
    font-size: 0.8125rem;
}

.user-tile {
    cursor: pointer;
}

.user-tile:focus-visible {
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
}

.user-tile-progress {
    height: 4px;
}

.user-flag {
    display: inline-block;
    font-size: 1.1rem;
    line-height: 1;
    margin-right: 0.15rem;
}

#appUsersTable .user-sub {
    max-width: 16rem;
}

/* Only the table scrolls sideways on a narrow screen -- the pager and the count stay put. */
.app-users-table-wrap .dt-layout-table > .dt-layout-cell {
    overflow-x: auto;
}

/* ── Companies (Views/Company, js/companies.js) ───────────────────────────────────────────────
   Logos sit on a fixed white tile in both themes: most are dark artwork on a transparent
   background and would vanish on the dark card. contain, not cover -- a logo is never cropped. */
.company-logo {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    object-fit: contain;
    padding: 0.15rem;
    border-radius: var(--theme-border-radius);
    border: 1px solid var(--theme-border-color);
    background-color: #fff;
}

.company-logo-xl {
    width: 7.5rem;
    height: 7.5rem;
    padding: 0.5rem;
    border-radius: var(--theme-border-radius-lg);
}

a.company-stat:hover {
    border-color: var(--theme-primary) !important;
}
