:root {
    --av-red: #d8243b;
    --av-red-dark: #9f1728;
    --ink: #1c1e21;
    --muted: #626975;
    --line: #d9dde3;
    --paper: #ffffff;
    --wash: #f5f6f8;
    --soft-red: #fff1f3;
    --gray: #c4c4c4;
    --focus: #2457a6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.public-body {
    background: var(--paper);
}

.app-body {
    background: var(--wash);
}

.site-header,
.app-header {
    align-items: center;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 4.75rem;
    padding: 0.85rem clamp(1rem, 4vw, 2rem);
}

.brand {
    align-items: center;
    display: inline-flex;
    gap: 0.75rem;
    min-width: 0;
}

.brand-mark,
.portal-logo {
    align-items: center;
    background: var(--av-red);
    color: white;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
}

.brand-mark {
    border-radius: 8px;
    height: 2.55rem;
    width: 2.55rem;
}

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

.brand strong {
    line-height: 1.1;
}

.brand small {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.site-nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.site-nav a,
.site-nav button {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
    padding: 0.55rem 0.7rem;
}

.site-nav a:hover,
.site-nav button:hover {
    background: var(--soft-red);
    color: var(--av-red-dark);
}

.account-menu {
    position: relative;
}

.account-menu summary {
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: 850;
    gap: 0.55rem;
    list-style: none;
    min-height: 2.65rem;
    padding: 0.55rem 0.75rem;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-menu[open] summary,
.account-menu summary:hover {
    border-color: var(--av-red);
    color: var(--av-red-dark);
}

.account-menu-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(28, 30, 33, 0.14);
    display: grid;
    gap: 0.2rem;
    min-width: 13rem;
    padding: 0.45rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.45rem);
    z-index: 20;
}

.account-menu-panel a,
.account-menu-panel button {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    display: block;
    font-size: 0.92rem;
    font-weight: 800;
    padding: 0.65rem 0.75rem;
    text-align: left;
    width: 100%;
}

.account-menu-panel a:hover,
.account-menu-panel button:hover {
    background: var(--soft-red);
    color: var(--av-red-dark);
}

.flash {
    background: #e8f7ef;
    border-bottom: 1px solid #b9e4cb;
    color: #16603a;
    font-weight: 800;
    padding: 0.7rem 1rem;
    text-align: center;
}

.hero-shell,
.page-shell,
.auth-shell,
.student-portal-shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: clamp(1rem, 4vw, 2rem);
}

.hero {
    align-items: stretch;
    display: grid;
    gap: clamp(1rem, 3vw, 2rem);
    grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
    min-height: calc(100vh - 8rem);
}

.hero-copy {
    align-self: center;
    padding: 2rem 0;
}

.eyebrow {
    color: var(--av-red);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    margin: 0 0 0.35rem;
    text-transform: uppercase;
}

h1,
h2 {
    line-height: 1.08;
    margin: 0;
}

h1 {
    font-size: clamp(2.1rem, 5vw, 4.6rem);
}

h2 {
    font-size: 1.25rem;
}

.hero-copy p:not(.eyebrow) {
    color: var(--muted);
    font-size: 1.1rem;
    margin: 1rem 0 0;
    max-width: 42rem;
}

.hero-media {
    background:
        linear-gradient(135deg, rgba(216, 36, 59, 0.94), rgba(28, 30, 33, 0.92)),
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: auto, 42px 42px;
    border-radius: 8px;
    min-height: 26rem;
    overflow: hidden;
    position: relative;
}

.field-lines {
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-left: 0;
    border-right: 0;
    inset: 18%;
    position: absolute;
}

.field-lines::before,
.field-lines::after {
    background: rgba(255, 255, 255, 0.28);
    content: "";
    height: 100%;
    position: absolute;
    top: 0;
    width: 2px;
}

.field-lines::before {
    left: 33%;
}

.field-lines::after {
    right: 33%;
}

.monogram {
    color: rgba(255, 255, 255, 0.92);
    font-size: clamp(6rem, 18vw, 15rem);
    font-weight: 950;
    inset: auto 1.2rem -2.4rem auto;
    line-height: 1;
    position: absolute;
}

.button-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

.button {
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    font-weight: 850;
    justify-content: center;
    min-height: 2.7rem;
    padding: 0.65rem 0.9rem;
}

.button:hover {
    border-color: var(--av-red);
    color: var(--av-red-dark);
}

.button-primary {
    background: var(--av-red);
    border-color: var(--av-red);
    color: white;
}

.button-primary:hover {
    background: var(--av-red-dark);
    border-color: var(--av-red-dark);
    color: white;
}

.button.small {
    min-height: 2.15rem;
    padding: 0.4rem 0.65rem;
}

.button.full {
    width: 100%;
}

.page-shell.narrow {
    max-width: 780px;
}

.page-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.page-header h1 {
    font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.panel,
.metric,
.tool-card,
.student-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel {
    padding: clamp(1rem, 3vw, 1.35rem);
}

.panel + .panel {
    margin-top: 1rem;
}

.auth-shell,
.student-portal-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 4.75rem);
}

.auth-panel,
.student-card {
    max-width: 28rem;
    width: 100%;
}

.auth-panel {
    padding: 1.5rem;
}

.portal-logo {
    border-radius: 999px;
    height: 4.25rem;
    margin: 0 auto 1rem;
    width: 4.25rem;
}

.auth-panel h1,
.student-card h1 {
    font-size: 2rem;
    text-align: center;
}

.stack {
    display: grid;
    gap: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.colors {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1rem;
}

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

.form-field.grow {
    flex: 1;
    min-width: 14rem;
}

label,
legend {
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 850;
}

input,
select,
textarea {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    min-height: 2.65rem;
    padding: 0.55rem 0.7rem;
    width: 100%;
}

input[type="color"] {
    height: 2.65rem;
    padding: 0.25rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--focus);
    outline: 3px solid rgba(36, 87, 166, 0.16);
}

.error {
    color: #a21d2d;
    font-size: 0.86rem;
    font-weight: 750;
}

.check-row {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}

.check-row input,
.check-card input {
    min-height: auto;
    width: auto;
}

.fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    padding: 1rem;
}

.check-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.check-grid.permissions {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.check-card {
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 0.65rem;
    padding: 0.8rem;
}

.check-card.compact {
    align-items: center;
    padding: 0.62rem 0.7rem;
}

.check-card strong,
.check-card small {
    display: block;
}

.check-card small {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 650;
}

.inline-form {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.metric-grid,
.tool-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    margin-bottom: 1rem;
}

.metric {
    padding: 1rem;
}

.metric span,
.tool-card span,
table span {
    color: var(--muted);
}

.metric strong {
    display: block;
    font-size: 2.1rem;
    line-height: 1;
    margin-top: 0.35rem;
}

.tool-card {
    display: grid;
    gap: 0.25rem;
    min-height: 6.2rem;
    padding: 1rem;
}

.tool-card:hover {
    border-color: var(--av-red);
}

.tool-card.muted {
    background: #fafafa;
}

.section-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.section-head a {
    color: var(--av-red-dark);
    font-weight: 850;
}

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

table {
    border-collapse: collapse;
    min-width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 0.75rem;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.actions {
    text-align: right;
    white-space: nowrap;
}

.badge {
    background: var(--soft-red);
    border-radius: 999px;
    color: var(--av-red-dark);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 900;
    padding: 0.25rem 0.55rem;
}

.detail-list {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
}

.detail-list li {
    background: #fafafa;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem;
}

.sticky-actions {
    background: var(--wash);
    bottom: 0;
    padding: 0.8rem 0;
    position: sticky;
}

.student-card {
    padding: 1.25rem;
}

.portal-menu {
    display: grid;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.portal-menu a,
.portal-menu button {
    background: var(--av-red);
    border: 0;
    border-radius: 8px;
    color: white;
    display: block;
    font-weight: 900;
    min-height: 3.25rem;
    padding: 0.85rem 1rem;
    text-align: center;
    width: 100%;
}

.portal-menu a[aria-disabled="true"] {
    background: #eceff3;
    color: #5f6875;
    pointer-events: none;
}

.portal-menu button {
    background: var(--ink);
}

@media (max-width: 760px) {
    .site-header,
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-nav {
        justify-content: flex-start;
        width: 100%;
    }

    .account-menu {
        width: 100%;
    }

    .account-menu summary {
        justify-content: space-between;
        width: 100%;
    }

    .account-menu-panel {
        left: 0;
        right: auto;
        width: 100%;
    }

    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .hero-media {
        min-height: 14rem;
    }

    .page-header,
    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .form-grid,
    .form-grid.colors {
        grid-template-columns: 1fr;
    }
}
