/*
 * -------------------------------------------------------------------------
 * Entra governance plugin for GLPI — design tokens
 * -------------------------------------------------------------------------
 *
 * The token set mirrors the sibling Asset Protocols plugin's `--ap-*` system,
 * renamed `--en-*`, so the two plugins look like one product rather than two.
 * Where a token can defer to GLPI's own Tabler variable it does, with a literal
 * fallback: that way the plugin follows a theme change without needing to know
 * about it, and still renders correctly if a variable is ever renamed.
 *
 * Dark mode is handled by GLPI, which sets `data-glpi-theme-dark="1"` on the root
 * element. Because every colour below resolves through a Tabler variable, the
 * dark palette arrives for free — there is deliberately no second block here
 * duplicating the palette, which would only be one more thing to keep in step.
 *
 * Milestone 1 ships the tokens and nothing else. Components arrive with the
 * screens that need them (Milestone 8); a stylesheet full of rules no template
 * uses is dead code that still has to be reviewed.
 */

:root {
    /* -- Spacing ------------------------------------------------------- */
    --en-space-1: 4px;
    --en-space-2: 8px;
    --en-space-3: 12px;
    --en-space-4: 16px;
    --en-space-5: 24px;
    --en-space-6: 32px;
    --en-space-7: 48px;

    /* -- Radii --------------------------------------------------------- */
    --en-radius-sm: var(--tblr-border-radius-sm, 4px);
    --en-radius-md: var(--tblr-border-radius, 6px);
    --en-radius-lg: var(--tblr-border-radius-lg, 8px);
    --en-radius-pill: 999px;

    /* -- Elevation ----------------------------------------------------- */
    --en-shadow-xs: 0 1px 1px rgba(var(--tblr-body-color-rgb, 24, 36, 51), 0.04);
    --en-shadow-sm:
        0 1px 2px rgba(var(--tblr-body-color-rgb, 24, 36, 51), 0.06),
        0 1px 1px rgba(var(--tblr-body-color-rgb, 24, 36, 51), 0.04);
    --en-shadow-md: 0 8px 24px -6px rgba(var(--tblr-body-color-rgb, 24, 36, 51), 0.18);

    /* -- Typography ---------------------------------------------------- */
    --en-font: var(--tblr-font-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
    --en-font-mono: var(--tblr-font-monospace, Monaco, Consolas, 'Liberation Mono', monospace);

    --en-text-xs: 0.6875rem;
    --en-text-sm: 0.78125rem;
    --en-text-md: var(--tblr-body-font-size, 0.875rem);
    --en-text-lg: 1rem;
    --en-text-xl: 1.125rem;
    --en-text-2xl: 1.5rem;

    --en-leading-tight: 1.25;
    --en-leading-normal: 1.5;
    --en-tracking-caps: 0.04em;

    /* -- Surfaces and text --------------------------------------------- */
    /* The fallback is `transparent`, not `#fff`, and that is the whole of
     * finding M2.
     *
     * Six places pinned `var(--tblr-bg-surface, #fff)` while letting the text
     * colour come from GLPI's body. The two are a pair only while the variable
     * resolves. The 2026-09-01 review measured a co-installed theme under which
     * it does not: the fallback fired and cards rendered white with #9ca8c0
     * text, 2.39:1. I could not reproduce that palette here without
     * re-authenticating, so the failing state is taken on the review's
     * measurement; what IS verified locally is that with the token present the
     * card is unchanged (#fff on #fff, 10.31:1, identical before and after).
     *
     * Pinning a foreground beside each background would not fix it. The
     * BACKGROUND is the half that is wrong: `#fff` is an assertion about a theme
     * that has just said it has no such colour. `transparent` lets the card sit
     * on the page background instead - and page background against body colour
     * is the one pair a theme is obliged to keep readable. What is lost is the
     * card's tint; what is kept is the text. The border and shadow still
     * delimit the card.
     *
     * A second reason to route everything through one token: because
     * `--en-surface` is computed HERE, on `:root`, whatever `--tblr-bg-surface`
     * means at this point is what every card gets. Six copies of the literal
     * could not have been reasoned about that way. */
    --en-surface: var(--tblr-bg-surface, transparent);
    /* A sunken tone, DERIVED rather than borrowed.
     *
     * `--tblr-bg-surface-secondary` was the obvious choice and it inverts. GLPI's
     * dark palettes set `--tblr-light: #aaa` and Tabler maps
     * `--tblr-bg-surface-secondary: var(--tblr-light)` - while the same palettes
     * set `--tblr-body-color: #aaa`. Background and inherited text land on the
     * identical colour: a contrast ratio of exactly 1.00:1, invisible, in every
     * dark theme GLPI ships.
     *
     * Mixing the surface toward the body colour cannot invert, because those two
     * are the pair a theme is obliged to keep readable. It yields a subtle sunken
     * tone in light and dark alike. Core already uses `color-mix` for
     * `--tblr-bg-surface-dark`, so this needs nothing new of the browser. */
    --en-surface-sunken: color-mix(in srgb, var(--en-surface) 92%, var(--tblr-body-color, #182433));
    --en-surface-hover: color-mix(in srgb, var(--tblr-body-color, #182433) 4%, transparent);

    --en-border: var(--tblr-border-color, #dbe0e5);
    --en-border-strong: color-mix(in srgb, var(--tblr-border-color, #dbe0e5), var(--tblr-body-color, #182433) 25%);

    --en-fg: var(--tblr-body-color, #182433);
    --en-fg-muted: color-mix(in srgb, var(--tblr-body-color, #182433) 88%, var(--en-surface));
    --en-fg-subtle: color-mix(in srgb, var(--tblr-body-color, #182433) 70%, var(--en-surface));

    /*
     * -- Semantic tones -------------------------------------------------
     *
     * The brief (§74) asks for a colour system with a dimension most products do
     * not have: Cost, Identity and Security are *categories of meaning* here, not
     * severities. A cost figure is not a warning because it is large, and an
     * identity conflict is not an error because it needs a decision. Giving them
     * their own tones keeps the severity colours meaning severity.
     */
    --en-tone-neutral: var(--tblr-secondary, #6b7280);
    --en-tone-info: var(--tblr-info, #4299e1);
    --en-tone-success: var(--tblr-success, #2fb344);
    --en-tone-warning: var(--tblr-warning, #f59f00);
    --en-tone-danger: var(--tblr-danger, #d63939);

    --en-tone-cost: var(--tblr-purple, #7048e8);
    --en-tone-identity: var(--tblr-azure, #4299e1);
    --en-tone-security: var(--tblr-orange, #f76707);

    /* -- Sync status ---------------------------------------------------- */
    --en-status-queued: var(--en-tone-neutral);
    --en-status-running: var(--en-tone-info);
    --en-status-success: var(--en-tone-success);
    --en-status-partial: var(--en-tone-warning);
    --en-status-failed: var(--en-tone-danger);
    --en-status-cancelled: var(--en-tone-neutral);
}

/*
 * -- The login-page control ------------------------------------------------
 *
 * Rendered by Sso\LoginButton through Hooks::DISPLAY_LOGIN, on the one page this
 * plugin touches that is reachable without a session. It is deliberately quiet:
 * GLPI's own login form is the primary path on most installations, and an SSO
 * button that shouts is a button people click by mistake.
 *
 * The Microsoft mark is drawn in CSS rather than fetched, because the login page
 * is anonymous and an external asset request there would leak that this GLPI uses
 * Entra to anyone watching the network -- and would fail entirely on an
 * air-gapped instance.
 */

.en-sso {
    margin-block-start: var(--en-space-5);
    padding-block-start: var(--en-space-5);
    border-block-start: 1px solid var(--en-border);
}

.en-sso__button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--en-space-3);

    inline-size: 100%;
    padding: var(--en-space-3) var(--en-space-4);

    font: inherit;
    font-size: var(--en-text-md);
    color: var(--en-fg);
    text-decoration: none;

    background: var(--en-surface);
    border: 1px solid var(--en-border-strong);
    border-radius: var(--en-radius-md);

    transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.en-sso__button:hover,
.en-sso__button:focus-visible {
    background: var(--en-surface-hover);
    border-color: var(--en-tone-identity);
    text-decoration: none;
}

/* Keyboard focus must stay obvious: this is the only control some people can use. */
.en-sso__button:focus-visible {
    outline: 2px solid var(--en-tone-identity);
    outline-offset: 2px;
}

/* The four-square Microsoft mark, as a 2x2 grid of coloured quadrants. */
.en-sso__mark {
    inline-size: 18px;
    block-size: 18px;
    flex: 0 0 auto;

    background-image:
        linear-gradient(#f25022 0 0),
        linear-gradient(#7fba00 0 0),
        linear-gradient(#00a4ef 0 0),
        linear-gradient(#ffb900 0 0);
    background-size: 8px 8px;
    background-position: 0 0, 10px 0, 0 10px, 10px 10px;
    background-repeat: no-repeat;
}

.en-sso__label {
    font-weight: var(--en-weight-medium, 600);
}

/*
 * Automatic sign-in under way. The page stays on screen while the browser goes
 * to Microsoft and back, a second or two; the label says so and the mark
 * breathes, so the button does not look like it is waiting for a click.
 */
.en-sso__button[aria-busy="true"] {
    cursor: progress;
}

.en-sso__button[aria-busy="true"] .en-sso__mark {
    animation: en-sso-busy 0.9s ease-in-out infinite alternate;
}

@keyframes en-sso-busy {
    to {
        opacity: 0.35;
    }
}

@media (prefers-reduced-motion: reduce) {
    .en-sso__button[aria-busy="true"] .en-sso__mark {
        animation: none;
    }
}

/*
 * Automatic sign-in: the screen shown instead of the login page while the
 * browser goes to Microsoft and back, and on the callback page that finishes
 * it (Sso\AutoSignInPage). The same markup and these same rules on both, so
 * the hand-over between the two documents is invisible.
 *
 * Neutral by default. A theme sets the custom properties on `.en-auto`, or
 * restyles it outright: the callback page links every anonymous-page
 * stylesheet, so a theme that styles it on the login page styles it there too.
 */
html.en-auto-on,
html.en-auto-on body {
    overflow: hidden;
}

/* The login page underneath is never painted, not merely covered. */
html.en-auto-on body > :not(.en-auto) {
    visibility: hidden !important;
}

html.en-auto-on body.en-auto-page {
    margin: 0;
}

:where(.en-auto) {
    --en-auto-bg: #f6f7f9;
    --en-auto-fg: #1b1f24;
    --en-auto-muted: #59636e;
    --en-auto-track: rgb(0 0 0 / 8%);
    --en-auto-accent: #0078d4;
    --en-auto-font: inherit;
    --en-auto-ease: cubic-bezier(0.16, 1, 0.3, 1);

    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 2rem;

    background: var(--en-auto-bg);
    color: var(--en-auto-fg);
    font-family: var(--en-auto-font);
    /* Stated rather than inherited: the login page's body and the callback's
     * bare body differ, and the two frames must lay out identically. */
    font-size: 1rem;
    line-height: 1.5;
    letter-spacing: normal;
    -webkit-font-smoothing: antialiased;
    visibility: visible;
}

:where(.en-auto[hidden]) {
    display: none;
}

:where(.en-auto *),
:where(.en-auto *::before),
:where(.en-auto *::after) {
    box-sizing: border-box;
}

:where(.en-auto__body) {
    display: grid;
    justify-items: center;
    gap: 0.625rem;
    max-inline-size: 32rem;
    text-align: center;
}

:where(.en-auto__body > *) {
    animation: en-auto-rise 700ms var(--en-auto-ease) both;
}

:where(.en-auto__body > :nth-child(2)) { animation-delay: 60ms; }
:where(.en-auto__body > :nth-child(3)) { animation-delay: 120ms; }
:where(.en-auto__body > :nth-child(4)) { animation-delay: 180ms; }

/* Continuing on the callback page: the entrance has already been seen. */
:where(.en-auto--resume .en-auto__body > *) {
    animation: none;
}

/* The four squares, breathing one after another, clockwise. */
:where(.en-auto__mark) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    margin-block-end: 0.75rem;
}

:where(.en-auto__mark i) {
    display: block;
    animation: en-auto-breathe 1600ms ease-in-out infinite;
}

:where(.en-auto__mark i:nth-child(1)) { background: #f25022; }
:where(.en-auto__mark i:nth-child(2)) { background: #7fba00; animation-delay: 200ms; }
:where(.en-auto__mark i:nth-child(3)) { background: #00a4ef; animation-delay: 600ms; }
:where(.en-auto__mark i:nth-child(4)) { background: #ffb900; animation-delay: 400ms; }

:where(.en-auto[data-state="done"] .en-auto__mark i) {
    animation: none;
}

/* Two states in one grid cell: the title changes in place, without a jump. */
:where(.en-auto__title) {
    display: grid;
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

:where(.en-auto__state) {
    grid-area: 1 / 1;
    /* The shorter state sits in the middle of the space the longer one holds. */
    align-self: center;
    transition:
        opacity 280ms ease,
        transform 480ms var(--en-auto-ease);
}

:where(.en-auto__state--done) {
    opacity: 0;
    transform: translateY(0.45em);
}

:where(.en-auto[data-state="done"] .en-auto__state--working) {
    opacity: 0;
    transform: translateY(-0.45em);
}

:where(.en-auto[data-state="done"] .en-auto__state--done) {
    opacity: 1;
    transform: none;
}

:where(.en-auto__note) {
    margin: 0;
    color: var(--en-auto-muted);
    font-size: 0.9375rem;
}

:where(.en-auto__progress) {
    position: relative;
    display: block;
    overflow: hidden;
    inline-size: 12rem;
    block-size: 3px;
    margin-block-start: 1.25rem;
    border-radius: 3px;
    background: var(--en-auto-track);
}

:where(.en-auto__bar) {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    inline-size: 40%;
    border-radius: inherit;
    background: var(--en-auto-accent);
    animation: en-auto-travel 1400ms cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

:where(.en-auto[data-state="done"] .en-auto__bar) {
    animation: en-auto-complete 420ms var(--en-auto-ease) forwards;
}

@keyframes en-auto-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@keyframes en-auto-breathe {
    0%,
    60%,
    100% {
        opacity: 1;
        transform: none;
    }

    30% {
        opacity: 0.45;
        transform: scale(0.78);
    }
}

@keyframes en-auto-travel {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@keyframes en-auto-complete {
    from {
        inline-size: 40%;
        transform: none;
    }

    to {
        inline-size: 100%;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    :where(.en-auto__body > *),
    :where(.en-auto__mark i) {
        animation: none;
    }

    :where(.en-auto__state) {
        transition: opacity 200ms ease;
        transform: none !important;
    }

    :where(.en-auto__bar) {
        inline-size: 100%;
        animation: en-auto-glow 1600ms ease-in-out infinite alternate;
    }

    @keyframes en-auto-glow {
        from { opacity: 0.35; }
        to { opacity: 1; }
    }
}

/* ===================================================================
 * Milestone 8 — the plugin's own screens
 *
 * Everything below is nested under `.en-root`, which the layout wraps every
 * page in. Without that scope a rule like `.en-panel` would apply on any core
 * page a plugin ever renders a fragment into, and the resulting collision is
 * invisible until somebody opens an unrelated screen.
 * =================================================================== */

.en-root {
    --en-check-border: var(--tblr-border-color, #dadfe5);
}

/* -- Section navigation ---------------------------------------------- */

.en-root .en-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--en-space-2);
    border-block-end: 1px solid var(--en-check-border);
    padding-block-end: var(--en-space-2);
}

.en-root .en-subnav__item {
    display: inline-flex;
    align-items: center;
    gap: var(--en-space-2);
    padding: var(--en-space-2) var(--en-space-3);
    border-radius: var(--en-radius-md);
    color: inherit;
    text-decoration: none;
}

.en-root .en-subnav__item:hover {
    background: var(--en-surface-sunken);
}

.en-root .en-subnav__item.is-active {
    background: var(--en-surface-sunken);
    font-weight: var(--en-weight-medium, 600);
}

/* -- Cost view tabs ---------------------------------------------------
 *
 * A second level below .en-subnav, and visually subordinate to it on purpose:
 * "Ausgaben" and "Restwert" are two views of the same area, not two areas. An
 * underline marker rather than a filled pill, so the eye reads the plugin
 * navigation above first.
 */

.en-root .en-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--en-space-4);
    border-block-end: 1px solid var(--en-check-border);
}

.en-root .en-tabs__item {
    display: inline-flex;
    align-items: center;
    gap: var(--en-space-2);
    padding: var(--en-space-2) 0;
    /* The active item gains a border rather than a thicker one, so switching
     * tabs does not shift the row by two pixels. */
    border-block-end: 2px solid transparent;
    margin-block-end: -1px;
    color: inherit;
    text-decoration: none;
}

.en-root .en-tabs__item:hover {
    border-block-end-color: var(--en-check-border);
}

.en-root .en-tabs__item.is-active {
    border-block-end-color: var(--tblr-primary, #206bc4);
    font-weight: var(--en-weight-medium, 600);
}

/* Keyboard users get the same ring the scroll containers use - a focus stop
 * nobody can see is worse than one nobody can reach. */
.en-root .en-tabs__item:focus-visible {
    outline: 2px solid var(--tblr-primary, #206bc4);
    outline-offset: 2px;
    border-radius: var(--en-radius-sm, 3px);
}

/* -- The summary line ------------------------------------------------- */

.en-root .en-summary {
    display: flex;
    align-items: flex-start;
    gap: var(--en-space-4);
    padding: var(--en-space-4);
    border: 1px solid var(--en-check-border);
    border-radius: var(--en-radius-lg);
    background: var(--en-surface);
    box-shadow: var(--en-shadow-xs);
}

.en-root .en-summary__icon {
    font-size: 1.75rem;
    line-height: 1;
}

/* The status glyph beside a summary line, darkened for light palettes.
 *
 * Tabler's own `text-warning` (#f59f00) measures 2.13:1 on a white card and
 * `text-success` (#2fb344) 2.74:1 - both below the 3:1 that a graphic carrying
 * meaning would owe. These glyphs are `aria-hidden` and sit beside a full text
 * label that says the same thing, so they are decoration and the threshold does
 * not formally apply; a low-vision reader still gets nothing from a shape they
 * cannot see.
 *
 * Measured after: #b07400 gives 3.93:1 and #1a7f37 gives 5.08:1 on white.
 * Scoped to `.en-root` so nothing outside this plugin's pages is touched, and
 * left alone in dark palettes, where all three tones already clear 3:1 - the
 * light branch is the one that fails.
 */
.en-root .en-summary__icon.text-warning {
    color: #b07400;
}

.en-root .en-summary__icon.text-success {
    color: #1a7f37;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .en-root .en-summary__icon.text-warning,
    :root:not([data-theme="light"]) .en-root .en-summary__icon.text-success {
        color: inherit;
    }
}

.en-root .en-summary__line {
    margin: 0;
    font-size: 1.05rem;
    font-weight: var(--en-weight-medium, 600);
}

.en-root .en-summary__meta {
    margin: var(--en-space-1) 0 0;
    color: var(--tblr-secondary, #667382);
    font-size: 0.875rem;
}

/* -- Diagnostic cards -------------------------------------------------- */

.en-root .en-checks {
    display: grid;
    gap: var(--en-space-4);
    margin-block-start: var(--en-space-5);
}

.en-root .en-check {
    border: 1px solid var(--en-check-border);
    /* The status stripe is on the inline start rather than being the only
     * signal: colour alone fails for a colour-blind reader and in a printout,
     * so the icon and the badge text carry it too. */
    border-inline-start-width: 4px;
    border-radius: var(--en-radius-lg);
    padding: var(--en-space-4);
    background: var(--en-surface);
}

.en-root .en-check--critical { border-inline-start-color: var(--tblr-danger, #d63939); }
.en-root .en-check--warning  { border-inline-start-color: var(--tblr-warning, #f76707); }
.en-root .en-check--unknown  { border-inline-start-color: var(--tblr-secondary, #667382); }
.en-root .en-check--ok       { border-inline-start-color: var(--tblr-success, #2fb344); }

.en-root .en-check__head {
    display: flex;
    align-items: center;
    gap: var(--en-space-3);
}

.en-root .en-check__title {
    margin: 0;
    font-size: 1rem;
    font-weight: var(--en-weight-medium, 600);
}

.en-root .en-check__badge {
    margin-inline-start: auto;
}

.en-root .en-check__body {
    display: grid;
    grid-template-columns: minmax(9rem, max-content) 1fr;
    gap: var(--en-space-2) var(--en-space-4);
    margin: var(--en-space-3) 0 0;
}

.en-root .en-check__body dt {
    color: var(--tblr-secondary, #667382);
    font-weight: var(--en-weight-normal, 400);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.en-root .en-check__body dd {
    margin: 0;
}

.en-root .en-check__link {
    margin-inline-start: var(--en-space-2);
    white-space: nowrap;
}

.en-root .en-check__facts {
    margin-block-start: var(--en-space-3);
    font-size: 0.875rem;
}

.en-root .en-check__facts summary {
    cursor: pointer;
    color: var(--tblr-secondary, #667382);
}

/* On a narrow screen the two-column definition list becomes unreadable long
 * before it becomes cramped, so it stacks rather than shrinking. */
@media (max-width: 40rem) {
    .en-root .en-check__body {
        grid-template-columns: 1fr;
        gap: var(--en-space-1);
    }

    .en-root .en-check__body dd {
        margin-block-end: var(--en-space-2);
    }
}

/* -- Dashboard tiles ---------------------------------------------------- */

.en-root .en-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--en-space-4);
}

.en-root .en-tile {
    border: 1px solid var(--en-check-border);
    border-radius: var(--en-radius-lg);
    padding: var(--en-space-4);
    background: var(--en-surface);
}

.en-root .en-tile__label {
    margin: 0;
    color: var(--tblr-secondary, #667382);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.en-root .en-tile__value {
    margin: var(--en-space-1) 0 0;
    font-size: 1.75rem;
    font-weight: var(--en-weight-medium, 600);
    line-height: 1.1;
}

/* An unknown figure is deliberately quiet. Rendering "unbekannt" at the same
 * weight as a real number invites it to be read as one. */
.en-root .en-tile__value--unknown {
    font-size: 1.25rem;
    color: var(--tblr-secondary, #667382);
    font-style: italic;
}

.en-root .en-tile__qualifier {
    margin: var(--en-space-2) 0 0;
    color: var(--tblr-secondary, #667382);
    font-size: 0.8125rem;
    line-height: 1.4;
}

/* -- Panels and forms ---------------------------------------------------- */

.en-root .en-panel {
    border: 1px solid var(--en-check-border);
    border-radius: var(--en-radius-lg);
    padding: var(--en-space-5);
    background: var(--en-surface);
}

.en-root .en-panel--danger {
    border-color: var(--tblr-danger, #d63939);
}

.en-root .en-panel__title {
    margin: 0 0 var(--en-space-2);
    font-size: 1.125rem;
    font-weight: var(--en-weight-medium, 600);
}

/* The same heading, outside a panel.
 *
 * The diagnostics page is a list of cards rather than a panel, and it had no h2
 * at all - GLPI's h1 was followed straight by the cards' h3, so the outline
 * claimed a nesting level that was not there. */
.en-root .en-section__title {
    margin: 0 0 var(--en-space-2);
    font-size: 1.125rem;
    font-weight: var(--en-weight-medium, 600);
}

.en-root .en-panel__intro {
    margin: 0 0 var(--en-space-4);
    color: var(--tblr-secondary, #667382);
}

.en-root .en-switch + .en-switch {
    margin-block-start: var(--en-space-4);
    padding-block-start: var(--en-space-4);
    border-block-start: 1px solid var(--en-check-border);
}

/* The note is not fine print: it is the consequence of ticking the box, and it
 * sits at body size for that reason. */
.en-root .en-switch__note {
    margin: var(--en-space-1) 0 0 2.5rem;
    color: var(--tblr-secondary, #667382);
    font-size: 0.875rem;
    line-height: 1.5;
}

.en-root .en-unknowns {
    margin: 0;
    padding-inline-start: var(--en-space-5);
}

.en-root .en-unknowns li + li {
    margin-block-start: var(--en-space-2);
}

/* -- The setup wizard ---------------------------------------------------- */

.en-root .en-steps {
    list-style: none;
    margin: 0;
    padding: 0;
}

.en-root .en-step {
    border: 1px solid var(--en-check-border);
    border-radius: var(--en-radius-lg);
    padding: var(--en-space-5);
    background: var(--en-surface);
}

.en-root .en-step + .en-step {
    margin-block-start: var(--en-space-4);
}

/* Done and current are marked on the inline edge, never by colour alone: the
 * step number in the heading carries the same information as text, so the page
 * still reads in a printout and for a colour-blind reader. */
.en-root .en-step.is-done {
    border-inline-start: 4px solid var(--tblr-success, #2fb344);
}

.en-root .en-step.is-current {
    border-inline-start: 4px solid var(--tblr-primary, #206bc4);
}

.en-root .en-step__title {
    margin: 0 0 var(--en-space-3);
    font-size: 1.125rem;
    font-weight: var(--en-weight-medium, 600);
}

.en-root .en-step__note {
    color: var(--tblr-secondary, #667382);
    font-size: 0.875rem;
}

/* A redirect URI is copied by hand into another system, so it has to survive
 * being read aloud and being wrapped: no ellipsis and no horizontal scroll. */
.en-root .en-code {
    display: inline-block;
    padding: var(--en-space-2) var(--en-space-3);
    border-radius: var(--en-radius-sm);
    background: var(--en-surface-sunken);
    /* Pinned, because `<code>` otherwise inherits Tabler's `--tblr-code-color`,
     * which is a `light-dark()` pair - and GLPI never sets `color-scheme: dark`,
     * so the LIGHT branch wins even in a dark palette. Measured on auror_dark:
     * #535f71 on #2d3847 = 1.83:1. The body colour gives 4.96:1.
     *
     * The same class on a <span> was fine, so the identical class rendered
     * readable or unreadable depending on the element it sat on. This is
     * finding 5's root cause arriving by a different route: the background was
     * made theme-safe and the foreground was left to chance. Wherever one is
     * pinned, pin the other. */
    color: var(--tblr-body-color, #182433);
    font-family: var(--tblr-font-monospace, monospace);
    word-break: break-all;
}

.en-root .en-permissions code {
    white-space: nowrap;
}

/* -- Tables the report pages share --------------------------------------- */

/* A wide table on a narrow screen must scroll inside itself, never widen the
 * page: a horizontally scrolling document hides the navigation. */
.en-root .en-scroller {
    overflow-x: auto;
    max-inline-size: 100%;
}

/* A scroll container carries `tabindex="0"` so a keyboard can reach the columns
 * that are off-screen — measured at 375 px, the run table is 1128 px wide inside
 * a 325 px box, and eight of its thirteen columns were unreachable without a
 * mouse.
 *
 * Making it focusable is only half of it. A focus stop with no visible ring is a
 * keyboard user tabbing into a place they cannot see, which is worse than not
 * being able to get there: they no longer know where they are. Both the
 * plugin's own scroller and Bootstrap's `.table-responsive` are covered, because
 * the pages use whichever suits and the requirement is the same.
 *
 * `:focus-visible` rather than `:focus`, so a click does not draw a ring nobody
 * asked for. */
.en-root .en-scroller:focus-visible,
.en-root .table-responsive:focus-visible {
    outline: 2px solid var(--en-tone-identity);
    outline-offset: 2px;
}

.en-root .en-table {
    inline-size: 100%;
    border-collapse: collapse;
}

.en-root .en-table th,
.en-root .en-table td {
    padding: var(--en-space-2) var(--en-space-3);
    border-block-end: 1px solid var(--en-check-border);
    text-align: start;
    vertical-align: top;
}

/* Money and counts line up on the decimal, which is the only way a column of
 * figures can be scanned for an outlier. */
.en-root .en-table .en-num {
    text-align: end;
    font-variant-numeric: tabular-nums;
}

/* An unknown or not-yet-computed figure is deliberately quiet, so it cannot be
 * mistaken for a real one at a glance. */
.en-root .en-unknown {
    color: var(--tblr-secondary, #667382);
    font-style: italic;
}

/* A caveat that belongs WITH a figure rather than in a footnote nobody reads. */
.en-root .en-caveat {
    margin: var(--en-space-2) 0 0;
    padding: var(--en-space-3);
    border-inline-start: 3px solid var(--tblr-warning, #f76707);
    background: var(--en-surface-sunken);
    color: var(--tblr-secondary, #667382);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* -- Status badges ---------------------------------------------------------
 *
 * Tabler's `bg-*-lt` badge is tone-coloured 12px text on a 10%-alpha wash of the
 * same tone. Measured on GLPI's default palette: warning 1.98:1, success 2.49:1,
 * danger 4.04:1, secondary 4.43:1 - every state below WCAG AA's 4.5:1, and worse
 * in print, where the background is suppressed and the warning tone lands at
 * 2.13:1 on white.
 *
 * That is bad anywhere and pointed here: this badge is the element the diagnostic
 * card nominates as the reason colour is not the only signal. The carrier meant
 * to survive colour-blindness and a photocopier was the one a low-vision reader
 * could not read at all.
 *
 * So the colour stops carrying the legibility. The label is body colour on the
 * plugin's own sunken surface - the one pair every theme is obliged to keep
 * readable - and the status tone moves to a border and a dot, where being a tone
 * is all it has to be.
 */

.en-root .en-badge {
    --en-badge-tone: var(--tblr-secondary, #667382);

    display: inline-flex;
    align-items: center;
    gap: var(--en-space-2);
    padding: 0.0625rem var(--en-space-2);
    border: 1px solid var(--en-badge-tone);
    border-radius: var(--en-radius-pill);
    background: var(--en-surface-sunken);
    color: var(--tblr-body-color, #182433);
    font-size: 0.75rem;
    line-height: 1.6;
    white-space: nowrap;
}

/* The dot is the colour. It is decorative - the word beside it says the same
 * thing - so it is not announced and does not need to be.
 *
 * Which is also the answer to audit finding a11y 9, which measured these tones
 * below 3:1 against the sunken surface in light palettes. WCAG 1.4.11 asks for
 * that ratio of a graphic REQUIRED to understand the content, and this one is
 * not: remove it and the badge still reads "aktiv".
 *
 * Repainting them was the wrong fix and was rejected. The tones are GLPI's own
 * --tblr-success and friends, so overriding them would make this plugin the one
 * place in the instance where a warning is a different colour - trading a
 * non-issue for a real one, and for a reader who navigates by colour that is
 * worse than the finding.
 *
 * What the exemption rests on is the word being there. So `tools/check-a11y.py`
 * now fails on an `.en-badge` with no text: an empty one is a status carried by
 * colour alone, and THAT is a 1.4.11 failure. The premise is checked rather than
 * asserted in a comment - including this one. */
.en-root .en-badge::before {
    content: "";
    flex: 0 0 auto;
    inline-size: 0.5rem;
    block-size: 0.5rem;
    border-radius: 50%;
    background: var(--en-badge-tone);
}

.en-root .en-badge--success { --en-badge-tone: var(--tblr-success, #2fb344); }
.en-root .en-badge--warning { --en-badge-tone: var(--tblr-warning, #f76707); }
.en-root .en-badge--danger { --en-badge-tone: var(--tblr-danger, #d63939); }
.en-root .en-badge--secondary { --en-badge-tone: var(--tblr-secondary, #667382); }
.en-root .en-badge--blue { --en-badge-tone: var(--tblr-blue, #206bc4); }
.en-root .en-badge--azure { --en-badge-tone: var(--tblr-azure, #4299e1); }

/* Print, and the previous rule here had it exactly backwards.
 *
 * The comment said "the dot survives and the border may not". It is the other
 * way round: the dot is a `background` on `::before`, and browsers suppress
 * backgrounds in print by default, while a border is a border and prints. So
 * the rule then set `border-color: currentColor` - stripping the status colour
 * from the one carrier that WAS going to survive, on the strength of a belief
 * about the one that was not.
 *
 * Nothing was lost to a reader, because the word beside the dot says the same
 * thing and the card's own stripe is also a border. But the rule did the
 * opposite of what it was written to do, which is worth more than a comment fix:
 * an inverted rule is a rule somebody will reason from again.
 *
 * The border keeps its tone. `print-color-adjust: exact` asks for the dot as
 * well - a request, not a guarantee, since the reader's own print settings win,
 * which is why the word remains the carrier and this is decoration. */
@media print {
    .en-root .en-badge::before {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}
