/* Privat Hub – Thum-CI (Graphit/Kupfer/Stein) + Violett-Akzent */
@font-face { font-family: "Chakra Petch"; src: url("/fonts/chakra-petch-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #14171C;
  --panel: #1B1F26;
  --panel-2: #232833;
  --line: #2E3542;
  --text: #E8E6E1;
  --muted: #8B93A3;
  --violet: #A48FD4;
  --violet-dim: #7E6BAA;
  --copper: #C97F3D;
  --copper-hi: #E0A86C;
  --green: #7CB07C;
  --red: #D47C6C;
  --amber: #E3B341;
  --blue: #5BA8D4;
  --push: #E0806C;
  --pull: #5BA8D4;
  --run: #93B86B;
  --stone: #B8B2A7;
  --head: "Chakra Petch", "Avenir Next Condensed", system-ui, sans-serif;
  --body: "Inter", -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.45; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea {
  font-family: var(--body); font-size: 16px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); }

/* ---- Login ---- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 20%, #1D2230 0%, var(--bg) 70%); padding: 20px; }
.login-box { width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.login-logo { width: 72px; height: 72px; margin: 0 auto 4px; border-radius: 20px; background: linear-gradient(135deg, var(--violet), var(--violet-dim)); display: flex; align-items: center; justify-content: center; font-family: var(--head); font-size: 38px; font-weight: 600; color: #14171C; }
.login h1 { font-family: var(--head); font-size: 26px; letter-spacing: 1px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.login input { text-align: center; }
.btn-primary { background: var(--violet); color: #14171C; font-weight: 600; border-radius: 10px; padding: 11px; font-size: 15px; }
.btn-primary:active { opacity: .85; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---- Layout ---- */
.app { display: flex; flex-direction: column; height: 100dvh; }
#topbar { display: flex; align-items: baseline; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-title { font-family: var(--head); font-size: 20px; letter-spacing: .5px; }
.topbar-date { color: var(--muted); font-size: 12.5px; }
#views { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(86px + env(safe-area-inset-bottom)); }
#tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: rgba(27,31,38,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; padding: 8px 2px 7px; font-size: 10.5px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tab-ico { font-size: 19px; filter: grayscale(1) opacity(.55); }
.tab.active { color: var(--violet); }
.tab.active .tab-ico { filter: none; }
#fab { position: fixed; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%; background: var(--violet); color: #14171C; font-size: 30px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.45); z-index: 5; }
#fab:active { transform: scale(.94); }

/* ---- Karten & Listen ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; margin-bottom: 12px; }
.card h2 { font-family: var(--head); font-size: 13.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; display: flex; justify-content: space-between; align-items: center; }
.card h2 .h2-accent { color: var(--violet); }
.empty { color: var(--muted); font-size: 13.5px; padding: 4px 0; }
.item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: none; }
.chk { width: 23px; height: 23px; min-width: 23px; border: 2px solid var(--muted); border-radius: 7px; margin-top: 1px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: transparent; }
.item.done .chk { background: var(--green); border-color: var(--green); color: #14171C; }
.item.done .item-text { text-decoration: line-through; color: var(--muted); }
.item-text { flex: 1; min-width: 0; overflow-wrap: break-word; white-space: pre-line; }
.item-sub { font-size: 12px; color: var(--muted); }
.prio-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; }
.prio-hoch { background: var(--red); } .prio-mittel { background: var(--amber); } .prio-niedrig { background: var(--muted); }
.mini { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; background: var(--panel-2); }
.mini:active { border-color: var(--violet); }
.row-menu { color: var(--muted); font-size: 18px; padding: 0 4px; }

/* Gruppen (Aufgaben-Tab) */
.grp-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; cursor: pointer; }
.grp-title { font-family: var(--head); font-size: 14px; letter-spacing: .5px; }
.grp-count { font-size: 12px; color: var(--muted); background: var(--panel-2); border-radius: 10px; padding: 2px 9px; }
.grp-body.collapsed { display: none; }
.add-row { width: 100%; text-align: left; color: var(--muted); font-size: 13.5px; padding: 8px 0 2px; }

/* Heute */
.today-hero { background: linear-gradient(135deg, #232030 0%, var(--panel) 60%); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.today-hero .big { font-family: var(--head); font-size: 19px; margin-bottom: 2px; }
.today-hero .sub { color: var(--muted); font-size: 13px; }
.habit-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.habit-time { font-size: 12px; color: var(--muted); min-width: 44px; }

/* Kalender */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav b { font-family: var(--head); font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 12px; }
.cal-dow { text-align: center; font-size: 10.5px; color: var(--muted); padding: 3px 0; }
.cal-day { aspect-ratio: 1; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); }
.cal-day.cur { color: var(--text); }
.cal-day.today { border-color: var(--violet); color: var(--violet); font-weight: 600; }
.cal-day .dots { display: flex; gap: 2px; height: 4px; }
.cal-day .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--copper-hi); }
.termin-time { font-family: var(--head); font-size: 12.5px; color: var(--copper-hi); min-width: 46px; margin-top: 2px; }

/* Geld */
.money-tiles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.tile .v { font-family: var(--head); font-size: 16px; }
.tile .l { font-size: 11px; color: var(--muted); }
.v.plus { color: var(--green); } .v.minus { color: var(--red); }
.betrag { font-family: var(--head); min-width: 76px; text-align: right; }
.notgroschen-bar { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 8px; }
.notgroschen-bar > div { height: 100%; background: linear-gradient(90deg, var(--copper), var(--copper-hi)); }

/* Ziele */
.goal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; margin-bottom: 10px; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.goal-title { font-weight: 600; }
.goal-val { font-family: var(--head); color: var(--violet); font-size: 14px; }
.goal-bar { height: 9px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.goal-bar > div { height: 100%; background: linear-gradient(90deg, var(--violet-dim), var(--violet)); }
.goal-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 9px; border: 1px solid var(--line); }
.badge.erreicht { color: var(--green); border-color: var(--green); }
.streak { display: flex; gap: 5px; margin-top: 4px; }
.streak .s { width: 26px; height: 26px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.streak .s.on { background: var(--green); border-color: var(--green); color: #14171C; }
.streak .s.today { border-color: var(--violet); }

/* Training */
.plan-bar { background: linear-gradient(135deg, #2A2333 0%, var(--panel) 70%); border: 1px solid var(--violet-dim); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.plan-bar .w { font-family: var(--head); font-size: 16px; color: var(--violet); }
.plan-bar .p { font-size: 13px; color: var(--copper-hi); margin-left: 8px; }
.plan-bar .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.plan-bar .runs { font-size: 13px; margin-top: 6px; }
.week-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.week-nav b { font-family: var(--head); font-size: 15px; min-width: 130px; text-align: center; }
.week-nav button { font-size: 22px; color: var(--muted); padding: 2px 10px; }
.day-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.day-head { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; border-left: 4px solid var(--stone); }
.day-head .dn { font-family: var(--head); font-size: 15px; }
.day-head .ds { font-size: 12px; color: var(--muted); }
.today-badge { background: var(--violet); color: #14171C; font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 9px; letter-spacing: .5px; }
.day-body { padding: 6px 14px 12px; }
.ex-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ex-row:last-child { border-bottom: none; }
.ex-main { display: flex; align-items: center; gap: 10px; }
.ex-name { flex: 1; min-width: 0; font-size: 13.5px; }
.ex-row.done .ex-name { color: var(--muted); text-decoration: line-through; }
.setgrid { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 33px; }
.setrow { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.setrow input { width: 74px; padding: 5px 6px; text-align: center; font-size: 16px; border-radius: 7px; }
.runbox { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 33px; align-items: center; font-size: 12px; color: var(--muted); }
.runbox input.km, .runbox input.mins { width: 74px; text-align: center; }
.runbox input.note { flex: 1; min-width: 120px; }
.hist { margin: 6px 0 0 33px; font-size: 12px; color: var(--muted); }

/* Sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--panel); border-radius: 18px 18px 0 0; border-top: 1px solid var(--line); padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 82dvh; overflow-y: auto; }
.sheet h3 { font-family: var(--head); font-size: 16px; margin-bottom: 12px; }
.sheet .frm { display: flex; flex-direction: column; gap: 10px; }
.sheet .frm-row { display: flex; gap: 8px; }
.sheet .frm-row > * { flex: 1; }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions .btn-primary { flex: 1; }
.btn-ghost { border: 1px solid var(--line); border-radius: 10px; padding: 11px 16px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 16px; padding: 7px 12px; font-size: 13px; background: var(--panel-2); color: var(--text); }
.chip.sel { border-color: var(--violet); background: rgba(164,143,212,.18); color: var(--violet); font-weight: 600; }
.chips-label { font-size: 11.5px; color: var(--muted); margin-bottom: -4px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.choice { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 8px; text-align: center; font-size: 13.5px; }
.choice .ci { font-size: 24px; display: block; margin-bottom: 6px; }
.choice:active { border-color: var(--violet); }
.danger { color: var(--red); }

.toast { position: fixed; bottom: calc(140px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--green); color: var(--green); font-size: 13px; padding: 8px 16px; border-radius: 20px; z-index: 30; white-space: nowrap; }
.toast.err { border-color: var(--red); color: var(--red); }

@media (min-width: 700px) {
  #views { max-width: 680px; margin: 0 auto; width: 100%; }
  #tabbar { max-width: 680px; margin: 0 auto; border-radius: 14px 14px 0 0; border: 1px solid var(--line); border-bottom: none; }
}
