:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1b1f27; --muted: #667085; --line: #e3e6ec;
  --accent: #2563eb; --accent-text: #ffffff; --danger: #c0392b; --warn-bg: #fff6e0; --warn-text: #6b4a00;
  --ok-bg: #e8f6ee; --ok-text: #14532d; --err-bg: #fde8e6; --err-text: #7a1c12; --shadow: 0 1px 2px rgba(16,24,40,.06);
  --tc: #64748b;
}
:root[data-theme="dark"] {
  --bg: #0f1218; --panel: #171b23; --text: #e6e9ef; --muted: #98a2b3; --line: #262c37;
  --accent: #60a5fa; --accent-text: #0b1220; --danger: #f08a7e; --warn-bg: #3a2f10; --warn-text: #f3d58a;
  --ok-bg: #12301f; --ok-text: #a6e3bd; --err-bg: #3b1a16; --err-text: #f6b2a9; --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --panel: #171b23; --text: #e6e9ef; --muted: #98a2b3; --line: #262c37;
    --accent: #60a5fa; --accent-text: #0b1220; --danger: #f08a7e; --warn-bg: #3a2f10; --warn-text: #f3d58a;
    --ok-bg: #12301f; --ok-text: #a6e3bd; --err-bg: #3b1a16; --err-text: #f6b2a9; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
code { background: var(--line); padding: .05em .35em; border-radius: 4px; }
.grow { flex: 1; min-width: 0; }
.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }

/* Kopfzeile */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem;
  padding-top: calc(.5rem + env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.search { flex: 1; max-width: 520px; margin: 0 .25rem; }
.search input { width: 100%; padding: .5rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.icon-btn { border: 0; background: transparent; color: var(--text); font-size: 1.25rem; width: 2.5rem; height: 2.5rem; border-radius: 10px; cursor: pointer; }
.icon-btn:hover { background: var(--line); }
.icon-btn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
.shell { display: flex; align-items: flex-start; max-width: 1200px; margin: 0 auto; }
.side { width: 260px; flex: none; padding: 1rem .75rem; position: sticky; top: 3.6rem; max-height: calc(100vh - 3.6rem); overflow: auto; }
.content { flex: 1; min-width: 0; padding: 1rem 1rem 4rem; }
.nav-title { margin: 1.1rem .6rem .3rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border-radius: 10px; color: var(--text); }
.nav-item:hover { background: var(--line); text-decoration: none; }
.nav-item.on { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.nav-item.off { opacity: .55; }
.nav-item .count { margin-left: auto; font-size: .78rem; color: var(--muted); }
.dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--tc); display: inline-block; flex: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .side { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; max-height: none; width: 82%; max-width: 320px; background: var(--panel);
    transform: translateX(-102%); transition: transform .2s; padding-top: calc(1rem + env(safe-area-inset-top)); visibility: hidden; }
  body.menu-open .side { transform: none; visibility: visible; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
}
@media (min-width: 901px) { #menu-btn { display: none; } }

/* Liste */
.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: .75rem; }
.list-head h1 { margin: 0; flex: 1 1 auto; }
.tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pill { display: inline-block; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; }
.pill.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pill:hover { text-decoration: none; }
select, input[type=text], input[type=url], input[type=number], input[type=password], textarea {
  width: 100%; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
.tools select { width: auto; padding: .3rem .6rem; border-radius: 999px; font-size: .88rem; }
textarea { resize: vertical; }
.cards { display: grid; gap: .6rem; }
.card { display: flex; gap: .9rem; padding: .85rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; color: var(--text); box-shadow: var(--shadow); }
.card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card.read { opacity: .62; }
.card-main { flex: 1; min-width: 0; }
.card h2 { font-size: 1.05rem; line-height: 1.3; margin: .15rem 0 .3rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { width: 104px; height: 78px; object-fit: cover; border-radius: 10px; flex: none; background: var(--line); align-self: center; }
@media (max-width: 520px) { .thumb { width: 84px; height: 64px; } }
.meta { font-size: .8rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.chip { font-size: .72rem; padding: .1rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--tc) 18%, transparent); color: var(--tc); font-weight: 600; }
:root[data-theme="dark"] .chip { color: color-mix(in srgb, var(--tc) 60%, #fff); }
.more { text-align: center; margin-top: 1rem; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

/* Buttons & Formulare */
.btn { display: inline-block; padding: .5rem .95rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; }
.btn:hover { text-decoration: none; background: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.form { display: grid; gap: .8rem; }
.form label { display: grid; gap: .25rem; font-size: .9rem; font-weight: 600; }
.form label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1; min-width: 0; }
.row > .btn { flex: none; }
input[type=color] { width: 3rem; height: 2.4rem; padding: .1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin-bottom: 1rem; }
details.panel > summary { cursor: pointer; font-weight: 600; list-style-position: inside; }
details.panel[open] > summary { margin-bottom: .8rem; }
details.panel .panel { border: 0; padding: 0; margin: 0; }
.hint, .sub { color: var(--muted); font-size: .88rem; }
.sub { word-break: break-all; }
.err { color: var(--danger); }
.rows { display: grid; gap: .6rem; }
.rowcard { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; padding: .8rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.rowcard.off { opacity: .6; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { font-size: .7rem; padding: .1rem .5rem; border-radius: 999px; background: var(--line); color: var(--muted); margin-left: .25rem; vertical-align: middle; }
.probe-out { border: 1px dashed var(--line); border-radius: 10px; padding: .6rem .8rem; font-size: .88rem; }
.probe-out ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.flash { padding: .65rem .9rem; border-radius: 10px; margin-bottom: .9rem; background: var(--ok-bg); color: var(--ok-text); }
.flash.err { background: var(--err-bg); color: var(--err-text); }
.flash.warn { background: var(--warn-bg); color: var(--warn-text); }

/* Lesemodus */
.reader { max-width: 720px; margin: 0 auto; }
.reader-nav { display: flex; gap: .4rem; margin-bottom: 1rem; }
.reader-nav.bottom { margin: 1.4rem 0 0; }
.reader h1 { font-size: 1.85rem; line-height: 1.2; margin: .3rem 0 .6rem; }
.hero { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; margin: 1rem 0; background: var(--line); }
.prose { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-size: 1.14rem; line-height: 1.72; overflow-wrap: anywhere; }
.prose p { margin: 0 0 1.1rem; }
.prose h2, .prose h3, .prose h4 { font-family: system-ui, sans-serif; line-height: 1.3; margin: 1.8rem 0 .6rem; }
.prose h2 { font-size: 1.3rem; } .prose h3 { font-size: 1.15rem; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 1rem auto; }
.prose figure { margin: 1.2rem 0; }
.prose figcaption { font-family: system-ui, sans-serif; font-size: .82rem; color: var(--muted); text-align: center; }
.prose blockquote { margin: 1.2rem 0; padding: .1rem 1rem; border-left: 3px solid var(--accent); color: var(--muted); }
.prose pre { overflow: auto; background: var(--line); padding: .8rem; border-radius: 8px; font-size: .9rem; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; font-size: .95rem; }
.prose td, .prose th { border: 1px solid var(--line); padding: .35rem .6rem; }
.reader-foot { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Anmeldung */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.authbox { width: 100%; max-width: 380px; }
