:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #16202b;
  --muted: #5d6b7a;
  --line: #dde3ea;
  --brand: #0d3b5e;
  --accent: #0a7bb5;
  --accent-ink: #ffffff;
  --ok: #1d7a46;   --ok-bg: #e3f4ea;
  --warn: #8a5a00; --warn-bg: #fff3d6;
  --bad: #a62b2b;  --bad-bg: #fbe4e4;
  --info-bg: #e5f1fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151c; --surface: #17202a; --ink: #e6edf3; --muted: #9aa8b6; --line: #2a3644;
    --brand: #0b2236; --accent: #38a6dd; --accent-ink: #06121c;
    --ok: #6fd39b; --ok-bg: #133423; --warn: #f2c35b; --warn-bg: #3a2c0c; --bad: #f08a8a; --bad-bg: #3d1717;
    --info-bg: #13283a; --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 1.6rem 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
p.lead { color: var(--muted); margin: 0 0 1.4rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Kopfzeile */
.topbar { background: var(--brand); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--brand); display: grid; place-items: center; font-weight: 800; }
.brand-sub { opacity: .75; font-weight: 400; }
.nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nav a, .nav .linklike { color: #fff; text-decoration: none; opacity: .9; font: inherit; }
.nav a:hover, .nav .linklike:hover { opacity: 1; text-decoration: underline; }
form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); font: inherit; }

/* Karten & Raster */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: .9rem; }
.stat.warn .num { color: var(--warn); }
.stat.bad .num { color: var(--bad); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.empty { color: var(--muted); padding: 10px 0; margin: 0; }

@media (max-width: 720px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; margin-bottom: 12px; }
  table.stack td { border: 0; padding: 6px 0; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
}

/* Status */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .84rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-neutral { background: var(--line); color: var(--muted); }

/* Lizenzschlüssel */
.key { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key code { font: .9rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; word-break: break-all; }

/* Formulare */
label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 4px; }
label .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], textarea, select, input[type=file] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
.row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.hint { color: var(--muted); font-size: .86rem; margin: 4px 0 0; }

.btn { display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad-bg); }
.btn-sm { padding: 4px 10px; font-size: .86rem; font-weight: 500; }

/* Anmeldung */
.auth { max-width: 420px; margin: 48px auto; }
.auth h1 { margin-top: 0; }

/* Meldungen */
.flash { border-radius: var(--radius); padding: 12px 16px; margin: 18px 0 0; border: 1px solid var(--line); word-break: break-word; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.flash-error { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.flash-info { background: var(--info-bg); }
.flash-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

.footer { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .86rem; padding-top: 24px; padding-bottom: 32px; }
.footer a { color: var(--muted); }
.copy-link { display: block; margin-top: 6px; font-family: ui-monospace, monospace; font-size: .82rem; user-select: all; }
.auth-wide { max-width: 560px; }
.mt { margin-top: 24px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form, .row-actions a { margin-left: 4px; }
@media (max-width: 720px) { .row-actions { text-align: left; white-space: normal; } .row-actions form, .row-actions a { margin: 0 4px 4px 0; } }
