:root {
    --navy: #07172f;
    --navy-2: #0b2347;
    --blue: #1d6ff2;
    --blue-2: #65a5ff;
    --gold: #d7b56d;
    --gold-soft: #f1dbad;
    --ivory: #f7f2e8;
    --ink: #ecf4ff;
    --muted: #9fb1c8;
    --line: rgba(185, 210, 243, 0.18);
    --line-strong: rgba(215, 181, 109, 0.28);
    --surface: rgba(10, 31, 63, 0.78);
    --surface-2: rgba(14, 43, 86, 0.72);
    --field: rgba(255, 255, 255, 0.075);
    --danger: #ff8b7d;
    --ok: #79d6a4;
    --shadow: 0 24px 70px rgba(0, 10, 25, 0.42);
    --ease: cubic-bezier(.16, 1, .3, 1);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(900px 520px at 82% -10%, rgba(29, 111, 242, 0.34), transparent 64%),
        radial-gradient(680px 460px at 8% 12%, rgba(215, 181, 109, 0.12), transparent 60%),
        linear-gradient(180deg, #051126 0%, var(--navy) 42%, #061225 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

body::before {
    background:
        linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 68px 68px;
    content: "";
    inset: 0;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .8), transparent 78%);
    pointer-events: none;
    position: fixed;
    z-index: -1;
}

a {
    color: var(--gold-soft);
    text-decoration: none;
}

a:hover {
    color: #fff;
}

.topbar {
    align-items: center;
    backdrop-filter: blur(22px);
    background: rgba(5, 17, 38, 0.82);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 78px;
    padding: 0 max(24px, calc((100vw - 1220px) / 2 + 20px));
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    color: var(--ivory);
    display: inline-flex;
    font-family: "Cormorant Garamond", serif;
    font-size: 24px;
    font-weight: 700;
    gap: 12px;
    letter-spacing: .01em;
}

.brand::before {
    align-items: center;
    background: linear-gradient(145deg, var(--blue), #7eb6ff);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(29, 111, 242, .32);
    color: #fff;
    content: "AW";
    display: inline-flex;
    font-family: Inter, sans-serif;
    font-size: 12px;
    font-weight: 900;
    height: 42px;
    justify-content: center;
    letter-spacing: .06em;
    width: 42px;
}

.topnav,
.actions,
.section-head,
.attendance-tools {
    align-items: center;
    display: flex;
    gap: 12px;
}

.topnav {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.topnav form {
    margin: 0;
}

.shell {
    margin: 0 auto;
    max-width: 1220px;
    padding: 36px 20px 72px;
}

.page-head {
    align-items: flex-end;
    background:
        linear-gradient(120deg, rgba(29, 111, 242, 0.23), rgba(215, 181, 109, 0.07)),
        rgba(8, 27, 57, 0.78);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 18px;
    overflow: hidden;
    padding: 34px;
    position: relative;
}

.page-head::after {
    background: linear-gradient(180deg, var(--gold), transparent);
    content: "";
    height: 120px;
    opacity: .85;
    position: absolute;
    right: 34px;
    top: 0;
    width: 1px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    color: var(--ivory);
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(46px, 6vw, 78px);
    font-weight: 700;
    letter-spacing: 0;
    line-height: .94;
    margin-bottom: 12px;
}

h2 {
    color: var(--ivory);
    font-family: "Cormorant Garamond", serif;
    font-size: 29px;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1.05;
    margin-bottom: 18px;
}

h3 {
    color: var(--ivory);
    font-family: "Cormorant Garamond", serif;
    font-size: 24px;
    font-weight: 650;
    line-height: 1.08;
    margin-bottom: 6px;
}

.eyebrow {
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .24em;
    margin-bottom: 11px;
    text-transform: uppercase;
}

.page-lead {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
    margin: 0;
    max-width: 620px;
}

.muted {
    color: var(--muted);
}

.metric-strip {
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 22px;
    overflow: hidden;
}

.metric {
    background: rgba(10, 31, 63, .76);
    border-bottom: 1px solid var(--line);
    border-top: 1px solid var(--line);
    padding: 18px 20px;
}

.metric:first-child {
    border-left: 1px solid var(--line);
    border-radius: 14px 0 0 14px;
}

.metric:last-child {
    border-radius: 0 14px 14px 0;
    border-right: 1px solid var(--line);
}

.metric span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.metric strong {
    color: var(--gold-soft);
    display: block;
    font-family: "Cormorant Garamond", serif;
    font-size: 42px;
    line-height: .9;
    margin-top: 8px;
}

.grid {
    display: grid;
    gap: 22px;
    margin-bottom: 22px;
}

.grid.two {
    grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1.28fr);
}

.panel,
.auth-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .025)),
        var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(0, 12, 30, .28);
    padding: 26px;
    position: relative;
}

.panel::before,
.auth-card::before {
    background: linear-gradient(90deg, var(--gold), rgba(29, 111, 242, .2));
    border-radius: 16px 16px 0 0;
    content: "";
    height: 2px;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.panel.narrow,
.auth-card {
    margin: 58px auto;
    max-width: 560px;
}

.form-stack,
.form-grid {
    display: grid;
    gap: 15px;
}

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

.form-grid.compact {
    gap: 10px;
}

.span-2 {
    grid-column: span 2;
}

label {
    color: #c5d4e7;
    display: grid;
    font-size: 13px;
    font-weight: 750;
    gap: 7px;
}

input,
select,
textarea {
    background: var(--field);
    border: 1px solid rgba(196, 218, 247, .22);
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    min-height: 46px;
    outline: none;
    padding: 10px 12px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
    width: 100%;
}

input::placeholder,
textarea::placeholder {
    color: rgba(205, 221, 242, .48);
}

input:focus,
select:focus,
textarea:focus {
    background: rgba(255, 255, 255, .105);
    border-color: rgba(215, 181, 109, .8);
    box-shadow: 0 0 0 4px rgba(215, 181, 109, .12);
}

textarea {
    resize: vertical;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0;
}

.button,
button {
    align-items: center;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(215, 181, 109, .34);
    border-radius: 999px;
    color: var(--ivory);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    justify-content: center;
    letter-spacing: .04em;
    min-height: 44px;
    padding: 10px 18px;
    transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}

.button:hover,
button:hover {
    border-color: var(--gold);
    box-shadow: 0 12px 30px rgba(0, 12, 30, .3);
    transform: translateY(-1px);
}

.button.primary,
button.primary {
    background: var(--gold);
    border-color: var(--gold);
    color: #07172f;
}

.button.primary:hover,
button.primary:hover {
    background: var(--gold-soft);
}

.button.subtle {
    background: rgba(29, 111, 242, .14);
    border-color: rgba(101, 165, 255, .32);
    color: #dceaff;
}

.link-button {
    background: transparent;
    border: 0;
    color: var(--gold-soft);
    min-height: auto;
    padding: 0;
}

.link-button:hover {
    box-shadow: none;
    transform: none;
}

.icon-button {
    aspect-ratio: 1;
    border-radius: 12px;
    min-height: 40px;
    padding: 0;
    width: 40px;
}

.flash {
    border-radius: 14px;
    box-shadow: 0 15px 34px rgba(0, 12, 30, .25);
    margin-bottom: 18px;
    padding: 14px 16px;
}

.flash.success {
    background: rgba(43, 154, 99, .15);
    border: 1px solid rgba(121, 214, 164, .28);
    color: var(--ok);
}

.flash.error {
    background: rgba(180, 35, 24, .18);
    border: 1px solid rgba(255, 139, 125, .32);
    color: var(--danger);
}

.cards {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.subject-card {
    background:
        radial-gradient(360px 220px at 100% 0%, rgba(29, 111, 242, .23), transparent 60%),
        rgba(8, 27, 57, .82);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(0, 12, 30, .24);
    display: grid;
    gap: 16px;
    min-height: 232px;
    padding: 22px;
    position: relative;
    transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}

.subject-card:hover {
    border-color: rgba(215, 181, 109, .42);
    box-shadow: 0 24px 56px rgba(0, 12, 30, .34);
    transform: translateY(-3px);
}

.subject-card h3 a {
    color: var(--ivory);
}

.subject-card h3 a:hover {
    color: var(--gold-soft);
}

.stats {
    display: flex;
    gap: 10px;
    margin: 0;
}

.stats div {
    background: rgba(255, 255, 255, .055);
    border: 1px solid var(--line);
    border-radius: 12px;
    min-width: 88px;
    padding: 10px 12px;
}

.stats dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.stats dd {
    color: var(--gold-soft);
    font-family: "Cormorant Garamond", serif;
    font-size: 29px;
    font-weight: 700;
    margin: 0;
}

.badge {
    background: rgba(215, 181, 109, .14);
    border: 1px solid rgba(215, 181, 109, .34);
    border-radius: 999px;
    color: var(--gold-soft);
    font-size: 12px;
    font-weight: 850;
    padding: 5px 9px;
    position: absolute;
    right: 16px;
    top: 16px;
}

.tabs {
    background: rgba(8, 27, 57, .76);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: flex;
    gap: 4px;
    margin-bottom: 22px;
    overflow-x: auto;
    padding: 5px;
}

.tabs a {
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
    padding: 11px 16px;
    white-space: nowrap;
}

.tabs a.active {
    background: var(--gold);
    box-shadow: 0 12px 26px rgba(0, 12, 30, .32);
    color: #07172f;
}

.list {
    display: grid;
    gap: 10px;
}

.list-row {
    align-items: center;
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--ink);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 14px 15px;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease), background .18s var(--ease);
}

a.list-row:hover {
    background: rgba(255, 255, 255, .072);
    border-color: rgba(215, 181, 109, .34);
    box-shadow: 0 15px 34px rgba(0, 12, 30, .25);
    color: var(--ink);
    transform: translateY(-1px);
}

.list-row strong {
    color: var(--ivory);
}

.list-row small {
    color: var(--muted);
    display: block;
    margin-top: 4px;
}

.list-row.editable span {
    display: grid;
    flex: 1;
    gap: 8px;
}

.search {
    max-width: 280px;
}

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

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

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .14em;
    text-transform: uppercase;
}

td.actions {
    display: flex;
    gap: 6px;
}

.student-list {
    display: grid;
    gap: 10px;
}

.student-row,
.student-edit {
    align-items: center;
    display: grid;
    gap: 8px;
}

.student-row {
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--line);
    border-radius: 14px;
    grid-template-columns: 1fr auto;
    padding: 10px;
}

.student-edit {
    grid-template-columns: repeat(4, minmax(100px, 1fr)) minmax(82px, auto) auto;
}

.student-status {
    background: rgba(29, 111, 242, .13);
    border: 1px solid rgba(101, 165, 255, .26);
    border-radius: 999px;
    color: #dceaff;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 10px;
    text-align: center;
}

.attendance-tools {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 16px;
    padding: 12px;
}

[data-material-field="link"],
[data-material-field="file"] {
    display: none;
}

.reveal-ready .panel,
.reveal-ready .auth-card,
.reveal-ready .subject-card,
.reveal-ready .metric,
.reveal-ready .list-row,
.reveal-ready .student-row {
    opacity: 0;
    transform: translateY(18px);
}

.reveal-ready .is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .75s var(--ease), transform .75s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}

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

    .reveal-ready .panel,
    .reveal-ready .auth-card,
    .reveal-ready .subject-card,
    .reveal-ready .metric,
    .reveal-ready .list-row,
    .reveal-ready .student-row {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 900px) {
    .grid.two,
    .form-grid,
    .metric-strip {
        grid-template-columns: 1fr;
    }

    .metric,
    .metric:first-child,
    .metric:last-child {
        border: 1px solid var(--line);
        border-radius: 14px;
    }

    .span-2 {
        grid-column: span 1;
    }

    .page-head,
    .section-head,
    .list-row {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head {
        padding: 26px;
    }

    .page-head::after {
        display: none;
    }

    .tabs {
        border-radius: 18px;
        flex-wrap: wrap;
        overflow: visible;
    }

    .tabs a {
        flex: 1 1 132px;
        text-align: center;
    }

    .student-row,
    .student-edit {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 16px 18px;
    }

    .topnav {
        width: 100%;
        justify-content: space-between;
    }

    .shell {
        padding: 24px 14px 48px;
    }

    h1 {
        font-size: 46px;
    }
}
