:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1a1d23; --muted: #626a75; --line: #e2e5ea;
  --accent: #1f6feb; --accent-text: #ffffff; --danger: #c62828; --ok: #2e7d32; --warn: #b26a00;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1216; --surface: #171b21; --text: #e8eaed; --muted: #9aa3ad; --line: #2a3038; --accent: #4c8dff; --shadow: none; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h2.cat { margin: 1.5rem 0 .6rem; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--bg); padding: .1em .35em; border-radius: 4px; }
code.wrap, td.wrap { word-break: break-all; white-space: normal; }
pre.out { background: var(--bg); padding: .8rem; border-radius: 8px; overflow: auto; font-size: .85rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { font-size: 1.05rem; color: var(--muted); margin-top: 0; }
.meta { color: var(--muted); font-size: .82rem; }
.error { color: var(--danger); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.topbar nav a:hover { color: var(--accent); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); letter-spacing: -.01em; }
.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.breadcrumb { margin: -.5rem 0 1rem; color: var(--muted); font-size: .9rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1.2rem; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile-icon { font-size: 1.7rem; }
.tile-name { font-weight: 600; }
.tile-desc { color: var(--muted); font-size: .85rem; }

label { display: block; margin-bottom: .9rem; font-weight: 500; font-size: .92rem; }
input[type=text], input[type=password], select { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }
.row input, .row select { margin: 0; width: auto; flex: 1 1 200px; }
.btn { display: inline-block; padding: .6rem 1rem; font: inherit; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-block { width: 100%; }
.btn-small { padding: .35rem .7rem; font-size: .85rem; }
.ico { margin-right: .3rem; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
button.link.danger { color: var(--danger); }
form.inline { display: inline; margin: 0; }
.inline-edit { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.inline-edit input { width: 14rem; margin: 0; padding: .3rem .5rem; font-size: .9rem; }
.toggle-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .92rem; }

.list { list-style: none; margin: 0 0 .8rem; padding: 0; }
.list li { display: flex; gap: .6rem 1rem; align-items: center; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li > form:last-child { margin-left: auto; }
.list li.pending { background: color-mix(in srgb, var(--warn) 8%, transparent); border-radius: 8px; padding: .8rem; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table.small { font-size: .8rem; }
.table .row { margin: 0; }

.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; border: 1px solid; }
.flash-success { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.flash-error { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.flash-info { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.flash-warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }

/* Auth-Seiten */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.6rem; box-shadow: var(--shadow); }
.brand-block { text-align: center; margin-bottom: 1rem; font-size: 1.1rem; }
.divider { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .8rem; margin: 1.1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.code-display { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 2rem; letter-spacing: .1em; text-align: center; padding: 1rem; background: var(--bg); border-radius: 10px; margin: 1rem 0; }
.checklist { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.checklist li { padding: .35rem 0 .35rem 1.6rem; position: relative; }
.checklist li::before { position: absolute; left: 0; }
.checklist li.ok::before { content: "✔"; color: var(--ok); }
.checklist li.fail::before { content: "✖"; color: var(--danger); }
.checklist li.todo::before { content: "○"; color: var(--muted); }
