:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1c2321;
  --muted: #6b7671;
  --accent: #00a884;
  --accent-dark: #008f70;
  --gradient: linear-gradient(100deg, #8cc63f, #00aeef);
  --danger: #c0392b;
  --border: #e3e7e5;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.82rem; margin: 0.75rem 0 0; }

/* ---------- Auth ---------- */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.brand h1 { font-size: 1.4rem; margin: 0; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.logo { height: 32px; }
.clock-icon { height: 30px; }

/* ---------- Formulare ---------- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

input, select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: #f0f2f1; }
.btn-primary { background: var(--gradient); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(0.93); }
.btn-block { width: 100%; }
.btn-small { padding: 0.35rem 0.7rem; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(192,57,43,0.08); }

.btn-play {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  font-size: 1.05rem;
  padding: 0.7rem 2.2rem;
}
.btn-play:hover { filter: brightness(0.93); }

.btn-stop {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-size: 1.05rem;
  padding: 0.7rem 2.2rem;
}
.btn-stop:hover { background: #a93226; }

.btn-nav { border: none; background: transparent; color: var(--muted); }
.btn-nav.active { color: var(--accent-dark); background: rgba(0,168,132,0.12); }

/* ---------- Layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topbar nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.user-name { color: var(--muted); font-size: 0.9rem; margin-left: 0.5rem; }

.panel {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.card h3 { font-size: 0.95rem; color: var(--muted); margin: 1.25rem 0 0.5rem; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.card-head h2 { margin: 0; }

.review-card { border-left: 4px solid #e67e22; }

/* ---------- Timer ---------- */
.timer-card { text-align: center; }

.timer-display {
  font-size: 3.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

.timer-meta { margin-bottom: 1.25rem; min-height: 1.2em; }

.row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn-row { justify-content: center; margin-top: 0.5rem; }

.form-grid { text-align: left; }
.form-grid label { flex: 1 1 160px; margin-bottom: 0.5rem; }
.form-grid .grow { flex: 2 1 240px; }

.inline { display: flex; gap: 0.4rem; align-items: center; }
.inline select { flex: 1; }

/* ---------- Tabellen / Listen ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.running td { color: var(--accent); font-weight: 600; }

.entry-actions { white-space: nowrap; text-align: right; }
.entry-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
}
.entry-actions button:hover { background: rgba(0,0,0,0.06); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.period-label { font-weight: 600; min-width: 150px; text-align: center; display: inline-block; }

.total-row td { font-weight: 700; border-top: 2px solid var(--text); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { margin: 0 0 1rem; font-size: 1.1rem; }

.modal-small { max-width: 400px; text-align: center; }
.modal-small h2 { margin-bottom: 0.5rem; }
.dlg-message { color: var(--muted); margin: 0 0 1rem; }
#dlg-input { text-align: left; margin-bottom: 1rem; }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #a93226; }

@media (max-width: 600px) {
  .timer-display { font-size: 2.4rem; }
  .panel { margin-top: 1rem; }
  .card { padding: 1.1rem; }
}
