:root {
  --bg: #F4F3EF; --surface: #FCFCFA; --ink: #0E1A2B; --muted: #56627A; --line: #D5DAE3; --soft: #E4E8EE;
  --strong: #0E1A2B; --strong-ink: #F4F3EF; --strong-muted: #B9C4D6; --strong-soft: #17283F; --strong-line: #2C3E5A;
  --side: #0E1A2B; --warn: #9A4A1C; --warn-bg: #F6E7DD; --ok: #2F6B4F;
  --display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, sans-serif;
  --r: 14px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0B1422; --surface: #13213A; --ink: #E8ECF3; --muted: #9AA8BE; --line: #24344F; --soft: #1B2A44;
  --strong: #E8ECF3; --strong-ink: #0B1422; --strong-muted: #3A4A63; --strong-soft: #D5DCE8; --strong-line: #B9C4D6;
  --side: #08101C; --warn: #F0A27A; --warn-bg: #3A2418; --ok: #8FD1AE;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { transition: background .4s, color .4s; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #5B8DEF; outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
h2 { font-size: 19px; font-weight: 700; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.warn { color: var(--warn); }
.hidden { display: none !important; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.side { width: 264px; flex: none; background: var(--side); color: #E8ECF3; padding: 22px 14px 28px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: .18em; padding: 0 10px; }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side .ey { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9FAFC6; padding: 0 10px 4px; }
.side a { display: flex; justify-content: space-between; align-items: center; min-height: 34px; padding: 0 10px; border-radius: 8px; font-size: 14px; color: #D7DEEA; }
.side a:hover { background: #17283F; color: #fff; }
.side a.on { background: #23385A; color: #fff; }
.side a.sub { padding-left: 24px; font-size: 13px; }
.side a small { font-size: 12px; color: #9FAFC6; }
.side .me { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 13px; color: #D7DEEA; }
.avatar { width: 26px; height: 26px; border-radius: 13px; background: #B9C4D6; color: #0E1A2B; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.main { flex: 1; min-width: 0; padding: 32px 44px 60px; }
.page { max-width: 1040px; display: flex; flex-direction: column; gap: 22px; }
.topbar { display: none; }
.bottomnav { display: none; }

@media (max-width: 899px) {
  .side { display: none; }
  .main { padding: 14px 18px calc(110px + env(safe-area-inset-bottom)); }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 18px 0; }
  .topbar .logo { font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: .18em; }
  h1 { font-size: 30px; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; align-items: center; padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 56px; min-height: 48px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: none; border: 0; }
  .bottomnav a.on { color: var(--ink); }
  .bottomnav .plus { width: 54px; height: 54px; border-radius: 27px; background: var(--strong); color: var(--strong-ink); margin-top: -22px; box-shadow: 0 6px 18px rgba(14,26,43,.25); }
}

/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card.dark { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); }
.card.dark .muted, .card.dark .eyebrow { color: var(--strong-muted); }
[data-theme="dark"] .card.dark .muted, [data-theme="dark"] .card.dark .eyebrow { color: #3A4A63; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 6px; min-height: 108px; transition: transform .15s, border-color .15s; }
.tile:hover { border-color: var(--muted); transform: translateY(-1px); }
.tile .nm { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.tile .mt { font-size: 12.5px; color: var(--muted); }
.tile .ct { margin-top: auto; font-size: 12px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--warn); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; }
.chip.on { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); }
.seg { display: inline-flex; background: var(--soft); border-radius: 20px; padding: 3px; gap: 2px; }
.seg a, .seg button { min-height: 32px; padding: 0 14px; border-radius: 16px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; border: 0; background: transparent; }
.seg .on { background: var(--strong); color: var(--strong-ink); }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--soft); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.item .t { font-size: 14.5px; }
.item .s { font-size: 12.5px; color: var(--muted); }
.item.done .t { text-decoration: line-through; color: var(--muted); }
.item .right { text-align: right; font-size: 13px; white-space: nowrap; }
.check { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--strong); cursor: pointer; }
.date { flex: none; width: 50px; font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.15; }
.date small { display: block; font-family: var(--body); font-weight: 600; font-size: 11px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.alert { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-bg); color: var(--warn); border-radius: var(--r); padding: 14px 16px; font-size: 14px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 6px 0; }

.add { display: flex; gap: 8px; }
.add input, .add select { min-height: 42px; }
input[type=text], input[type=search], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; font-size: 14.5px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--muted); }
textarea { min-height: 110px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.inline { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 40px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.search input { border: 0; padding: 12px 0; background: transparent; }

/* Hero auf „Heute“ */
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero h1 { font-size: 44px; }
@media (max-width: 899px) { .hero h1 { font-size: 34px; } }

/* Dialog */
.backdrop { position: fixed; inset: 0; background: rgba(8,16,28,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .backdrop { align-items: center; } }
.dialog { background: var(--bg); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 640px) { .dialog { border-radius: 18px; } }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.dialog .actions .left { margin-right: auto; }
.sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sheet button { min-height: 72px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 12px 14px; text-align: left; }
.sheet button span { font-weight: 500; font-size: 12px; color: var(--muted); }

/* Anmeldung */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: #0E1A2B; color: #F4F3EF; }
.login .box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login .logo { font-family: var(--display); font-weight: 800; font-size: 40px; letter-spacing: .2em; }
.login .who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.login .who button { min-height: 72px; border-radius: 14px; border: 1px solid #2C3E5A; background: #17283F; color: #F4F3EF; font-family: var(--display); font-size: 20px; font-weight: 700; }
.login .who button.on { background: #F4F3EF; color: #0E1A2B; }
.login input { background: #17283F; border-color: #2C3E5A; color: #F4F3EF; }
.login .note { font-size: 12.5px; color: #B9C4D6; }
.login .err { color: #F0A27A; font-size: 13px; min-height: 18px; }

#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); background: var(--strong); color: var(--strong-ink); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; }
#toast.show { opacity: 1; transform: translateX(-50%); }
