:root {
  --bg: #f4f6fa; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --accent: #2563eb; --accent-soft: #dbeafe; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --card: #131c2e; --text: #e2e8f0; --muted: #94a3b8; --line: #23304a;
    --accent: #60a5fa; --accent-soft: #1e3a5f; --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand-sub { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase;
  line-height: 1; padding-left: .24em; }
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav a { padding: 7px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
nav a.on { background: var(--accent-soft); color: var(--accent); }
.me { display: flex; align-items: center; gap: 10px; }
select, input, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; }
input, textarea { width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 26px 0 10px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.hint { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.center { max-width: 460px; margin: 40px auto; }
.center .card { padding: 24px; }
.loading { margin: 60px auto; width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 10px; padding: 8px 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.red { background: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.big { width: 100%; padding: 12px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { border: none; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: inline-flex; }
.iconbtn:hover { background: var(--bg); color: var(--text); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: #fef3c7; color: #92400e; } .badge.bad { background: #fee2e2; color: #991b1b; }
.badge.ok { background: #dcfce7; color: #166534; } .badge.grey { background: var(--bg); color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

/* Startseite: Kacheln */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; text-align: center; color: var(--text); text-decoration: none; transition: transform .1s; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; overflow: hidden;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 20px; }
.tile .ico img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.tile b { font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.tile small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tile .more { position: absolute; top: 4px; right: 4px; }
.tile .warnmark { position: absolute; top: 8px; left: 8px; }
.menu { position: fixed; z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 6px; min-width: 210px; }
.menu button { display: flex; width: 100%; gap: 8px; align-items: center; border: none; background: none; color: var(--text);
  font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--bg); }
.menu .code { margin-left: auto; font-family: ui-monospace, Consolas, monospace; color: var(--accent); }

/* Formulare */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.form label small { font-weight: 400; }
.two { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.pw { display: flex; gap: 6px; }
.pw input { font-family: ui-monospace, Consolas, monospace; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter > div { height: 100%; width: 0; transition: width .2s; }
.icopick { display: flex; align-items: center; gap: 10px; }
.icopick .ico { width: 40px; height: 40px; border-radius: 10px; overflow: hidden; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.icopick .ico img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

dialog { border: none; border-radius: 16px; padding: 0; background: var(--card); color: var(--text); width: min(560px, calc(100vw - 24px));
  box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(15,23,42,.5); }
dialog > div { padding: 20px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.recovery { font: 600 20px/1.6 ui-monospace, Consolas, monospace; letter-spacing: .06em; text-align: center; padding: 14px;
  border: 2px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); user-select: all; word-break: break-all; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 12px; }
.steps li { counter-increment: s; padding-left: 30px; position: relative; margin-bottom: 8px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
.scroll { overflow-x: auto; }
.factbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); padding: 0; overflow: hidden; margin-bottom: 14px; }
.factbox > div { padding: 12px 16px; border-right: 1px solid var(--line); }
.factbox > div:last-child { border-right: none; }
.factbox span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.factbox b { font-size: 22px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px); background: #0f172a; color: #fff;
  padding: 10px 16px; border-radius: 10px; transition: transform .2s; z-index: 30; max-width: calc(100vw - 32px); }
#toast.show { transform: translateX(-50%) translateY(0); }

@media print {
  .top, .noprint, #toast { display: none !important; }
  body, main { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #999; }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; gap: 10px; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .two { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
  .tile .ico { width: 42px; height: 42px; }
  .hide-sm { display: none; }
}
