@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Sora:wght@600;700&display=swap");

:root {
    --bg: #f2f5f8;
    --bg-soft: #e8eef3;
    --surface: #ffffff;
    --surface-2: #f8fbff;
    --line: #d6e0ea;
    --ink: #10202c;
    --muted: #566978;
    --primary: #0f5a91;
    --primary-strong: #0c426a;
    --accent: #f29f05;
    --danger: #be2d2d;
    --success: #1d7a4f;
    --shadow: 0 14px 30px rgba(12, 39, 60, 0.1);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 2% 0%, #ffffff 0, #ffffff00 38%),
        radial-gradient(circle at 98% 10%, #ffedc6 0, #ffffff00 26%),
        linear-gradient(125deg, var(--bg), var(--bg-soft));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(transparent 95%, rgba(16, 32, 44, 0.03) 95%);
    background-size: 100% 20px;
}

.container {
    width: min(1240px, 95vw);
    margin: 20px auto 40px;
    animation: fade-slide 380ms ease;
}

.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(115deg, #071e30 0%, #0d395b 48%, #1068aa 100%);
    color: #f7fbff;
    border-radius: 22px;
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 18px 44px rgba(8, 35, 55, 0.28);
}

.hero::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -75px;
    top: -90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(242, 159, 5, 0.45), rgba(242, 159, 5, 0.02) 70%);
    z-index: 0;
}

.hero h1 {
    position: relative;
    margin: 0;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: clamp(1.55rem, 2.1vw, 2.2rem);
    letter-spacing: 0.01em;
}

.hero p {
    position: relative;
    margin: 8px 0 0;
    max-width: 72ch;
    color: rgba(247, 251, 255, 0.9);
}

.hero-top {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: flex-start;
}

.session-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    max-width: min(100%, 420px);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(196, 218, 235, 0.48);
    background: rgba(5, 24, 38, 0.45);
    backdrop-filter: blur(4px);
}

.session-email {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ebf6ff;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.session-box button.ghost {
    background: #eef3f8;
    color: #1d3f56;
    border: 1px solid #c7d5e2;
    padding: 8px 12px;
    min-height: 34px;
}

.session-box button.ghost:hover {
    filter: brightness(1);
    background: #ffffff;
}

.actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.btn-link.ghost {
    background: #eaf3fa;
    color: #1c4a6c;
    border-color: #c6d9ea;
}

.btn-link.primary-link {
    background: linear-gradient(135deg, var(--primary) 0%, #2683c7 100%);
    color: #ffffff;
    border-color: #2f7fb7;
}

.nav {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.nav a {
    color: #edf6ff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 999px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.nav a:hover,
.nav a.active {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.6);
}

.grid {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.grid.cols-4 {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
}

.card {
    background: linear-gradient(170deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    animation: pop-in 320ms ease backwards;
}

.grid .card:nth-child(2) {
    animation-delay: 40ms;
}

.grid .card:nth-child(3) {
    animation-delay: 80ms;
}

.grid .card:nth-child(4) {
    animation-delay: 120ms;
}

.card h2,
.card h3 {
    margin: 0 0 12px;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 1.03rem;
}

.stat {
    margin: 0 0 6px;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: clamp(1.8rem, 2.9vw, 2.2rem);
    color: var(--primary-strong);
}

.muted {
    color: var(--muted);
    font-size: 0.93rem;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 16px;
}

form {
    display: grid;
    gap: 12px;
}

.auth-shell {
    margin-top: 18px;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(480px, 96vw);
}

.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.87rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #395264;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c7d6e3;
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink);
    padding: 11px 12px;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2279ba;
    box-shadow: 0 0 0 4px rgba(34, 121, 186, 0.15);
}

textarea {
    min-height: 92px;
    resize: vertical;
}

button {
    border: 0;
    border-radius: 10px;
    font-weight: 800;
    padding: 10px 14px;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

button.primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2683c7 100%);
    color: #ffffff;
}

button.danger {
    background: linear-gradient(135deg, #a72222 0%, var(--danger) 100%);
    color: #ffffff;
}

button.ghost {
    background: #eaf3fa;
    color: #1c4a6c;
}

.flash {
    margin-top: 14px;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 700;
    border: 1px solid transparent;
}

.flash.success {
    color: #10593b;
    background: #e4f8ec;
    border-color: #b8e9cb;
}

.flash.error {
    color: #7f2525;
    background: #fdecec;
    border-color: #f8c7c7;
}

.table-wrap {
    overflow: auto;
    border-radius: 12px;
    border: 1px solid #d6e0ea;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    text-align: left;
    padding: 10px 10px;
    border-bottom: 1px solid #e3eaf1;
    vertical-align: top;
    font-size: 0.92rem;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f3f8fc;
    color: #415a6b;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:hover td {
    background: #f8fbff;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid transparent;
    font-size: 0.8rem;
    font-weight: 800;
}

.level-1 {
    background: #fff1dd;
    border-color: #f5cd94;
    color: #875100;
}

.level-2 {
    background: #fff8da;
    border-color: #ebdc96;
    color: #806100;
}

.level-3 {
    background: #e6f8ee;
    border-color: #9cd8b7;
    color: #1d744b;
}

.level-4 {
    background: #d7f4ed;
    border-color: #7bcbb5;
    color: #14604b;
}

.level-5 {
    background: #d0ecf7;
    border-color: #83c2df;
    color: #0f4f6a;
}

.level-empty {
    background: #f1f4f7;
    border-color: #d5dde5;
    color: #697888;
}

.matrix-cell {
    min-width: 104px;
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--muted);
}

.checkbox-line input {
    width: auto;
    margin: 0;
}

body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    background: rgba(7, 25, 40, 0.52);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-card {
    width: min(420px, 96vw);
    background: linear-gradient(170deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(8, 35, 55, 0.3);
    padding: 16px;
    transform: translateY(10px) scale(0.98);
    transition: transform 180ms ease;
}

.modal-card-wide {
    width: min(640px, 96vw);
}

.modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-card h3 {
    margin: 0 0 8px;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 1rem;
}

.modal-card .actions-row {
    justify-content: flex-end;
    margin-top: 6px;
}

.modal-error {
    display: none;
    margin-top: 6px;
    font-size: 0.84rem;
    font-weight: 700;
    color: #9a2525;
}

.instruction-stack {
    display: grid;
    gap: 14px;
}

.instruction-box {
    min-height: 92px;
    border: 1px solid #d6e0ea;
    border-radius: 12px;
    background: #f8fbff;
    padding: 12px;
    color: var(--ink);
    white-space: pre-wrap;
}

.instruction-image {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border: 1px solid #d6e0ea;
    border-radius: 12px;
    background: #f8fbff;
    padding: 10px;
}

@keyframes fade-slide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .grid.cols-4 {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .split {
        grid-template-columns: 1fr;
    }

    .two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(1240px, 96vw);
        margin-top: 12px;
    }

    .grid.cols-4 {
        grid-template-columns: 1fr;
    }

    .hero {
        border-radius: 16px;
        padding: 18px;
    }

    .nav a {
        font-size: 0.84rem;
        padding: 7px 11px;
    }

    .hero-top {
        flex-direction: column;
    }

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

    .session-email {
        max-width: 68vw;
    }
}
