/* =====================================================================
   IOX Graphite — platform admin skin
   ---------------------------------------------------------------------
   Loaded after Filament's own stylesheet (see AdminPanelProvider's
   HEAD_END render hook), so every rule here wins on cascade order alone
   and none of it needs !important to beat a Tailwind utility of equal
   specificity.

   The ground stack and the colour ramps arrive from the panel provider
   as Filament's --gray-* / --primary-* custom properties. What is left
   for this file is the part a palette cannot express: the three faces,
   the 4px radius, the near-white action button, the rail, and the
   mono tabular numerics that make a table of figures readable.

   No colour below is invented — every hex traces to the token block in
   IOX-DESIGN-SYSTEM.md §8.
   ===================================================================== */

:root {
    /* --- action -----------------------------------------------------
       The primary button is the brightest surface on the screen and
       carries no hue. That is what frees steel and ochre to mean
       something. Exactly one per view.                                */
    --ac-fill: #E9EAEC;
    --ac-hover: #FFFFFF;
    --ac-ink: #0F1011;

    /* --- brand ------------------------------------------------------ */
    --br-600: #47759F;
    --br-500: #5988B4;
    --br-400: #6E9BC4;
    --br-300: #8FB0CF;
    --br-tint: rgba(89, 136, 180, 0.15);
    --br-glow: rgba(89, 136, 180, 0.30);
    --sg-500: #BC7B44;
    --sg-400: #CB8C55;
    --sg-tint: rgba(188, 123, 68, 0.15);

    /* --- ground ----------------------------------------------------- */
    --bg-base: #0F1011;
    --bg-rail: #0A0B0C;
    --bg-surface: #16181A;
    --bg-raised: #1D2023;
    --bg-overlay: #262A2E;

    /* --- text ------------------------------------------------------- */
    --tx-primary: #E9EAEC;
    --tx-secondary: #979BA1;
    --tx-tertiary: #62666C;
    --tx-inverse: #0F1011;

    /* --- border ----------------------------------------------------- */
    --bd-subtle: rgba(255, 255, 255, 0.055);
    --bd-default: rgba(255, 255, 255, 0.10);
    --bd-strong: rgba(255, 255, 255, 0.18);

    /* --- semantic --------------------------------------------------- */
    --se-ok: #4E9B72;
    --se-warn: #C4964A;
    --se-crit: #C0564F;
    --se-info: #5988B4;

    /* --- shape, depth, motion --------------------------------------- */
    --r-xs: 2px;
    --r-sm: 4px;
    --r-md: 6px;
    --r-pill: 999px;
    --el-1: 0 1px 0 rgba(0, 0, 0, 0.45);
    --el-2: 0 6px 18px -6px rgba(0, 0, 0, 0.65);
    --el-3: 0 28px 56px -20px rgba(0, 0, 0, 0.8);
    --ring: 0 0 0 3px var(--br-glow);
    --mo-fast: 120ms;
    --mo-base: 180ms;
    --ease: cubic-bezier(.2, .8, .3, 1);

    /* --- type ------------------------------------------------------- */
    --f-disp: 'Archivo', system-ui, sans-serif;
    --f-ui: 'Public Sans', system-ui, -apple-system, sans-serif;
    --f-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* --- Tailwind shape scale ---------------------------------------
       Filament reaches for rounded-lg/xl almost everywhere. Retuning the
       scale here is what puts the whole panel on the 4px radius instead
       of chasing each component.                                       */
    --radius-md: var(--r-sm);
    --radius-lg: var(--r-sm);
    --radius-xl: var(--r-md);
    --radius-2xl: var(--r-md);
    --radius-3xl: var(--r-md);
}

/* =====================================================================
   LIGHT THEME — mirrors assets/css/tokens.css in the portal.

   Filament puts .dark on <html> for dark mode, so :not(.dark) is light.
   This skin loads AFTER Filament's own stylesheet and was dark-only, which
   meant Filament's light mode produced a half-styled panel — that is why
   dark used to be forced. With the palette redefined here, the panel's own
   switcher and the portal's top-bar toggle both work; they share an origin
   and therefore the same localStorage 'theme' key.

   Only the palette moves. Shape, type and motion are theme-independent, and
   the 122 var() uses in the rest of the file re-resolve for free.
   ===================================================================== */
html.fi:not(.dark) {
    --ac-fill: #16181A;
    --ac-hover: #000000;
    --ac-ink: #FFFFFF;

    --br-600: #2E4F6E;
    --br-500: #3A6489;
    --br-400: #47759F;
    --br-300: #5988B4;
    --br-tint: rgba(58, 100, 137, 0.10);
    --br-glow: rgba(58, 100, 137, 0.28);
    --sg-500: #8A5424;
    --sg-400: #A2672F;
    --sg-tint: rgba(138, 84, 36, 0.12);

    --bg-base: #F1F3F5;
    --bg-rail: #FFFFFF;
    --bg-surface: #FFFFFF;
    --bg-raised: #F1F3F5;
    --bg-overlay: #E6E9EC;

    --tx-primary: #16181A;
    --tx-secondary: #565C64;
    --tx-tertiary: #6B7078;
    --tx-inverse: #FFFFFF;

    --bd-subtle: rgba(0, 0, 0, 0.06);
    --bd-default: rgba(0, 0, 0, 0.12);
    --bd-strong: rgba(0, 0, 0, 0.22);

    --se-ok: #2A6E49;
    --se-warn: #855C18;
    --se-crit: #A5332C;
    --se-info: #3A6489;

    --el-1: 0 1px 0 rgba(0, 0, 0, 0.05);
    --el-2: 0 6px 18px -6px rgba(0, 0, 0, 0.14);
    --el-3: 0 28px 56px -20px rgba(0, 0, 0, 0.20);
}

/* Colour-scheme so native controls (scrollbars, date pickers, the
   password reveal eye) match the surface rather than punching a hole
   of the opposite brightness through it. */
html.fi,
.fi-body {
    color-scheme: dark;
}
html.fi:not(.dark),
html.fi:not(.dark) .fi-body {
    color-scheme: light;
}

.fi-body {
    background-color: var(--bg-base);
    font-family: var(--f-ui);
    font-size: 13px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
    .fi-body *,
    .fi-body *::before,
    .fi-body *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* =====================================================================
   1. Type
   ===================================================================== */

/* Display face on every heading the panel draws: page titles, section
   headings, widget headings, modal headings. Archivo 800 at -.02em. */
.fi-header-heading,
.fi-section-header-heading,
.fi-ta-header-heading,
.fi-modal-heading,
.fi-wi-stats-overview-stat-value,
.fi-simple-header-heading,
.fi-fo-wizard-header-step-label {
    font-family: var(--f-disp);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.12;
}

.fi-header-heading {
    font-size: 1.6rem;
    color: var(--tx-primary);
}

.fi-header-subheading {
    color: var(--tx-secondary);
}

/* Mono eyebrows. UPPERCASE is only ever this, at .14em. A column label
   is a bare text node on the th when the column does not sort, and is
   wrapped in a button when it does — hence both selectors. */
.fi-ta-header-cell,
.fi-ta-header-cell button,
.fi-wi-stats-overview-stat-label,
.fi-sidebar-group-label,
.fi-in-entry-label,
.fi-fo-field-wrp-label > label {
    font-family: var(--f-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    /* Secondary, not tertiary. These eyebrows label nav groups, table
       columns and stats — they get read, so they clear 4.5:1 on every
       ground they sit on (5.8:1 on the raised table header, the worst
       case). Tertiary would land at 2.8:1. */
    color: var(--tx-secondary);
}

/* Field labels stay sentence case — they are read, not scanned. */
.fi-fo-field-wrp-label > label {
    font-family: var(--f-ui);
    font-size: 0.78rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--tx-secondary);
}

/* Every figure the panel prints is tabular, so columns of numbers line
   up on the decimal instead of drifting. */
.fi-ta-text-item-label,
.fi-in-text,
.fi-wi-stats-overview-stat-value,
.fi-ta-cell [class*="fi-align-right"] .fi-ta-text-item-label {
    font-variant-numeric: tabular-nums;
}

/* =====================================================================
   2. The rail
   ---------------------------------------------------------------------
   The sidebar sits a step below the base ground so the content reads as
   the foreground. Active nav is steel — the system telling you where
   you are — carried on a tint plus a 2px marker, never a filled pill.
   ===================================================================== */

.fi-sidebar,
.fi-sidebar-header,
.fi-main-sidebar {
    background-color: var(--bg-rail);
    border-color: var(--bd-default);
}

.fi-sidebar-header {
    box-shadow: none;
    border-bottom: 1px solid var(--bd-subtle);
}

.fi-sidebar-nav {
    padding-top: var(--r-md);
}

.fi-sidebar-group-label {
    padding-block: 0.6rem 0.25rem;
}

.fi-sidebar-item-btn {
    border-radius: var(--r-sm);
    color: var(--tx-secondary);
    font-weight: 500;
    position: relative;
    transition: background-color var(--mo-fast) var(--ease),
                color var(--mo-fast) var(--ease);
}

.fi-sidebar-item-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--tx-primary);
}

.fi-sidebar-item-btn .fi-sidebar-item-icon {
    color: var(--tx-tertiary);
    transition: color var(--mo-fast) var(--ease);
}

.fi-sidebar-item-btn:hover .fi-sidebar-item-icon {
    color: var(--tx-secondary);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn,
.fi-sidebar-item-btn.fi-active {
    background-color: var(--br-tint);
    color: var(--tx-primary);
    font-weight: 600;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-icon,
.fi-sidebar-item-btn.fi-active .fi-sidebar-item-icon {
    color: var(--br-400);
}

/* The marker that says "you are here". 2px, steel, flush to the rail. */
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn::before,
.fi-sidebar-item-btn.fi-active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 6px;
    bottom: 6px;
    width: 2px;
    border-radius: var(--r-xs);
    background-color: var(--br-500);
}

/* =====================================================================
   3. Brand lockup
   ===================================================================== */

.iox-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.iox-brand-mark {
    height: 20px;
    width: auto;
    flex: none;
}

/* Brand-kit inks: light letters + cyan LED on dark, navy + deeper cyan on light. */
.iox-logo-ink { fill: #EEF5FF; }
.iox-logo-led { fill: #22C8E5; }
html:not(.dark) .iox-logo-ink { fill: #0B1B34; }
html:not(.dark) .iox-logo-led { fill: #0A8BC4; }

.iox-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    min-width: 0;
}

.iox-brand-name {
    font-family: var(--f-disp);
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: 0.02em;
    color: var(--tx-primary);
}

.iox-brand-sub {
    font-family: var(--f-mono);
    font-size: 0.55rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tx-secondary);
}

/* =====================================================================
   4. Top bar
   ===================================================================== */

/* The chrome is one ground. The top bar shares the rail's value so the
   shell reads as a single frame around the content rather than two
   panels meeting at a seam. */
nav.fi-topbar {
    background-color: var(--bg-rail);
    border-bottom: 1px solid var(--bd-subtle);
    box-shadow: none;
}

.fi-global-search-field .fi-input {
    font-family: var(--f-ui);
}

.fi-user-avatar,
.fi-avatar {
    border-radius: var(--r-pill);
}

/* =====================================================================
   5. Surfaces
   ---------------------------------------------------------------------
   Depth comes from the ground stack before it comes from a shadow, so
   sections carry a hairline and sit a step up from the base instead of
   floating on a drop shadow.
   ===================================================================== */

.fi-section,
.fi-ta-ctn,
.fi-fo-repeater-item,
.fi-in-entry-ctn {
    background-color: var(--bg-surface);
    border: 1px solid var(--bd-subtle);
    border-radius: var(--r-sm);
    box-shadow: none;
}

/* A "not contained" section is a heading over content that draws its own
   cards — the stats overview being the one on the dashboard. Giving it a
   surface of its own would card the cards. */
.fi-section.fi-section-not-contained {
    background-color: transparent;
    border-color: transparent;
}

.fi-section-header {
    border-bottom: 1px solid var(--bd-subtle);
}

.fi-section-not-contained > .fi-section-header {
    border-bottom: none;
    padding-inline: 0;
}

.fi-section-header-heading {
    font-size: 0.95rem;
    color: var(--tx-primary);
}

.fi-section-header-description {
    color: var(--tx-secondary);
}

.fi-modal-window,
.fi-dropdown-panel {
    background-color: var(--bg-raised);
    border: 1px solid var(--bd-default);
    border-radius: var(--r-md);
    box-shadow: var(--el-3);
}

.fi-dropdown-list-item {
    border-radius: var(--r-sm);
    color: var(--tx-secondary);
}

.fi-dropdown-list-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--tx-primary);
}

/* =====================================================================
   6. Buttons
   ---------------------------------------------------------------------
   One primary per view, and it is not a colour: the action fill is the
   brightest surface on the screen with the base ground as its ink.
   Everything else is an outline or a bare label, so the eye lands on
   the one thing the page wants you to do.
   ===================================================================== */

.fi-btn {
    border-radius: var(--r-sm);
    font-family: var(--f-ui);
    font-weight: 600;
    letter-spacing: 0;
    transition: background-color var(--mo-fast) var(--ease),
                border-color var(--mo-fast) var(--ease),
                color var(--mo-fast) var(--ease);
}

.fi-btn.fi-color-primary {
    background-color: var(--ac-fill);
    color: var(--ac-ink);
    box-shadow: none;
    --fi-btn-icon-color: var(--ac-ink);
}

.fi-btn.fi-color-primary:hover {
    background-color: var(--ac-hover);
    color: var(--ac-ink);
}

.fi-btn.fi-color-primary .fi-icon,
.fi-btn.fi-color-primary svg {
    color: var(--ac-ink);
}

/* Outline buttons: a hairline that firms up on hover, no fill. */
.fi-btn.fi-outlined,
.fi-btn.fi-btn-outlined {
    border-color: var(--bd-strong);
    color: var(--tx-primary);
    background-color: transparent;
}

.fi-btn.fi-outlined:hover,
.fi-btn.fi-btn-outlined:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--bd-strong);
}

.fi-icon-btn {
    border-radius: var(--r-sm);
    color: var(--tx-secondary);
}

.fi-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--tx-primary);
}

/* Keyboard focus is always visible, everywhere, in steel. */
.fi-body :focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--r-sm);
}

/* =====================================================================
   7. Fields
   ===================================================================== */

.fi-input-wrp {
    background-color: var(--bg-raised);
    border-radius: var(--r-sm);
    box-shadow: none;
    border: 1px solid var(--bd-default);
    transition: border-color var(--mo-fast) var(--ease),
                box-shadow var(--mo-fast) var(--ease);
}

.fi-input-wrp:has(:focus) {
    border-color: var(--br-500);
    box-shadow: var(--ring);
}

.fi-input-wrp .fi-input {
    font-family: var(--f-ui);
    color: var(--tx-primary);
}

/* A placeholder is still text somebody has to read, so it carries the
   secondary tone; the value typed over it is primary, which is what
   keeps the two apart. */
.fi-input-wrp .fi-input::placeholder {
    color: var(--tx-secondary);
}

/* Numeric inputs get the data face — a quantity is a figure, not prose. */
.fi-input-wrp .fi-input[type="number"] {
    font-family: var(--f-mono);
    font-variant-numeric: tabular-nums;
}

.fi-fo-field-wrp-hint,
.fi-fo-field-wrp-helper-text {
    color: var(--tx-secondary);
}

.fi-checkbox-input,
.fi-radio-input,
.fi-toggle {
    accent-color: var(--br-500);
}

/* =====================================================================
   8. Tables
   ---------------------------------------------------------------------
   Where an admin actually lives. The header is a mono eyebrow on the
   raised ground, rows separate on a subtle hairline rather than a
   stripe, and every right-aligned cell is mono and tabular.
   ===================================================================== */

.fi-ta-header-ctn {
    border-bottom: 1px solid var(--bd-subtle);
}

.fi-ta-header-cell {
    background-color: var(--bg-raised);
    border-bottom: 1px solid var(--bd-default);
}

.fi-ta-row {
    border-color: var(--bd-subtle);
    transition: background-color var(--mo-fast) var(--ease);
}

.fi-ta-row:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.fi-ta-cell {
    color: var(--tx-secondary);
}

.fi-ta-cell .fi-ta-text-item-label {
    color: var(--tx-secondary);
}

.fi-ta-cell .fi-font-medium .fi-ta-text-item-label,
.fi-ta-cell .fi-font-semibold .fi-ta-text-item-label,
.fi-ta-cell .fi-font-bold .fi-ta-text-item-label {
    color: var(--tx-primary);
}

/* A right-aligned column is a numeric column. */
.fi-ta-cell.fi-align-right .fi-ta-text-item-label,
.fi-ta-cell.fi-align-end .fi-ta-text-item-label,
.fi-ta-header-cell.fi-align-right,
.fi-ta-header-cell.fi-align-end {
    font-family: var(--f-mono);
    font-variant-numeric: tabular-nums;
}

.fi-ta-empty-state {
    background-color: var(--bg-surface);
}

/* Filament puts placeholders and empty cells on gray-500, which in this
   ramp is the design system's dimmest ink and lands under 4.5:1. An
   em-dash standing in for a missing value still has to be legible. */
.fi-ta-placeholder,
.fi-in-placeholder,
.fi-select-input-placeholder,
.fi-fo-placeholder {
    color: var(--tx-secondary);
}

.fi-pagination .fi-btn,
.fi-ta-pagination .fi-btn {
    font-family: var(--f-mono);
    font-variant-numeric: tabular-nums;
}

/* =====================================================================
   9. Badges
   ---------------------------------------------------------------------
   2px radius per the shape rule — a badge is a tag, never a pill.
   Status colours stay status: they carry no brand meaning.
   ===================================================================== */

.fi-badge {
    border-radius: var(--r-xs);
    font-family: var(--f-ui);
    font-weight: 600;
    font-size: 0.68rem;
    letter-spacing: 0.01em;
}

/* =====================================================================
   10. Stats
   ---------------------------------------------------------------------
   One display-size number per screen: the stat value is the figure, in
   Archivo 800, above a mono eyebrow label.
   ===================================================================== */

.fi-wi-stats-overview-stat {
    background-color: var(--bg-surface);
    border: 1px solid var(--bd-subtle);
    border-radius: var(--r-sm);
    box-shadow: none;
}

.fi-wi-stats-overview-stat-label {
    margin-bottom: 0.35rem;
}

.fi-wi-stats-overview-stat-value {
    font-size: 2rem;
    color: var(--tx-primary);
}

.fi-wi-stats-overview-stat-description {
    font-size: 0.72rem;
    color: var(--tx-secondary);
}

/* =====================================================================
   11. Login
   ---------------------------------------------------------------------
   Full-bleed split: the brand holds the left, the form the right. The
   panel collapses to a single centred column below 900px, where a brand
   panel would only be pushing the form off the fold.
   ===================================================================== */

.fi-simple-layout {
    background-color: var(--bg-base);
}

.fi-simple-main {
    background-color: var(--bg-surface);
    border: 1px solid var(--bd-subtle);
    border-radius: var(--r-md);
    box-shadow: var(--el-3);
}

.fi-simple-header-heading {
    font-size: 1.35rem;
    color: var(--tx-primary);
}

.fi-simple-header-subheading {
    color: var(--tx-secondary);
}

/* Below the split, the brand panel would only push the form off the
   fold — so it is not drawn at all. */
.iox-auth-brand {
    display: none;
}

@media (min-width: 900px) {
    .fi-simple-layout {
        display: grid;
        grid-template-columns: 42fr 58fr;
        grid-template-rows: 100vh;
        /* Filament centres the lone card by centring its grid items; both
           halves have to fill the row instead, or the brand panel shrinks
           to the height of its own text. */
        align-items: stretch;
        justify-items: stretch;
        min-height: 100vh;
        padding: 0;
    }

    /* The brand half already says IOX, so the card does not repeat it. */
    .fi-simple-layout .fi-simple-header-logo-ctn,
    .fi-simple-layout .fi-logo {
        display: none;
    }

    /* The brand half. Its ground is the rail, lit by one steel bloom off
       the top-left corner — the only gradient anywhere in the panel. */
    .iox-auth-brand {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        grid-column: 1;
        grid-row: 1;
        padding: clamp(2rem, 4vw, 3.5rem);
        background-color: var(--bg-rail);
        background-image: radial-gradient(115% 85% at 10% 6%, var(--br-tint) 0%, transparent 60%);
        border-inline-end: 1px solid var(--bd-subtle);
        overflow: hidden;
    }

    .iox-auth-brand-lockup {
        display: flex;
        align-items: center;
        gap: 0.65rem;
    }

    .iox-auth-brand-mark {
        height: 30px;
        width: auto;
        flex: none;
    }

    .iox-auth-brand-word {
        font-family: var(--f-disp);
        font-weight: 800;
        font-size: 1.25rem;
        letter-spacing: 0.02em;
        color: var(--tx-primary);
    }

    .iox-auth-brand-body {
        max-width: 24rem;
    }

    .iox-auth-brand-eyebrow {
        font-family: var(--f-mono);
        font-size: 0.62rem;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--br-300);
        margin: 0 0 0.9rem;
    }

    .iox-auth-brand-headline {
        font-family: var(--f-disp);
        font-weight: 800;
        font-size: clamp(1.5rem, 2.3vw, 2.1rem);
        letter-spacing: -0.02em;
        line-height: 1.14;
        color: var(--tx-primary);
        margin: 0 0 0.85rem;
    }

    .iox-auth-brand-note {
        font-size: 0.8rem;
        line-height: 1.6;
        color: var(--tx-secondary);
        margin: 0;
        max-width: 21rem;
    }

    /* The form half: one column, the card centred in it. */
    .fi-simple-main-ctn {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2rem;
        margin: 0;
        max-width: none;
        width: 100%;
        overflow-y: auto;
    }

    .fi-simple-main {
        width: 100%;
        max-width: 25rem;
    }
}

/* =====================================================================
   12. Notifications
   ===================================================================== */

.fi-no-notification {
    background-color: var(--bg-raised);
    border: 1px solid var(--bd-default);
    border-radius: var(--r-sm);
    box-shadow: var(--el-2);
}

/* =====================================================================
   13. Scrollbars
   ===================================================================== */

.fi-body ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.fi-body ::-webkit-scrollbar-track {
    background: transparent;
}

.fi-body ::-webkit-scrollbar-thumb {
    background-color: var(--bg-overlay);
    border-radius: var(--r-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}

.fi-body ::-webkit-scrollbar-thumb:hover {
    background-color: var(--tx-tertiary);
}
