:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eef3fe;
  --danger-bg: #fdecec;
  --danger: #b42318;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1b1f27;
    --text: #e6e8ec;
    --muted: #9aa1ad;
    --border: #2b313c;
    --accent: #5b8def;
    --accent-hover: #7aa3f3;
    --accent-soft: #1f2a40;
    --danger-bg: #3a1d1d;
    --danger: #f6a5a0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

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

a { color: var(--accent); text-decoration: none; }

code {
  font: 0.9em ui-monospace, Consolas, monospace;
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.user { color: var(--muted); font-size: 14px; }

/* ---------- Layout ---------- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.section { margin-top: 28px; }
.section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  margin: 0 0 10px;
}
.count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 8px;
}

/* ---------- Liste ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.list li + li { border-top: 1px solid var(--border); }
.list a {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text);
}
.list a:hover, .list a:focus-visible { background: var(--accent-soft); outline: none; }
.icon { font-size: 20px; text-align: center; }
.name { font-weight: 500; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.action { color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; }

.empty {
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
}

.filter {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- Formulare ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.login { max-width: 380px; margin: 40px auto 0; }
.login h1 { margin: 0 0 16px; font-size: 22px; }
.login label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 14px; }
.login input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.muted { color: var(--muted); font-size: 14px; }

.btn {
  display: inline-block;
  width: 100%;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn-ghost {
  width: auto;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--accent-soft); }

.alert {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.code {
  font: 13px/1.4 ui-monospace, Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

/* ---------- Mobil ---------- */
@media (max-width: 600px) {
  .list a {
    grid-template-columns: 28px 1fr auto;
    grid-template-areas: "icon name action" "icon meta action";
    row-gap: 2px;
  }
  .icon { grid-area: icon; }
  .name { grid-area: name; }
  .meta { grid-area: meta; }
  .action { grid-area: action; }
  .user { display: none; }
  .login { margin-top: 16px; }
}
