:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #202428;
    --muted: #626a73;
    --primary: #1e3a5f;
    --primary-light: #2f5d8c;
    --border: #dfe4e8;
    --success: #247044;
    --danger: #a63d3d;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scrollbar-gutter: stable;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

header {
    padding: 2rem 1rem;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 650;
}

nav {
    display: flex;
    justify-content: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

nav a {
    color: #fff;
    text-decoration: none;
    padding: .45rem .7rem;
    border-radius: .4rem;
}

nav a:hover,
nav a:focus-visible,
nav a[aria-current="page"] {
    background: rgba(255, 255, 255, .14);
}

main {
    width: min(760px, calc(100% - 2rem));
    margin: 2rem auto;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}

h2 {
    margin-top: 0;
    color: var(--primary);
    font-size: clamp(1.4rem, 4vw, 2rem);
}

p {
    line-height: 1.65;
}

main a:not(.button-link):not(.button),
main a:not(.button-link):not(.button):visited {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

main a:not(.button-link):not(.button):hover,
main a:not(.button-link):not(.button):focus-visible {
    color: var(--primary);
    background: #eef3f8;
    border-radius: .2rem;
}

.hero {
    margin: 1.5rem 0;
    text-align: center;
}

.hero img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: .6rem;
}

.hero figcaption {
    margin-top: .5rem;
    color: var(--muted);
    font-size: .9rem;
    font-style: italic;
}

.tool-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.tool-card {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: .65rem;
    background: #f8fafb;
}

.tool-card h3 {
    margin-top: 0;
    margin-bottom: .5rem;
    color: var(--primary);
}

.button-link {
    display: inline-block;
    padding: .65rem .9rem;
    border-radius: .45rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.button-link:hover,
.button-link:focus-visible {
    background: var(--primary-light);
}

.secondary-link {
    background: #68737e;
}

.contact-form {
    display: grid;
    gap: 1.1rem;
}

.auth-form {
    max-width: 34rem;
}

.form-field {
    display: grid;
    gap: .4rem;
}

.form-field label {
    font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: .7rem .75rem;
    border: 1px solid #b9c1c8;
    border-radius: .45rem;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.form-field textarea {
    resize: vertical;
    min-height: 11rem;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 3px solid rgba(47, 93, 140, .18);
    border-color: var(--primary-light);
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

.contact-form button:not(.password-toggle),
.action-button {
    justify-self: start;
    border: 0;
    border-radius: .45rem;
    padding: .75rem 1.1rem;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.contact-form button:not(.password-toggle):hover,
.contact-form button:not(.password-toggle):focus-visible,
.action-button:hover,
.action-button:focus-visible {
    background: var(--primary-light);
}

.action-button.secondary {
    background: #68737e;
}

.action-button.danger {
    background: var(--danger);
}

.notice {
    margin: 0 0 1.5rem;
    padding: 1rem;
    border-left: .3rem solid var(--primary-light);
    border-radius: .35rem;
    background: #eef3f8;
}

.notice.error {
    border-left-color: #b74747;
    background: #fff0f0;
}

.notice.success {
    border-left-color: var(--success);
    background: #eef8f2;
}

.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap input {
    padding-right: 3.25rem;
}

.contact-form .password-toggle {
    position: absolute;
    top: 50%;
    right: .35rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border: 0;
    border-radius: .35rem;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: normal;
}

.contact-form .password-toggle:hover,
.contact-form .password-toggle:focus-visible {
    background: #edf1f4;
    color: var(--primary);
}

.password-toggle svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: currentColor;
    stroke: none;
}

.password-toggle .icon-hide,
.password-toggle.is-visible .icon-show {
    display: none;
}

.password-toggle.is-visible .icon-hide {
    display: block;
}

.password-strength {
    margin: .2rem 0 0;
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: .45rem;
    background: #f8fafb;
}

.password-strength ul {
    margin: .4rem 0 0;
    padding-left: 1.25rem;
}

.password-strength li {
    margin: .2rem 0;
    color: var(--muted);
}

.password-strength li::marker {
    content: "○  ";
}

.password-strength li.is-valid {
    color: var(--success);
}

.password-strength li.is-valid::marker {
    content: "✓  ";
}

.auth-links {
    margin-top: 1rem;
}

.admin-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.user-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.user-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: .65rem;
    background: #f8fafb;
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.user-card h3 {
    margin: 0;
    color: var(--primary);
}

.user-meta {
    margin: .25rem 0 0;
    color: var(--muted);
    font-size: .92rem;
}

.user-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.user-actions form {
    margin: 0;
}

.role-toggle {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    padding: .25rem;
}

.role-toggle-track {
    position: relative;
    width: 2.9rem;
    height: 1.55rem;
    border-radius: 999px;
    background: #a9b2bb;
    transition: background .15s ease;
}

.role-toggle-track::after {
    content: "";
    position: absolute;
    top: .18rem;
    left: .18rem;
    width: 1.19rem;
    height: 1.19rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .15s ease;
}

.role-toggle.is-admin .role-toggle-track {
    background: var(--success);
}

.role-toggle.is-admin .role-toggle-track::after {
    transform: translateX(1.35rem);
}

.badge {
    display: inline-block;
    padding: .22rem .5rem;
    border-radius: 999px;
    background: #e6ebef;
    color: #45515c;
    font-size: .82rem;
    font-weight: 650;
}

.badge.admin {
    background: #e8f3ec;
    color: #245d3c;
}

footer {
    width: min(760px, calc(100% - 2rem));
    margin: 0 auto 2rem;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
}

footer a,
footer a:hover,
footer a:focus-visible {
    color: inherit;
    font: inherit;
    font-weight: normal;
    text-decoration: none;
}

@media (max-width: 600px) {
    .button-link,
    .contact-form button:not(.password-toggle),
    .action-button,
    .role-toggle {
        width: 100%;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .section-heading-row .button-link {
        flex-basis: 100%;
    }

    .user-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .user-actions form,
    .user-actions .action-button {
        width: 100%;
    }
}
