:root {
  --bg: #0f1a26;
  --bg2: #14202e;
  --card: #1b2a3b;
  --line: #2a3d52;
  --text: #eef3f8;
  --muted: #93a4b6;
  --accent: #f5a623;
  --start: #2fb36b;
  --start2: #1f8f52;
  --stop: #e5484d;
  --stop2: #b8343a;
  --night: #f5a623;
  --radius: 16px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f8; --bg2: #ffffff; --card: #ffffff; --line: #dde3ea;
    --text: #15202b; --muted: #5d6b7a; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
[hidden] { display: none !important; }
h1 { margin: .3em 0 .1em; font-size: 1.6rem; }
h2 { font-size: 1.05rem; margin: 1.4em 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--stop); }
.ok { color: var(--start); }

label { display: block; font-size: .85rem; color: var(--muted); margin: .9em 0 .3em; }
input, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 10px; padding: .65em .75em;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: .75em 1.1em;
  background: var(--card); color: var(--text); cursor: pointer; text-decoration: none;
  border: 1px solid var(--line);
}
.btn.primary { background: var(--accent); color: #1b1300; border-color: transparent; }
.btn.danger { background: transparent; color: var(--stop); border-color: var(--stop); }
.btn.ghost { background: transparent; }
.btn.small { padding: .45em .8em; font-size: .9rem; }
.btn.block { display: flex; width: 100%; margin-top: 1.2em; }
.pill { background: rgba(0,0,0,.25); border-radius: 99px; padding: .05em .6em; font-variant-numeric: tabular-nums; }

/* Login */
.login { max-width: 360px; margin: 0 auto; padding: 12vh 20px 40px; text-align: center; }
.login form { text-align: left; margin-top: 1.5em; }
.login .btn { width: 100%; margin-top: 1em; }
.login-logo { width: 96px; height: 96px; }

/* Layout */
#app { padding: 0 16px calc(88px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 0 8px;
}
.brand { display: flex; align-items: center; gap: .5em; font-weight: 700; }
.brand img { width: 28px; height: 28px; }
.net { font-size: .8rem; background: var(--accent); color: #1b1300; padding: .2em .6em; border-radius: 99px; }

/* Erfassen */
.clock { text-align: center; font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .3em; letter-spacing: .02em; }
.date { text-align: center; color: var(--muted); margin-bottom: 1.2em; }

.big {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: min(72vw, 280px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  border: 0; color: #fff; font: inherit; cursor: pointer; user-select: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 -8px 0 rgba(0,0,0,.18);
  transition: transform .08s ease, background .2s ease;
}
.big:active { transform: scale(.96); }
.big.start { background: radial-gradient(circle at 35% 30%, #4cd68a, var(--start) 55%, var(--start2)); }
.big.stop { background: radial-gradient(circle at 35% 30%, #ff7b7f, var(--stop) 55%, var(--stop2)); animation: pulse 1.6s ease-in-out infinite; }
.big-label { font-size: 1.55rem; font-weight: 800; letter-spacing: .02em; }
.big-sub { font-size: .85rem; opacity: .85; margin-top: .2em; }
.big-icon { width: 64px; height: 64px; background: url(/icons/rooster-white.svg) center/contain no-repeat; margin-bottom: .3em; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(229,72,77,.18), 0 10px 30px rgba(0,0,0,.35), inset 0 -8px 0 rgba(0,0,0,.18); } }
@media (prefers-reduced-motion: reduce) { .big.stop { animation: none; } }

.running { text-align: center; margin-top: 1em; }
.since { color: var(--muted); }
.timer { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--stop); }
.btn.crow { margin-top: .6em; background: var(--card); padding: .9em 1.4em; font-size: 1.05rem; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 1.6em; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .6em .3em; text-align: center; }
.stats b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.stats span { font-size: .72rem; color: var(--muted); }

/* Liste */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: .7em .85em; margin-bottom: 8px; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
}
.list li.night { border-left: 4px solid var(--night); }
.list .when { font-weight: 600; }
.list .dur { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.list .meta { grid-column: 1 / -1; font-size: .82rem; color: var(--muted); }
.list .note { grid-column: 1 / -1; font-size: .88rem; }
.tag { display: inline-block; font-size: .72rem; padding: .05em .5em; border-radius: 99px; background: rgba(245,166,35,.18); color: var(--accent); margin-right: 4px; }
.tag.grey { background: rgba(147,164,182,.18); color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 1.5em 0; }
.row-head { display: flex; align-items: center; justify-content: space-between; }

/* Chips */
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .8em; }
.chip { font: inherit; font-size: .82rem; border-radius: 99px; padding: .35em .8em; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; }

.hints { padding-left: 1.1em; color: var(--muted); font-size: .9rem; }
#logout { margin-top: 1em; }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg2); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { font: inherit; font-size: .75rem; background: none; border: 0; color: var(--muted); padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.tabs button.active { color: var(--accent); }
.ti { width: 24px; height: 24px; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.ti-rec { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3C/svg%3E"); }
.ti-log { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M8 6h12M8 12h12M8 18h12'/%3E%3Ccircle cx='4' cy='6' r='1' fill='black'/%3E%3Ccircle cx='4' cy='12' r='1' fill='black'/%3E%3Ccircle cx='4' cy='18' r='1' fill='black'/%3E%3C/svg%3E"); }
.ti-xls { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 2h9l5 5v15H6z'/%3E%3Cpath d='M15 2v5h5M9 12l6 6M15 12l-6 6'/%3E%3C/svg%3E"); }
.ti-set { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c1-4 4-6 8-6s7 2 8 6'/%3E%3C/svg%3E"); }

/* Dialog */
dialog {
  width: min(94vw, 480px); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg2); color: var(--text); padding: 18px;
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; gap: 8px; margin-top: 1.2em; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.block-del { width: 100%; margin-top: 10px; }
