/* FlagDesk client — minimal global styles. MudBlazor provides the component styling. */

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* Pre-Blazor loading splash (shown until the WASM runtime and app boot). */
.loading-splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #1e3a5f;
}

.loading-splash-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.loading-splash-text {
    margin-top: 0.75rem;
    color: #5a6b7b;
}

/* Blazor unhandled-error banner. */
#blazor-error-ui {
    background: #b00020;
    color: #fff;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1500;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
}

#blazor-error-ui .reload {
    color: #fff;
    text-decoration: underline;
    margin-left: 0.5rem;
}

/* ---------------------------------------------------------------------------------------------
   FlagDesk registry console (FD-UI-001). Restrained, institutional: white surfaces on a pale slate
   background, one navy accent, thin rules instead of shadows. Desktop-first; collapses at 960px
   (drawer becomes temporary) and 600px (tables stack into labelled rows).
   --------------------------------------------------------------------------------------------- */

:root {
    --fd-navy: #1f3a5f;
    --fd-ink: #1b2733;
    --fd-muted: #5a6b7e;
    --fd-rule: #e3e8ef;
    --fd-wash: #f5f7fa;
    --fd-accent-wash: #e8eef5;
}

body {
    background: var(--fd-wash);
    color: var(--fd-ink);
}

/* Headings receive focus on navigation (FocusOnNavigate) for screen readers; no box is drawn. */
h1:focus {
    outline: none;
}

.mud-button-root {
    text-transform: none;
    letter-spacing: 0.01em;
}

/* App bar */
.fd-appbar.mud-appbar {
    border-bottom: 1px solid var(--fd-rule);
}

.fd-brand {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    color: inherit;
    text-decoration: none;
    margin-left: 0.25rem;
}

.fd-brand-mark {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: var(--fd-navy);
}

.fd-brand-sub {
    font-size: 0.8rem;
    color: var(--fd-muted);
    padding-left: 0.6rem;
    border-left: 1px solid var(--fd-rule);
}

.fd-active-registry {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--fd-rule);
    border-radius: 6px;
    background: var(--fd-accent-wash);
    min-width: 0;
}

.fd-active-registry-icon {
    color: var(--fd-navy);
}

.fd-active-registry-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.fd-active-registry-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fd-muted);
}

.fd-active-registry-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fd-registry-code {
    display: inline-block;
    font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--fd-navy);
    background: #fff;
    border: 1px solid #c9d4e2;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    vertical-align: middle;
    white-space: nowrap;
}

.fd-user-button {
    text-transform: none !important;
}

.fd-user-menu-header {
    padding: 0.75rem 1rem;
    max-width: 280px;
}

.fd-user-menu-name {
    font-weight: 600;
}

.fd-user-menu-email,
.fd-user-menu-roles {
    font-size: 0.8rem;
    color: var(--fd-muted);
    overflow-wrap: anywhere;
}

/* Navigation */
.fd-drawer.mud-drawer {
    border-right: 1px solid var(--fd-rule);
}

.fd-nav {
    padding-top: 0.75rem;
}

.fd-nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fd-muted);
    padding: 1rem 1.25rem 0.35rem;
}

/* Page scaffolding */
.fd-page {
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
}

.fd-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.fd-page-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0;
    color: var(--fd-ink);
}

.fd-page-description {
    margin: 0.3rem 0 0;
    color: var(--fd-muted);
    font-size: 0.92rem;
    max-width: 60rem;
}

.fd-panel.mud-paper {
    padding: 0.25rem 0;
    border-color: var(--fd-rule);
    overflow: hidden;
}

.fd-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem 0.5rem;
}

.fd-panel-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* Tables */
.fd-table .mud-table-head .mud-table-cell,
.fd-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fd-muted);
    background: #fafbfd;
}

.fd-strong {
    font-weight: 500;
}

.fd-mono {
    font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

.fd-num {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.fd-break {
    overflow-wrap: anywhere;
}

.fd-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.fd-status-active {
    color: #1f6a42;
    background: #e8f4ed;
    border-color: #cfe6d8;
}

.fd-status-inactive {
    color: var(--fd-muted);
    background: #f1f3f6;
    border-color: var(--fd-rule);
}

.fd-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--fd-rule);
}

.fd-pager-summary {
    font-size: 0.85rem;
    color: var(--fd-muted);
}

/* States */
.fd-state {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    color: var(--fd-muted);
}

.fd-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--fd-muted);
}

.fd-empty p {
    margin: 0.5rem 0 0;
}

/* Dashboard */
.fd-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.fd-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: #fff;
    border: 1px solid var(--fd-rule);
    border-radius: 6px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.fd-stat:hover,
.fd-stat:focus-visible {
    border-color: #9fb3cc;
}

.fd-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: var(--fd-accent-wash);
    color: var(--fd-navy);
    flex-shrink: 0;
}

.fd-stat-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fd-stat-label {
    font-size: 0.8rem;
    color: var(--fd-muted);
}

.fd-stat-value {
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.fd-stat-muted {
    font-size: 0.9rem;
    color: var(--fd-muted);
    padding-top: 0.35rem;
}

.fd-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.fd-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.6rem 1rem;
    margin: 0;
    padding: 0.25rem 1rem 0.75rem;
    font-size: 0.9rem;
}

.fd-facts dt {
    color: var(--fd-muted);
}

.fd-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.fd-note {
    font-size: 0.8rem;
    color: var(--fd-muted);
    margin: 0;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--fd-rule);
}

/* Sign-in and registry selection */
.fd-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, #eef2f7 0%, var(--fd-wash) 100%);
}

.fd-auth-panel {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--fd-rule);
    border-radius: 8px;
    padding: 2rem 2rem 1.5rem;
    box-shadow: 0 1px 2px rgba(16, 32, 56, 0.04);
}

.fd-auth-brand {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--fd-rule);
}

.fd-auth-brand .fd-brand-mark {
    font-size: 1.4rem;
}

.fd-auth-tagline {
    font-size: 0.85rem;
    color: var(--fd-muted);
}

.fd-auth-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.fd-auth-text {
    color: var(--fd-muted);
    margin: 0 0 1.25rem;
    font-size: 0.92rem;
}

.fd-auth-footnote {
    font-size: 0.75rem;
    color: var(--fd-muted);
    text-align: center;
    margin: 1.5rem 0 0;
}

.fd-registry-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.fd-registry-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid var(--fd-rule);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.fd-registry-option:hover:not(:disabled),
.fd-registry-option:focus-visible {
    border-color: var(--fd-navy);
    background: #fbfcfe;
}

.fd-registry-option:disabled {
    cursor: progress;
    opacity: 0.7;
}

.fd-registry-option-icon {
    color: var(--fd-navy);
    display: flex;
}

.fd-registry-option-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.fd-registry-option-name {
    font-weight: 600;
}

.fd-registry-option-current {
    font-size: 0.72rem;
    color: #1f6a42;
    background: #e8f4ed;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}

.fd-registry-option-chevron {
    color: var(--fd-muted);
}

/* Responsive */
@media (min-width: 960px) {
    .fd-menu-toggle {
        display: none !important;
    }
}

@media (max-width: 959.98px) {
    .fd-dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .fd-brand-sub {
        display: none;
    }
}

@media (max-width: 719.98px) {
    .fd-stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .fd-active-registry-label,
    .fd-active-registry-icon,
    .fd-user-name {
        display: none;
    }

    .fd-active-registry {
        padding: 0.25rem 0.5rem;
    }

    .fd-active-registry-name {
        max-width: 38vw;
    }

    .fd-page-title {
        font-size: 1.35rem;
    }
}

@media (max-width: 479.98px) {
    .fd-brand {
        display: none;
    }

    .fd-active-registry-name {
        max-width: 42vw;
    }
}
