:root {
    --ink: #1c2230;
    --muted: #667085;
    --line: #dfe3ea;
    --bg: #eef1f5;
    --card: #fff;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --danger: #c2332b;
    --ok: #16803c;
    --warn: #b45309;
    --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.auth:not(.page) {
    display: flex; align-items: center; justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) 16px 24px;
    background: radial-gradient(1200px 600px at 10% -10%, #dbe6ff 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e2f0ea 0, transparent 60%), var(--bg);
}
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 10px 30px rgba(20, 30, 60, .06);
}
.card.wide { max-width: 760px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; margin-bottom: 18px; }
.brand img { width: 30px; height: 30px; }
h1 { font-size: 22px; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 0; }
input, select {
    display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit; font-weight: 400;
    border: 1px solid #c9cfd9; border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 3px solid rgba(37, 99, 235, .2); border-color: var(--accent); }
input.otp { font-size: 22px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; line-height: 1.35; margin-top: 16px; }
label.check input { width: 20px; height: 20px; margin: 0; flex: none; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; margin-top: 18px;
    font: inherit; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid #c9cfd9; border-radius: 9px;
    cursor: pointer; text-decoration: none; min-height: 42px;
}
.btn:hover { background: #f4f6fa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #ecc7c4; }
.btn.danger:hover { background: #fdf1f0; }
.btn.small { padding: 5px 10px; min-height: 32px; margin: 2px; font-size: 13px; }
.msg { padding: 11px 14px; border-radius: 9px; margin: 12px 0; font-size: 14px; }
.msg-error { background: #fdecea; color: #8a1f17; border: 1px solid #f5c2bd; }
.msg-ok { background: #e8f6ed; color: #14532d; border: 1px solid #b7e1c4; }
.msg-info { background: #e9f0fe; color: #1e3a8a; border: 1px solid #c3d4fb; }
.msg a { margin-left: 8px; font-weight: 600; }
code.secret { display: inline-block; padding: 4px 8px; background: #f1f3f7; border-radius: 6px; font-size: 15px; letter-spacing: .05em; word-break: break-all; user-select: all; }
.setup-grid { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; margin: 14px 0 4px; }
.qr { background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 10px; line-height: 0; }
.qr svg { width: 210px; height: 210px; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 10px; }
.codes { columns: 2; font-size: 17px; padding-left: 26px; }
.codes code { letter-spacing: .06em; }
.links a { color: var(--accent); }
.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 99px; background: #e9f0fe; color: #1e3a8a; font-weight: 600; }

/* Verwaltungsseiten */
.topbar {
    position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-left)); background: #fff; border-bottom: 1px solid var(--line);
}
.topbar .brand { margin: 0; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav a { padding: 7px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.topbar nav a:hover { background: #f1f3f7; }
.stack { max-width: 1100px; margin: 0 auto; padding: 22px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.stack .card { max-width: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 0 14px; align-items: end; }
.grid3 .btn, .inline .btn { margin-top: 0; }
form.inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
form.inline label { flex: 1 1 220px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { margin-top: 12px; }
details { margin-top: 18px; }
summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.actions { white-space: normal; min-width: 260px; }
td.actions form { display: inline; }
tr.inactive td { opacity: .55; }

@media (max-width: 640px) {
    .card { padding: 20px; }
    .setup-grid { grid-template-columns: 1fr; justify-items: center; }
    .grid2, .grid3 { grid-template-columns: 1fr; }
    .grid3 .btn { margin-top: 14px; }
    .codes { columns: 1; }
}
@media (pointer: coarse) {
    .btn { min-height: 48px; }
    .btn.small { min-height: 40px; }
    input, select { padding: 13px 12px; font-size: 16px; }
}
