:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --border: #d9dee3;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --error: #b91c1c;
    --error-bg: #fee2e2;
    --success: #166534;
    --success-bg: #dcfce7;
    --info: #1e40af;
    --info-bg: #dbeafe;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: #111827;
    color: #fff;
}

.topbar .brand {
    font-weight: 700;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar a {
    color: #e5e7eb;
    text-decoration: none;
}

.topbar a:hover {
    text-decoration: underline;
}

.topbar .inline {
    margin: 0;
}

.link-button {
    background: none;
    border: none;
    color: #e5e7eb;
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: none;
}

.link-button:hover {
    text-decoration: underline;
}

.wrap {
    max-width: 760px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.card.highlight {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

h1 {
    font-size: 1.5rem;
    margin-top: 0;
}

h2 {
    font-size: 1.15rem;
    margin-top: 0;
}

label {
    display: block;
    margin: 0.75rem 0;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"] {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

button,
.button {
    display: inline-block;
    padding: 0.55rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

button:hover {
    background: #f3f4f6;
}

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

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

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.flash {
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.flash-error {
    background: var(--error-bg);
    color: var(--error);
}

.flash-success {
    background: var(--success-bg);
    color: var(--success);
}

.flash-info {
    background: var(--info-bg);
    color: var(--info);
}

.dev-box {
    background: #fef9c3;
    border: 1px dashed #ca8a04;
    color: #854d0e;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    margin: 0.75rem 0;
}

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

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.on {
    background: var(--success-bg);
    color: var(--success);
}

.badge.off {
    background: #e5e7eb;
    color: #4b5563;
}

.button-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.backup-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.backup-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #f3f4f6;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    text-align: center;
    letter-spacing: 1px;
}

.inline-form {
    display: inline-block;
    margin: 0.35rem 0.35rem 0.35rem 0;
}

.passkey-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.passkey-table th,
.passkey-table td {
    text-align: left;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    vertical-align: middle;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #f3f4f6;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}