:root {
    --bg: #0f1216;
    --bg-card: #1a1f27;
    --fg: #e6e9ef;
    --fg-muted: #9aa3b2;
    --accent: #4f8cff;
    --accent-hover: #6ba1ff;
    --border: #2a313c;
    --error: #ff6b6b;
    --error-bg: #3a1f23;
    --radius: 6px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* --- Login -------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth__card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.auth__title {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
}

.auth__subtitle {
    margin: 0 0 1.5rem;
    color: var(--fg-muted);
    font-size: 0.95rem;
}

.auth__error {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--error-bg);
    color: var(--error);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.auth__form { display: flex; flex-direction: column; gap: 1rem; }
.auth__field { display: flex; flex-direction: column; gap: 0.4rem; }

.auth__label {
    font-size: 0.85rem;
    color: var(--fg-muted);
}

.auth__field input {
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}
.auth__field input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth__submit {
    margin-top: 0.5rem;
    padding: 0.7rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.auth__submit:hover { background: var(--accent-hover); }

.auth__checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}
.auth__checkbox input { margin: 0; }

.auth__card--wide { max-width: 460px; }
.auth__footer {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.85rem;
}

.auth__notice {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.auth__notice--success {
    background: #1f3a2a;
    color: #6ee7a3;
}

.enroll__qr {
    display: flex;
    justify-content: center;
    margin: 1.25rem 0 1rem;
}
.enroll__qr img {
    background: white;
    padding: 8px;
    border-radius: var(--radius);
}

.enroll__manual {
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}
.enroll__manual summary { cursor: pointer; color: var(--fg-muted); }
.enroll__manual code {
    display: block;
    margin-top: 0.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    word-break: break-all;
}

/* --- Authenticated layout ----------------------------------------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.app__header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.875rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.app__brand {
    color: var(--fg);
    font-weight: 600;
    text-decoration: none;
}

.app__nav {
    display: flex;
    gap: 1.25rem;
    flex: 1;
}
.app__nav a {
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}
.app__nav a:hover { color: var(--fg); }
.app__nav a.is-active { color: var(--fg); border-bottom-color: var(--accent); }

.app__user {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
}
.app__user-email { color: var(--fg-muted); }

.app__main {
    flex: 1;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.app__flash {
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.app__flash--success { background: #1f3a2a; color: #6ee7a3; }
.app__flash--error   { background: var(--error-bg); color: var(--error); }
.app__flash--warning { background: #3a311f; color: #f3c969; }
.app__flash--info    { background: #1f2c3a; color: #8fb8f3; }

/* --- Page header / cards / tables --------------------------------------- */
.page__header { margin-bottom: 1.75rem; }
.page__header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.page__title { margin: 0 0 0.25rem; font-size: 1.5rem; }
.page__lead  { margin: 0; color: var(--fg-muted); font-size: 0.95rem; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card--no-pad { padding: 0; overflow: hidden; }
.card--empty  { text-align: center; color: var(--fg-muted); }
.card__muted  { color: var(--fg-muted); margin: 0; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fg-muted);
    font-weight: 500;
}
.table tbody tr:last-child td { border-bottom: none; }
.table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9rem;
}

/* --- Pills / buttons / forms ------------------------------------------- */
.pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pill--web  { background: #1f2c3a; color: #8fb8f3; }
.pill--mail { background: #2a1f3a; color: #c89af3; }

.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn--primary { background: var(--accent); color: white; }
.btn--primary:hover { background: var(--accent-hover); color: white; }
.btn--ghost { background: transparent; color: var(--fg-muted); border-color: var(--border); }
.btn--ghost:hover { color: var(--fg); border-color: var(--fg-muted); text-decoration: none; }
.btn--danger { background: #5a1f1f; color: #f5b8b8; }
.btn--danger:hover { background: #722828; color: #ffd0d0; }

.form-inline { margin-top: 0.5rem; }

.form { display: flex; flex-direction: column; gap: 1.25rem; }
.form__field { display: flex; flex-direction: column; gap: 0.4rem; }
.form__label { font-size: 0.85rem; color: var(--fg-muted); }
.form__hint  { font-size: 0.8rem; color: var(--fg-muted); }
.form__field input,
.form__field select {
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}
.form__field input:focus,
.form__field select:focus {
    outline: none;
    border-color: var(--accent);
}
.form__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}
