/* Dunkel ist Standard; "System" folgt prefers-color-scheme, "Hell"/"Dunkel" erzwingt per data-theme am <html> */
:root {
  --bg: #0f1020; --bg2: #171936; --card: #1e2147; --card2: #272b5a; --text: #eef0ff; --muted: #9096c4;
  --accent: #7c5cff; --accent2: #22d3ee; --ok: #34d399; --warn: #fbbf24; --bad: #fb7185; --radius: 18px;
  --glass: #ffffff14; --glass2: #ffffff18; --line: #ffffff14; --line2: #ffffff22; --input: #0b0c20;
  --shadow: #0005; --note: #0b0c2088; --scrim: #000a; --toast: #000d; --glow1: #2a2470; --glow2: #0b4a63; --track: #ffffff18;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f4ff; --bg2: #ffffff; --card: #ffffff; --card2: #eceeff; --text: #1b1d3a; --muted: #5b6090;
  --accent: #6b4bf0; --accent2: #0891b2; --ok: #059669; --warn: #b45309; --bad: #e11d48;
  --glass: #1b1d3a0d; --glass2: #1b1d3a14; --line: #1b1d3a1f; --line2: #1b1d3a33; --input: #ffffff;
  --shadow: #3b3f7a22; --note: #eef0ff; --scrim: #1b1d3a88; --toast: #1b1d3aee; --glow1: #d9d4ff; --glow2: #cdeffa; --track: #1b1d3a1a;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #f3f4ff; --bg2: #ffffff; --card: #ffffff; --card2: #eceeff; --text: #1b1d3a; --muted: #5b6090;
    --accent: #6b4bf0; --accent2: #0891b2; --ok: #059669; --warn: #b45309; --bad: #e11d48;
    --glass: #1b1d3a0d; --glass2: #1b1d3a14; --line: #1b1d3a1f; --line2: #1b1d3a33; --input: #ffffff;
    --shadow: #3b3f7a22; --note: #eef0ff; --scrim: #1b1d3a88; --toast: #1b1d3aee; --glow1: #d9d4ff; --glow2: #cdeffa; --track: #1b1d3a1a;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, var(--glow1) 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, var(--glow2) 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
}
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--accent2); }
.wrap { max-width: 860px; margin: 0 auto; padding: 18px 16px 80px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top .who { color: var(--muted); font-size: .9rem; }
.logo { font-weight: 800; font-size: 1.3rem; background: linear-gradient(90deg, var(--accent2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card { background: linear-gradient(160deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 8px 24px var(--shadow); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap-r { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .85rem; }
button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--accent), #5b8cff); transition: transform .08s, filter .15s;
}
button:hover { filter: brightness(1.12); } button:active { transform: scale(.97); }
button.ghost { background: var(--glass); color: var(--text); }
button.danger { background: linear-gradient(135deg, #e11d48, #fb7185); color: #fff; }
button.ok { background: linear-gradient(135deg, #10b981, #34d399); color: #043; }
button.sm { padding: 6px 10px; font-size: .85rem; border-radius: 9px; }
button.link { background: none; color: var(--accent2); padding: 4px; font-weight: 500; text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--input); border: 1px solid var(--line2); border-radius: 12px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); border-color: transparent; }
input[type=checkbox] { width: auto; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; }
.tabs button { background: var(--glass); color: var(--muted); white-space: nowrap; }
.tabs button.on { background: linear-gradient(135deg, var(--accent), #5b8cff); color: #fff; }
.badge { display: inline-block; font-size: .75rem; padding: 2px 9px; border-radius: 99px; background: var(--glass2); color: var(--muted); margin-right: 4px; }
.badge.ok { background: #34d39922; color: var(--ok); } .badge.warn { background: #fbbf2422; color: var(--warn); } .badge.bad { background: #fb718522; color: var(--bad); }
.task { display: flex; gap: 14px; align-items: center; }
.check {
  width: 46px; height: 46px; flex: none; border-radius: 50%; border: 2px solid var(--line2); display: grid; place-items: center; font-size: 1.4rem; cursor: pointer; background: transparent; color: var(--text); padding: 0;
}
.task.done .check { background: linear-gradient(135deg, #10b981, #34d399); border-color: transparent; color: #fff; }
.task.done .title { text-decoration: line-through; opacity: .7; }
.title { font-weight: 650; }
.future { opacity: .5; filter: grayscale(.6); }
.future .check { cursor: default; border-style: dashed; }
.hero { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.ring { --p: 0; width: 92px; height: 92px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--track) 0); }
.ring span { width: 74px; height: 74px; border-radius: 50%; background: var(--bg2); display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; }
.thumb { max-width: 160px; max-height: 120px; border-radius: 10px; margin-top: 8px; display: block; cursor: zoom-in; }
.note { background: var(--note); border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-size: .92rem; white-space: pre-wrap; }
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 14px; z-index: 10; overflow: auto; }
.modal { background: var(--bg2); border: 1px solid var(--line2); border-radius: 20px; padding: 20px; width: 100%; max-width: 520px; max-height: 94vh; overflow: auto; box-shadow: 0 20px 60px var(--shadow); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 99px; background: var(--glass); cursor: pointer; user-select: none; font-size: .9rem; }
.chip.on { background: var(--accent); color: #fff; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; background: var(--glass); color: var(--text); }
.seg button.on { background: linear-gradient(135deg, var(--accent), #5b8cff); color: #fff; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0 4px; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: #000d; display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 94vw; max-height: 82vh; border-radius: 12px; box-shadow: 0 20px 60px #000a; }
.lightbox .x { position: fixed; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 1.2rem; background: #ffffff26; color: #fff; }
.lightbox .lb-actions { position: fixed; bottom: 18px; left: 0; right: 0; display: flex; justify-content: center; }
.handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; padding: 8px 6px; font-size: 1.3rem; line-height: 1; color: var(--muted); border-radius: 8px; }
.handle:hover { background: var(--glass); }
.card.dragging { opacity: .9; outline: 2px solid var(--accent); box-shadow: 0 14px 34px var(--shadow); }
/* Admin-Kopfzeile: mobil Titel + Aktionen oben, Reiter darunter; Desktop alles in einer Zeile (Titel links, Reiter, Aktionen rechts) */
.hdr { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px 0; }
.hdr-title { order: 1; }
.hdr-actions { order: 2; margin-left: auto; }
.hdr .tabs { order: 3; width: 100%; margin: 0; }
.hdr + .wrap { padding-top: 14px; }
@media (min-width: 1000px) {
  .hdr { flex-wrap: nowrap; padding: 12px 24px 0; }
  .hdr .tabs { order: 2; width: auto; flex: 1; min-width: 0; margin: 0 0 0 8px; padding-bottom: 0; }
  .hdr-actions { order: 3; margin-left: 0; }
  .hdr-title { white-space: nowrap; }
  .hdr + .wrap { padding-top: 10px; }
}
.savebar { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; margin-top: 18px; z-index: 4; }
.savebar button { padding: 12px 22px; box-shadow: 0 8px 24px var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.center { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.corner { position: fixed; top: 12px; right: 12px; z-index: 5; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 30; }
#toast div { background: var(--toast); color: #fff; border: 1px solid #ffffff33; padding: 10px 16px; border-radius: 12px; }
#toast div.err { border-color: var(--bad); }
.confetti { position: fixed; top: -10px; font-size: 1.6rem; pointer-events: none; z-index: 40; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .2; } }
.bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--ok)); }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .hero { flex-direction: column; text-align: center; } }

/* Speichern-Button auf breiten Bildschirmen weit rechts außerhalb der Inhaltsspalte (nach den Basisregeln, damit er sie überschreibt) */
@media (min-width: 1200px) { .savebar { position: fixed; right: 28px; bottom: 28px; margin: 0; } }
