/* ==========================================================================
   Norse Fluent 2 — web stylesheet (NorseTechnologies.Fluent2.Web)
   --------------------------------------------------------------------------
   Tokens follow the Fluent 2 (Microsoft 365 / Office) web theme: Segoe UI
   Variable type ramp, brand-80 blue, neutral surface layers, 4px radius,
   layered elevation shadows, and 2px accessible focus rings. Light and dark
   themes are provided; the host can force one with data-theme="light|dark"
   on <html>. All selectors are prefixed "nf-" and all tokens "--nf-" so
   nothing leaks into the host application's styles. Override any token in
   a stylesheet loaded after this one to re-brand.

   Same token values as NorseTechnologies.Fluent2.WinForms and .Maui.
   ========================================================================== */

:root {
    /* Type ramp */
    --nf-font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --nf-font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
    --nf-font-mono: "Cascadia Code", "Cascadia Mono", Consolas, "Courier New", monospace;
    --nf-fs-caption: 12px;
    --nf-fs-body: 14px;
    --nf-fs-body-lg: 16px;
    --nf-fs-subtitle2: 16px;
    --nf-fs-subtitle1: 20px;
    --nf-fs-title3: 24px;
    --nf-fs-title2: 28px;
    --nf-lh-body: 20px;

    /* Brand (Fluent 2 brand ramp) */
    --nf-brand: #0f6cbd;
    --nf-brand-hover: #115ea3;
    --nf-brand-pressed: #0f548c;
    --nf-brand-selected: #115ea3;
    --nf-brand-bg2: #ebf3fc;
    --nf-brand-bg2-hover: #cfe4fa;
    --nf-brand-stroke: #0f6cbd;
    --nf-brand-fg: #0f6cbd;
    --nf-brand-fg-hover: #115ea3;
    --nf-brand-on: #ffffff;

    /* Neutral surfaces */
    --nf-bg1: #ffffff;
    --nf-bg2: #fafafa;
    --nf-bg3: #f5f5f5;
    --nf-bg4: #f0f0f0;
    --nf-bg5: #ebebeb;
    --nf-bg6: #e6e6e6;
    --nf-bg1-hover: #f5f5f5;
    --nf-bg1-pressed: #e0e0e0;
    --nf-bg1-selected: #ebebeb;
    --nf-subtle-hover: #f5f5f5;
    --nf-subtle-pressed: #e0e0e0;
    --nf-subtle-selected: #ebebeb;
    --nf-bg-disabled: #f0f0f0;

    /* Neutral foregrounds */
    --nf-fg1: #242424;
    --nf-fg2: #424242;
    --nf-fg3: #616161;
    --nf-fg4: #707070;
    --nf-fg-disabled: #bdbdbd;
    --nf-fg-on-brand: #ffffff;

    /* Strokes */
    --nf-stroke1: #d1d1d1;
    --nf-stroke2: #e0e0e0;
    --nf-stroke3: #f0f0f0;
    --nf-stroke-accessible: #616161;
    --nf-stroke-focus: #000000;
    --nf-stroke-focus-inner: #ffffff;
    --nf-stroke-disabled: #e0e0e0;

    /* Status palettes */
    --nf-danger-fg: #c50f1f;
    --nf-danger-bg: #fdf3f4;
    --nf-danger-stroke: #eeacb2;
    --nf-danger-hover: #b10e1c;
    --nf-success-fg: #0e700e;
    --nf-success-bg: #f1faf1;
    --nf-success-stroke: #9fd89f;
    --nf-warning-fg: #bc4b09;
    --nf-warning-bg: #fff9f5;
    --nf-warning-stroke: #f4bfab;
    --nf-info-fg: #0f6cbd;
    --nf-info-bg: #ebf3fc;
    --nf-info-stroke: #b4d6fa;

    /* Shape */
    --nf-radius-sm: 2px;
    --nf-radius: 4px;
    --nf-radius-lg: 8px;
    --nf-radius-xl: 12px;
    --nf-radius-circle: 9999px;

    /* Elevation */
    --nf-shadow2: 0 0 2px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .14);
    --nf-shadow4: 0 0 2px rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .14);
    --nf-shadow8: 0 0 2px rgba(0, 0, 0, .12), 0 4px 8px rgba(0, 0, 0, .14);
    --nf-shadow16: 0 0 2px rgba(0, 0, 0, .12), 0 8px 16px rgba(0, 0, 0, .14);
    --nf-shadow28: 0 0 8px rgba(0, 0, 0, .12), 0 14px 28px rgba(0, 0, 0, .14);
    --nf-shadow64: 0 0 8px rgba(0, 0, 0, .12), 0 32px 64px rgba(0, 0, 0, .14);

    /* Spacing (Fluent 2 4px grid) */
    --nf-sp-xxs: 2px;
    --nf-sp-xs: 4px;
    --nf-sp-s: 8px;
    --nf-sp-m: 12px;
    --nf-sp-l: 16px;
    --nf-sp-xl: 20px;
    --nf-sp-xxl: 24px;
    --nf-sp-xxxl: 32px;

    /* Motion */
    --nf-dur-fast: 100ms;
    --nf-dur-normal: 200ms;
    --nf-ease: cubic-bezier(.33, 0, .67, 1);
    --nf-ease-decel: cubic-bezier(0, 0, 0, 1);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --nf-brand: #479ef5;
        --nf-brand-hover: #62abf5;
        --nf-brand-pressed: #2886de;
        --nf-brand-selected: #62abf5;
        --nf-brand-bg2: #082338;
        --nf-brand-bg2-hover: #0c3b5e;
        --nf-brand-stroke: #479ef5;
        --nf-brand-fg: #479ef5;
        --nf-brand-fg-hover: #62abf5;
        --nf-brand-on: #000000;

        --nf-bg1: #292929;
        --nf-bg2: #1f1f1f;
        --nf-bg3: #141414;
        --nf-bg4: #0a0a0a;
        --nf-bg5: #000000;
        --nf-bg6: #333333;
        --nf-bg1-hover: #3d3d3d;
        --nf-bg1-pressed: #1f1f1f;
        --nf-bg1-selected: #383838;
        --nf-subtle-hover: #383838;
        --nf-subtle-pressed: #2e2e2e;
        --nf-subtle-selected: #333333;
        --nf-bg-disabled: #141414;

        --nf-fg1: #ffffff;
        --nf-fg2: #d6d6d6;
        --nf-fg3: #adadad;
        --nf-fg4: #999999;
        --nf-fg-disabled: #5c5c5c;
        --nf-fg-on-brand: #000000;

        --nf-stroke1: #666666;
        --nf-stroke2: #525252;
        --nf-stroke3: #3d3d3d;
        --nf-stroke-accessible: #adadad;
        --nf-stroke-focus: #ffffff;
        --nf-stroke-focus-inner: #000000;
        --nf-stroke-disabled: #424242;

        --nf-danger-fg: #dc626d;
        --nf-danger-bg: #3b1213;
        --nf-danger-stroke: #8c2733;
        --nf-danger-hover: #e37d84;
        --nf-success-fg: #54b054;
        --nf-success-bg: #0d2e0d;
        --nf-success-stroke: #2c722c;
        --nf-warning-fg: #f7823a;
        --nf-warning-bg: #3c1a0a;
        --nf-warning-stroke: #86381a;
        --nf-info-fg: #479ef5;
        --nf-info-bg: #082338;
        --nf-info-stroke: #0c3b5e;

        --nf-shadow2: 0 0 2px rgba(0, 0, 0, .24), 0 1px 2px rgba(0, 0, 0, .28);
        --nf-shadow4: 0 0 2px rgba(0, 0, 0, .24), 0 2px 4px rgba(0, 0, 0, .28);
        --nf-shadow8: 0 0 2px rgba(0, 0, 0, .24), 0 4px 8px rgba(0, 0, 0, .28);
        --nf-shadow16: 0 0 2px rgba(0, 0, 0, .24), 0 8px 16px rgba(0, 0, 0, .28);
        --nf-shadow28: 0 0 8px rgba(0, 0, 0, .24), 0 14px 28px rgba(0, 0, 0, .28);
        --nf-shadow64: 0 0 8px rgba(0, 0, 0, .24), 0 32px 64px rgba(0, 0, 0, .28);

        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --nf-brand: #479ef5;
    --nf-brand-hover: #62abf5;
    --nf-brand-pressed: #2886de;
    --nf-brand-selected: #62abf5;
    --nf-brand-bg2: #082338;
    --nf-brand-bg2-hover: #0c3b5e;
    --nf-brand-stroke: #479ef5;
    --nf-brand-fg: #479ef5;
    --nf-brand-fg-hover: #62abf5;
    --nf-brand-on: #000000;
    --nf-bg1: #292929;
    --nf-bg2: #1f1f1f;
    --nf-bg3: #141414;
    --nf-bg4: #0a0a0a;
    --nf-bg5: #000000;
    --nf-bg6: #333333;
    --nf-bg1-hover: #3d3d3d;
    --nf-bg1-pressed: #1f1f1f;
    --nf-bg1-selected: #383838;
    --nf-subtle-hover: #383838;
    --nf-subtle-pressed: #2e2e2e;
    --nf-subtle-selected: #333333;
    --nf-bg-disabled: #141414;
    --nf-fg1: #ffffff;
    --nf-fg2: #d6d6d6;
    --nf-fg3: #adadad;
    --nf-fg4: #999999;
    --nf-fg-disabled: #5c5c5c;
    --nf-fg-on-brand: #000000;
    --nf-stroke1: #666666;
    --nf-stroke2: #525252;
    --nf-stroke3: #3d3d3d;
    --nf-stroke-accessible: #adadad;
    --nf-stroke-focus: #ffffff;
    --nf-stroke-focus-inner: #000000;
    --nf-stroke-disabled: #424242;
    --nf-danger-fg: #dc626d;
    --nf-danger-bg: #3b1213;
    --nf-danger-stroke: #8c2733;
    --nf-danger-hover: #e37d84;
    --nf-success-fg: #54b054;
    --nf-success-bg: #0d2e0d;
    --nf-success-stroke: #2c722c;
    --nf-warning-fg: #f7823a;
    --nf-warning-bg: #3c1a0a;
    --nf-warning-stroke: #86381a;
    --nf-info-fg: #479ef5;
    --nf-info-bg: #082338;
    --nf-info-stroke: #0c3b5e;
    --nf-shadow2: 0 0 2px rgba(0, 0, 0, .24), 0 1px 2px rgba(0, 0, 0, .28);
    --nf-shadow4: 0 0 2px rgba(0, 0, 0, .24), 0 2px 4px rgba(0, 0, 0, .28);
    --nf-shadow8: 0 0 2px rgba(0, 0, 0, .24), 0 4px 8px rgba(0, 0, 0, .28);
    --nf-shadow16: 0 0 2px rgba(0, 0, 0, .24), 0 8px 16px rgba(0, 0, 0, .28);
    --nf-shadow28: 0 0 8px rgba(0, 0, 0, .24), 0 14px 28px rgba(0, 0, 0, .28);
    --nf-shadow64: 0 0 8px rgba(0, 0, 0, .24), 0 32px 64px rgba(0, 0, 0, .28);
    color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Shell: Office-style left navigation rail + content canvas
   -------------------------------------------------------------------------- */

.nf-page {
    margin: 0;
    background: var(--nf-bg3);
    color: var(--nf-fg1);
    font-family: var(--nf-font);
    font-size: var(--nf-fs-body);
    line-height: var(--nf-lh-body);
    -webkit-font-smoothing: antialiased;
}

.nf-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
    font-family: var(--nf-font);
    font-size: var(--nf-fs-body);
    line-height: var(--nf-lh-body);
    color: var(--nf-fg1);
    background: var(--nf-bg3);
}

.nf-shell--embedded {
    min-height: 0;
    border: 1px solid var(--nf-stroke2);
    border-radius: var(--nf-radius-lg);
    overflow: hidden;
    background: var(--nf-bg2);
}

.nf-nav {
    background: var(--nf-bg2);
    border-right: 1px solid var(--nf-stroke2);
    padding: var(--nf-sp-l) var(--nf-sp-s);
    display: flex;
    flex-direction: column;
    gap: var(--nf-sp-xxs);
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
}

.nf-nav__brand {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-m);
    padding: var(--nf-sp-s) var(--nf-sp-m) var(--nf-sp-l);
    color: var(--nf-fg1);
    text-decoration: none;
}

.nf-nav__brand-mark {
    width: 32px;
    height: 32px;
    border-radius: var(--nf-radius);
    background: var(--nf-brand);
    color: var(--nf-brand-on);
    display: grid;
    place-items: center;
    font-family: var(--nf-font-display);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -.02em;
    flex: none;
}

.nf-nav__brand-title {
    font-family: var(--nf-font-display);
    font-weight: 600;
    font-size: var(--nf-fs-subtitle2);
    line-height: 22px;
}

.nf-nav__brand-sub {
    font-size: var(--nf-fs-caption);
    line-height: 16px;
    color: var(--nf-fg3);
}

.nf-nav__section {
    padding: var(--nf-sp-l) var(--nf-sp-m) var(--nf-sp-xs);
    font-size: var(--nf-fs-caption);
    line-height: 16px;
    font-weight: 600;
    color: var(--nf-fg3);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.nf-nav__item {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-m);
    height: 36px;
    padding: 0 var(--nf-sp-m);
    border-radius: var(--nf-radius);
    color: var(--nf-fg2);
    text-decoration: none;
    font-weight: 400;
    position: relative;
    transition: background var(--nf-dur-fast) var(--nf-ease), color var(--nf-dur-fast) var(--nf-ease);
}

.nf-nav__item:hover {
    background: var(--nf-subtle-hover);
    color: var(--nf-fg1);
}

.nf-nav__item:active {
    background: var(--nf-subtle-pressed);
}

.nf-nav__item[aria-current="page"] {
    background: var(--nf-subtle-selected);
    color: var(--nf-fg1);
    font-weight: 600;
}

.nf-nav__item[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: var(--nf-radius-circle);
    background: var(--nf-brand);
}

.nf-nav__icon {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--nf-fg2);
}

.nf-nav__item[aria-current="page"] .nf-nav__icon {
    color: var(--nf-brand-fg);
}

.nf-main {
    padding: var(--nf-sp-xxl) var(--nf-sp-xxxl) var(--nf-sp-xxxl);
    min-width: 0;
}

@media (max-width: 900px) {
    .nf-shell {
        grid-template-columns: 1fr;
    }

    .nf-nav {
        position: static;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--nf-stroke2);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .nf-nav__brand {
        padding-bottom: var(--nf-sp-s);
        width: 100%;
    }

    .nf-nav__section {
        display: none;
    }

    .nf-main {
        padding: var(--nf-sp-l);
    }
}

/* --------------------------------------------------------------------------
   Page header + command bar
   -------------------------------------------------------------------------- */

.nf-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--nf-sp-l);
    margin-bottom: var(--nf-sp-xl);
}

.nf-header__eyebrow {
    font-size: var(--nf-fs-caption);
    line-height: 16px;
    color: var(--nf-fg3);
    margin: 0 0 var(--nf-sp-xs);
}

.nf-header__title {
    font-family: var(--nf-font-display);
    font-size: var(--nf-fs-title2);
    line-height: 36px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -.01em;
}

.nf-header__subtitle {
    margin: var(--nf-sp-xs) 0 0;
    color: var(--nf-fg3);
    max-width: 64ch;
}

.nf-commandbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--nf-sp-s);
}

.nf-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-xs);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--nf-sp-s);
    font-size: var(--nf-fs-body);
    color: var(--nf-fg3);
}

.nf-breadcrumb a {
    color: var(--nf-fg3);
    text-decoration: none;
    padding: 2px var(--nf-sp-xs);
    border-radius: var(--nf-radius-sm);
}

.nf-breadcrumb a:hover {
    color: var(--nf-fg1);
    background: var(--nf-subtle-hover);
}

.nf-breadcrumb li + li::before {
    content: "›";
    color: var(--nf-fg4);
    padding: 0 2px;
}

.nf-breadcrumb li:last-child {
    color: var(--nf-fg1);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.nf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nf-sp-s);
    min-width: 96px;
    height: 32px;
    padding: 0 var(--nf-sp-m);
    border: 1px solid var(--nf-stroke1);
    border-radius: var(--nf-radius);
    background: var(--nf-bg1);
    color: var(--nf-fg1);
    font: inherit;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background var(--nf-dur-fast) var(--nf-ease), border-color var(--nf-dur-fast) var(--nf-ease), color var(--nf-dur-fast) var(--nf-ease);
}

.nf-btn:hover {
    background: var(--nf-bg1-hover);
    border-color: var(--nf-stroke1);
}

.nf-btn:active {
    background: var(--nf-bg1-pressed);
}

.nf-btn:disabled,
.nf-btn[aria-disabled="true"] {
    background: var(--nf-bg-disabled);
    border-color: var(--nf-stroke-disabled);
    color: var(--nf-fg-disabled);
    cursor: default;
}

.nf-btn--primary {
    background: var(--nf-brand);
    border-color: transparent;
    color: var(--nf-fg-on-brand);
}

.nf-btn--primary:hover {
    background: var(--nf-brand-hover);
    border-color: transparent;
}

.nf-btn--primary:active {
    background: var(--nf-brand-pressed);
}

.nf-btn--subtle {
    background: transparent;
    border-color: transparent;
    color: var(--nf-fg2);
    min-width: 0;
}

.nf-btn--subtle:hover {
    background: var(--nf-subtle-hover);
    color: var(--nf-fg1);
}

.nf-btn--subtle:active {
    background: var(--nf-subtle-pressed);
}

.nf-btn--danger {
    color: var(--nf-danger-fg);
}

.nf-btn--danger.nf-btn--primary {
    background: var(--nf-danger-fg);
    color: #ffffff;
}

.nf-btn--danger.nf-btn--primary:hover {
    background: var(--nf-danger-hover);
}

.nf-btn--sm {
    height: 24px;
    min-width: 0;
    padding: 0 var(--nf-sp-s);
    font-size: var(--nf-fs-caption);
    line-height: 16px;
}

.nf-btn--icon {
    min-width: 32px;
    width: 32px;
    padding: 0;
}

.nf-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

/* Focus ring: Fluent 2 dual-ring */
.nf-btn:focus-visible,
.nf-input:focus-visible,
.nf-select:focus-visible,
.nf-nav__item:focus-visible,
.nf-checkbox input:focus-visible + .nf-checkbox__box,
.nf-tile:focus-visible,
.nf-link:focus-visible {
    outline: 2px solid var(--nf-stroke-focus);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--nf-stroke-focus-inner);
}

/* --------------------------------------------------------------------------
   Inputs
   -------------------------------------------------------------------------- */

.nf-field {
    display: flex;
    flex-direction: column;
    gap: var(--nf-sp-xs);
    margin-bottom: var(--nf-sp-l);
}

.nf-field__label {
    font-weight: 600;
    color: var(--nf-fg1);
}

.nf-field__label .nf-required {
    color: var(--nf-danger-fg);
    margin-left: 2px;
}

.nf-field__hint {
    font-size: var(--nf-fs-caption);
    line-height: 16px;
    color: var(--nf-fg3);
}

.nf-field__error {
    font-size: var(--nf-fs-caption);
    line-height: 16px;
    color: var(--nf-danger-fg);
}

.nf-input,
.nf-select,
.nf-textarea {
    width: 100%;
    box-sizing: border-box;
    height: 32px;
    padding: 0 var(--nf-sp-m);
    background: var(--nf-bg1);
    color: var(--nf-fg1);
    border: 1px solid var(--nf-stroke1);
    border-bottom-color: var(--nf-stroke-accessible);
    border-radius: var(--nf-radius);
    font: inherit;
    line-height: 20px;
    transition: border-color var(--nf-dur-fast) var(--nf-ease);
}

.nf-textarea {
    height: auto;
    min-height: 72px;
    padding: var(--nf-sp-s) var(--nf-sp-m);
    resize: vertical;
}

.nf-input::placeholder,
.nf-textarea::placeholder {
    color: var(--nf-fg4);
}

.nf-input:hover,
.nf-select:hover,
.nf-textarea:hover {
    border-color: var(--nf-stroke-accessible);
}

.nf-input:focus,
.nf-select:focus,
.nf-textarea:focus {
    outline: none;
    border-bottom: 2px solid var(--nf-brand);
    padding-bottom: 0;
}

.nf-input[aria-invalid="true"],
.nf-input.input-validation-error {
    border-bottom-color: var(--nf-danger-fg);
}

.nf-input--inline {
    width: auto;
    min-width: 240px;
}

.nf-search {
    position: relative;
    min-width: 240px;
}

.nf-search .nf-input {
    padding-left: 32px;
}

.nf-search svg {
    position: absolute;
    left: 10px;
    top: 8px;
    width: 16px;
    height: 16px;
    color: var(--nf-fg3);
    pointer-events: none;
}

/* Checkbox — Fluent 2 20px box with brand fill */
.nf-checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--nf-sp-s);
    cursor: pointer;
    user-select: none;
    color: var(--nf-fg1);
    min-height: 32px;
    padding: 0 var(--nf-sp-xs);
    border-radius: var(--nf-radius);
}

.nf-checkbox:hover {
    color: var(--nf-fg1);
}

.nf-checkbox input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.nf-checkbox__box {
    width: 16px;
    height: 16px;
    flex: none;
    border: 1px solid var(--nf-stroke-accessible);
    border-radius: 3px;
    background: var(--nf-bg1);
    display: grid;
    place-items: center;
    transition: background var(--nf-dur-fast) var(--nf-ease), border-color var(--nf-dur-fast) var(--nf-ease);
}

.nf-checkbox__box svg {
    width: 12px;
    height: 12px;
    color: var(--nf-fg-on-brand);
    opacity: 0;
    transform: scale(.6);
    transition: opacity var(--nf-dur-fast) var(--nf-ease), transform var(--nf-dur-fast) var(--nf-ease-decel);
}

.nf-checkbox:hover .nf-checkbox__box {
    border-color: var(--nf-fg1);
}

.nf-checkbox input:checked + .nf-checkbox__box {
    background: var(--nf-brand);
    border-color: var(--nf-brand);
}

.nf-checkbox input:checked + .nf-checkbox__box svg {
    opacity: 1;
    transform: scale(1);
}

.nf-checkbox input:disabled + .nf-checkbox__box {
    background: var(--nf-bg-disabled);
    border-color: var(--nf-stroke-disabled);
}

.nf-checkbox--muted {
    color: var(--nf-fg3);
}

/* --------------------------------------------------------------------------
   Cards, tiles, stats
   -------------------------------------------------------------------------- */

.nf-card {
    background: var(--nf-bg1);
    border: 1px solid var(--nf-stroke2);
    border-radius: var(--nf-radius-lg);
    box-shadow: var(--nf-shadow2);
    padding: var(--nf-sp-xl);
    margin-bottom: var(--nf-sp-xl);
}

.nf-card--flush {
    padding: 0;
    overflow: hidden;
}

.nf-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nf-sp-l);
    padding: var(--nf-sp-l) var(--nf-sp-xl);
    border-bottom: 1px solid var(--nf-stroke2);
}

.nf-card__title {
    font-family: var(--nf-font-display);
    font-size: var(--nf-fs-subtitle2);
    line-height: 22px;
    font-weight: 600;
    margin: 0;
}

.nf-card__body {
    padding: var(--nf-sp-xl);
}

.nf-card__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--nf-sp-s);
    padding: var(--nf-sp-l) var(--nf-sp-xl);
    border-top: 1px solid var(--nf-stroke2);
    background: var(--nf-bg2);
}

.nf-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--nf-sp-l);
    margin-bottom: var(--nf-sp-xxl);
}

.nf-tile {
    display: flex;
    flex-direction: column;
    gap: var(--nf-sp-m);
    padding: var(--nf-sp-xl);
    background: var(--nf-bg1);
    border: 1px solid var(--nf-stroke2);
    border-radius: var(--nf-radius-lg);
    box-shadow: var(--nf-shadow2);
    color: inherit;
    text-decoration: none;
    transition: box-shadow var(--nf-dur-normal) var(--nf-ease), transform var(--nf-dur-normal) var(--nf-ease-decel), border-color var(--nf-dur-fast) var(--nf-ease);
}

.nf-tile:hover {
    box-shadow: var(--nf-shadow8);
    border-color: var(--nf-stroke1);
    transform: translateY(-1px);
}

.nf-tile__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--nf-radius);
    background: var(--nf-brand-bg2);
    color: var(--nf-brand-fg);
    display: grid;
    place-items: center;
}

.nf-tile__icon svg {
    width: 22px;
    height: 22px;
}

.nf-tile__value {
    font-family: var(--nf-font-display);
    font-size: var(--nf-fs-title2);
    line-height: 36px;
    font-weight: 600;
}

.nf-tile__label {
    color: var(--nf-fg3);
}

/* --------------------------------------------------------------------------
   Data grid
   -------------------------------------------------------------------------- */

.nf-grid-wrap {
    overflow-x: auto;
}

.nf-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--nf-fs-body);
}

.nf-grid th,
.nf-grid td {
    text-align: left;
    padding: 0 var(--nf-sp-l);
    height: 44px;
    border-bottom: 1px solid var(--nf-stroke2);
    vertical-align: middle;
    white-space: nowrap;
}

.nf-grid th {
    font-weight: 600;
    color: var(--nf-fg2);
    background: var(--nf-bg1);
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: var(--nf-fs-body);
}

.nf-grid tbody tr {
    transition: background var(--nf-dur-fast) var(--nf-ease);
}

.nf-grid tbody tr:hover {
    background: var(--nf-subtle-hover);
}

.nf-grid tbody tr:last-child td {
    border-bottom: 0;
}

.nf-grid td.nf-grid__actions {
    text-align: right;
}

.nf-grid td.nf-grid__actions .nf-btn {
    opacity: .72;
}

.nf-grid tbody tr:hover td.nf-grid__actions .nf-btn {
    opacity: 1;
}

.nf-grid .nf-grid__primary {
    font-weight: 600;
    color: var(--nf-fg1);
}

.nf-grid .nf-grid__muted {
    color: var(--nf-fg3);
}

.nf-grid .nf-grid__wrap {
    white-space: normal;
}

.nf-empty {
    padding: var(--nf-sp-xxxl) var(--nf-sp-xl);
    text-align: center;
    color: var(--nf-fg3);
}

.nf-empty__title {
    font-family: var(--nf-font-display);
    font-size: var(--nf-fs-subtitle2);
    font-weight: 600;
    color: var(--nf-fg1);
    margin: var(--nf-sp-s) 0 var(--nf-sp-xs);
}

.nf-empty svg {
    width: 40px;
    height: 40px;
    color: var(--nf-fg4);
}

/* --------------------------------------------------------------------------
   Badges, tags, persona, code
   -------------------------------------------------------------------------- */

.nf-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 var(--nf-sp-s);
    border-radius: var(--nf-radius-circle);
    font-size: var(--nf-fs-caption);
    line-height: 16px;
    font-weight: 600;
    background: var(--nf-bg5);
    color: var(--nf-fg2);
    white-space: nowrap;
}

.nf-badge--brand {
    background: var(--nf-brand-bg2);
    color: var(--nf-brand-fg);
}

.nf-badge--success {
    background: var(--nf-success-bg);
    color: var(--nf-success-fg);
}

.nf-badge--danger {
    background: var(--nf-danger-bg);
    color: var(--nf-danger-fg);
}

.nf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--nf-sp-xs);
}

.nf-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--nf-sp-xs);
    height: 24px;
    padding: 0 var(--nf-sp-s);
    border-radius: var(--nf-radius);
    background: var(--nf-bg4);
    color: var(--nf-fg1);
    font-size: var(--nf-fs-caption);
    line-height: 16px;
    border: 1px solid var(--nf-stroke2);
    white-space: nowrap;
}

.nf-tag--brand {
    background: var(--nf-brand-bg2);
    border-color: transparent;
    color: var(--nf-brand-fg);
}

.nf-persona {
    display: inline-flex;
    align-items: center;
    gap: var(--nf-sp-m);
}

.nf-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--nf-radius-circle);
    background: var(--nf-brand-bg2);
    color: var(--nf-brand-fg);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: var(--nf-fs-caption);
    flex: none;
}

.nf-avatar--group {
    border-radius: var(--nf-radius);
}

.nf-code {
    font-family: var(--nf-font-mono);
    font-size: var(--nf-fs-caption);
    background: var(--nf-bg4);
    padding: 2px 6px;
    border-radius: var(--nf-radius-sm);
    color: var(--nf-fg2);
}

.nf-bits {
    font-family: var(--nf-font-mono);
    font-size: 11px;
    letter-spacing: .02em;
    color: var(--nf-fg3);
}

/* --------------------------------------------------------------------------
   Message bar
   -------------------------------------------------------------------------- */

.nf-message {
    display: flex;
    align-items: flex-start;
    gap: var(--nf-sp-m);
    padding: var(--nf-sp-m) var(--nf-sp-l);
    border: 1px solid var(--nf-info-stroke);
    border-radius: var(--nf-radius);
    background: var(--nf-info-bg);
    color: var(--nf-fg1);
    margin-bottom: var(--nf-sp-l);
}

.nf-message svg {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--nf-info-fg);
    margin-top: 0;
}

.nf-message--success {
    background: var(--nf-success-bg);
    border-color: var(--nf-success-stroke);
}

.nf-message--success svg {
    color: var(--nf-success-fg);
}

.nf-message--danger {
    background: var(--nf-danger-bg);
    border-color: var(--nf-danger-stroke);
}

.nf-message--danger svg {
    color: var(--nf-danger-fg);
}

.nf-message--warning {
    background: var(--nf-warning-bg);
    border-color: var(--nf-warning-stroke);
}

.nf-message--warning svg {
    color: var(--nf-warning-fg);
}

.nf-message__title {
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Permission picker (checkbox grid) + two-column layouts
   -------------------------------------------------------------------------- */

.nf-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--nf-sp-xxs) var(--nf-sp-l);
}

.nf-picker__item {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-s);
    min-height: 36px;
    padding: 0 var(--nf-sp-s);
    border-radius: var(--nf-radius);
    cursor: pointer;
}

.nf-picker__item:hover {
    background: var(--nf-subtle-hover);
}

.nf-picker__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nf-sp-s);
    margin-bottom: var(--nf-sp-m);
}

.nf-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: var(--nf-sp-xl);
    align-items: start;
}

@media (max-width: 1100px) {
    .nf-columns {
        grid-template-columns: 1fr;
    }
}

.nf-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nf-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nf-sp-s);
    padding: var(--nf-sp-s) 0;
    border-bottom: 1px solid var(--nf-stroke3);
}

.nf-list li:last-child {
    border-bottom: 0;
}

.nf-kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--nf-sp-xs) var(--nf-sp-l);
    margin: 0;
}

.nf-kv dt {
    color: var(--nf-fg3);
}

.nf-kv dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Dialog (native <dialog>, Fluent 2 surface)
   -------------------------------------------------------------------------- */

.nf-dialog {
    border: 0;
    padding: 0;
    width: min(480px, calc(100vw - 32px));
    background: var(--nf-bg1);
    color: var(--nf-fg1);
    border-radius: var(--nf-radius-lg);
    box-shadow: var(--nf-shadow64);
    font-family: var(--nf-font);
    font-size: var(--nf-fs-body);
    line-height: var(--nf-lh-body);
}

.nf-dialog::backdrop {
    background: rgba(0, 0, 0, .4);
}

.nf-dialog__body {
    padding: var(--nf-sp-xxl) var(--nf-sp-xxl) var(--nf-sp-l);
}

.nf-dialog__title {
    font-family: var(--nf-font-display);
    font-size: var(--nf-fs-subtitle1);
    line-height: 28px;
    font-weight: 600;
    margin: 0 0 var(--nf-sp-l);
}

.nf-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--nf-sp-s);
    padding: 0 var(--nf-sp-xxl) var(--nf-sp-xxl);
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.nf-link {
    color: var(--nf-brand-fg);
    text-decoration: none;
    border-radius: var(--nf-radius-sm);
}

.nf-link:hover {
    color: var(--nf-brand-fg-hover);
    text-decoration: underline;
}

.nf-muted {
    color: var(--nf-fg3);
}

.nf-caption {
    font-size: var(--nf-fs-caption);
    line-height: 16px;
}

.nf-stack {
    display: flex;
    flex-direction: column;
    gap: var(--nf-sp-m);
}

.nf-row {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-s);
    flex-wrap: wrap;
}

.nf-spacer {
    flex: 1;
}

.nf-inline-form {
    display: inline;
}

.nf-divider {
    border: 0;
    border-top: 1px solid var(--nf-stroke2);
    margin: var(--nf-sp-l) 0;
}

.nf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Additional components (select, toggle, radio, danger-primary, command bar)
   -------------------------------------------------------------------------- */

.nf-btn--danger-primary {
    background: var(--nf-danger-fg);
    border-color: transparent;
    color: #ffffff;
}

.nf-btn--danger-primary:hover {
    background: var(--nf-danger-hover);
    border-color: transparent;
}

.nf-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23616161' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px 16px;
    cursor: pointer;
}

.nf-select:focus {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230f6cbd' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
}

.nf-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--nf-sp-m);
    cursor: pointer;
    user-select: none;
    min-height: 32px;
}

.nf-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.nf-toggle__track {
    position: relative;
    width: 40px;
    height: 20px;
    border-radius: var(--nf-radius-circle);
    border: 1px solid var(--nf-stroke-accessible);
    background: var(--nf-bg1);
    transition: background var(--nf-dur-normal) var(--nf-ease), border-color var(--nf-dur-fast) var(--nf-ease);
    flex: none;
}

.nf-toggle__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--nf-stroke-accessible);
    transition: transform var(--nf-dur-normal) var(--nf-ease-decel), background var(--nf-dur-fast) var(--nf-ease);
}

.nf-toggle:hover .nf-toggle__track {
    border-color: var(--nf-fg1);
}

.nf-toggle:hover .nf-toggle__track::after {
    background: var(--nf-fg1);
}

.nf-toggle input:checked + .nf-toggle__track {
    background: var(--nf-brand);
    border-color: var(--nf-brand);
}

.nf-toggle input:checked + .nf-toggle__track::after {
    background: var(--nf-fg-on-brand);
    transform: translateX(20px);
}

.nf-toggle input:focus-visible + .nf-toggle__track {
    outline: 2px solid var(--nf-stroke-focus);
    outline-offset: 2px;
}

.nf-toggle input:disabled + .nf-toggle__track {
    background: var(--nf-bg-disabled);
    border-color: var(--nf-stroke-disabled);
}

.nf-radio {
    display: inline-flex;
    align-items: center;
    gap: var(--nf-sp-s);
    cursor: pointer;
    user-select: none;
    min-height: 32px;
    padding: 0 var(--nf-sp-xs);
}

.nf-radio input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.nf-radio__dot {
    width: 16px;
    height: 16px;
    flex: none;
    border-radius: 50%;
    border: 1px solid var(--nf-stroke-accessible);
    background: var(--nf-bg1);
    display: grid;
    place-items: center;
    transition: border-color var(--nf-dur-fast) var(--nf-ease);
}

.nf-radio__dot::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nf-brand);
    transform: scale(0);
    transition: transform var(--nf-dur-fast) var(--nf-ease-decel);
}

.nf-radio:hover .nf-radio__dot {
    border-color: var(--nf-fg1);
}

.nf-radio input:checked + .nf-radio__dot {
    border-color: var(--nf-brand);
}

.nf-radio input:checked + .nf-radio__dot::after {
    transform: scale(1);
}

.nf-radio input:focus-visible + .nf-radio__dot {
    outline: 2px solid var(--nf-stroke-focus);
    outline-offset: 2px;
}

.nf-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

.nf-icon svg {
    width: 100%;
    height: 100%;
}

.nf-icon--20 {
    width: 20px;
    height: 20px;
    vertical-align: -5px;
}

.nf-toolbar {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-xs);
    padding: var(--nf-sp-xs);
    background: var(--nf-bg1);
    border: 1px solid var(--nf-stroke2);
    border-radius: var(--nf-radius);
}

.nf-toolbar__separator {
    width: 1px;
    height: 20px;
    background: var(--nf-stroke2);
    margin: 0 var(--nf-sp-xs);
}

/* --------------------------------------------------------------------------
   Menu (dropdown), dropzone, auth column, file list helpers (1.1.0)
   -------------------------------------------------------------------------- */
.nf-menu {
    position: relative;
    display: inline-block;
}

.nf-menu__list {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 220px;
    margin: 0;
    padding: var(--nf-sp-xs);
    list-style: none;
    background: var(--nf-bg1);
    border: 1px solid var(--nf-stroke2);
    border-radius: var(--nf-radius-lg);
    box-shadow: var(--nf-shadow16);
    z-index: 40;
}

.nf-menu__list--left {
    right: auto;
    left: 0;
}

.nf-menu__header {
    padding: var(--nf-sp-s) var(--nf-sp-m);
    font-size: var(--nf-fs-caption);
    color: var(--nf-fg3);
}

.nf-menu__header strong {
    display: block;
    font-size: var(--nf-fs-body);
    font-weight: 600;
    color: var(--nf-fg1);
}

.nf-menu__item {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-s);
    width: 100%;
    padding: 0 var(--nf-sp-m);
    height: 36px;
    border: 0;
    border-radius: var(--nf-radius);
    background: transparent;
    color: var(--nf-fg1);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--nf-dur-fast) var(--nf-ease);
}

.nf-menu__item:hover,
.nf-menu__item:focus-visible {
    background: var(--nf-subtle-hover);
    color: var(--nf-fg1);
    text-decoration: none;
}

.nf-menu__item--danger {
    color: var(--nf-danger-fg);
}

.nf-menu__divider {
    height: 1px;
    margin: var(--nf-sp-xs) 0;
    background: var(--nf-stroke2);
}

.nf-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--nf-sp-s);
    padding: var(--nf-sp-xxl);
    border: 1px dashed var(--nf-stroke1);
    border-radius: var(--nf-radius-lg);
    background: var(--nf-bg2);
    color: var(--nf-fg2);
    text-align: center;
    transition: border-color var(--nf-dur-fast) var(--nf-ease), background var(--nf-dur-fast) var(--nf-ease);
}

.nf-dropzone .nf-icon {
    width: 32px;
    height: 32px;
    color: var(--nf-brand);
}

.nf-dropzone .nf-icon svg {
    width: 32px;
    height: 32px;
}

.nf-dropzone.is-dragover,
.nf-dropzone:focus-within {
    border-color: var(--nf-brand);
    background: var(--nf-brand-bg2);
}

.nf-auth {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 70vh;
    padding: var(--nf-sp-xxl) var(--nf-sp-l);
}

.nf-auth .nf-card {
    width: 100%;
    max-width: 440px;
}

.nf-auth__title {
    margin: 0 0 var(--nf-sp-xs);
    font-family: var(--nf-font-display);
    font-size: var(--nf-fs-title3);
    font-weight: 600;
    color: var(--nf-fg1);
}

.nf-auth__sub {
    margin: 0 0 var(--nf-sp-l);
    color: var(--nf-fg3);
}

.nf-divider--text {
    display: flex;
    align-items: center;
    gap: var(--nf-sp-m);
    margin: var(--nf-sp-l) 0;
    color: var(--nf-fg3);
    font-size: var(--nf-fs-caption);
    white-space: nowrap;
}

.nf-divider--text::before,
.nf-divider--text::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--nf-stroke2);
}

.nf-btn--block {
    width: 100%;
    justify-content: center;
}

.nf-code-input {
    font-family: var(--nf-font-mono);
    font-size: 22px;
    letter-spacing: .4em;
    text-align: center;
    height: 48px;
}

.nf-qr {
    display: block;
    width: 180px;
    height: 180px;
    margin: 0 auto;
    padding: var(--nf-sp-s);
    background: #fff;
    border: 1px solid var(--nf-stroke2);
    border-radius: var(--nf-radius-lg);
}

.nf-file-icon {
    color: var(--nf-fg3);
}

.nf-file-icon--folder {
    color: var(--nf-brand);
}

.nf-text-end {
    text-align: right;
}

.nf-text-center {
    text-align: center;
}

/* ASP.NET Core validation helpers: an empty summary stays hidden; field errors use the caption style */
.nf-message.validation-summary-valid {
    display: none;
}

.nf-message ul {
    margin: 0;
    padding-left: 1.2em;
}

.nf-field__error:empty {
    display: none;
}
