/* ==========================================================================
   Southland Load Board — application design system
   --------------------------------------------------------------------------
   Layering model (see docs/54_Prompt16K_UI_Completion.md):

     1. wwwroot/bootstrap/bootstrap.min.css   vendored Bootstrap 5.1 — grid,
                                              utilities, component skeletons.
     2. wwwroot/app.css (this file)           Southland tokens + the component
                                              layer built on top of Bootstrap.
     3. *.razor.css                           CSS isolation, shell only
                                              (MainLayout / NavMenu).

   Bootstrap 5.1 does NOT theme its components from --bs-* custom properties the
   way 5.3 does, so component colours are re-declared here against Southland
   tokens rather than assigned to Bootstrap variables.

   RULE: components must not hard-code colour, spacing, radius or shadow values.
   Add a token here and reference it. Razor files should carry classes, not
   inline style attributes.
   ========================================================================== */

/* ==========================================================================
   1. TOKENS
   ========================================================================== */

:root {
    /* --- Brand ---------------------------------------------------------- */
    --stc-brand-900: #0b2545;
    --stc-brand-800: #12315b;
    --stc-brand-700: #1b4171;
    --stc-brand-600: #235691;
    --stc-brand-500: #2f6fb4;
    --stc-brand-100: #e4edf7;
    --stc-brand-050: #f2f7fc;

    /* Accent — used sparingly for the active nav rail and focus affordances. */
    --stc-accent-600: #b26a00;
    --stc-accent-500: #e08600;
    --stc-accent-100: #fdf1de;

    /* --- Surfaces ------------------------------------------------------- */
    --stc-page-bg: #f4f6f9;
    --stc-surface: #ffffff;
    --stc-surface-raised: #ffffff;
    --stc-surface-sunken: #f8fafc;
    --stc-surface-header: #f1f4f8;
    --stc-surface-hover: #f5f8fc;

    /* --- Text ----------------------------------------------------------- */
    --stc-text: #1c2430;
    --stc-text-strong: #0f1620;
    --stc-text-muted: #5c6a7d;
    --stc-text-subtle: #7a8798;
    --stc-text-inverse: #ffffff;
    --stc-text-on-brand: #dbe6f3;

    /* --- Lines ---------------------------------------------------------- */
    --stc-border: #d8dfe8;
    --stc-border-strong: #b9c4d2;
    --stc-border-subtle: #e7ecf2;

    /* --- Actions -------------------------------------------------------- */
    --stc-primary: #1b4171;
    --stc-primary-hover: #143257;
    --stc-primary-active: #0f2643;
    --stc-primary-contrast: #ffffff;

    --stc-secondary: #ffffff;
    --stc-secondary-hover: #eef2f7;
    --stc-secondary-border: #b9c4d2;
    --stc-secondary-contrast: #1c2430;

    /* --- Semantic states ------------------------------------------------ */
    --stc-success: #1c6b3f;
    --stc-success-bg: #e6f4ec;
    --stc-success-border: #a9d6bd;

    --stc-warning: #8a5a00;
    --stc-warning-bg: #fdf3e0;
    --stc-warning-border: #e8cd97;

    --stc-danger: #a32020;
    --stc-danger-bg: #fbeaea;
    --stc-danger-border: #eab4b4;

    --stc-info: #1a5c86;
    --stc-info-bg: #e6f1f8;
    --stc-info-border: #a8cbe1;

    --stc-neutral: #4a5666;
    --stc-neutral-bg: #eef1f5;
    --stc-neutral-border: #cdd5e0;

    /* --- Spacing scale (4px base) --------------------------------------- */
    --stc-space-1: 0.25rem;
    --stc-space-2: 0.5rem;
    --stc-space-3: 0.75rem;
    --stc-space-4: 1rem;
    --stc-space-5: 1.25rem;
    --stc-space-6: 1.5rem;
    --stc-space-8: 2rem;
    --stc-space-10: 2.5rem;
    --stc-space-12: 3rem;

    /* --- Radius --------------------------------------------------------- */
    --stc-radius-sm: 3px;
    --stc-radius: 6px;
    --stc-radius-lg: 10px;
    --stc-radius-pill: 999px;

    /* --- Shadows -------------------------------------------------------- */
    --stc-shadow-xs: 0 1px 2px rgba(16, 27, 43, 0.06);
    --stc-shadow-sm: 0 1px 3px rgba(16, 27, 43, 0.10), 0 1px 2px rgba(16, 27, 43, 0.06);
    --stc-shadow-md: 0 4px 12px rgba(16, 27, 43, 0.10);
    --stc-shadow-lg: 0 12px 32px rgba(16, 27, 43, 0.16);

    /* --- Typography ----------------------------------------------------- */
    --stc-font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --stc-font-mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

    --stc-text-xs: 0.75rem;
    --stc-text-sm: 0.8125rem;
    --stc-text-base: 0.875rem;
    --stc-text-md: 0.9375rem;
    --stc-text-lg: 1.0625rem;
    --stc-text-xl: 1.25rem;
    --stc-text-2xl: 1.5rem;
    --stc-text-3xl: 1.875rem;

    --stc-leading-tight: 1.25;
    --stc-leading: 1.5;
    --stc-leading-loose: 1.65;

    --stc-weight-normal: 400;
    --stc-weight-medium: 500;
    --stc-weight-semibold: 600;
    --stc-weight-bold: 700;

    /* --- Controls ------------------------------------------------------- */
    --stc-control-height: 2.25rem;
    --stc-control-height-sm: 1.875rem;
    --stc-control-height-lg: 2.625rem;
    --stc-control-padding-x: 0.625rem;

    /* --- Tables --------------------------------------------------------- */
    --stc-table-cell-y: 0.5rem;
    --stc-table-cell-x: 0.75rem;
    --stc-table-header-size: var(--stc-text-xs);

    /* --- Shell ---------------------------------------------------------- */
    --stc-sidebar-width: 250px;
    --stc-topbar-height: 3.25rem;
    --stc-content-max: 1600px;
    --stc-nav-item-y: 0.4rem;
    --stc-nav-item-x: 0.75rem;
    --stc-nav-group-gap: 1rem;

    --stc-focus-ring: 0 0 0 2px var(--stc-surface), 0 0 0 4px var(--stc-brand-500);
}

/* ==========================================================================
   2. BASE
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

html,
body {
    font-family: var(--stc-font-sans);
    font-size: var(--stc-text-base);
    line-height: var(--stc-leading);
    color: var(--stc-text);
    background-color: var(--stc-page-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--stc-text-strong);
    font-weight: var(--stc-weight-semibold);
    line-height: var(--stc-leading-tight);
    margin-top: 0;
}

h1 { font-size: var(--stc-text-2xl); margin-bottom: var(--stc-space-2); }
h2 { font-size: var(--stc-text-xl); margin-bottom: var(--stc-space-3); }
h3 { font-size: var(--stc-text-lg); margin-bottom: var(--stc-space-2); }
h4 { font-size: var(--stc-text-md); margin-bottom: var(--stc-space-2); }
h5, h6 { font-size: var(--stc-text-base); margin-bottom: var(--stc-space-2); }

h1:focus { outline: none; }

p { margin-top: 0; margin-bottom: var(--stc-space-3); }

a, .btn-link {
    color: var(--stc-brand-600);
    text-decoration: none;
}

a:hover, .btn-link:hover {
    color: var(--stc-brand-700);
    text-decoration: underline;
}

code, kbd, samp, pre, .stc-mono {
    font-family: var(--stc-font-mono);
    font-size: var(--stc-text-sm);
}

hr {
    border: 0;
    border-top: 1px solid var(--stc-border);
    opacity: 1;
    margin: var(--stc-space-6) 0;
}

/* Visible keyboard focus everywhere (Part P). Pointer clicks stay quiet. */
:focus-visible {
    outline: 2px solid var(--stc-brand-500);
    outline-offset: 2px;
    border-radius: var(--stc-radius-sm);
}

.stc-visually-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Skip link — first focusable element in the shell. */
.stc-skip-link {
    position: absolute;
    left: var(--stc-space-2);
    top: -3rem;
    z-index: 1200;
    padding: var(--stc-space-2) var(--stc-space-4);
    background: var(--stc-surface);
    color: var(--stc-text-strong);
    border: 1px solid var(--stc-border-strong);
    border-radius: var(--stc-radius);
    box-shadow: var(--stc-shadow-md);
    transition: top 0.12s ease-in-out;
}

.stc-skip-link:focus {
    top: var(--stc-space-2);
}

/* ==========================================================================
   3. PAGE HEADER / CONTENT RHYTHM
   ========================================================================== */

.stc-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--stc-space-4);
    margin-bottom: var(--stc-space-5);
}

.stc-page-header__text { min-width: 0; }

.stc-page-header h1,
.stc-page-title {
    font-size: var(--stc-text-2xl);
    margin-bottom: var(--stc-space-1);
}

.stc-page-subtitle,
.stc-page-header p {
    color: var(--stc-text-muted);
    font-size: var(--stc-text-md);
    margin-bottom: 0;
    max-width: 78ch;
}

.stc-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--stc-space-2);
    align-items: center;
}

.stc-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--stc-space-2);
    padding: 0;
    margin: 0 0 var(--stc-space-2);
    list-style: none;
    font-size: var(--stc-text-sm);
    color: var(--stc-text-subtle);
}

.stc-breadcrumb li { display: flex; align-items: center; gap: var(--stc-space-2); }

.stc-breadcrumb li + li::before {
    content: "/";
    color: var(--stc-border-strong);
}

.stc-breadcrumb a { color: var(--stc-text-muted); }
.stc-breadcrumb [aria-current="page"] { color: var(--stc-text); font-weight: var(--stc-weight-medium); }

.stc-section {
    margin-bottom: var(--stc-space-8);
}

.stc-section__title {
    font-size: var(--stc-text-lg);
    margin-bottom: var(--stc-space-3);
}

.stc-stack > * + * { margin-top: var(--stc-space-4); }

/* ==========================================================================
   4. SURFACES / CARDS
   ========================================================================== */

.stc-card {
    background: var(--stc-surface);
    border: 1px solid var(--stc-border);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-xs);
}

.stc-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--stc-space-3);
    padding: var(--stc-space-3) var(--stc-space-5);
    border-bottom: 1px solid var(--stc-border-subtle);
    background: var(--stc-surface-header);
    border-radius: var(--stc-radius-lg) var(--stc-radius-lg) 0 0;
}

.stc-card__title {
    font-size: var(--stc-text-md);
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-strong);
    margin: 0;
}

.stc-card__body { padding: var(--stc-space-5); min-width: 0; overflow-x: auto; }
.stc-card__body--flush { padding: 0; }

.stc-card__footer {
    padding: var(--stc-space-3) var(--stc-space-5);
    border-top: 1px solid var(--stc-border-subtle);
    background: var(--stc-surface-sunken);
    border-radius: 0 0 var(--stc-radius-lg) var(--stc-radius-lg);
}

/* --- Statistic tiles (dashboard) --------------------------------------- */

.stc-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--stc-space-4);
}

.stc-stat {
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-1);
    padding: var(--stc-space-4) var(--stc-space-5);
    background: var(--stc-surface);
    border: 1px solid var(--stc-border);
    border-left: 3px solid var(--stc-brand-500);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-xs);
    color: inherit;
    text-decoration: none;
}

a.stc-stat:hover {
    text-decoration: none;
    border-color: var(--stc-brand-500);
    box-shadow: var(--stc-shadow-sm);
    background: var(--stc-surface-hover);
}

.stc-stat__label {
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--stc-text-muted);
}

.stc-stat__value {
    font-size: var(--stc-text-3xl);
    font-weight: var(--stc-weight-semibold);
    line-height: 1.1;
    color: var(--stc-text-strong);
    font-variant-numeric: tabular-nums;
}

.stc-stat__meta {
    font-size: var(--stc-text-sm);
    color: var(--stc-text-muted);
}

.stc-stat--success { border-left-color: var(--stc-success); }
.stc-stat--warning { border-left-color: var(--stc-warning); }
.stc-stat--danger  { border-left-color: var(--stc-danger); }
.stc-stat--neutral { border-left-color: var(--stc-neutral-border); }

/* --- Definition / detail lists ----------------------------------------- */

.stc-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--stc-space-4) var(--stc-space-6);
    margin: 0;
}

/* One term/value pair. A wrapper is required rather than letting <dt> and <dd> be direct
   grid children: with auto-fit columns each direct child takes its own cell, so a bare
   dt/dd sequence lands the label and its value in two unrelated columns. */
.stc-detail { min-width: 0; }

.stc-detail__term {
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--stc-text-muted);
    margin-bottom: var(--stc-space-1);
}

/* Parenthetical qualifier inside a term — e.g. "(written to Assigned_Carrier)". Kept
   lower-case and lighter so the field name itself still reads as the label. */
.stc-detail__hint {
    text-transform: none;
    letter-spacing: 0;
    font-weight: var(--stc-weight-normal);
    color: var(--stc-text-muted);
}

.stc-detail__value {
    font-size: var(--stc-text-md);
    color: var(--stc-text-strong);
    margin: 0;
    overflow-wrap: anywhere;
}

.stc-detail__value--mono {
    font-family: var(--stc-font-mono);
    font-size: var(--stc-text-sm);
}

/* ==========================================================================
   5. TABLES
   ========================================================================== */

.stc-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stc-table,
table.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    font-size: var(--stc-text-base);
    color: var(--stc-text);
}

.stc-table thead th,
table.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--stc-surface-header);
    color: var(--stc-text-muted);
    font-size: var(--stc-table-header-size);
    font-weight: var(--stc-weight-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
    padding: var(--stc-table-cell-y) var(--stc-table-cell-x);
    border-bottom: 1px solid var(--stc-border);
    vertical-align: bottom;
}

.stc-table tbody td,
table.table tbody td,
.stc-table tbody th,
table.table tbody th {
    padding: var(--stc-table-cell-y) var(--stc-table-cell-x);
    border-top: 1px solid var(--stc-border-subtle);
    vertical-align: middle;
    background: transparent;
}

.stc-table tbody tr:hover,
table.table tbody tr:hover {
    background: var(--stc-surface-hover);
}

.stc-table tbody tr:first-child td,
table.table tbody tr:first-child td {
    border-top: 0;
}

/* Numeric columns line up on the decimal. */
.stc-table .stc-num,
.stc-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stc-table .stc-nowrap,
.stc-nowrap { white-space: nowrap; }

.stc-table__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--stc-space-2);
    justify-content: flex-end;
}

/* A table that lives directly inside a card body gets flush edges. */
.stc-card__body--flush .stc-table-wrap { border-radius: 0 0 var(--stc-radius-lg) var(--stc-radius-lg); }

.stc-table caption {
    caption-side: top;
    padding: 0 0 var(--stc-space-2);
    color: var(--stc-text-muted);
    font-size: var(--stc-text-sm);
}

/* ==========================================================================
   6. STATUS BADGES
   --------------------------------------------------------------------------
   Meaning is never carried by colour alone (Part K): every badge renders its
   own text label, and the tone classes add a border + weight difference that
   survives greyscale.
   ========================================================================== */

.stc-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--stc-space-1);
    padding: 0.125rem var(--stc-space-2);
    border: 1px solid var(--stc-neutral-border);
    border-radius: var(--stc-radius-pill);
    background: var(--stc-neutral-bg);
    color: var(--stc-neutral);
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: baseline;
}

.stc-badge--success {
    background: var(--stc-success-bg);
    border-color: var(--stc-success-border);
    color: var(--stc-success);
}

.stc-badge--warning {
    background: var(--stc-warning-bg);
    border-color: var(--stc-warning-border);
    color: var(--stc-warning);
}

.stc-badge--danger {
    background: var(--stc-danger-bg);
    border-color: var(--stc-danger-border);
    color: var(--stc-danger);
}

.stc-badge--info {
    background: var(--stc-info-bg);
    border-color: var(--stc-info-border);
    color: var(--stc-info);
}

.stc-badge--brand {
    background: var(--stc-brand-100);
    border-color: var(--stc-brand-500);
    color: var(--stc-brand-700);
}

.stc-badge--muted {
    background: transparent;
    border-color: var(--stc-border-strong);
    color: var(--stc-text-muted);
}

/* Small round dot preceding the label — decorative only. */
.stc-badge__dot {
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

/* ==========================================================================
   7. RESTRICTION / CALLOUT
   ========================================================================== */

.stc-restriction {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--stc-space-2);
    padding: var(--stc-space-2) var(--stc-space-3);
    background: var(--stc-warning-bg);
    border: 1px solid var(--stc-warning-border);
    border-left: 3px solid var(--stc-warning);
    border-radius: var(--stc-radius);
    color: var(--stc-warning);
    font-size: var(--stc-text-sm);
    line-height: var(--stc-leading);
}

.stc-restriction__label {
    font-weight: var(--stc-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: var(--stc-text-xs);
    flex: none;
}

/* Restriction text is exact source text — never truncated or reworded. */
.stc-restriction__text { color: var(--stc-text); overflow-wrap: anywhere; }

.stc-callout {
    padding: var(--stc-space-3) var(--stc-space-4);
    border: 1px solid var(--stc-info-border);
    border-left: 3px solid var(--stc-info);
    border-radius: var(--stc-radius);
    background: var(--stc-info-bg);
    color: var(--stc-text);
    font-size: var(--stc-text-base);
}

.stc-callout--warning { border-color: var(--stc-warning-border); border-left-color: var(--stc-warning); background: var(--stc-warning-bg); }
.stc-callout--danger  { border-color: var(--stc-danger-border);  border-left-color: var(--stc-danger);  background: var(--stc-danger-bg); }
.stc-callout--success { border-color: var(--stc-success-border); border-left-color: var(--stc-success); background: var(--stc-success-bg); }
.stc-callout--neutral { border-color: var(--stc-border);         border-left-color: var(--stc-border-strong); background: var(--stc-surface-sunken); }

.stc-callout__title {
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-strong);
    margin-bottom: var(--stc-space-1);
}

/* ==========================================================================
   8. BUTTONS
   ========================================================================== */

.btn {
    --bs-btn-focus-box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--stc-space-2);
    min-height: var(--stc-control-height);
    padding: 0 var(--stc-space-4);
    border-radius: var(--stc-radius);
    border: 1px solid transparent;
    font-size: var(--stc-text-base);
    font-weight: var(--stc-weight-medium);
    line-height: var(--stc-leading);
    white-space: nowrap;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: var(--stc-focus-ring);
    outline: none;
}

.btn-sm { min-height: var(--stc-control-height-sm); padding: 0 var(--stc-space-3); font-size: var(--stc-text-sm); }
.btn-lg { min-height: var(--stc-control-height-lg); padding: 0 var(--stc-space-5); font-size: var(--stc-text-md); }

.btn-primary {
    background-color: var(--stc-primary);
    border-color: var(--stc-primary);
    color: var(--stc-primary-contrast);
}

.btn-primary:hover {
    background-color: var(--stc-primary-hover);
    border-color: var(--stc-primary-hover);
    color: var(--stc-primary-contrast);
}

.btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active {
    background-color: var(--stc-primary-active);
    border-color: var(--stc-primary-active);
    color: var(--stc-primary-contrast);
}

.btn-secondary,
.btn-outline-secondary {
    background-color: var(--stc-secondary);
    border-color: var(--stc-secondary-border);
    color: var(--stc-secondary-contrast);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background-color: var(--stc-secondary-hover);
    border-color: var(--stc-border-strong);
    color: var(--stc-secondary-contrast);
}

.btn-success { background-color: var(--stc-success); border-color: var(--stc-success); color: #fff; }
.btn-success:hover { background-color: #165833; border-color: #165833; color: #fff; }

.btn-danger { background-color: var(--stc-danger); border-color: var(--stc-danger); color: #fff; }
.btn-danger:hover { background-color: #871a1a; border-color: #871a1a; color: #fff; }

.btn-warning { background-color: var(--stc-warning); border-color: var(--stc-warning); color: #fff; }
.btn-warning:hover { background-color: #714a00; border-color: #714a00; color: #fff; }

.btn-outline-danger { background: transparent; border-color: var(--stc-danger-border); color: var(--stc-danger); }
.btn-outline-danger:hover { background: var(--stc-danger-bg); border-color: var(--stc-danger); color: var(--stc-danger); }

.btn-link {
    min-height: auto;
    padding: 0;
    border: 0;
    background: none;
    font-weight: var(--stc-weight-medium);
    color: var(--stc-brand-600);
}

.btn:disabled,
.btn.disabled,
fieldset:disabled .btn {
    opacity: 0.55;
    cursor: not-allowed;
}

.stc-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--stc-space-2);
    align-items: center;
}

.stc-btn-row--end { justify-content: flex-end; }

/* Inline busy indicator for submitting buttons. */
.stc-spinner {
    width: 0.875rem;
    height: 0.875rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: stc-spin 0.7s linear infinite;
    flex: none;
}

@keyframes stc-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .stc-spinner { animation-duration: 2.4s; }
    * { scroll-behavior: auto !important; }
}

/* ==========================================================================
   9. FORMS
   ========================================================================== */

.stc-form { max-width: 46rem; }
.stc-form--wide { max-width: none; }

.stc-field { margin-bottom: var(--stc-space-4); }

.stc-field__label,
.stc-form label,
label.form-label {
    display: block;
    margin-bottom: var(--stc-space-1);
    font-size: var(--stc-text-sm);
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-strong);
}

/* Required marker is text-bearing, not colour-only. */
.stc-required {
    color: var(--stc-danger);
    font-weight: var(--stc-weight-bold);
    margin-left: 0.125rem;
}

.stc-optional {
    color: var(--stc-text-subtle);
    font-weight: var(--stc-weight-normal);
    font-size: var(--stc-text-xs);
    margin-left: var(--stc-space-1);
}

.form-control,
.form-select,
input[type="text"].form-control,
input[type="email"].form-control,
input[type="number"].form-control,
input[type="password"].form-control,
input[type="date"].form-control {
    min-height: var(--stc-control-height);
    padding: 0.3125rem var(--stc-control-padding-x);
    font-size: var(--stc-text-base);
    line-height: var(--stc-leading);
    color: var(--stc-text);
    background-color: var(--stc-surface);
    border: 1px solid var(--stc-border-strong);
    border-radius: var(--stc-radius);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

textarea.form-control { min-height: 5rem; padding-top: var(--stc-space-2); }

.form-control:focus,
.form-select:focus {
    border-color: var(--stc-brand-500);
}

.form-control::placeholder { color: var(--stc-text-subtle); }

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: var(--stc-surface-sunken);
    color: var(--stc-text-muted);
    cursor: not-allowed;
}

.form-select {
    padding-right: var(--stc-space-8);
    background-position: right var(--stc-space-3) center;
}

.form-check-input:checked {
    background-color: var(--stc-primary);
    border-color: var(--stc-primary);
}

.darker-border-checkbox.form-check-input { border-color: var(--stc-border-strong); }

/* Helper text sits under the control, above validation. */
.stc-field__help,
.form-text {
    display: block;
    margin-top: var(--stc-space-1);
    font-size: var(--stc-text-sm);
    color: var(--stc-text-muted);
}

/* Currency and unit affixes. */
.stc-input-group {
    display: flex;
    align-items: stretch;
    max-width: 16rem;
}

.stc-input-group .form-control {
    border-radius: 0;
    position: relative;
    z-index: 1;
}

.stc-input-group > :first-child { border-top-left-radius: var(--stc-radius); border-bottom-left-radius: var(--stc-radius); }
.stc-input-group > :last-child { border-top-right-radius: var(--stc-radius); border-bottom-right-radius: var(--stc-radius); }

.stc-input-group__affix {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--stc-space-3);
    background: var(--stc-surface-header);
    border: 1px solid var(--stc-border-strong);
    color: var(--stc-text-muted);
    font-size: var(--stc-text-base);
    font-weight: var(--stc-weight-medium);
    white-space: nowrap;
}

.stc-input-group__affix--prefix { border-right: 0; }
.stc-input-group__affix--suffix { border-left: 0; }

/* --- Validation --------------------------------------------------------- */

.valid.modified:not([type=checkbox]) {
    border-color: var(--stc-success);
}

.invalid,
.form-control.invalid,
.form-select.invalid {
    border-color: var(--stc-danger);
    background-color: var(--stc-danger-bg);
}

.validation-message,
.stc-field__error {
    display: block;
    margin-top: var(--stc-space-1);
    font-size: var(--stc-text-sm);
    font-weight: var(--stc-weight-medium);
    color: var(--stc-danger);
}

/* Prefix keeps the error legible without relying on the red alone. */
.validation-message::before,
.stc-field__error::before {
    content: "Error: ";
    font-weight: var(--stc-weight-bold);
}

.validation-errors {
    margin: 0 0 var(--stc-space-4);
    padding: var(--stc-space-3) var(--stc-space-4);
    list-style-position: inside;
    background: var(--stc-danger-bg);
    border: 1px solid var(--stc-danger-border);
    border-left: 3px solid var(--stc-danger);
    border-radius: var(--stc-radius);
    color: var(--stc-danger);
    font-size: var(--stc-text-base);
}

.validation-errors .validation-message::before { content: ""; }

.stc-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--stc-space-2);
    align-items: center;
    margin-top: var(--stc-space-5);
    padding-top: var(--stc-space-4);
    border-top: 1px solid var(--stc-border-subtle);
}

/* ==========================================================================
   10. FILTER BAR
   ========================================================================== */

.stc-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--stc-space-3);
    padding: var(--stc-space-4);
    background: var(--stc-surface);
    border: 1px solid var(--stc-border);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-xs);
    margin-bottom: var(--stc-space-5);
}

/* An active filter set is signalled by the bar itself, not colour alone: the
   count chip below spells out how many filters are applied. */
.stc-filters--active {
    border-color: var(--stc-brand-500);
    background: var(--stc-brand-050);
}

.stc-filters__field {
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-1);
    min-width: 11rem;
}

.stc-filters__field label {
    margin: 0;
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--stc-text-muted);
}

.stc-filters__actions {
    display: flex;
    gap: var(--stc-space-2);
    align-items: center;
    margin-left: auto;
}

/* A checkbox filter still needs the same uppercase label rhythm as the inputs
   beside it, so the control sits in a second row under its own group label. */
.stc-filters__field--check .form-check {
    display: flex;
    align-items: center;
    gap: var(--stc-space-2);
    min-height: var(--stc-control-height);
    margin: 0;
    padding: 0;
}

.stc-filters__field--check .form-check-input { margin: 0; flex: none; }

.stc-filters__field--check .form-check-label {
    margin: 0;
    font-size: var(--stc-text-base);
    font-weight: var(--stc-weight-normal);
    text-transform: none;
    letter-spacing: 0;
    color: var(--stc-text);
}

.stc-filters__count {
    display: inline-flex;
    align-items: center;
    gap: var(--stc-space-1);
    padding: 0.125rem var(--stc-space-2);
    border-radius: var(--stc-radius-pill);
    background: var(--stc-brand-100);
    border: 1px solid var(--stc-brand-500);
    color: var(--stc-brand-700);
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
}

/* ==========================================================================
   11. STATE BLOCKS — loading / empty / error / no permission
   ========================================================================== */

.stc-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--stc-space-2);
    padding: var(--stc-space-10) var(--stc-space-6);
    text-align: center;
    color: var(--stc-text-muted);
}

.stc-state__title {
    font-size: var(--stc-text-md);
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-strong);
    margin: 0;
}

.stc-state__detail {
    font-size: var(--stc-text-base);
    color: var(--stc-text-muted);
    margin: 0;
    max-width: 52ch;
}

.stc-state__actions { margin-top: var(--stc-space-3); }

.stc-state--inline { padding: var(--stc-space-6) var(--stc-space-4); }

.stc-state--error .stc-state__title { color: var(--stc-danger); }

.stc-state__spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--stc-border-strong);
    border-top-color: var(--stc-brand-500);
    border-radius: 50%;
    animation: stc-spin 0.8s linear infinite;
}

/* Skeleton rows for table loading. */
.stc-skeleton {
    height: 0.75rem;
    border-radius: var(--stc-radius-sm);
    background: linear-gradient(90deg, var(--stc-surface-sunken) 25%, var(--stc-border-subtle) 37%, var(--stc-surface-sunken) 63%);
    background-size: 400% 100%;
    animation: stc-shimmer 1.4s ease infinite;
}

@keyframes stc-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ==========================================================================
   12. ALERTS
   ========================================================================== */

.alert {
    padding: var(--stc-space-3) var(--stc-space-4);
    border-radius: var(--stc-radius);
    border: 1px solid transparent;
    border-left-width: 3px;
    font-size: var(--stc-text-base);
    margin-bottom: var(--stc-space-4);
}

.alert-success { background: var(--stc-success-bg); border-color: var(--stc-success-border); border-left-color: var(--stc-success); color: var(--stc-success); }
.alert-warning { background: var(--stc-warning-bg); border-color: var(--stc-warning-border); border-left-color: var(--stc-warning); color: var(--stc-warning); }
.alert-danger  { background: var(--stc-danger-bg);  border-color: var(--stc-danger-border);  border-left-color: var(--stc-danger);  color: var(--stc-danger); }
.alert-info,
.alert-primary { background: var(--stc-info-bg);    border-color: var(--stc-info-border);    border-left-color: var(--stc-info);    color: var(--stc-info); }
.alert-secondary,
.alert-light   { background: var(--stc-surface-sunken); border-color: var(--stc-border); border-left-color: var(--stc-border-strong); color: var(--stc-text); }

/* ==========================================================================
   13. DIALOGS
   ========================================================================== */

.stc-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--stc-space-8) var(--stc-space-4);
    overflow-y: auto;
    background: rgba(11, 37, 69, 0.45);
}

.stc-dialog {
    width: 100%;
    max-width: 34rem;
    background: var(--stc-surface);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-lg);
    overflow: hidden;
}

.stc-dialog--wide { max-width: 52rem; }

.stc-dialog__header {
    padding: var(--stc-space-4) var(--stc-space-5);
    border-bottom: 1px solid var(--stc-border-subtle);
    background: var(--stc-surface-header);
}

.stc-dialog__title {
    margin: 0;
    font-size: var(--stc-text-lg);
    color: var(--stc-text-strong);
}

.stc-dialog__body { padding: var(--stc-space-5); }

.stc-dialog__consequences {
    margin: var(--stc-space-4) 0 0;
    padding: var(--stc-space-3) var(--stc-space-4);
    background: var(--stc-warning-bg);
    border: 1px solid var(--stc-warning-border);
    border-left: 3px solid var(--stc-warning);
    border-radius: var(--stc-radius);
    font-size: var(--stc-text-base);
}

.stc-dialog__consequences ul { margin: var(--stc-space-2) 0 0; padding-left: var(--stc-space-5); }
.stc-dialog__consequences li + li { margin-top: var(--stc-space-1); }

.stc-dialog__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--stc-space-2);
    padding: var(--stc-space-4) var(--stc-space-5);
    border-top: 1px solid var(--stc-border-subtle);
    background: var(--stc-surface-sunken);
}

/* ==========================================================================
   14. DISCLOSURE (Apollo GUID and other long technical values)
   ========================================================================== */

.stc-disclosure { font-size: var(--stc-text-sm); }

.stc-disclosure > summary {
    cursor: pointer;
    color: var(--stc-brand-600);
    font-weight: var(--stc-weight-medium);
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: var(--stc-space-1);
}

.stc-disclosure > summary::-webkit-details-marker { display: none; }
.stc-disclosure > summary::before { content: "\25B8"; font-size: 0.7em; }
.stc-disclosure[open] > summary::before { content: "\25BE"; }
.stc-disclosure > summary:hover { text-decoration: underline; }

.stc-disclosure__content {
    margin-top: var(--stc-space-2);
    padding: var(--stc-space-2) var(--stc-space-3);
    background: var(--stc-surface-sunken);
    border: 1px solid var(--stc-border-subtle);
    border-radius: var(--stc-radius);
    font-family: var(--stc-font-mono);
    font-size: var(--stc-text-xs);
    color: var(--stc-text-muted);
    overflow-wrap: anywhere;
}

/* ==========================================================================
   15. HEALTH GRID (System Health)
   ========================================================================== */

.stc-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--stc-space-4);
}

.stc-health {
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-2);
    padding: var(--stc-space-4);
    background: var(--stc-surface);
    border: 1px solid var(--stc-border);
    border-top: 3px solid var(--stc-border-strong);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-xs);
}

.stc-health--healthy  { border-top-color: var(--stc-success); }
.stc-health--degraded { border-top-color: var(--stc-warning); }
.stc-health--unhealthy{ border-top-color: var(--stc-danger); }
.stc-health--unknown  { border-top-color: var(--stc-border-strong); }

.stc-health__name {
    font-size: var(--stc-text-md);
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-strong);
    margin: 0;
}

.stc-health__detail { font-size: var(--stc-text-sm); color: var(--stc-text-muted); margin: 0; }

/* ==========================================================================
   16. AUTH SHELL
   --------------------------------------------------------------------------
   /login, /verify-code, /forgot-password, /reset-password, /accept-invitation
   and the two terminal states (/access-denied, /Error) all render inside the
   normal content area, so the shell here is a centred column rather than a
   separate layout. One card, one job per screen.
   ========================================================================== */

.stc-auth {
    width: 100%;
    max-width: 27rem;
    margin: 0 auto;
    padding: var(--stc-space-6) 0 var(--stc-space-10);
}

.stc-auth--wide { max-width: 34rem; }

/* Logo above the card. It is the brand cue on these screens; the rail that normally
   carries it is hidden from an anonymous visitor. Rendered by AuthBrand.razor. */
.stc-auth__brand {
    margin-bottom: var(--stc-space-5);
    text-align: center;
}

/*
  The asset is a 1536x1024 (3:2) transparent PNG, so it sits straight on the page
  background with no card or border around it. Its dark truck and black-outlined
  wordmark read against the light page surface, exactly as its white and orange
  elements read against the dark rail. Relative sizing only: it fills the auth column
  up to the cap and its height follows the intrinsic ratio, so it never stretches.
*/
.stc-auth__brand-logo {
    display: block;
    width: 100%;
    max-width: 24rem;
    height: auto;
    margin: 0 auto var(--stc-space-3);
}

/*
  A 3:2 mark at full width is 16rem tall. On a short viewport -- a laptop at 768px, or a
  phone in landscape -- that pushes the submit button below the fold, so the mark gives
  up height rather than the form.
*/
@media (max-height: 800px) {
    .stc-auth__brand-logo { max-width: 17rem; }
}

@media (max-height: 620px) {
    .stc-auth__brand { margin-bottom: var(--stc-space-4); }
    .stc-auth__brand-logo { max-width: 12rem; }
}

.stc-auth__brand-eyebrow {
    display: block;
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--stc-text-subtle);
}

.stc-auth__card {
    background: var(--stc-surface);
    border: 1px solid var(--stc-border);
    border-top: 3px solid var(--stc-brand-700);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-sm);
    padding: var(--stc-space-6);
}

.stc-auth__title {
    font-size: var(--stc-text-xl);
    margin-bottom: var(--stc-space-2);
}

.stc-auth__intro {
    font-size: var(--stc-text-base);
    color: var(--stc-text-muted);
    margin-bottom: var(--stc-space-5);
}

/* The form itself must not inherit .stc-form's 46rem cap inside a 27rem card. */
.stc-auth__card .stc-form { max-width: none; }

.stc-auth__submit { width: 100%; }

.stc-auth__footer {
    margin-top: var(--stc-space-5);
    padding-top: var(--stc-space-4);
    border-top: 1px solid var(--stc-border-subtle);
    font-size: var(--stc-text-base);
    display: flex;
    flex-wrap: wrap;
    gap: var(--stc-space-2) var(--stc-space-4);
    align-items: center;
    justify-content: space-between;
}

.stc-auth__footer p { margin: 0; }

/* A secondary form (resend code) that must not read as the primary action. */
.stc-auth__aside {
    margin-top: var(--stc-space-4);
    font-size: var(--stc-text-sm);
    color: var(--stc-text-muted);
}

/* One-time code entry: wide tracking so a 6-digit code is read in pairs. */
.stc-code-input {
    font-family: var(--stc-font-mono);
    font-size: var(--stc-text-2xl);
    letter-spacing: 0.35em;
    text-align: center;
    min-height: var(--stc-control-height-lg);
}

/* ==========================================================================
   17. QUICK LINKS (dashboard navigation tiles)
   --------------------------------------------------------------------------
   Distinct from .stc-stat: a stat reports a number, a quick link is a
   destination with a one-line explanation of what is there.
   ========================================================================== */

.stc-linkgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--stc-space-3);
}

.stc-linktile {
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-1);
    padding: var(--stc-space-4);
    background: var(--stc-surface);
    border: 1px solid var(--stc-border);
    border-radius: var(--stc-radius-lg);
    box-shadow: var(--stc-shadow-xs);
    color: inherit;
    text-decoration: none;
}

.stc-linktile:hover {
    text-decoration: none;
    border-color: var(--stc-brand-500);
    background: var(--stc-surface-hover);
    box-shadow: var(--stc-shadow-sm);
}

.stc-linktile__name {
    font-size: var(--stc-text-md);
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-brand-700);
}

.stc-linktile:hover .stc-linktile__name { text-decoration: underline; }

.stc-linktile__detail {
    font-size: var(--stc-text-sm);
    color: var(--stc-text-muted);
    margin: 0;
}

/* ==========================================================================
   18. ANNOTATED / LEGACY BLOCKS
   --------------------------------------------------------------------------
   Carrier administration still surfaces legacy Set A identifiers. They must be
   readable but must never be mistaken for the authoritative Apollo/VEN mapping,
   so they sit on a sunken, dashed surface behind an explicit text label.
   ========================================================================== */

.stc-legacy {
    padding: var(--stc-space-4);
    background: var(--stc-surface-sunken);
    border: 1px dashed var(--stc-border-strong);
    border-radius: var(--stc-radius);
}

.stc-legacy__label {
    display: inline-flex;
    align-items: center;
    gap: var(--stc-space-1);
    margin-bottom: var(--stc-space-3);
    padding: 0.125rem var(--stc-space-2);
    border: 1px solid var(--stc-border-strong);
    border-radius: var(--stc-radius-pill);
    background: var(--stc-surface);
    color: var(--stc-text-muted);
    font-size: var(--stc-text-xs);
    font-weight: var(--stc-weight-semibold);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Groups related controls above a table or list. */
.stc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--stc-space-2);
    margin-bottom: var(--stc-space-4);
}

.stc-toolbar__spacer { margin-left: auto; }

/* ==========================================================================
   19. BLAZOR ERROR UI
   ========================================================================== */

.blazor-error-boundary {
    padding: var(--stc-space-4) var(--stc-space-5);
    background: var(--stc-danger-bg);
    border: 1px solid var(--stc-danger-border);
    border-left: 3px solid var(--stc-danger);
    border-radius: var(--stc-radius);
    color: var(--stc-danger);
}

.blazor-error-boundary::after {
    content: "An error has occurred. The team has been notified.";
}

/* ==========================================================================
   20. LOAD CALENDAR (Prompt 16X)
   --------------------------------------------------------------------------
   The month/week grid is a real <table>, so the day-of-week row is a genuine
   set of column headers rather than a visual convention. These rules only
   change how that table LOOKS; nothing here carries meaning of its own.

   Status is always accompanied by its text label in the markup, so the badge
   colours used alongside are redundant reinforcement — removing every colour
   from this section would cost polish and no information.
   ========================================================================== */

.stc-cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--stc-space-3);
    margin-bottom: var(--stc-space-4);
}

.stc-cal-nav,
.stc-cal-views {
    display: flex;
    flex-wrap: wrap;
    gap: var(--stc-space-2);
}

/* Pushed to the right on wide viewports; wraps under the controls when narrow. */
.stc-cal-views { margin-left: auto; }

.stc-cal-period {
    margin: 0;
    font-size: var(--stc-text-lg);
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-strong);
}

.stc-cal-grid {
    width: 100%;
    min-width: 45rem;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--stc-surface);
}

.stc-cal-grid th {
    padding: var(--stc-table-cell-y) var(--stc-table-cell-x);
    background: var(--stc-surface-header);
    border: 1px solid var(--stc-border);
    font-size: var(--stc-table-header-size);
    font-weight: var(--stc-weight-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--stc-text-muted);
    text-align: left;
}

.stc-cal-day {
    vertical-align: top;
    width: calc(100% / 7);
    height: 7.5rem;
    padding: var(--stc-space-2);
    border: 1px solid var(--stc-border);
}

/* A padding day from the neighbouring month. Recessed, never hidden: a load that
   ships on the 1st is still operationally real when viewed from the previous month. */
.stc-cal-day--outside { background: var(--stc-surface-sunken); }

.stc-cal-day--today { box-shadow: inset 0 0 0 2px var(--stc-brand-500); }

.stc-cal-day__label {
    display: flex;
    align-items: baseline;
    gap: var(--stc-space-2);
    margin: 0 0 var(--stc-space-2);
    font-size: var(--stc-text-sm);
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-muted);
}

/* "Today" is spelled out beside the ring, so the current day is not signalled by
   the border colour alone. */
.stc-cal-day__today {
    padding: 0 var(--stc-space-1);
    border-radius: var(--stc-radius-sm);
    background: var(--stc-brand-100);
    color: var(--stc-brand-700);
    font-size: var(--stc-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stc-cal-day__events {
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.stc-cal-event {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: var(--stc-space-1) var(--stc-space-2);
    border: 1px solid var(--stc-border-subtle);
    border-radius: var(--stc-radius-sm);
    background: var(--stc-surface-sunken);
    color: var(--stc-text);
    text-decoration: none;
    font-size: var(--stc-text-xs);
}

.stc-cal-event:hover {
    background: var(--stc-surface-hover);
    border-color: var(--stc-border-strong);
}

/* Keyboard focus is visible on the event itself, so the grid is traversable by Tab. */
.stc-cal-event:focus-visible {
    outline: none;
    box-shadow: var(--stc-focus-ring);
}

.stc-cal-event__number {
    font-weight: var(--stc-weight-semibold);
    color: var(--stc-text-strong);
}

.stc-cal-event__lane,
.stc-cal-event__carrier {
    color: var(--stc-text-muted);
    overflow-wrap: anywhere;
}

.stc-cal-footnote {
    margin: var(--stc-space-3) 0 0;
    font-size: var(--stc-text-sm);
    color: var(--stc-text-muted);
}

/* Internal-user creation: DOM order stays details, roles, actions for a natural narrow-screen
   reading/keyboard flow. At desktop width the actions return beneath the details while the role
   fieldset occupies the right column. Content, never a minimum height, determines the card height. */
.stc-create-user-layout {
    display: grid;
    grid-template-areas:
        "details"
        "roles"
        "actions";
    gap: var(--stc-space-5);
    align-items: start;
}

.stc-create-user-layout__details { grid-area: details; }
.stc-create-user-layout__roles { grid-area: roles; }
.stc-create-user-layout__actions { grid-area: actions; }

@media (min-width: 992px) {
    .stc-create-user-layout {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        grid-template-areas:
            "details roles"
            "actions roles";
        column-gap: var(--stc-space-6);
        row-gap: 0;
    }
}

/* Narrow viewports: the grid keeps its shape and scrolls inside .stc-table-wrap
   rather than collapsing to unreadable 2rem columns. Cells get shorter so more
   weeks stay on screen, and the toolbar stacks. */
@media (max-width: 991.98px) {
    .stc-cal-day { height: 6rem; }
    .stc-cal-views { margin-left: 0; }
    .stc-cal-toolbar { flex-direction: column; align-items: stretch; }
}

/* ==========================================================================
   21. UTILITIES
   --------------------------------------------------------------------------
   A deliberately small set. Anything reused more than a few times earns a
   component class above instead.
   ========================================================================== */

.stc-text-subtle { color: var(--stc-text-subtle); }
.stc-text-muted { color: var(--stc-text-muted); }
.stc-text-strong { color: var(--stc-text-strong); font-weight: var(--stc-weight-semibold); }
.stc-text-sm { font-size: var(--stc-text-sm); }
.stc-text-xs { font-size: var(--stc-text-xs); }

/* A secondary annotation that follows a cell's primary value. */
.stc-cell-note { margin-left: var(--stc-space-2); }

/* Stacks a primary value over a quiet secondary line inside one table cell. */
.stc-cell-stack { display: flex; flex-direction: column; gap: 0.125rem; }
.stc-cell-stack__sub { font-size: var(--stc-text-xs); color: var(--stc-text-muted); }

/* A short list of reasons under a verdict — the Apollo Loads "Not Visible" explanation.
   Compact and flush so several reasons read as one answer rather than as body copy. */
.stc-reason-list {
    margin: 0;
    padding-left: var(--stc-space-4);
    font-size: var(--stc-text-sm);
}

.stc-reason-list > li + li { margin-top: var(--stc-space-1); }

.stc-money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Long technical identifiers (Apollo GUIDs) rendered as secondary detail. */
.stc-ident {
    font-family: var(--stc-font-mono);
    font-size: var(--stc-text-xs);
    color: var(--stc-text-subtle);
    overflow-wrap: anywhere;
}

/* GUID / operation identifiers are long but should still shrink on tablet layouts. */
.stc-guid-input {
    width: min(100%, 24rem);
    font-family: var(--stc-font-mono);
}

.stc-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--stc-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ==========================================================================
   22. RESPONSIVE
   ========================================================================== */

@media (max-width: 991.98px) {
    :root {
        --stc-table-cell-x: 0.5rem;
    }

    .stc-page-header { flex-direction: column; align-items: stretch; }
    .stc-filters__actions { margin-left: 0; width: 100%; }
}

@media (max-width: 640.98px) {
    .stc-card__body { padding: var(--stc-space-4); }
    .stc-stat-grid { grid-template-columns: 1fr; }
    .stc-form__actions .btn { flex: 1 1 auto; }
}

@media print {
    .stc-filters, .stc-page-header__actions, .stc-table__actions { display: none !important; }
    .stc-card { box-shadow: none; border-color: #999; }
}
