:root {
    color-scheme: light;
    --ink: #13281f;
    --muted: #5b6c64;
    --surface: #f3f5f4;
    --brand: #176b45;
    --brand-dark: #0d4b30;
    --accent: #d5a72f;
    --line: #dce2dc;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--surface);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--surface);
    font-size: .9rem;
    line-height: 1.4;
}

a {
    color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid #176b45;
    outline-offset: 2px;
}

.landing-shell {
    display: flex;
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 3rem;
    flex-direction: column;
}

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

.app-content { min-width: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.app-header .brand { gap: .4rem; padding: .25rem; }
.app-header .brand-mark { width: 2rem; height: 2rem; flex-shrink: 0; }
.app-header .brand small { font-size: .6rem; letter-spacing: 0; }
.skip-link { position: fixed; left: .5rem; top: -5rem; z-index: 100; padding: .5rem; background: white; }
.skip-link:focus { top: .5rem; }
.record-toolbar, .register-toolbar, .view-tabs {
    display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .65rem;
}
.record-toolbar h2 { margin: 0 auto 0 0; }
.view-tabs { border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.view-tabs [aria-selected="true"], .view-tabs [aria-pressed="true"], .view-tabs .active {
    background: var(--brand-dark); color: white;
}
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .5rem 1rem; margin: .5rem 0; }
.detail-grid dt { color: var(--muted); font-size: .8rem; }
.detail-grid dd { margin: .15rem 0 0; font-weight: 600; }
.numeric, th.numeric, td.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.workspace .numeric { text-align: right; }
.secondary-details { border-top: 1px solid var(--line); margin-top: .65rem; padding-top: .4rem; }
.secondary-details summary { cursor: pointer; font-weight: 600; padding: .35rem 0; }
.workspace input[type="number"] { font-variant-numeric: tabular-nums; }
.workspace .table-wrap tbody tr:hover, .responsive-table tbody tr:hover { background: #f6faf8; }
.workspace .panel > .form-grid, .workspace .panel > form > .form-grid { max-width: 60rem; }
.account-card form { display: grid; gap: .8rem; margin: 1rem 0; }
.account-card .eyebrow { margin-bottom: .5rem; }
.account-card .password-help { color: var(--muted); font-size: .82rem; margin: 0; }
.password-toggle { justify-self: start; padding: .2rem .35rem; border: 0; background: transparent; color: var(--brand-dark); cursor: pointer; text-decoration: underline; font: inherit; }

.app-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    height: 100vh;
    overflow-y: auto;
    padding: .6rem .5rem;
    gap: .6rem;
    align-items: stretch;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: #fff;
}

.app-nav {
    display: block;
    flex: 1;
}

.app-nav a,
.app-nav summary {
    display: block;
    padding: .3rem .5rem;
    border-radius: .3rem;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 550;
    text-decoration: none;
}

.nav-group {
    position: relative;
}

.nav-group:not(:has(a)) {
    display: none;
}

.nav-group summary {
    cursor: pointer;
    font-size: .72rem;
    font-weight: 750;
    margin-top: .45rem;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.nav-group:has(a.active) > summary,
.nav-group[open] > summary {
    color: var(--brand-dark);
    background: transparent;
}

.nav-options {
    padding-left: .35rem;
}

.nav-options a {
    display: block;
}

.app-nav a:hover,
.app-nav a.active {
    color: var(--brand-dark);
    background: #e9f2ed;
}

.nav-logout,
.primary-action,
.secondary-action {
    min-height: 2.15rem;
    padding: .35rem .7rem;
    border: 1px solid var(--brand-dark);
    border-radius: 0.45rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.nav-logout,
.secondary-action {
    color: var(--brand-dark);
    background: transparent;
}

.primary-action {
    color: white;
    background: var(--brand-dark);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.app-page,
.account-shell {
    width: min(88rem, 100%);
    margin: 0 auto;
    padding: .85rem 1rem 1.5rem;
}

.account-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.account-card {
    width: min(28rem, 100%);
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: .45rem;
    background: white;
    box-shadow: 0 .2rem 1rem rgba(19, 40, 31, .05);
}

.app-page h1,
.workspace h1,
.app-content h1 {
    max-width: none;
    font-family: inherit;
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -.025em;
    line-height: 1.15;
}

.account-card h1 {
    max-width: none;
    font-family: inherit;
    font-size: 1.65rem;
    letter-spacing: -.025em;
    line-height: 1.2;
    margin-bottom: .75rem;
}

.template-header {
    display: block;
    overflow-wrap: anywhere;
    margin-top: .4rem;
}

.page-heading {
    margin-bottom: .75rem;
}

.page-heading p:not(.eyebrow) {
    max-width: 48rem;
    color: var(--muted);
}

.panel {
    margin-bottom: .75rem;
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: .35rem;
    background: white;
    box-shadow: none;
}

.panel h2 {
    margin-top: 0;
    font-size: 1rem;
}

.form-grid {
    display: grid;
    margin-bottom: 1rem;
    gap: .65rem .85rem;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.form-field {
    display: grid;
    align-content: start;
    gap: 0.35rem;
}

.form-field label,
.form-field legend,
.account-card label {
    font-size: 0.9rem;
    font-weight: 700;
}

.form-field input:not([type="checkbox"]),
.form-field select,
.form-field textarea,
.account-card input:not([type="checkbox"]),
.sensitive-panel textarea {
    width: 100%;
    min-height: 2.15rem;
    padding: .35rem .5rem;
    border: 1px solid #9fb3a9;
    border-radius: 0.45rem;
    background: white;
    font: inherit;
}

.role-options {
    margin: 0;
    padding: 0;
    border: 0;
}

.role-options label {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    font-weight: 500;
}

.notice {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.55rem;
    color: #195739;
    background: #dcefe4;
}

.responsive-table {
    overflow-x: auto;
}

.responsive-table table {
    width: 100%;
    border-collapse: collapse;
}

.responsive-table th,
.responsive-table td {
    padding: .4rem .5rem;
    border-bottom: 1px solid #e2e9e5;
    text-align: left;
    vertical-align: top;
}

.responsive-table th {
    color: var(--muted);
    font-size: .82rem;
    background: #f4f6f5;
}

.site-header {
    display: flex;
    min-height: 6.5rem;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border-radius: 0.75rem 0.25rem 0.75rem 0.25rem;
    color: white;
    background: var(--brand);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.brand small {
    margin-top: 0.12rem;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.phase-badge {
    padding: 0.5rem 0.75rem;
    border: 1px solid #bfd3c8;
    border-radius: 999px;
    color: var(--brand-dark);
    background: #edf6f0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.hero {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(0, 1.55fr) minmax(19rem, 0.75fr);
    gap: clamp(3rem, 8vw, 8rem);
    align-items: center;
    padding: 5rem 0;
}

.eyebrow,
.card-kicker {
    margin: 0 0 1rem;
    color: var(--brand);
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

h1 {
    max-width: 13ch;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 6.4vw, 6.4rem);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.96;
}

h1:focus {
    outline: none;
}

.hero-copy {
    max-width: 43rem;
    margin: 2rem 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 1.4vw, 1.18rem);
    line-height: 1.75;
}

.status-row {
    display: flex;
    margin-top: 2rem;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: #3f5349;
    font-size: 0.85rem;
    font-weight: 650;
}

.status-row span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.status-row i {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #2b9d63;
    box-shadow: 0 0 0 4px rgba(43, 157, 99, 0.12);
}

.foundation-card {
    position: relative;
    overflow: hidden;
    padding: clamp(1.75rem, 3vw, 2.75rem);
    border: 1px solid rgba(19, 40, 31, 0.12);
    border-radius: 0.45rem;
    color: #f8f7f2;
    background: var(--ink);
    box-shadow: 0 1.75rem 4rem rgba(19, 40, 31, 0.16);
}

.foundation-card::after {
    position: absolute;
    right: -3rem;
    bottom: -4rem;
    width: 10rem;
    height: 10rem;
    border: 1.5rem solid rgba(213, 167, 47, 0.16);
    border-radius: 50%;
    content: "";
}

.foundation-card .card-kicker {
    color: #efd479;
}

.foundation-card h2 {
    max-width: 14ch;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.7rem, 3vw, 2.45rem);
    font-weight: 500;
    line-height: 1.08;
}

.foundation-card ul {
    margin: 2rem 0;
    padding: 0;
    list-style: none;
}

.foundation-card li {
    position: relative;
    padding: 0.65rem 0 0.65rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.11);
    color: #cbd7d1;
    font-size: 0.9rem;
}

.foundation-card li::before {
    position: absolute;
    top: 1rem;
    left: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--accent);
    content: "";
}

.foundation-card a {
    position: relative;
    z-index: 1;
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    color: #fff5cf;
    font-size: 0.85rem;
    font-weight: 750;
    text-underline-offset: 0.25rem;
}

footer {
    display: flex;
    min-height: 4.5rem;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.75rem;
}

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

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

.validation-message {
    color: #b32121;
}

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

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

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

    .app-header {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .app-nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
        order: 3;
        width: 100%;
    }

    .nav-options {
        position: static;
    }

    .app-header > form {
        margin-left: auto;
    }

    .landing-shell {
        padding: 0 1.5rem;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 3.5rem;
        padding: 4rem 0;
    }

    .foundation-card {
        max-width: 34rem;
    }
}

@media (max-width: 520px) {
    .site-header {
        min-height: 5.5rem;
    }

    .phase-badge {
        max-width: 8.5rem;
        text-align: center;
    }

    .brand small {
        display: none;
    }

    .hero {
        padding-top: 3rem;
    }

    h1 {
        font-size: clamp(2.75rem, 15vw, 4.25rem);
    }

    .status-row {
        gap: 0.9rem;
    }

    footer {
        align-items: flex-start;
        padding: 1.25rem 0;
        flex-direction: column;
        justify-content: center;
        gap: 0.35rem;
    }
}

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