/* ═══════════════════════════════════════════════════════════════════════════════
   iNdex Bursary — design tokens, app shell, sign-in and shared patterns.
   The tokens mirror Theme/iNdexBursaryTheme.cs (MudBlazor palette): change both together.
   Light is the default; [data-theme="dark"] on <html> (set by MainLayout) switches the tokens.
   Type scale 12/14/16/20/24/32 · weights 400/500/600/700 · 8px spacing grid ·
   radius 12px cards, 10px buttons and inputs · subtle elevation (1px border + soft shadow).
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Colour rules (see the theme class): one brand hue — the green ramp; slate for structure; warning and
   danger only where they mean "needs action" / "refused". No decorative second hue. */
:root {
    --ib-g-50: #EFF7F3;
    --ib-g-100: #D8EDE2;
    --ib-g-200: #B3DAC6;
    --ib-g-300: #82BFA1;
    --ib-g-400: #4F9F7C;
    --ib-g-500: #237F5E;
    --ib-g-600: #0B6E4F;
    --ib-g-700: #095C42;
    --ib-g-800: #074A35;
    --ib-g-900: #053325;
    --ib-primary: var(--ib-g-600);
    --ib-primary-hover: var(--ib-g-700);
    --ib-primary-tint: var(--ib-g-50);
    --ib-primary-soft: var(--ib-g-100);
    --ib-primary-ink: var(--ib-g-800);
    --ib-neutral-tint: #F1F4F6;
    --ib-ink: #0F1A24;
    --ib-text-2: #4A5866;
    --ib-text-3: #5F6B78;
    --ib-border: #DCE3E8;
    --ib-border-soft: #E8EDF0;
    --ib-bg: #F6F8F7;
    --ib-surface: #FFFFFF;
    --ib-surface-2: #F9FBFA;
    --ib-success: var(--ib-g-600);
    --ib-success-tint: var(--ib-g-50);
    --ib-warning: #A15C00;
    --ib-warning-tint: #FDF5E8;
    --ib-danger: #B42318;
    --ib-danger-tint: #FDEDEC;
    --ib-info: #1D5FA8;
    --ib-info-tint: #EDF3FA;
    --ib-track: #EDF1EF;
    --ib-shadow-sm: 0 1px 2px rgba(15, 26, 36, 0.04), 0 1px 3px rgba(15, 26, 36, 0.04);
    --ib-shadow-md: 0 2px 4px rgba(15, 26, 36, 0.04), 0 8px 24px rgba(15, 26, 36, 0.06);
    --ib-shadow-lg: 0 12px 40px rgba(15, 26, 36, 0.12);
    --ib-radius-card: 12px;
    --ib-radius-control: 10px;
    --ib-focus: 0 0 0 3px rgba(11, 110, 79, 0.28);
    --ib-hero: linear-gradient(140deg, #0B6E4F 0%, #095C42 55%, #07402F 100%);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --ib-primary: #3DBE8B;
    --ib-primary-hover: #5FD3A4;
    --ib-primary-tint: rgba(61, 190, 139, 0.14);
    --ib-primary-soft: rgba(61, 190, 139, 0.26);
    --ib-primary-ink: #9BE3C4;
    --ib-neutral-tint: rgba(255, 255, 255, 0.06);
    --ib-ink: #E8EFEC;
    --ib-text-2: #A3B3AD;
    --ib-text-3: #8A9C95;
    --ib-border: #25332E;
    --ib-border-soft: #1F2C27;
    --ib-bg: #0E1513;
    --ib-surface: #15201C;
    --ib-surface-2: #18241F;
    --ib-success: #3DBE8B;
    --ib-success-tint: rgba(61, 190, 139, 0.14);
    --ib-warning: #E0A84B;
    --ib-warning-tint: rgba(224, 168, 75, 0.12);
    --ib-danger: #EF6B6B;
    --ib-danger-tint: rgba(239, 107, 107, 0.14);
    --ib-info: #64B5F6;
    --ib-info-tint: rgba(100, 181, 246, 0.14);
    --ib-track: #22302B;
    --ib-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --ib-shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.25);
    --ib-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --ib-focus: 0 0 0 3px rgba(61, 190, 139, 0.35);
    --ib-hero: linear-gradient(140deg, #0F5B42 0%, #0B4433 55%, #082C22 100%);
    color-scheme: dark;
}

html, body {
    min-height: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--ib-bg);
    color: var(--ib-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
}
/* No page should ever scroll sideways: a wide table scrolls inside its own card (.table-scroll). Only on
   <html> (it applies to the window): on <body> as well it would make the body its own scroll box, and the
   window — which Blazor scrolls to the top on navigation — would never scroll. */
html { overflow-x: hidden; }
body { overflow-x: clip; }

.tabular, .kpi-value, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; }

/* ── Loading splash (index.html): a fixed overlay sibling of #app, faded out once Blazor renders ── */
.loading-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse 900px 600px at 50% 40%, #FFFFFF 0%, var(--ib-bg) 70%);
    transition: opacity 0.45s ease, visibility 0.45s ease;
}
.loading-splash.loading-splash-hide { opacity: 0; visibility: hidden; }
.loading-splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: ib-fade-up 0.6s ease both;
}
.loading-splash-mark { width: 72px; height: 72px; filter: drop-shadow(0 8px 20px rgba(11, 110, 79, 0.25)); }
.loading-splash-mark .sun { transform-origin: 32px 30px; animation: ib-sun-rise 1.6s ease-in-out infinite alternate; }
.loading-splash-wordmark { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--ib-ink); }
.loading-splash-wordmark b { color: var(--ib-primary); font-weight: 700; }
.loading-splash-message { font-size: 14px; color: var(--ib-text-2); }
.loading-bar { position: relative; width: 160px; height: 4px; border-radius: 4px; background: var(--ib-primary-tint); overflow: hidden; }
.loading-bar span {
    position: absolute; top: 0; bottom: 0; width: 40%; left: -40%;
    border-radius: 4px; background: var(--ib-primary);
    animation: ib-bar-sweep 1.3s ease-in-out infinite;
}
@keyframes ib-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ib-sun-rise { from { transform: translateY(2px); } to { transform: translateY(-2px); } }
@keyframes ib-bar-sweep { 0% { left: -40%; } 100% { left: 100%; } }

#blazor-error-ui {
    background: var(--ib-warning-tint);
    color: var(--ib-ink);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.12);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ── Brand mark (Components/BrandLogo.razor) ─────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark { flex: none; display: block; }
.brand-wordmark { font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; color: var(--ib-ink); line-height: 1; }
.brand-wordmark b { font-weight: 700; color: var(--ib-primary); }
.brand-on-dark .brand-wordmark, .brand-on-dark .brand-wordmark b { color: #FFFFFF; }
.brand-sub { display: block; font-size: 12px; font-weight: 500; color: var(--ib-text-2); letter-spacing: 0; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-on-dark .brand-sub { color: rgba(255, 255, 255, 0.75); }

/* ── App shell ───────────────────────────────────────────────────────────── */
.mud-layout { background: var(--ib-bg); }

.app-topbar.mud-appbar {
    border-bottom: 1px solid var(--ib-border);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.app-topbar .mud-toolbar { gap: 8px; padding-left: 16px; padding-right: 16px; }
.topbar-programme { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.topbar-programme-name { font-size: 14px; font-weight: 600; color: var(--ib-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-programme-sub { font-size: 12px; color: var(--ib-text-2); white-space: nowrap; }
.topbar-brand { display: none; }

.global-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 1 380px;
    min-width: 0;
    margin: 0 8px 0 24px;
}
.global-search svg { position: absolute; left: 12px; width: 18px; height: 18px; fill: var(--ib-text-3); pointer-events: none; }
.global-search input {
    width: 100%;
    height: 40px;
    padding: 0 56px 0 38px;
    border-radius: var(--ib-radius-control);
    border: 1px solid var(--ib-border);
    background: var(--ib-surface-2);
    color: var(--ib-ink);
    font: 400 14px/1 Inter, system-ui, sans-serif;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.global-search input::placeholder { color: var(--ib-text-3); }
.global-search input:hover { border-color: #C5CFD6; }
.global-search input:focus { border-color: var(--ib-primary); box-shadow: var(--ib-focus); background: var(--ib-surface); }
.global-search kbd {
    position: absolute; right: 10px;
    font: 500 11px/1 Inter, sans-serif; color: var(--ib-text-3);
    padding: 4px 6px; border-radius: 6px; border: 1px solid var(--ib-border); background: var(--ib-surface);
}

.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-icon-btn.mud-icon-button { color: var(--ib-text-2); border-radius: var(--ib-radius-control); }
.topbar-icon-btn.mud-icon-button:hover { background: var(--ib-primary-tint); color: var(--ib-primary); }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 4px 4px; border-radius: 999px;
    border: 1px solid transparent; background: none; cursor: pointer; color: inherit;
    font: inherit; text-align: left;
    transition: background-color .15s ease, border-color .15s ease;
}
.user-chip:hover { background: var(--ib-surface-2); border-color: var(--ib-border); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip-name { font-size: 14px; font-weight: 600; color: var(--ib-ink); white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: 12px; color: var(--ib-text-2); white-space: nowrap; }
.user-chip .avatar { width: 32px; height: 32px; font-size: 12px; }
.user-menu-head { padding: 12px 16px 8px; min-width: 240px; }
.user-menu-head strong { display: block; font-size: 14px; color: var(--ib-ink); }
.user-menu-head span { display: block; font-size: 12px; color: var(--ib-text-2); }

.app-drawer.mud-drawer {
    border-right: 1px solid var(--ib-border);
    background: var(--ib-surface);
}
.app-drawer .mud-drawer-content { display: flex; flex-direction: column; }
.nav-brand { display: flex; align-items: center; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--ib-border-soft); flex: none; }
.nav-scroll { flex: 1; overflow-y: auto; padding: 12px 12px 16px; }
.nav-section-label {
    display: block;
    padding: 16px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ib-text-3);
}
.nav-section-label:first-child { padding-top: 4px; }
.nav-menu .mud-nav-link {
    border-radius: var(--ib-radius-control);
    margin: 2px 0;
    padding: 8px 12px;
    min-height: 40px;
    color: var(--ib-text-2);
    font-weight: 500;
    font-size: 14px;
    transition: background-color .15s ease, color .15s ease;
}
.nav-menu .mud-nav-link .mud-nav-link-text { font-size: 14px; letter-spacing: 0; }
.nav-menu .mud-nav-link .mud-nav-link-icon { color: var(--ib-text-3); width: 20px; height: 20px; font-size: 20px; margin-right: 4px; }
.nav-menu .mud-nav-link:hover { background: var(--ib-surface-2); color: var(--ib-ink); }
.nav-menu .mud-nav-link:hover .mud-nav-link-icon { color: var(--ib-ink); }
.nav-menu .mud-nav-link.active {
    background: var(--ib-primary-tint);
    color: var(--ib-primary);
    font-weight: 600;
}
.nav-menu .mud-nav-link.active .mud-nav-link-icon { color: var(--ib-primary); }
.nav-footer {
    flex: none;
    margin: 0 12px 12px;
    padding: 12px;
    border-radius: var(--ib-radius-card);
    background: var(--ib-surface-2);
    border: 1px solid var(--ib-border-soft);
    font-size: 12px;
    color: var(--ib-text-2);
    display: flex; align-items: center; gap: 10px;
}
.nav-footer strong { display: block; color: var(--ib-ink); font-size: 12px; font-weight: 600; }
.nav-footer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ib-success); box-shadow: 0 0 0 3px var(--ib-success-tint); flex: none; }

.app-main { padding-bottom: 48px; }
.app-container { padding-top: 24px; padding-left: 32px !important; padding-right: 32px !important; max-width: 1440px; }

/* Persistent drawer below 960px: content takes the full width, the fixed drawer overlays it
   with a tap-to-close scrim (see MainLayout). MudBlazor's Persistent variant would otherwise push
   the page over by the drawer's width at every size, leaving a phone ~130px for content. */
@media (max-width: 959px) {
    .mud-main-content,
    .mud-appbar {
        margin-left: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    .app-container { padding-left: 16px !important; padding-right: 16px !important; padding-top: 16px; }
    .topbar-programme { display: none; }
    .topbar-brand { display: flex; }
    .global-search { margin-left: 8px; }
    .user-chip-text { display: none; }
}
@media (max-width: 599px) {
    .global-search kbd { display: none; }
    .global-search input { padding-right: 12px; }
    .global-search { flex-basis: auto; flex-grow: 1; }
    .topbar-brand .brand-wordmark { display: none; }
    .app-bar-chip-text { display: none; }
}

.mobile-drawer-scrim { display: none; }
@media (max-width: 959px) {
    .mobile-drawer-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 26, 36, 0.4);
        z-index: calc(var(--mud-zindex-drawer, 1300) - 1);
    }
}

.auth-layout { min-height: 100vh; background: var(--ib-bg); }

/* ── Surfaces: cards, buttons, inputs, chips, tables ─────────────────────── */
.mud-main-content .mud-paper:not(.mud-popover):not(.mud-dialog) {
    border-radius: var(--ib-radius-card);
}
.mud-main-content .mud-paper.mud-paper-outlined,
.mud-main-content .mud-paper.mud-elevation-1,
.mud-main-content .mud-paper.mud-elevation-0,
.mud-main-content .mud-paper:not([class*="mud-elevation-"]):not(.mud-popover):not(.mud-dialog) {
    border: 1px solid var(--ib-border);
    box-shadow: var(--ib-shadow-sm);
}
.mud-main-content .mud-paper.mud-elevation-1 { box-shadow: var(--ib-shadow-sm); }

.mud-button-root.mud-button { border-radius: var(--ib-radius-control); letter-spacing: 0; text-transform: none; }
.mud-button-filled.mud-button-filled-primary { box-shadow: 0 1px 2px rgba(11, 110, 79, 0.25); }
.mud-button-filled.mud-button-filled-primary:hover { background-color: var(--ib-primary-hover); box-shadow: 0 4px 12px rgba(11, 110, 79, 0.25); }
.mud-button-outlined { border-color: var(--ib-border) !important; color: var(--ib-ink); background: var(--ib-surface); }
.mud-button-outlined.mud-button-outlined-primary { border-color: var(--ib-primary-soft) !important; color: var(--ib-primary); }
.mud-button-outlined.mud-button-outlined-error { border-color: rgba(198, 40, 40, 0.35) !important; color: var(--ib-danger); }
.mud-button-outlined:hover { background: var(--ib-surface-2); border-color: #C5CFD6 !important; }
.mud-button-filled.mud-button-filled-size-large { padding: 10px 22px; font-size: 15px; }

.mud-input.mud-input-outlined, .mud-input-outlined-border { border-radius: var(--ib-radius-control) !important; }
.mud-input.mud-input-outlined.mud-input-adorned-start { background: var(--ib-surface); }

.mud-chip { font-weight: 600; }
.mud-chip.mud-chip-size-small { height: 24px; font-size: 12px; }
.mud-chip.mud-chip-filled { border-radius: 999px; }

.mud-alert { border-radius: var(--ib-radius-card); }
.mud-tooltip { font-size: 12px; border-radius: 8px; }

.mud-table-root .mud-table-head .mud-table-cell {
    font-size: 12px;
    font-weight: 600;
    color: var(--ib-text-2);
    background: var(--ib-surface-2);
    border-bottom: 1px solid var(--ib-border);
    white-space: nowrap;
}
.mud-table-root .mud-table-body .mud-table-cell { border-bottom: 1px solid var(--ib-border-soft); }
.mud-table-root .mud-table-body .mud-table-row:last-child .mud-table-cell { border-bottom: 0; }
.mud-table .mud-table-container { border-radius: var(--ib-radius-card); }

.clickable-table .mud-table-row, .clickable-row { cursor: pointer; }
.mud-table-row:hover .mud-table-cell { background: var(--mud-palette-table-hover); }

/* Wide tables scroll horizontally within their own card instead of the page. */
.table-scroll { overflow-x: auto; max-width: 100%; box-sizing: border-box; }
@media (max-width: 600px) {
    .table-scroll td, .table-scroll th { font-size: 0.8rem !important; padding: 6px 8px !important; white-space: nowrap; }
    .table-scroll table { min-width: 412px; }
}

.mud-skeleton { border-radius: 8px; }

/* ── Accessibility: visible focus rings, reduced motion honoured ─────────── */
:focus-visible { outline: 2px solid var(--ib-primary); outline-offset: 2px; }
.mud-nav-link:focus-visible, .mud-button-root:focus-visible, .mud-icon-button:focus-visible { outline: 2px solid var(--ib-primary); outline-offset: 2px; }

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

/* ── Page header (Components/PageHeader.razor) ───────────────────────────── */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header-text { min-width: 0; flex: 1 1 360px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; font-size: 12px; color: var(--ib-text-3); }
.breadcrumbs a { color: var(--ib-text-2); text-decoration: none; font-weight: 500; border-radius: 4px; }
.breadcrumbs a:hover { color: var(--ib-primary); text-decoration: underline; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: #B8C2CA; }
.breadcrumbs [aria-current="page"] { color: var(--ib-text-2); }
.page-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ib-primary); margin-bottom: 4px; }
.page-title { font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; color: var(--ib-ink); margin: 0; }
.page-subtitle { font-size: 14px; color: var(--ib-text-2); margin: 6px 0 0; max-width: 760px; }
.page-header-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; font-size: 13px; color: var(--ib-text-2); }
.page-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (min-width: 960px) { .page-title { font-size: 28px; } }
@media (max-width: 600px) {
    .page-header { margin-bottom: 16px; }
    .page-header-actions { width: 100%; }
    .page-header-actions .mud-button-root { flex: 1 1 auto; }
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.ib-card {
    background: var(--ib-surface);
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-card);
    box-shadow: var(--ib-shadow-sm);
    min-width: 0;
}
.ib-card-pad { padding: 24px; }
.ib-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.ib-card-head.with-border { padding-bottom: 16px; border-bottom: 1px solid var(--ib-border-soft); }
.ib-card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--ib-ink); margin: 0; letter-spacing: -0.01em; }
.ib-card-title .mud-icon-root { color: var(--ib-primary); font-size: 20px; }
.ib-card-sub { font-size: 13px; color: var(--ib-text-2); margin: 2px 0 0; }
.ib-card-body { padding: 16px 24px 24px; }
.ib-card-foot { padding: 12px 24px; border-top: 1px solid var(--ib-border-soft); font-size: 13px; color: var(--ib-text-2); }
@media (max-width: 600px) {
    .ib-card-pad { padding: 16px; }
    .ib-card-head { padding: 16px 16px 0; }
    .ib-card-body { padding: 12px 16px 16px; }
}

/* Older pages' KPI cards (icon + number): a cleaner tile, same markup. */
.stat-card-row { min-width: 0; }
.stat-card-row > .mud-icon-root {
    width: 44px; height: 44px; padding: 10px; flex: none;
    border-radius: 12px; background: var(--ib-primary-tint); color: var(--ib-primary) !important;
    box-sizing: border-box;
}
.stat-card-row > .mud-icon-root.mud-success-text { background: var(--ib-success-tint); color: var(--ib-success) !important; }
.stat-card-row > .mud-icon-root.mud-warning-text { background: var(--ib-warning-tint); color: var(--ib-warning) !important; }
.stat-card-row > .mud-icon-root.mud-info-text { background: var(--ib-info-tint); color: var(--ib-info) !important; }
.stat-card-row > .mud-icon-root.mud-error-text { background: var(--ib-danger-tint); color: var(--ib-danger) !important; }
.stat-card-row .mud-typography-h5 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ── Empty state (Components/EmptyState.razor) ──────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; }
.empty-state-icon {
    width: 56px; height: 56px; border-radius: 16px; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ib-primary-tint); color: var(--ib-primary);
}
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--ib-ink); margin: 0 0 4px; }
.empty-state-text { font-size: 14px; color: var(--ib-text-2); max-width: 420px; margin: 0 0 16px; }

/* ── Avatars with initials ───────────────────────────────────────────────── */
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 36px; height: 36px; border-radius: 50%;
    font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
    color: var(--avatar-ink, #0B6E4F); background: var(--avatar-bg, #E6F2ED);
}
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ── Shared responsive patterns (detail headers, action rows, stat cards) ── */
.detail-header, .detail-title-block, .detail-title-row, .action-button-group,
.stat-card, .stat-card-row, .stat-card-text { box-sizing: border-box; max-width: 100%; }
.detail-header, .detail-title-block, .detail-title-row, .stat-card-row, .stat-card-text { min-width: 0; }
@media (max-width: 600px) {
    .detail-title-row { flex-wrap: wrap; }
    .detail-heading.mud-typography-h4, .detail-heading.mud-typography-h3 { font-size: 1.4rem; word-break: break-word; overflow-wrap: anywhere; }
    .action-button-group { flex-direction: column; align-items: stretch; width: 100%; }
    .action-button-group .mud-button-root { width: 100%; }
    .stat-card-value.mud-typography-h5, .stat-card-value.mud-typography-h6 { font-size: 1.15rem; word-break: break-word; overflow-wrap: anywhere; line-height: 1.25; }
}

/* ═══ Sign-in family (login, forgot/reset password, register) ═════════════ */
.login-shell { display: flex; min-height: 100vh; width: 100%; background: var(--ib-bg); }
.login-content-row { display: flex; width: 100%; min-height: 100vh; }

.login-branding-panel {
    position: relative;
    flex: 0 0 46%;
    max-width: 640px;
    display: flex;
    align-items: stretch;
    color: #FFFFFF;
    background: var(--ib-hero);
    overflow: hidden;
}
/* Sunrise glow and contour lines: decorative only. */
.login-branding-panel::before {
    content: "";
    position: absolute;
    width: 620px; height: 620px;
    right: -220px; bottom: -260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(179, 218, 198, 0.22) 0%, rgba(179, 218, 198, 0.05) 45%, transparent 70%);
    pointer-events: none;
}
.login-branding-panel::after {
    content: "";
    position: absolute; inset: 0;
    background-image: repeating-radial-gradient(circle at 100% 100%, transparent 0 46px, rgba(255, 255, 255, 0.05) 46px 47px);
    pointer-events: none;
}
.login-branding-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column;
    width: 100%;
    padding: 48px 56px;
}
.login-brand-mark { margin-bottom: auto; }
.login-hero { margin: 64px 0 40px; }
.login-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: #FFFFFF;
    margin-bottom: 24px;
}
.login-eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--ib-g-200); box-shadow: 0 0 0 3px rgba(179, 218, 198, 0.3); }
.login-heading { font-size: 40px; line-height: 1.12; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 16px; color: #FFFFFF; max-width: 520px; }
.login-heading .accent { color: var(--ib-g-200); }
.login-subtitle { font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, 0.82); margin: 0; max-width: 480px; }
.login-proofs { list-style: none; margin: 0 0 40px; padding: 0; display: grid; gap: 16px; max-width: 480px; }
.login-proof { display: flex; align-items: flex-start; gap: 14px; }
.login-proof-icon {
    flex: none; width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16); color: #FFFFFF;
}
.login-proof-icon .mud-icon-root { font-size: 20px; }
.login-proof div > strong { display: block; font-size: 14px; font-weight: 600; color: #FFFFFF; }
.login-proof div > span { display: block; font-size: 13px; color: rgba(255, 255, 255, 0.75); margin-top: 2px; }
.login-panel-foot { font-size: 12px; color: rgba(255, 255, 255, 0.6); display: flex; gap: 16px; flex-wrap: wrap; }

.login-form-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    min-width: 0;
}
.login-form-card { width: 100%; max-width: 420px; }
.login-form-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--ib-ink); margin: 0 0 6px; }
.login-form-sub { font-size: 14px; color: var(--ib-text-2); margin: 0 0 32px; }
.login-form-card .mud-input-control { margin-bottom: 4px; }
.login-form-card .mud-button-filled-primary { height: 48px; font-size: 15px; }
.login-form-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; font-size: 12px; color: var(--ib-text-3); }
.login-form-divider::before, .login-form-divider::after { content: ""; flex: 1; height: 1px; background: var(--ib-border); }
.login-hub-note {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--ib-radius-control);
    background: var(--ib-surface); border: 1px solid var(--ib-border);
    font-size: 13px; color: var(--ib-text-2);
}
.login-hub-note .mud-icon-root { color: var(--ib-primary); }
.login-hub-note a { color: var(--ib-primary); font-weight: 600; }
.login-secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; font-size: 12px; color: var(--ib-text-3); }
.login-secure .mud-icon-root { font-size: 14px; }
.auth-copyright { margin-top: 32px; font-size: 12px; color: var(--ib-text-3); text-align: center; }
.login-mobile-brand { display: none; }
.login-brand-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--ib-primary-tint); color: var(--ib-primary);
}
.register-form-card { max-width: 640px; }
.register-tip { display: flex; align-items: flex-start; gap: 10px; height: 100%; padding-top: 6px; }

@media (max-width: 1199px) {
    .login-branding-content { padding: 40px; }
    .login-heading { font-size: 34px; }
}
/* Below 960px the brand panel collapses into a compact header over the form. */
@media (max-width: 959px) {
    .login-shell, .login-content-row { flex-direction: column; min-height: 100vh; }
    .login-branding-panel { flex: none; max-width: none; }
    .login-branding-content { padding: 20px 20px 24px; }
    .login-brand-mark { margin-bottom: 0; }
    .login-hero { margin: 20px 0 0; }
    .login-eyebrow { display: none; }
    .login-heading { font-size: 22px; line-height: 1.3; margin-bottom: 0; }
    .login-subtitle, .login-proofs, .login-panel-foot { display: none; }
    .login-form-panel { justify-content: flex-start; padding: 32px 20px 40px; }
    .login-form-title { font-size: 24px; }
    .login-form-sub { margin-bottom: 24px; }
}

/* ═══ Inherited KPI tiles (operations dashboard) ════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

/* ── App bar status chips and icons ─────────────────────────────────────── */
.conn-chip {
    display: inline-flex; align-items: center; gap: 8px;
    height: 32px; padding: 0 12px; border-radius: 999px; margin-right: 4px;
    font-size: 13px; font-weight: 500; color: var(--ib-text-2);
    border: 1px solid var(--ib-border); background: var(--ib-surface);
    white-space: nowrap;
}
.conn-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--ib-success); box-shadow: 0 0 0 3px var(--ib-success-tint); }
.conn-chip.warn i { background: var(--ib-warning); box-shadow: 0 0 0 3px var(--ib-warning-tint); }
.conn-chip.warn { color: var(--ib-warning); }
[data-theme="dark"] .conn-chip.warn { color: var(--ib-warning); }
@media (max-width: 599px) { .conn-chip { padding: 0 10px; } }
.topbar-icon-wrap {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--ib-radius-control);
    color: var(--ib-text-2); cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.topbar-icon-wrap:hover { background: var(--ib-primary-tint); color: var(--ib-primary); }
.app-topbar .mud-chip { margin-right: 4px; }
[data-theme="dark"] .loading-splash { background: var(--ib-bg); }
@media (max-width: 1199px) { .topbar-programme { display: none; } }
/* A table (itself a paper) inside a card: one border, not two. */
.mud-main-content .mud-paper .mud-paper:not(.mud-popover) { border: 0 !important; box-shadow: none !important; }
.mud-main-content .mud-avatar { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.mud-main-content .mud-avatar.mud-avatar-medium { width: 40px; height: 40px; }
@media (max-width: 599px) {
    .app-topbar .mud-toolbar { gap: 4px; padding-left: 8px; padding-right: 8px; }
    .app-topbar .mud-spacer, .app-topbar .flex-grow-1 { display: none; }
    .global-search { margin: 0 4px; flex: 1 1 auto; }
    .user-chip > .mud-icon-root { display: none; }
    .user-chip { padding: 2px; }
}
.global-search input::-webkit-search-cancel-button, .filter-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
