/* === Reset & Basis ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f5f5f5;
  --surface:     #ffffff;
  --text:        #1a1a1a;
  --text-muted:  #666666;
  --border:      #ddd;
  --accent:      #2563eb;
  --accent-hover:#1d4ed8;
  --danger:      #dc2626;
  --danger-hover:#b91c1c;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,0.08);
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}

/* === Navigation ============================================================ */

.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav nav {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
}

.nav-link {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 15px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover { color: var(--text); }
.nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* === Views (SPA-Umschaltung) =============================================== */

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.hidden { display: none !important; }

/* === Plus-Button =========================================================== */

.add-section {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.btn-add {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-add:hover  { background: var(--accent-hover); }
.btn-add:active { transform: scale(0.95); }

/* === Formular (Inline) ===================================================== */

.add-form {
  margin-bottom: 24px;
}

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-row input {
  flex: 1 1 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.form-row input:focus {
  border-color: var(--accent);
}

.btn-confirm, .btn-cancel {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-confirm {
  background: var(--accent);
  color: #fff;
}
.btn-confirm:hover { background: var(--accent-hover); }

.btn-cancel {
  background: var(--border);
  color: var(--text);
}
.btn-cancel:hover { background: #ccc; }

/* === Protokoll-Liste ======================================================= */

.entry-log {
  list-style: none;
}

.entry-log li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-meta {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  text-align: right;
  line-height: 1.4;
}

.entry-meta .date { display: block; }
.entry-meta .ago  { display: block; font-size: 12px; }

.btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.btn-delete:hover {
  color: var(--danger);
  background: rgba(220,38,38,0.08);
}

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0;
}

/* === Auswertung (Tabelle) ================================================== */

.view h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.stats-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stats-table th,
.stats-table td {
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
}

.stats-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.stats-table td {
  border-bottom: 1px solid #eee;
}

.stats-table tr:last-child td {
  border-bottom: none;
}

/* Numerische Spalten rechtsbündig */
.stats-table td:nth-child(2),
.stats-table td:nth-child(3),
.stats-table td:nth-child(4),
.stats-table th:nth-child(2),
.stats-table th:nth-child(3),
.stats-table th:nth-child(4) {
  text-align: right;
}

/* === Responsive ============================================================ */

@media (max-width: 480px) {
  .entry-log li {
    flex-wrap: wrap;
    gap: 6px;
  }
  .entry-meta {
    flex-basis: 100%;
    text-align: left;
    order: 3;
  }
  .btn-delete {
    order: 2;
    margin-left: auto;
  }
  .stats-table th,
  .stats-table td {
    padding: 8px 10px;
    font-size: 13px;
  }
}
