:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #5b6470;
  --line: #dde1e6;
  --accent: #0b5fd6;
  --on-accent: #ffffff;
  --allow: #13703a;
  --allow-bg: #e4f4ea;
  --block: #b3261e;
  --block-bg: #fbe7e5;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --info: #1f4f8f;
  --info-bg: #e5eefb;
  --radius: 10px;
  font-size: 15px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --text: #e7eaee;
    --muted: #9aa3ae;
    --line: #2d333b;
    --accent: #5b9dff;
    --on-accent: #0b1220;
    --allow: #6fd394;
    --allow-bg: #15301f;
    --block: #ff8a80;
    --block-bg: #3a1a18;
    --warn: #f2c25b;
    --warn-bg: #332712;
    --info: #9cc2ff;
    --info-bg: #17263d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }

a { color: var(--accent); }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; }

h1 { font-size: 1.6rem; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 32px 0 10px; }
h3 { font-size: 1rem; margin: 28px 0 8px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 56px; }
.brand { font-weight: 650; color: var(--text); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; }
nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
nav a, nav .link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border-radius: 8px; color: var(--text); text-decoration: none;
}
nav a[aria-current="page"] { background: var(--bg); font-weight: 600; }
nav a:hover, nav .link:hover { background: var(--bg); }

.head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.head h1 { margin: 0; }

.narrow { max-width: 440px; }
section.narrow { margin: 40px auto; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: 0.93rem; }
/* Feld mit Beschriftung: Hinweis in derselben Zeile, Eingabe immer unten bündig. */
.fld { justify-content: flex-end; min-width: 0; }
.fld .lbl { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.fld .opt { font-size: 0.82rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 450; min-height: 44px; }
.opt { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

input, select, button, .button {
  font: inherit; color: var(--text); min-height: 44px; border-radius: 8px;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select {
  width: 100%; height: 44px; padding: 0 12px; background-color: var(--surface); border: 1px solid var(--line);
  line-height: 1.2;
}
/* Safari zeichnet Auswahllisten sonst niedriger als Eingabefelder. */
select {
  -webkit-appearance: none; appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23808893' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="file"] { min-height: 44px; padding: 8px 0; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, .scroll:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

button, .button {
  display: inline-flex; align-items: center; justify-content: center; padding: 0 16px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--block); }
button.link { background: none; border: 0; padding: 0 12px; }
form.inline { display: inline; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px 12px; margin: 0; }
legend { font-weight: 600; padding: 0 4px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.actions { display: flex; gap: 16px; align-items: center; margin-top: 16px; }

.query { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0 8px; }
.query details { margin-top: 14px; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 550; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details:not(.wd) > summary::before {
  content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform 0.15s ease; margin: 0 4px 0 2px;
}
details[open]:not(.wd) > summary::before { transform: rotate(45deg); }
details .grid { margin-top: 6px; }

.picker { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; max-width: 100%; }
.head .picker { flex: 0 1 640px; justify-content: flex-end; }
.picker label { font-size: 0.85rem; flex: 1 1 220px; min-width: 0; }
.picker select { min-width: 0; }
@media (max-width: 640px) {
  .head { flex-direction: column; align-items: stretch; }
  .head .picker { flex: none; justify-content: flex-start; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }

.box { border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; border: 1px solid transparent; }
.box ul { margin: 6px 0 0; padding-left: 20px; }
.box.ok { background: var(--allow-bg); color: var(--allow); }
.box.error { background: var(--block-bg); color: var(--block); }
.box.warn { background: var(--warn-bg); color: var(--warn); }
.box.info { background: var(--info-bg); color: var(--info); }

.muted { color: var(--muted); }
.small { font-size: 0.86rem; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.result { margin-top: 24px; }
.verdict { display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-radius: var(--radius); }
.verdict h2 { margin: 0; font-size: 1.4rem; }
.verdict p { margin: 2px 0 0; }
.verdict .icon {
  flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 700; background: var(--surface);
}
.verdict.allow { background: var(--allow-bg); color: var(--allow); }
.verdict.block { background: var(--block-bg); color: var(--block); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); }
.verdict.info { background: var(--info-bg); color: var(--info); }

.path { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin: 14px 0; }
.path .arrow { align-self: center; font-size: 1.4rem; color: var(--muted); }
.loc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.loc .k { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.loc .ip { font: 600 1.05rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.loc .zone { font-weight: 600; }
.loc .why { font-size: 0.86rem; color: var(--muted); }
@media (max-width: 640px) {
  .path { grid-template-columns: 1fr; }
  .path .arrow { transform: rotate(90deg); justify-self: center; }
}

.scroll { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; color: var(--muted); font-weight: 600; background: var(--bg); }
tr:last-child td { border-bottom: 0; }
tr.off td { color: var(--muted); }
td.row { flex-wrap: nowrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; border: 1px solid currentColor; }
.badge.sm { font-weight: 500; }
.badge.allow { color: var(--allow); background: var(--allow-bg); }
.badge.block { color: var(--block); background: var(--block-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.muted { color: var(--muted); background: var(--bg); }
.tag { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }

.trace { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; margin-bottom: 8px; }
.trace > summary { gap: 8px; flex-wrap: wrap; }
.steps { list-style: none; margin: 0 0 12px; padding: 0; }
.steps > li { border-top: 1px solid var(--line); padding: 10px 0; }
.steps > li.match { border-left: 4px solid var(--allow); padding-left: 10px; }
.steps > li.unknown { border-left: 4px solid var(--warn); padding-left: 10px; }
.steps .row .name { font-weight: 600; }
.steps ul.why { margin: 4px 0 0; padding-left: 18px; font-size: 0.88rem; }
.help p { margin: 6px 0; }
.file input { padding: 8px; }

/* Geführte Einrichtung */
.wizard { list-style: none; margin: 20px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wstep { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.wstep.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.wstep.todo { background: transparent; border-style: dashed; }
.whead { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 60px; flex-wrap: wrap; }
.wstep details > summary.whead::before { display: none; }
.wnum {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 0.9rem; background: var(--accent); color: var(--on-accent);
}
.wnum.ok { background: var(--allow); color: var(--surface); }
.todo .wnum { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.wtitle { font-weight: 650; }
.todo .wtitle { color: var(--muted); }
.wsum { color: var(--muted); font-weight: 400; font-size: 0.9rem; flex: 1 1 200px; }
.wedit { color: var(--accent); font-weight: 500; font-size: 0.9rem; }
details[open] > summary .wedit { visibility: hidden; }
.wbody { padding: 4px 16px 16px 58px; }
.wbody .actions { margin-top: 4px; }
.wbody form + .inline-after { margin-top: 4px; }
.choice { min-height: 44px; }
.choice span .opt { margin-left: 4px; }
.row.end { justify-content: flex-end; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; margin-bottom: 10px; }
.panel[open] { padding-bottom: 14px; }
@media (max-width: 640px) { .wbody { padding-left: 16px; } }

/* Abfrage: Umschalter und Gruppen */
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.qhead p { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--bg); }
.seg a {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; border-radius: 7px;
  color: var(--muted); text-decoration: none; font-weight: 550;
}
.seg a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.group { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 16px; }
.group legend { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.gnum {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.78rem;
  background: var(--accent); color: var(--on-accent);
}
.group .check { min-height: 44px; }
