:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5d6677;
    --border: #dde1e8;
    --accent: #2f5bd3;
    --accent-text: #ffffff;
    --error: #b42318;
    --radius: 8px;
    --gap: 1rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1b2029;
        --text: #e6e9ef;
        --muted: #9aa3b2;
        --border: #2c3340;
        --accent: #7b9cf5;
        --accent-text: #0d1220;
        --error: #f97066;
    }
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }

.container {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 var(--gap);
}

main.container { flex: 1; padding-block: 2rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap); min-height: 3.5rem; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.site-nav { flex: 1; }
.account { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.account a { text-decoration: none; }
.account a:hover, .link-button:hover { text-decoration: underline; }
.account form { margin: 0; }
.account-name { color: var(--muted); }

/* Menus */
.menu, .menu ul { list-style: none; margin: 0; padding: 0; }
.menu { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.menu a { text-decoration: none; color: var(--text); padding: .25rem 0; display: inline-block; }
.menu a:hover, .menu a[aria-current="page"] { color: var(--accent); }
.menu a[aria-current="page"] { font-weight: 600; }
.menu-section { position: relative; }
.menu-section-title { color: var(--muted); cursor: default; padding: .25rem 0; display: inline-block; }
.menu-section > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    min-width: 12rem;
    padding: .5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgb(0 0 0 / .12);
}
.menu-section:hover > ul, .menu-section:focus-within > ul { display: block; }

/* Content */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card.narrow { max-width: 28rem; margin: 0 auto; }
.card h1:first-child, .card .alert + h1 { margin-top: 0; }

.alert {
    padding: .75rem 1rem;
    margin-bottom: var(--gap);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}
.alert-error { border-color: var(--error); color: var(--error); }

/* Forms */
.form { display: flex; flex-direction: column; gap: .5rem; }
.form input[type=text], .form input[type=password], .form input[type=email], .form input:not([type]) {
    font: inherit;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}
.form .helptext, .form ul { font-size: .85rem; color: var(--muted); }
.button {
    font: inherit;
    margin-top: .5rem;
    padding: .6rem 1rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-text);
    cursor: pointer;
}
.link-button { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding-block: 1rem; }
.site-footer p { margin: .5rem 0 0; }

@media (max-width: 40rem) {
    .header-inner { padding-block: .75rem; }
    .site-nav { flex-basis: 100%; order: 3; }
    .menu-section > ul { position: static; display: block; border: 0; box-shadow: none; padding: 0 0 0 1rem; min-width: 0; }
}
