:root {
  --bg: #0b111c;
  --bg-2: #111a29;
  --card: rgba(255, 255, 255, 0.045);
  --card-solid: #151f30;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2f8;
  --muted: #8b97ab;
  --accent: #7c6cff;
  --accent-2: #2dd4bf;
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.14);
  --bad: #fb7185;
  --bad-bg: rgba(251, 113, 133, 0.14);
  --radius: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124, 108, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(45, 212, 191, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent-2); }

.wrap { max-width: 760px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(110px + var(--safe-b)); }

/* ---------- Kopfzeile ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 0; }
.top .sub { color: var(--muted); font-size: 14px; font-weight: 500; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff; flex: none;
  background: linear-gradient(135deg, var(--c1, #7c6cff), var(--c2, #2dd4bf));
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

/* ---------- Hero: heutige Basis-Challenge ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 22px;
  background: linear-gradient(140deg, #2a2160 0%, #1b2a4a 55%, #123a44 100%);
  border: 1px solid rgba(255,255,255,.08); box-shadow: var(--shadow); margin-bottom: 22px;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
}
.hero-row { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; }
.hero .label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.65); }
.hero h2 { font-size: 21px; margin: 4px 0 4px; letter-spacing: -0.01em; }
.hero p { margin: 0; color: rgba(255,255,255,.72); font-size: 14px; }
.ring { width: 92px; height: 92px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.ring .num small { display: block; font-size: 11px; font-weight: 600; color: rgba(255,255,255,.6); text-align: center; margin-top: -2px; }

.cta {
  margin-top: 18px; width: 100%; padding: 15px 18px; border-radius: 16px; font-weight: 700; font-size: 16px;
  background: #fff; color: #1b1840; display: flex; align-items: center; justify-content: center; gap: 10px;
  position: relative; z-index: 1; transition: transform .12s ease, background .2s;
}
.cta:active { transform: scale(.98); }
.cta.done { background: var(--ok); color: #053321; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 6px 8px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: rgba(255,255,255,.1);
}
.chip.ok { background: rgba(52, 211, 153, .2); color: #a7f3d0; }
.chip.open { background: rgba(251, 113, 133, .18); color: #fecdd3; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Abschnitte ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; gap: 10px; }
.section-head h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.section-head .hint { color: var(--muted); font-size: 13px; }

/* ---------- Konto-Karten ---------- */
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.acc {
  text-align: left; border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--c1), var(--c2)); color: #fff; min-height: 168px;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.acc:active { transform: scale(.985); }
.acc::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(240px 140px at 110% -20%, rgba(255,255,255,.28), transparent 60%),
    radial-gradient(200px 160px at -20% 120%, rgba(0,0,0,.25), transparent 60%);
}
.acc > * { position: relative; }
.acc .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.acc .name { font-weight: 700; font-size: 16px; }
.acc .bal-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; font-weight: 600; margin-top: 14px; }
.acc .bal { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.acc .bal.neg { color: #ffe4e6; }
.acc .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pill {
  font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,.22); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pill.ok { background: rgba(6, 78, 59, .55); color: #a7f3d0; }
.pill.open { background: rgba(127, 29, 29, .5); color: #fecdd3; }
.pill.free { background: rgba(0,0,0,.25); color: rgba(255,255,255,.8); }
.chip-icon { font-size: 13px; }
.acc .chip-mark { width: 34px; height: 24px; border-radius: 6px; background: linear-gradient(135deg, #f8e3a1, #c9a548); opacity: .9; }

/* ---------- Wochenübersicht ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.week-nav .title { font-weight: 700; font-size: 15px; text-align: center; }
.week-nav .title small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.06);
  border: 1px solid var(--line); font-size: 16px;
}
.icon-btn:disabled { opacity: .35; }

.person-week { padding: 14px 0; border-top: 1px solid var(--line); }
.person-week:first-of-type { border-top: 0; padding-top: 4px; }
.pw-head { display: flex; align-items: center; gap: 10px; }
.pw-head .n { font-weight: 700; flex: 1; }
.status { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.open { background: var(--warn-bg); color: var(--warn); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.status.none { background: rgba(255,255,255,.06); color: var(--muted); }

.grid-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.dayc { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }
.daybox {
  height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid transparent;
}
.daybox.ok { background: var(--ok-bg); color: var(--ok); }
.daybox.miss { background: var(--bad-bg); color: var(--bad); }
.daybox.today { border-color: rgba(255,255,255,.35); }
.daybox.off { background: transparent; color: rgba(255,255,255,.18); }
button.daybox { width: 100%; }
button.daybox:disabled { cursor: default; }

.wc { margin-top: 12px; }
.wc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.wc-top .t { font-weight: 600; }
.wc-top .c { color: var(--muted); font-weight: 600; white-space: nowrap; }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.bar.full > i { background: linear-gradient(90deg, #10b981, #34d399); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

.alert {
  border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; font-size: 14px; line-height: 1.45;
  background: var(--warn-bg); color: #fde68a; border: 1px solid rgba(251,191,36,.25);
}
.alert.bad { background: var(--bad-bg); color: #fecdd3; border-color: rgba(251,113,133,.25); }
.alert.ok { background: var(--ok-bg); color: #a7f3d0; border-color: rgba(52,211,153,.25); }
.alert b { color: #fff; }

/* ---------- Meine Woche ---------- */
.mine { display: grid; gap: 12px; }
.mine .card h4 { margin: 0; font-size: 16px; }
.mine .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mine .del { color: var(--muted); font-size: 13px; padding: 6px 8px; border-radius: 8px; }
.mine .del:hover { color: var(--bad); }
.tag { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; padding: 14px 15px; border-radius: 14px; background: rgba(255,255,255,.05);
  border: 1px solid var(--line); outline: none; font-size: 16px; transition: border-color .15s, background .15s;
}
.input:focus { border-color: var(--accent); background: rgba(124,108,255,.08); }
.btn {
  padding: 14px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; background: var(--accent); color: #fff;
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; transition: transform .12s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.block { width: 100%; }
.btn.ghost { background: rgba(255,255,255,.07); color: var(--text); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.sm { padding: 9px 12px; font-size: 13px; border-radius: 11px; }
.seg { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.seg button {
  padding: 11px 0; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-weight: 700;
}
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 14px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.row-gap { display: flex; gap: 10px; }
.row-gap > * { flex: 1; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; }
.logo {
  width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 18px; display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 40px rgba(124,108,255,.45);
}
.login h1 { text-align: center; margin: 0 0 6px; font-size: 28px; letter-spacing: -0.02em; }
.login p.sub { text-align: center; color: var(--muted); margin: 0 0 28px; }
.error { color: var(--bad); font-size: 14px; min-height: 20px; margin: -4px 0 10px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); z-index: 20;
  display: flex; gap: 4px; padding: 6px; border-radius: 22px;
  background: rgba(20, 28, 44, .82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
.nav button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 14px; border-radius: 16px;
  font-size: 11px; font-weight: 600; color: var(--muted); min-width: 68px;
}
.nav button .ic { font-size: 19px; line-height: 1; }
.nav button.on { background: rgba(124,108,255,.18); color: #fff; }

/* ---------- Sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(4,8,15,.6); z-index: 40; animation: fade .2s ease; backdrop-filter: blur(3px); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh; overflow: auto;
  background: var(--card-solid); border-radius: 26px 26px 0 0; border-top: 1px solid var(--line);
  padding: 10px 18px calc(26px + var(--safe-b)); animation: up .25s cubic-bezier(.2,.8,.2,1);
  max-width: 640px; margin: 0 auto;
}
.sheet h2, .sheet-head { padding-right: 40px; }
.sheet-x { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.08); color: var(--muted); font-size: 14px; display: grid; place-items: center; z-index: 2; }
.sheet .grab { width: 42px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.18); margin: 4px auto 14px; }
.sheet h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.01em; }
.sheet .sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.sheet-head .big { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

.tx { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.tx:first-child { border-top: 0; }
.tx .note { font-weight: 600; font-size: 14px; }
.tx .when { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tx .amt { font-weight: 800; white-space: nowrap; }
.tx .amt.pos { color: var(--ok); }
.tx .amt.neg { color: var(--bad); }
.tx .x { color: var(--muted); padding: 4px 6px; margin-left: 4px; }

.menu-list { display: grid; gap: 8px; }
.menu-list button {
  text-align: left; padding: 15px 16px; border-radius: 14px; background: rgba(255,255,255,.05); font-weight: 600;
  display: flex; align-items: center; gap: 12px;
}

.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-row .n { flex: 1; font-weight: 600; }
.user-row .n small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 7px; background: rgba(124,108,255,.2); color: #c4b5fd; margin-left: 6px; }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: #fff; color: #111; padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); color: #fff; }

.skeleton { height: 160px; border-radius: 26px; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.08), rgba(255,255,255,.04)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

@media (min-width: 700px) {
  .top h1 { font-size: 30px; }
  .hero { padding: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

