.admin-body {
    min-height: 100vh;
}

.admin-topbar .state-dot {
    border-color: #7054b8;
    box-shadow: 0 0 0 4px rgba(112, 84, 184, 0.11);
}

.admin-shell {
    position: relative;
    z-index: 1;
    width: min(1040px, calc(100% - 48px));
    margin: 42px auto 30px;
}

.admin-login-page .admin-shell {
    width: min(560px, calc(100% - 32px));
    min-height: calc(100vh - 230px);
    display: grid;
    align-content: center;
}

.admin-login-card {
    position: relative;
    padding: clamp(30px, 7vw, 58px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-top: 3px solid #7054b8;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.admin-login-card::after {
    position: absolute;
    right: -72px;
    top: -72px;
    width: 190px;
    height: 190px;
    content: "";
    transform: rotate(45deg);
    border: 1px solid rgba(112, 84, 184, 0.12);
    pointer-events: none;
}

.admin-emblem {
    width: 68px;
    height: 68px;
    margin: 0 0 34px 8px;
    display: grid;
    place-items: center;
    transform: rotate(45deg);
    border: 1px solid #7054b8;
    color: #7054b8;
    background: #f5f2fc;
}

.admin-emblem span {
    transform: rotate(-45deg);
    font-size: 1rem;
}

.admin-login-card h1,
.admin-heading h1 {
    margin: 0;
    font-size: clamp(2.7rem, 8vw, 5.1rem);
    line-height: 0.98;
    font-weight: 300;
    letter-spacing: -0.055em;
}

.admin-intro {
    max-width: 390px;
    margin: 21px 0 29px;
    color: var(--muted);
    line-height: 1.75;
}

.admin-setup-note {
    margin: 0 0 25px;
    padding: 14px 16px;
    display: grid;
    gap: 4px;
    border-left: 3px solid var(--amber);
    color: #76510c;
    background: var(--amber-soft);
    font-size: 0.84rem;
}

.admin-setup-note span {
    color: var(--muted);
}

.admin-login-form {
    display: grid;
    gap: 11px;
}

.admin-login-form label,
.code-import-form > label,
.admin-child-choice legend {
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.admin-login-form input,
.code-import-form textarea {
    width: 100%;
    min-width: 0;
    padding: 15px 17px;
    border: 1px solid var(--line-strong);
    border-radius: 0;
    color: var(--ink);
    background: var(--paper);
    font: inherit;
}

.admin-login-form input {
    min-height: 54px;
}

.admin-login-form input:focus,
.code-import-form textarea:focus {
    border-color: #7054b8;
    outline: 3px solid rgba(112, 84, 184, 0.13);
    outline-offset: 1px;
}

.admin-login-form .primary-button,
.admin-submit {
    margin-top: 7px;
    border-color: #7054b8;
    background: #7054b8;
}

.admin-login-form .primary-button:hover:not(:disabled),
.admin-submit:hover:not(:disabled) {
    border-color: #573d96;
    background: #573d96;
}

.admin-back-link {
    margin-top: 28px;
    display: inline-block;
    color: var(--muted);
    font-size: 0.74rem;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.admin-back-link:hover {
    color: var(--blue);
}

.admin-heading {
    margin-bottom: 30px;
    padding: clamp(28px, 5vw, 47px);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 25px;
    border: 1px solid var(--line);
    border-top: 3px solid #7054b8;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.admin-heading > div > p:last-child {
    margin: 20px 0 0;
    color: var(--muted);
}

.logout-form {
    flex: 0 0 auto;
}

.admin-overview,
.admin-import {
    margin-top: 24px;
    padding: clamp(24px, 5vw, 44px);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
}

.admin-section-title {
    margin-bottom: 24px;
}

.admin-section-title h2 {
    margin: 0;
    font-size: clamp(1.9rem, 5vw, 3rem);
    line-height: 1.1;
    font-weight: 330;
    letter-spacing: -0.04em;
}

.admin-section-title > p:last-child {
    max-width: 680px;
    margin: 13px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.admin-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-profile-card {
    position: relative;
    padding: 24px;
    border: 1px solid var(--line);
    background: var(--paper);
}

.admin-profile-card::before {
    position: absolute;
    inset: -1px auto auto -1px;
    width: 62px;
    height: 3px;
    content: "";
    background: #7054b8;
}

.admin-profile-name {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-avatar {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border: 1px solid #7054b8;
    color: #7054b8;
    background: #f5f2fc;
    font-size: 1rem;
}

.admin-profile-name h3 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 350;
}

.admin-profile-card dl {
    margin: 23px 0 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.admin-profile-card dl div {
    min-width: 0;
    padding: 14px;
    background: var(--soft);
}

.admin-profile-card dt {
    color: var(--muted);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.admin-profile-card dd {
    margin: 5px 0 0;
    color: #7054b8;
    font-size: 2.1rem;
    line-height: 1;
    font-weight: 350;
}

.code-import-form {
    display: grid;
    gap: 11px;
}

.admin-child-choice {
    min-width: 0;
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

.admin-child-choice legend {
    margin-bottom: 10px;
}

.admin-child-choice > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.admin-child-option {
    position: relative;
    cursor: pointer;
}

.admin-child-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.admin-child-option span {
    min-height: 76px;
    padding: 15px 18px;
    display: grid;
    align-content: center;
    gap: 3px;
    border: 1px solid var(--line-strong);
    background: var(--paper);
    transition: border-color 150ms ease, background 150ms ease;
}

.admin-child-option b {
    font-size: 1.08rem;
    font-weight: 650;
}

.admin-child-option small {
    color: var(--muted);
}

.admin-child-option input:checked + span {
    border-color: #7054b8;
    color: #573d96;
    background: #f5f2fc;
    box-shadow: inset 3px 0 0 #7054b8;
}

.admin-child-option input:focus-visible + span {
    outline: 3px solid rgba(112, 84, 184, 0.18);
    outline-offset: 2px;
}

.code-import-form textarea {
    min-height: 240px;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.65;
}

.field-help {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.77rem;
    line-height: 1.6;
}

.admin-submit {
    width: min(100%, 420px);
}

.admin-footer a {
    color: var(--muted);
    text-decoration: none;
}

.admin-footer a:hover {
    color: var(--blue);
}

@media (max-width: 680px) {
    .admin-shell,
    .admin-footer {
        width: calc(100% - 28px);
    }

    .admin-heading {
        flex-direction: column;
    }

    .admin-profile-grid,
    .admin-child-choice > div {
        grid-template-columns: 1fr;
    }

    .admin-profile-card dl {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-submit {
        width: 100%;
    }
}

@media (max-width: 390px) {
    .admin-login-card,
    .admin-heading,
    .admin-overview,
    .admin-import {
        padding: 22px 17px;
    }

    .admin-login-card h1,
    .admin-heading h1 {
        font-size: 2.7rem;
    }

    .admin-profile-card {
        padding: 19px 15px;
    }
}
