:root {
    --app-ink: #12395f;
    --app-ink-soft: #3a5e83;
    --app-accent: #2a5298;
    --app-accent-strong: #173b6d;
    --app-accent-soft: #e9f1fb;
    --app-sky: #5a9bd5;
    --app-border: #d7e4f1;
    --app-panel: rgba(255, 255, 255, 0.88);
    --app-panel-strong: #ffffff;
    --app-shadow: 0 24px 60px rgba(18, 57, 95, 0.12);
    --app-shadow-soft: 0 12px 30px rgba(18, 57, 95, 0.08);
    --app-success: #1f7a55;
    --app-warning: #b7791f;
    --app-danger: #b33a3a;
    --app-radius-xl: 28px;
    --app-radius-lg: 22px;
    --app-radius-md: 16px;
    --app-radius-sm: 12px;
}

html,
body {
    font-family: "Aptos", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(90, 155, 213, 0.24), transparent 30%),
        radial-gradient(circle at bottom right, rgba(42, 82, 152, 0.16), transparent 28%),
        linear-gradient(135deg, #f4f8fc 0%, #e8eff7 48%, #f7fbff 100%);
    color: var(--app-ink);
    min-height: 100%;
}

body {
    margin: 0;
}

html.app-scroll-locked,
body.app-scroll-locked {
    overflow: hidden;
}

a,
.btn-link {
    color: var(--app-accent);
}

a:hover,
.btn-link:hover {
    color: var(--app-accent-strong);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--app-ink);
    font-weight: 700;
    letter-spacing: -0.02em;
}

code {
    color: var(--app-accent-strong);
    background: rgba(42, 82, 152, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
}

pre {
    background: #f7fbff;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    padding: 1rem;
    color: var(--app-ink);
}

.app-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 100vh;
    gap: 1rem;
    padding: 1rem;
}

.app-sidebar {
    min-width: 0;
}

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    border-radius: var(--app-radius-xl);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(243, 248, 255, 0.96));
    border: 1px solid rgba(90, 155, 213, 0.14);
    box-shadow: var(--app-shadow);
}

.app-header__intro {
    max-width: 58rem;
}

.app-header__eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(42, 82, 152, 0.1);
    color: var(--app-accent-strong);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.app-header__title {
    margin: 0.8rem 0 0.35rem;
    font-size: clamp(1.8rem, 2vw, 2.5rem);
}

.app-header__copy {
    color: var(--app-ink-soft);
    max-width: 48rem;
    font-size: 1rem;
}

.app-header__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.85rem;
}

.app-status-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.65rem;
}

.app-session-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(31, 122, 85, 0.12);
    color: var(--app-success);
    font-weight: 600;
}

.app-session-pill__dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 0.2rem rgba(31, 122, 85, 0.12);
}

.app-key-pill {
    background: rgba(42, 82, 152, 0.1);
    color: var(--app-accent-strong);
}

.app-key-pill .app-session-pill__dot {
    box-shadow: 0 0 0 0.2rem rgba(42, 82, 152, 0.12);
}

.app-key-pill--warning {
    background: rgba(184, 117, 18, 0.14);
    color: #8a5a12;
}

.app-key-pill--warning .app-session-pill__dot {
    box-shadow: 0 0 0 0.2rem rgba(184, 117, 18, 0.14);
}

.app-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: var(--app-panel-strong);
    box-shadow: var(--app-shadow-soft);
    color: var(--app-ink);
}

.app-user-chip:hover,
.app-user-chip:focus-visible {
    border-color: rgba(42, 82, 152, 0.35);
    background: #f7fbff;
}

.app-user-chip__icon {
    font-size: 1.8rem;
    color: var(--app-accent);
}

.app-user-chip__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.app-user-chip__text small {
    color: var(--app-ink-soft);
    font-size: 0.8rem;
}

.app-content {
    flex: 1;
    border-radius: var(--app-radius-xl);
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(90, 155, 213, 0.14);
    box-shadow: var(--app-shadow-soft);
    padding: 1.5rem;
}

.app-content > .container,
.app-content > .container-fluid {
    padding-left: 0;
    padding-right: 0;
}

.nav-shell {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    min-height: calc(100vh - 2rem);
    padding: 1.25rem;
    border-radius: var(--app-radius-xl);
    background:
        linear-gradient(180deg, rgba(18, 57, 95, 0.98) 0%, rgba(23, 59, 109, 0.98) 55%, rgba(16, 44, 81, 0.98) 100%);
    box-shadow: var(--app-shadow);
    color: #f5fbff;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem;
    border-radius: var(--app-radius-lg);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-brand__logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

.nav-brand__copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-brand__eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(230, 244, 255, 0.72);
}

.nav-brand__title {
    font-size: 1.05rem;
    color: #ffffff;
}

.nav-brand__subtitle {
    font-size: 0.88rem;
    color: rgba(230, 244, 255, 0.78);
}

.nav-sections {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1rem;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.nav-section--footer {
    margin-top: auto;
}

.nav-section__label {
    padding: 0 0.35rem;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(224, 239, 255, 0.58);
}

.menu-link {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 0.95rem;
    border-radius: 18px;
    color: rgba(244, 250, 255, 0.88);
    text-decoration: none;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.menu-link:hover,
.menu-link:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.menu-link.active {
    color: #0f325d;
    background: linear-gradient(135deg, #ffffff 0%, #edf5ff 100%);
    border-color: rgba(90, 155, 213, 0.28);
    box-shadow: 0 16px 28px rgba(7, 25, 45, 0.22);
}

.menu-link.active .menu-link__meta {
    color: #53708e;
}

.menu-link__icon {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.menu-link.active .menu-link__icon {
    background: rgba(42, 82, 152, 0.1);
    color: var(--app-accent-strong);
}

.menu-link__content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.menu-link__title {
    font-weight: 700;
    line-height: 1.15;
}

.menu-link__meta {
    font-size: 0.83rem;
    line-height: 1.2;
    color: rgba(226, 240, 255, 0.72);
}

.card,
.modal-content {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-panel);
    box-shadow: var(--app-shadow-soft);
}

.card-title {
    color: var(--app-ink);
}

.alert {
    border: none;
    border-radius: 18px;
    box-shadow: var(--app-shadow-soft);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(42, 82, 152, 0.04);
    --bs-table-hover-bg: rgba(42, 82, 152, 0.06);
    color: var(--app-ink);
    vertical-align: middle;
}

.table > :not(caption) > * > * {
    border-bottom-color: rgba(18, 57, 95, 0.08);
}

.table thead th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-ink-soft);
    border-bottom-width: 1px;
}

.table-responsive {
    border-radius: 18px;
}

.form-control,
.form-select {
    min-height: 2.95rem;
    border-radius: 14px;
    border-color: #cbd9e7;
    background: rgba(255, 255, 255, 0.92);
    color: var(--app-ink);
}

textarea.form-control {
    min-height: auto;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus {
    border-color: rgba(42, 82, 152, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(42, 82, 152, 0.12);
}

.btn {
    border-radius: 14px;
    font-weight: 600;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--app-accent), var(--app-accent-strong));
    border: none;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    color: #fff;
    background: linear-gradient(135deg, #315ea9, #1a4278);
}

.btn-outline-primary {
    color: var(--app-accent);
    border-color: rgba(42, 82, 152, 0.28);
    background: rgba(255, 255, 255, 0.72);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
    background: var(--app-accent-soft);
    color: var(--app-accent-strong);
    border-color: rgba(42, 82, 152, 0.36);
}

.btn-outline-secondary {
    color: var(--app-ink);
    border-color: rgba(18, 57, 95, 0.14);
    background: rgba(255, 255, 255, 0.72);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    color: var(--app-ink);
    background: rgba(18, 57, 95, 0.06);
    border-color: rgba(18, 57, 95, 0.18);
}

.badge {
    padding: 0.5rem 0.7rem;
    border-radius: 999px;
    font-weight: 700;
}

.content {
    padding-top: 0;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

#blazor-error-ui {
    background: #fff6d7;
    color: #6c5400;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    box-shadow: var(--app-shadow-soft);
    display: none;
    padding: 0.85rem 1.2rem;
    position: fixed;
    border-radius: 18px;
    border: 1px solid rgba(183, 121, 31, 0.18);
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.9rem;
    top: 0.7rem;
}

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

    .nav-shell {
        position: static;
        min-height: auto;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-header__actions {
        width: 100%;
        align-items: stretch;
    }

    .app-status-pills {
        justify-content: stretch;
    }

    .app-status-pills .app-session-pill {
        flex: 1 1 14rem;
    }

    .app-user-chip,
    .app-session-pill {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .app-shell {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .app-content,
    .app-header,
    .nav-shell {
        border-radius: 22px;
    }

    .nav-brand {
        align-items: flex-start;
    }

    .nav-brand__logo {
        width: 52px;
        height: 52px;
    }

    .menu-link {
        padding: 0.85rem;
    }
}
