/* ---------- Design-Tokens ---------- */
:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --card-2: #fafbfc;
  --ink: #14161a;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --line: #e4e7ec;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --green: #15803d;
  --green-soft: #e8f7ee;
  --red: #c02626;
  --red-soft: #fdeceb;
  --amber: #b45309;
  --amber-soft: #fef4e2;
  --blue: #1d4ed8;
  --blue-soft: #e8efff;
  --shadow: 0 1px 2px rgba(16,18,24,.06), 0 4px 16px rgba(16,18,24,.05);
  --radius: 16px;
  --tap: 46px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d11; --card: #16181e; --card-2: #1c1f26; --ink: #eceef2;
    --muted: #98a0ad; --faint: #6d7480; --line: #262a33;
    --accent: #818cf8; --accent-soft: #1e2140;
    --green: #4ade80; --green-soft: #122a1c;
    --red: #f87171; --red-soft: #2d1618;
    --amber: #fbbf24; --amber-soft: #2b2110;
    --blue: #93b4fd; --blue-soft: #151f38;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior-y: none; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1,h2,h3 { margin: 0; line-height: 1.25; }
a { color: var(--accent); }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.hh-switch {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  background: none; border: 0; padding: 4px 0; text-align: left; cursor: pointer;
}
.hh-switch b { font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-switch svg { flex: none; opacity: .5; }
.icon-btn {
  flex: none; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; cursor: pointer; position: relative;
}
.icon-btn .dot {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--bg);
}
@media (prefers-color-scheme: dark) { .icon-btn .dot { color: #2d1618; } }

/* ---------- Container ---------- */
.wrap { max-width: 620px; margin: 0 auto; padding: 14px; }
.stack > * + * { margin-top: 10px; }

/* ---------- Filter-Chips ---------- */
.filters {
  display: flex; gap: 7px; overflow-x: auto; padding: 2px 14px 12px;
  max-width: 620px; margin: 0 auto; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 7px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { font-size: 11px; opacity: .65; font-weight: 700; }

/* ---------- Karten ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card.tappable { cursor: pointer; transition: transform .12s ease; }
.card.tappable:active { transform: scale(.985); }
.card-pad { padding: 14px; }

.task-top { display: flex; gap: 11px; align-items: flex-start; }
.task-icon {
  flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 21px; background: var(--card-2); border: 1px solid var(--line);
}
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.task-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.task-price { flex: none; text-align: right; }
.task-price .amt { font-size: 19px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.task-price .lbl { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 7px;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 4px;
}
.badge.shared { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.badge.private { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.live { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.warn { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge.bad { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.good { background: var(--green-soft); color: var(--green); border-color: transparent; }

/* Fortschrittsbalken der Auktionsuhr */
.clock { height: 5px; background: var(--line); position: relative; overflow: hidden; }
.clock i { position: absolute; inset: 0 auto 0 0; background: var(--accent); transition: width .9s linear; }
.clock.warn i { background: var(--amber); }
.clock.hot i { background: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 0 18px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--card); font-weight: 650; font-size: 15px; cursor: pointer; width: 100%;
  transition: transform .1s ease, opacity .1s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #12142a; } }
.btn.good { background: var(--green); border-color: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.good { color: #0b2415; } }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.btn.sm { min-height: 38px; font-size: 13.5px; padding: 0 13px; width: auto; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.fab {
  position: fixed; right: 16px; z-index: 25;
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 20px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 45%, transparent);
  display: grid; place-items: center;
}
@media (prefers-color-scheme: dark) { .fab { color: #12142a; } }

/* ---------- Untere Navigation ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(14px) saturate(1.5);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: 0; background: none; padding: 9px 4px 8px; cursor: pointer;
  display: grid; gap: 3px; justify-items: center; color: var(--faint); font-size: 10.5px; font-weight: 650;
  position: relative;
}
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar .dot {
  position: absolute; top: 5px; margin-left: 17px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 9.5px; font-weight: 800;
  display: grid; place-items: center;
}
@media (prefers-color-scheme: dark) { .tabbar .dot { color: #2d1618; } }

/* ---------- Eingabefelder ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field .hint { font-weight: 500; color: var(--faint); }
input[type=text], input[type=number], input[type=password], input[type=tel], textarea, select {
  width: 100%; min-height: var(--tap); padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); outline: none; font-size: 16px;
}
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; min-height: var(--tap); border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-weight: 650; font-size: 14px;
  display: grid; place-items: center; gap: 1px; padding: 6px;
}
.seg button small { font-weight: 500; font-size: 11px; color: var(--faint); }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.seg button[aria-pressed="true"] small { color: inherit; opacity: .8; }

/* ---------- Bottom-Sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(8,9,12,.45);
  backdrop-filter: blur(2px); opacity: 0; transition: opacity .2s ease;
}
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--bg); border-radius: 22px 22px 0 0;
  max-height: 92dvh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.22);
}
.sheet.on { transform: translateY(0); }
.sheet-grip { padding: 9px 0 4px; display: grid; place-items: center; flex: none; }
.sheet-grip i { width: 38px; height: 4px; border-radius: 2px; background: var(--line); display: block; }
.sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 4px 16px 12px; flex: none;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 17px; flex: 1; min-width: 0; letter-spacing: -.01em; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; }
.sheet-foot {
  flex: none; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--card);
}
.x-btn { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; cursor: pointer; font-size: 17px; }

/* ---------- Listen & Details ---------- */
.rows { display: grid; }
.row {
  display: flex; align-items: center; gap: 11px; padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .who { font-weight: 620; font-size: 14.5px; }
.row .meta { color: var(--faint); font-size: 12px; margin-top: 1px; }
.row .val { font-weight: 750; font-variant-numeric: tabular-nums; }

.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff; background: var(--accent);
}
.sec-title { font-size: 12px; font-weight: 800; color: var(--faint); text-transform: uppercase;
  letter-spacing: .07em; margin: 22px 0 8px; }
.sec-title:first-child { margin-top: 0; }

.note {
  border-radius: 13px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5;
  background: var(--card-2); border: 1px solid var(--line);
}
.note.info { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.note.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.note.bad { background: var(--red-soft); border-color: transparent; color: var(--red); }
.note.good { background: var(--green-soft); border-color: transparent; color: var(--green); }
.note b { font-weight: 750; }

.big-clock {
  text-align: center; padding: 18px 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
}
.big-clock .amt { font-size: 38px; font-weight: 850; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.big-clock .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.big-clock .time { margin-top: 10px; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }

.photo { width: 100%; border-radius: 13px; border: 1px solid var(--line); display: block; }
.empty { text-align: center; padding: 52px 22px; color: var(--muted); }
.empty .em { font-size: 42px; display: block; margin-bottom: 12px; opacity: .75; }
.empty h3 { font-size: 16px; margin-bottom: 5px; color: var(--ink); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.spark i { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .8; min-height: 3px; }

.money-pos { color: var(--green); }
.money-neg { color: var(--red); }
.tabnum { font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(14px); z-index: 80;
  bottom: calc(84px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--bg); padding: 11px 17px; border-radius: 13px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--red); color: #fff; }

.center-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; }
.brand { text-align: center; margin-bottom: 26px; }
.brand .logo { width: 66px; height: 66px; border-radius: 20px; margin: 0 auto 14px;
  background: linear-gradient(140deg, #6366f1, #a855f7); display: grid; place-items: center;
  box-shadow: 0 8px 26px rgba(99,102,241,.35); }
.brand h1 { font-size: 25px; letter-spacing: -.03em; }
.brand p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }

.skeleton { background: linear-gradient(90deg, var(--line) 25%, var(--card-2) 50%, var(--line) 75%);
  background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 9px; }
@keyframes sk { to { background-position: -200% 0; } }
