:root {
    --app-primary: #0d6efd;
    --app-primary-readable-surface: color-mix(in srgb, var(--app-primary) 44%, black);
    --app-surface: #ffffff;
    --app-border: #dce3ea;
}

body {
    min-height: 100vh;
    color: #243447;
}

.skip-link {
    position: fixed;
    z-index: 1100;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background: #fff;
    color: #111827;
}

.app-header,
.app-navbar {
    background: var(--app-primary-readable-surface);
}

.app-navbar .navbar-brand,
.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.88);
}

.app-navbar .navbar-brand:hover,
.app-navbar .navbar-brand:focus,
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active {
    color: #fff;
}

.app-navbar .nav-link.active {
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 0.14rem;
    text-underline-offset: 0.35rem;
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.65);
}

.app-navbar .navbar-toggler-icon {
    filter: brightness(0) invert(1);
}

.app-brand-logo {
    width: auto;
    max-width: 10rem;
    height: 2.25rem;
    object-fit: contain;
}

.app-brand-mark {
    display: inline-grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    place-items: center;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.18);
}

.app-page-header {
    margin-bottom: 2rem;
}

.app-module-card {
    height: 100%;
    border-color: var(--app-border);
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.app-module-card:hover,
.app-module-card:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.25rem rgba(36, 52, 71, 0.1);
}

.app-module-icon {
    display: inline-grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--app-primary) 12%, white);
    color: #243447;
    font-size: 1.35rem;
}

.auth-card {
    max-width: 30rem;
    margin: 2rem auto;
}

.app-content-narrow {
    max-width: 58rem;
}

.app-form-section,
.app-data-card,
.app-consequential-panel {
    margin-bottom: 1.5rem;
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    background: var(--app-surface);
}

.app-form-section > legend {
    float: none;
    width: auto;
    margin: 0 0 1rem;
    padding: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.app-required-label::before {
    content: "* ";
    font-weight: 700;
    color: inherit;
}

.app-data-card > :last-child,
.app-form-section > :last-child,
.app-consequential-panel > :last-child {
    margin-bottom: 0;
}

.app-data-list {
    display: grid;
    grid-template-columns: minmax(9rem, 0.45fr) minmax(0, 1fr);
    gap: 0.45rem 1rem;
    margin-bottom: 0;
}

.app-data-list dt {
    color: #5c6773;
    font-weight: 600;
}

.app-data-list dd {
    min-width: 0;
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.app-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.app-action-group form {
    margin: 0;
}

.app-consequential-panel {
    border-left: 0.3rem solid var(--app-primary);
}

.app-empty-state {
    padding: 1.5rem;
    border: 1px dashed #adb5bd;
    border-radius: 0.75rem;
    background: #f8f9fa;
    text-align: center;
}

.app-empty-state > .bi {
    display: block;
    margin-bottom: 0.5rem;
    color: #6c757d;
    font-size: 1.75rem;
}

.app-form-grid {
    display: grid;
    gap: 1rem;
}

.app-resource-card {
    height: 100%;
}

.app-resource-section > form,
.app-resource-section article > form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}

.app-resource-section label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
}

.app-resource-section input:not([type="hidden"]),
.app-resource-section select,
.app-resource-section textarea {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    color: #212529;
    font-weight: 400;
}

.app-resource-section button {
    width: fit-content;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--app-primary-readable-surface);
    border-radius: 0.375rem;
    background: var(--app-primary-readable-surface);
    color: #fff;
}

.app-resource-section button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.app-resource-section button:focus-visible {
    outline: 0.2rem solid #111827;
    outline-offset: 0.15rem;
}

.app-context-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--app-border);
    border-left: 0.3rem solid var(--app-primary);
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--app-primary) 6%, white);
}

.app-context-banner > :last-child {
    margin-bottom: 0;
}

.app-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.app-section-nav a {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface);
    color: #243447;
    font-weight: 600;
    text-decoration: none;
}

.app-section-nav a:hover,
.app-section-nav a:focus-visible {
    border-color: var(--app-primary);
    background: color-mix(in srgb, var(--app-primary) 8%, white);
}

.app-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-progress-grid > li {
    padding: 0.85rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: 0.65rem;
    background: var(--app-surface);
}

.app-autosave-status {
    min-height: 1.5rem;
    font-weight: 600;
}

.app-readonly-panel {
    background: #f8f9fa;
}

.app-resource-section {
    margin-bottom: 2rem;
    scroll-margin-top: 1rem;
}

.report-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
}

.report-table-wrap .table {
    min-width: max-content;
    margin-bottom: 0;
}

.report-notice {
    padding: 0.75rem 1rem;
    border-left: 0.25rem solid var(--app-primary);
    background: color-mix(in srgb, var(--app-primary) 7%, white);
}

.table > :not(caption) > * > * {
    vertical-align: top;
}

.app-sensitive-data {
    border-left: 0.25rem solid #ffc107;
}

@media (min-width: 768px) {
    .app-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-form-grid .app-field-wide {
        grid-column: 1 / -1;
    }
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        padding-top: 1rem;
    }

    .app-navbar .nav-link {
        padding-block: 0.65rem;
    }

    .app-navbar form .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .app-data-list {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .app-data-list dd {
        margin-bottom: 0.75rem;
    }

    .app-action-group > .btn,
    .app-action-group > form,
    .app-action-group > form > .btn {
        width: 100%;
    }
}
