:root {
  --dark: #1c1c1c;
  --accent: #e63946;
  --bg: #faf9f7;
  --card: #ffffff;
  --border: #e8e6e2;
  --muted: #8a8a8a;
  --text: #1c1c1c;

  --status-unerledigt: #e63946;
  --status-erledigt: #2e7d4f;
  --status-rechnung: #b8860b;
  --status-abgeschlossen: #8a8a8a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 90px;
}

header.topbar {
  background: var(--dark);
  color: #fff;
  padding: 18px 20px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topbar h1 {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header.topbar h1 a { color: #fff; text-decoration: none; font-size: 13px; font-weight: 500; opacity: 0.7; }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.tab {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  cursor: pointer;
}

.tab.active { background: var(--accent); }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
}

.task-card img.thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.task-info { flex: 1; min-width: 0; }

.task-title { font-weight: 600; font-size: 15px; margin: 0 0 4px; }

.task-meta { font-size: 13px; color: var(--muted); margin: 0; }

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  margin-top: 6px;
}

.status-unerledigt { background: var(--status-unerledigt); }
.status-erledigt { background: var(--status-erledigt); }
.status-rechnung_schreiben { background: var(--status-rechnung); }
.status-abgeschlossen { background: var(--status-abgeschlossen); }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 14px;
}

.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 28px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  cursor: pointer;
  z-index: 20;
}

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: flex-end;
  z-index: 30;
}

.overlay.open { display: flex; }

.sheet {
  background: #fff;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 20px 20px 30px;
}

.sheet h2 { font-family: 'Fraunces', serif; font-size: 19px; margin: 0 0 16px; }

.field { margin-bottom: 14px; position: relative; }

.field label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }

.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fdfdfc;
}

.field textarea { resize: vertical; min-height: 60px; }

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 40;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.autocomplete-list div {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.status-select { display: flex; gap: 6px; flex-wrap: wrap; }

.status-option {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
}

.status-option.selected { border-color: var(--accent); background: #fdeceb; }

.preview-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
}

.btn-row { display: flex; gap: 10px; margin-top: 20px; }

.btn {
  flex: 1;
  padding: 13px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #f1f1f0; color: var(--text); }
.btn-danger { background: transparent; color: var(--status-unerledigt); font-weight: 600; }
