:root {
  --bg: #f6f6f4;
  --karte: #ffffff;
  --text: #0d0d0d;
  --muted: #6b6b6b;
  --linie: #e4e4e0;
  --akzent: #99ff66;
  --akzent-dunkel: #5fc22c;
  --rot: #d93b3b;
  --gelb: #e9a400;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Poppins, "Segoe UI", system-ui, sans-serif; font-size: 15px; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 380px; background: var(--karte); border-radius: var(--radius); padding: 32px 28px; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.login-box .logo { height: 28px; }
.login-box h1 { margin: 18px 0 4px; font-size: 26px; }
.login-box label { display: block; margin: 22px 0 6px; font-size: 13px; color: var(--muted); }
.login-box input { width: 100%; padding: 12px 14px; border: 1px solid var(--linie); border-radius: 10px; }
.login-box .btn { width: 100%; margin-top: 14px; }
.muted { color: var(--muted); margin: 0; }
.hinweis { margin-top: 16px; padding: 10px 12px; background: #f0fbe9; border-radius: 10px; font-size: 14px; }
.fehler { margin-top: 12px; padding: 10px 12px; background: #fdecec; color: var(--rot); border-radius: 10px; font-size: 14px; }

/* Kopf */
.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--text); color: #fff; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #555; display: inline-block; }
.dot.an { background: var(--akzent); box-shadow: 0 0 0 4px rgba(153,255,102,.25); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: none; border: 0; color: #bbb; padding: 8px 12px; border-radius: 8px; }
.tabs button.aktiv { color: var(--text); background: var(--akzent); font-weight: 600; }
.user { font-size: 13px; color: #ccc; }
.link { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0 0 0 8px; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h2 { font-size: 17px; margin: 28px 0 10px; display: flex; justify-content: space-between; }
.summe { color: var(--muted); font-weight: 500; }

/* Timer */
.timer-card { background: var(--karte); border-radius: var(--radius); padding: 24px; box-shadow: 0 4px 18px rgba(0,0,0,.05); }
.uhr { font-size: clamp(44px, 12vw, 72px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -1px; line-height: 1; }
.timer-card.laeuft .uhr { color: var(--text); }
.timer-card.laeuft { outline: 3px solid var(--akzent); }
.laufend-info { margin: 8px 0 18px; color: var(--muted); }
.auswahl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feld label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.feld select, .feld input { width: 100%; padding: 11px 12px; border: 1px solid var(--linie); border-radius: 10px; background: #fff; }
.feld.breit { grid-column: 1 / -1; }
.knoepfe { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn { border: 1px solid var(--linie); background: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; }
.btn:disabled { opacity: .35; cursor: default; }
.btn-primary { background: var(--akzent); border-color: var(--akzent); color: var(--text); }
.btn-stopp { background: var(--text); border-color: var(--text); color: #fff; }
.btn.klein { padding: 7px 12px; font-size: 13px; }

/* Listen */
.liste { list-style: none; margin: 0; padding: 0; background: var(--karte); border-radius: var(--radius); overflow: hidden; }
.liste li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--linie); }
.liste li:last-child { border-bottom: 0; }
.liste .titel { font-weight: 600; }
.liste .sub { color: var(--muted); font-size: 13px; }
.liste .dauer { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.liste .aktionen button { background: none; border: 0; font-size: 18px; padding: 4px 6px; color: var(--muted); }
.liste .aktionen button:hover { color: var(--text); }
.liste .leer { display: block; color: var(--muted); text-align: center; }
.tag-kopf { background: #fafaf8; font-size: 13px; font-weight: 600; color: var(--muted); display: flex !important; justify-content: space-between; }

.filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--linie); }
.check { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.summen { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.kachel { background: var(--karte); border-radius: 12px; padding: 12px 16px; min-width: 140px; }
.kachel b { display: block; font-size: 20px; }
.kachel span { color: var(--muted); font-size: 12px; }

/* Tabelle */
.tabelle-wrap { overflow-x: auto; background: var(--karte); border-radius: var(--radius); padding: 6px 8px; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th, .tabelle td { padding: 10px 12px; border-bottom: 1px solid var(--linie); text-align: left; white-space: nowrap; }
.tabelle th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tabelle .r { text-align: right; font-variant-numeric: tabular-nums; }
.ampel { display: inline-block; padding: 2px 8px; border-radius: 99px; font-weight: 600; font-size: 12px; }
.ampel.gruen { background: #e8fbdc; color: #2f7a0f; }
.ampel.gelb { background: #fff4d6; color: #8a6200; }
.ampel.rot { background: #fdecec; color: var(--rot); }

/* Dialog */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
#dialog-form { padding: 22px; display: grid; gap: 12px; }
#dialog-form h3 { margin: 0 0 4px; }
#dialog-form .zeile { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#dialog-form .knoepfe { justify-content: flex-end; margin-top: 6px; }

@media (max-width: 640px) {
  .auswahl { grid-template-columns: 1fr; }
  .timer-card .knoepfe { display: grid; grid-template-columns: 1fr 1fr; }
  .knoepfe .btn { flex: 1; white-space: nowrap; }
  .user { width: 100%; }
  .tabs { order: 3; width: 100%; }
  #dialog-form .zeile { grid-template-columns: 1fr; }
}
