*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ── CSS Variables (Light) ───────────────────────────────────────────────── */
:root {
  --blue: #1e40af;
  --blue-light: #3b82f6;
  --blue-faint: #eff6ff;
  --red: #dc2626;
  --red-light: #ef4444;
  --green: #16a34a;
  --green-faint: #f0fdf4;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.06);

  --bg: var(--gray-100);
  --surface: #ffffff;
  --surface2: var(--gray-50);
  --text: var(--gray-900);
  --text2: var(--gray-700);
  --text3: var(--gray-500);
  --border: var(--gray-200);
  --nav-bg: #ffffff;
  --nav-border: var(--gray-200);
  --header-from: #1e40af;
  --header-to: #3b82f6;
}

/* ── Dark Mode ───────────────────────────────────────────────────────────── */
body.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #273549;
  --text: #f1f5f9;
  --text2: #cbd5e1;
  --text3: #64748b;
  --border: #334155;
  --nav-bg: #1e293b;
  --nav-border: #334155;
  --header-from: #0f172a;
  --header-to: #1e3a5f;
  --blue-faint: #1e3a5f;
  --green-faint: #14532d;
  --gray-50: #273549;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-400: #64748b;
  --gray-700: #cbd5e1;
  --gray-900: #f1f5f9;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--header-from) 0%, var(--header-to) 100%);
  color: white;
  padding: 1rem 1rem 0.9rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.header-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  background: white;
  border-radius: 5px;
  padding: 2px 6px;
}
.header-h1 { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.header-sub { font-size: 0.72rem; opacity: 0.8; font-weight: 400; }
.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-badge {
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.icon-btn:active { background: rgba(255,255,255,0.3); }

/* ── Pull-to-Refresh ─────────────────────────────────────────────────────── */
.ptr-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 0;
  overflow: hidden;
  transition: height 0.2s ease;
  background: var(--surface);
  color: var(--text2);
  font-size: 0.85rem;
}
.ptr-indicator.ptr-visible { height: 52px; }
.ptr-indicator.ptr-releasing .ptr-text { content: 'Loslassen...'; }
.ptr-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--blue-light);
  border-radius: 50%;
  transition: transform 0.2s;
}
.ptr-indicator.ptr-releasing .ptr-spinner { transform: rotate(180deg); }
.ptr-indicator.ptr-loading .ptr-spinner {
  animation: ptr-spin 0.7s linear infinite;
}
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ── Tab Content ─────────────────────────────────────────────────────────── */
.tab-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 0 0;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

.tab-page { display: none; }
.tab-page.active { display: block; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  margin: 0 0.75rem 0.75rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.85rem;
}

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.input-group { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.input-group label { font-size: 0.75rem; color: var(--text3); font-weight: 600; }

.input-group select,
.input-group input[type="time"],
.field-input {
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface2);
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.input-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  background-color: var(--surface2);
}
.input-group select:focus,
.input-group input[type="time"]:focus,
.field-input:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.sep { font-size: 1.1rem; font-weight: 700; color: var(--text3); padding-bottom: 0.4rem; }

.person-readonly {
  cursor: default;
  opacity: 0.75;
  font-weight: 600;
  color: var(--text2);
  background: var(--surface2);
  border-color: var(--border);
  display: flex;
  align-items: center;
}

.add-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.add-row input[type="text"] {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface2);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.add-row input[type="text"]:focus { border-color: var(--blue-light); }
.add-row .btn { width: auto; white-space: nowrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue-light); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--gray-200); color: var(--text2); }
.btn-danger  { background: var(--red-light); color: white; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-success:disabled { background: #86efac; color: #fff; cursor: not-allowed; opacity: 0.7; }
.btn-reset-small { width: auto; align-self: center; margin: 0.5rem auto 0; display: block; padding: 0.45rem 1.2rem; font-size: 0.82rem; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--blue-light);
  color: var(--blue-light);
  margin-top: 0.35rem;
}
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; width: auto; }

.btn-row-manual { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.btn-row-manual .btn { flex: 1; }

.pw-field-wrap { position: relative; }
.pw-field-wrap input { padding-right: 2.6rem !important; }
.pw-toggle { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text2); padding: 0.2rem; display: flex; align-items: center; line-height: 1; }
.pw-toggle:hover { color: var(--text); }

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.sw-btn-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.sw-btn-row .btn { flex: 1; min-width: 0; }

/* ── Date Input ─────────────────────────────────────────────────────────── */
.input-group input[type="date"] {
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface2);
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.input-group input[type="date"]:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* iOS Safari: native Datum-/Zeitfelder ignorieren sonst width:100% und ragen aus der Karte */
input[type="date"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-width: 0;
  max-width: 100%;
}
input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value { text-align: left; }
/* Ohne native Darstellung fallen leere Felder auf iOS sonst in sich zusammen */
.input-group input[type="date"],
.input-group input[type="time"] { min-height: 2.6rem; }
.filter-date { min-height: 1.95rem; }

/* ── Stopwatch Display ───────────────────────────────────────────────────── */
.display {
  font-size: 3.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: 3px;
  color: var(--blue-light);
  background: var(--blue-faint);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.85rem;
}

/* ── Timer State ────────────────────────────────────────────────────────── */
.timer-state {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  height: 1.4rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.3px;
}
.timer-state.running { color: var(--green); }
.timer-state.paused  { color: var(--gray-400); }

/* ── Result ──────────────────────────────────────────────────────────────── */
.result {
  margin: 0.65rem 0 0.35rem;
  padding: 0.65rem 0.8rem;
  background: var(--green-faint);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text2);
  border: 1px solid rgba(22,163,74,0.2);
}
.result strong { color: var(--green); font-size: 1.05rem; }

/* ── Entries ─────────────────────────────────────────────────────────────── */
.entries-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.entries-header .card-title { margin-bottom: 0; }

.entry-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.entry-list .empty-hint {
  color: var(--text3);
  font-size: 0.88rem;
  text-align: center;
  padding: 1.5rem 0;
}
.entry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  gap: 0.5rem;
}
.entry-item .entry-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.entry-item .entry-meta { font-size: 0.72rem; color: var(--text3); font-weight: 500; }
.entry-item .entry-label { color: var(--text2); font-weight: 600; font-size: 0.88rem; }
.entry-item .entry-note { font-size: 0.76rem; color: var(--text3); font-style: italic; margin-top: 0.25rem; padding-left: 0.6rem; border-left: 2px solid var(--border); line-height: 1.4; }
.entry-item .entry-duration { color: var(--blue-light); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.note-group { margin-top: 0.85rem; margin-bottom: 0; }
.note-label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; color: var(--text3); font-weight: 600; margin-bottom: 5px; }
.note-optional { font-weight: 400; opacity: 0.65; }
.note-textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s, border-style 0.15s;
  box-sizing: border-box;
  display: block;
}
.note-textarea:focus {
  outline: none;
  border-color: var(--blue-light);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.note-textarea::placeholder { color: var(--text3); opacity: 0.55; }
.backup-row { display: flex; }
.backup-row .btn, .btn-file-label { width: 100%; text-align: center; cursor: pointer; }
.backup-feedback { margin-top: 0.5rem; font-size: 0.85rem; min-height: 1.2rem; }
.backup-last-info { font-size: 0.82rem; margin-bottom: 0.65rem; }
.backup-last-ok { color: var(--green); }
.backup-last-warn { color: #d97706; font-weight: 600; }
.backup-warning { font-size: 0.78rem; color: var(--text3); margin-top: 0.65rem; font-style: italic; }
.entry-item .btn-delete {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.3rem;
  width: auto;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}
.entry-item .btn-delete:active { color: var(--red); background: rgba(239,68,68,0.1); }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 0.88rem;
  color: var(--text2);
  font-weight: 500;
}
.total-row strong {
  color: var(--green);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* ── Active Timers (Admin) ──────────────────────────────────────────────── */
.active-timers-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.active-timer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem;
  background: var(--surface2);
  border-radius: 10px;
  margin-bottom: 0.6rem;
  border: 1.5px solid var(--border);
}

.timer-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.timer-user {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.timer-meta {
  font-size: 0.8rem;
  color: var(--text3);
}

.timer-status {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.2rem;
}

.timer-status.running {
  color: var(--green);
}

.timer-status.paused {
  color: var(--gray-400);
}

.timer-duration {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--blue-light);
  margin-left: 1rem;
}

/* ── Admin Filter Bar ────────────────────────────────────────────────────── */
.admin-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.admin-filter-row {
  display: flex;
  gap: 0.5rem;
}
.admin-filter-row > * { flex: 1; min-width: 0; }
.filter-select, .filter-date {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  background: var(--bg);
  color: var(--text);
}
.admin-filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.filter-actions-left {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-filter-actions .btn { margin-top: 0; }
/* Bleibt rechts, auch wenn er auf schmalen Bildschirmen in eine eigene Zeile umbricht */
#btn-ef-export { margin-left: auto; }
.filter-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0 0.75rem;
}

/* ── Admin Summary ───────────────────────────────────────────────────────── */
.filter-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.filter-row .input-group { flex: 1; }

.summary-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.75rem; }
.summary-item {
  background: var(--surface2);
  border-radius: 10px;
  padding: 0.85rem;
  border-left: 3px solid var(--blue-light);
}
.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.summary-header strong { font-size: 1rem; color: var(--text); }
.summary-total { font-size: 1.1rem; font-weight: 700; color: var(--blue-light); font-variant-numeric: tabular-nums; }
.summary-details { display: flex; flex-direction: column; gap: 0.3rem; }
.summary-detail {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  padding: 0.2rem 0;
}
.summary-detail span:first-child { color: var(--text3); }
.summary-detail span:last-child { font-weight: 600; color: var(--text2); font-variant-numeric: tabular-nums; }
.summary-grand-total {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: white;
  border-radius: 10px;
  text-align: center;
  font-size: 0.9rem;
}
.summary-grand-total strong { font-size: 1.3rem; display: block; margin-top: 0.2rem; font-variant-numeric: tabular-nums; }

/* ── Summary Table Rows ──────────────────────────────────────────────────── */
.summary-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-bottom: 0.75rem; }
.summary-table th { text-align: left; padding: 0.4rem 0.5rem; color: var(--text3); font-weight: 600; border-bottom: 2px solid var(--border); }
.summary-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.summary-table .time-cell { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--blue-light); text-align: right; }
.summary-person-cell strong { color: var(--text); }
.summary-total-row td { background: var(--surface2); font-size: 0.82rem; border-bottom: 2px solid var(--border); }
.summary-total-row td:last-child { color: var(--blue-light); }
.summary-person-last td { border-bottom: none; }

/* ── User Add Form ───────────────────────────────────────────────────────── */
.user-add-form { margin-bottom: 1rem; }
.user-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.bereich-select-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.bereich-select-header .btn-sm { padding: 0.2rem 0.65rem; font-size: 0.75rem; }
.bereich-select-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 0;
  margin: 0.6rem 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bereich-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.bereich-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--card-bg2, var(--bg2));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.15s, border-color 0.15s;
}
.bereich-checkbox-item:has(input:checked) {
  background: var(--blue-light);
  color: #fff;
  border-color: var(--blue-light);
}
.bereich-checkbox-item input { display: none; }

.user-feedback {
  font-size: 0.85rem;
  margin-top: 0.4rem;
  min-height: 1.2rem;
  transition: color 0.2s;
}
.user-feedback-ok    { color: var(--green, #22c55e); }
.user-feedback-error { color: var(--danger, #ef4444); }

/* ── User Cards ──────────────────────────────────────────────────────────── */
.user-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.user-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.user-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--blue-light);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-avatar-admin { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%); }
.user-info { flex: 1; min-width: 0; }
.user-name-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.15rem; }
.user-name-row strong { font-size: 0.95rem; }
.user-id-text { font-size: 0.78rem; color: var(--text3); margin-bottom: 0.35rem; }
.role-badge {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  padding: 0.15rem 0.5rem; border-radius: 20px; letter-spacing: 0.4px;
}
.role-admin { background: rgba(99,102,241,0.15); color: #6366f1; }
.role-user  { background: var(--surface); color: var(--text3); }
.role-pw-pending { background: rgba(217,119,6,0.15); color: #d97706; }
.user-depts { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.dept-tag {
  font-size: 0.72rem; padding: 0.1rem 0.45rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text2);
}
.user-pw-reset { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.user-pw-reset .field-input { font-size: 0.85rem; padding: 0.35rem 0.6rem; }
.pw-reset-actions { display: flex; gap: 0.4rem; }
.user-actions { display: flex; flex-direction: column; gap: 0.4rem; flex-shrink: 0; }

/* ── Settings ────────────────────────────────────────────────────────────── */
.setting-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 1rem 0 0.5rem;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.setting-row:last-child { border-bottom: none; }
.setting-info { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.setting-icon { font-size: 1.3rem; flex-shrink: 0; }
.setting-label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.setting-desc { font-size: 0.75rem; color: var(--text3); margin-top: 1px; }
.setting-select {
  padding: 0.35rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--surface2);
  color: var(--text);
  outline: none;
  font-family: inherit;
  flex-shrink: 0;
}

/* Toggle Switch */
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--gray-300);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--blue-light); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* App Info */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: var(--text3); }
.info-row span:last-child { font-weight: 500; color: var(--text); }

/* ── Impressum ───────────────────────────────────────────────────────────── */
.impressum-section {
  margin-bottom: 0.85rem;
}
.impressum-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 0.2rem;
}
.impressum-value {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}
.impressum-link {
  color: var(--blue-light);
  text-decoration: none;
}
.impressum-link:hover { text-decoration: underline; }
.impressum-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.impressum-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue-light);
  margin-bottom: 0.75rem;
}
.btn-export-data {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  justify-content: center;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.impressum-note {
  font-size: 0.78rem;
  color: var(--text3);
  line-height: 1.6;
  text-align: center;
  padding-top: 0.25rem;
}

/* ── Bottom Navigation ───────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  display: flex;
  align-items: stretch;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.85rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  transition: color 0.15s, background 0.15s;
  position: relative;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn:active { background: rgba(0,0,0,0.06); }
.nav-btn.active { color: var(--blue-light); }
.nav-btn.active::after {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 3px;
  background: var(--blue-light);
  border-radius: 0 0 4px 4px;
}
.nav-icon { display: none; }
.nav-label { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.01em; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom);
}
#confirm-modal {
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 600;
}
#confirm-modal .modal {
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 360px;
}
.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 1.5rem 1.25rem 1.25rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
}
.modal-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.modal-body { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.modal-error { color: var(--red); font-size: 0.83rem; min-height: 1rem; }
.modal-actions { display: flex; gap: 0.6rem; }
.modal-actions .btn { flex: 1; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, var(--header-from) 0%, var(--header-to) 40%, var(--bg) 100%);
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo .logo-img {
  width: 120px;
  height: auto;
  margin-bottom: 0.75rem;
  border-radius: 10px;
}
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-top: 0.4rem; }
.login-form { display: flex; flex-direction: column; gap: 0.85rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text2); }
.form-group input {
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface2);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.form-group input:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.login-btn { margin-top: 0.5rem; padding: 0.875rem; font-size: 1rem; }
.error-msg { color: var(--red); font-size: 0.83rem; text-align: center; min-height: 1.2rem; }

.toggle-form {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text3);
}
.toggle-form a {
  color: var(--blue-light);
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.5rem;
}
.toggle-form a:hover {
  text-decoration: underline;
}

/* ── iOS Banner ──────────────────────────────────────────────────────────── */
.ios-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--blue);
  color: white;
  padding: 0.9rem 1rem;
  padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
  font-size: 0.85rem;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
}
.ios-banner button {
  position: absolute; right: 0.75rem; top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2); border: none; color: white;
  border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; font-size: 0.9rem; line-height: 1;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes pulseShadow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  50%       { box-shadow: 0 0 0 9px rgba(22,163,74,0); }
}
@keyframes displayGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
  50%       { box-shadow: 0 0 18px 2px rgba(59,130,246,0.18); }
}
@keyframes spinnerSpin {
  to { transform: rotate(360deg); }
}

/* ── Tab page swipe animations ───────────────────────────────────────────── */
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideInLeft {
  from { transform: translateX(-40px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}
.tab-page.active { animation: fadeIn 0.18s ease both; }
.tab-page.slide-in-right { animation: slideInRight 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.tab-page.slide-in-left  { animation: slideInLeft  0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }

/* ── Cards: subtle border + smoother shadow ──────────────────────────────── */
.card {
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s;
}

/* ── Buttons: gradient + shadow ──────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 2px 8px rgba(59,130,246,0.32);
}
.btn-primary:hover:not(:disabled) { opacity: 1; filter: brightness(1.07); box-shadow: 0 4px 14px rgba(59,130,246,0.4); }
.btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 2px 8px rgba(22,163,74,0.32);
}
.btn-success:hover:not(:disabled) { opacity: 1; filter: brightness(1.07); box-shadow: 0 4px 14px rgba(22,163,74,0.4); }
.btn-danger { box-shadow: 0 2px 6px rgba(239,68,68,0.25); }
.btn:active:not(:disabled) { transform: scale(0.95); box-shadow: none !important; filter: brightness(0.94) !important; }

/* ── Running timer button pulse ──────────────────────────────────────────── */
.btn-running {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  color: white !important;
  animation: pulseShadow 1.8s ease-in-out infinite;
}

/* ── Stopwatch display glow when running ─────────────────────────────────── */
.display.running {
  animation: displayGlow 2s ease-in-out infinite;
  border: 1.5px solid rgba(59,130,246,0.25);
}

/* ── Entry items: staggered slide-in + left accent ───────────────────────── */
.entry-item {
  border-left: 3px solid var(--blue-light);
  animation: fadeSlideUp 0.22s ease both;
  transition: background 0.15s;
}
.entry-item:hover { background: var(--surface); }
.entry-item:nth-child(1)  { animation-delay: 0s; }
.entry-item:nth-child(2)  { animation-delay: 0.04s; }
.entry-item:nth-child(3)  { animation-delay: 0.07s; }
.entry-item:nth-child(4)  { animation-delay: 0.10s; }
.entry-item:nth-child(5)  { animation-delay: 0.13s; }
.entry-item:nth-child(n+6){ animation-delay: 0.16s; }

/* ── Summary items slide-in ──────────────────────────────────────────────── */
.summary-item {
  animation: fadeSlideUp 0.22s ease both;
  transition: box-shadow 0.15s;
}
.summary-item:nth-child(1)   { animation-delay: 0s; }
.summary-item:nth-child(2)   { animation-delay: 0.05s; }
.summary-item:nth-child(3)   { animation-delay: 0.10s; }
.summary-item:nth-child(n+4) { animation-delay: 0.15s; }

/* ── User cards slide-in ─────────────────────────────────────────────────── */
.user-card {
  animation: fadeSlideUp 0.22s ease both;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.user-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.1); border-color: var(--blue-light); }
.user-card:nth-child(1)   { animation-delay: 0s; }
.user-card:nth-child(2)   { animation-delay: 0.04s; }
.user-card:nth-child(3)   { animation-delay: 0.08s; }
.user-card:nth-child(n+4) { animation-delay: 0.12s; }

/* ── Modal slide up ──────────────────────────────────────────────────────── */
.modal { animation: modalUp 0.28s cubic-bezier(0.34, 1.4, 0.64, 1) both; }

/* ── Login card entrance ─────────────────────────────────────────────────── */
.login-card { animation: fadeSlideUp 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) 0.06s both; }

/* ── Input number (Pause) ────────────────────────────────────────────────── */
input[type="number"] {
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface2);
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"]:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ── Nav active: subtle background pill ──────────────────────────────────── */
.nav-btn { transition: color 0.15s, background 0.2s; }
.nav-btn.active { background: rgba(59,130,246,0.07); }

/* ── Active timer item: pulse border ─────────────────────────────────────── */
.active-timer-item {
  transition: border-color 0.3s;
  animation: fadeSlideUp 0.22s ease both;
}

/* ── Result reveal ───────────────────────────────────────────────────────── */
.result:not([hidden]) { animation: fadeSlideUp 0.2s ease both; }

/* ── Entries sort + pagination ───────────────────────────────────────────── */
.entries-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.sort-select {
  padding: 0.28rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text2);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.sort-select:focus { border-color: var(--blue-light); }
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.65rem 0 0.1rem;
}
.pg-btn {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 1.1rem;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}
.pg-btn:hover:not(:disabled) { background: var(--surface); border-color: var(--blue-light); color: var(--blue-light); }
.pg-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pg-info { font-size: 0.82rem; color: var(--text2); white-space: nowrap; }
.pg-count { color: var(--text3); }

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 1rem);
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 0.6rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  animation: toastIn 0.28s cubic-bezier(0.34,1.56,0.64,1) both;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
}
.toast-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.toast-error   { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.toast-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.toast.toast-out { animation: toastOut 0.22s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-8px) scale(0.92); }
}

/* ── Button loading state ────────────────────────────────────────────────── */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 17px; height: 17px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spinnerSpin 0.55s linear infinite;
  top: 50%; left: 50%;
  margin: -8.5px 0 0 -8.5px;
}
.btn-secondary.btn-loading::after,
.btn-outline.btn-loading::after {
  border-color: rgba(0,0,0,0.12);
  border-top-color: var(--text2);
}

/* ── Card hover lift ─────────────────────────────────────────────────────── */
.card { transition: box-shadow 0.2s, transform 0.2s; }
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.09), 0 12px 32px rgba(0,0,0,0.07); }
