/* Neutrale Grau/Weiß-Palette — bewusst kein Branding, damit der Auftraggeber
   das Design später leicht an seine eigene Marke anpassen kann. */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #374151;
  --border: #e2e2e2;
  --accent: #4b5563;
  --accent-hover: #374151;
  --danger: #b91c1c;
  --success: #166534;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

header.topbar .brand { font-weight: 600; font-size: 1.05rem; }

nav.tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

nav.tabs a {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-size: 0.92rem;
}

nav.tabs a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

h1 { font-size: 1.3rem; margin: 0 0 16px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }

.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 0.92rem;
}
.flash.success { background: #eafaf0; color: var(--success); border: 1px solid #bfe9cf; }
.flash.error { background: #fdecec; color: var(--danger); border: 1px solid #f4bcbc; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }

.table-scroll { overflow-x: auto; }

select, input[type=text], input[type=tel], input[type=email], input[type=password],
input[type=datetime-local], input[type=number], textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; margin-top: 12px; }
label:first-child { margin-top: 0; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 0.8rem; }

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #eee;
  color: var(--text-muted);
  white-space: nowrap;
}
.pill.verkauft { background: #eafaf0; color: var(--success); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: flex-end; }
.filters > div { min-width: 160px; }
.filters label { margin-top: 0; }

.note {
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  font-size: 0.88rem;
}
.note:last-child { border-bottom: none; }
.note .meta { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
@media (min-width: 640px) {
  .overlay { align-items: center; }
}
.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .modal { border-radius: var(--radius); }
}

.field-display {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.muted { color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 640px) {
  main { padding: 14px; }
  th, td { padding: 8px 6px; font-size: 0.85rem; }
  header.topbar { flex-wrap: wrap; gap: 8px; }
  header.topbar form { order: 3; max-width: none !important; width: 100%; margin: 0 !important; }
  header.topbar .brand { flex: 1; }
}

/* Finanzsheet: Zeile grün, sobald vollständig bezahlt */
tr.zeile-bezahlt {
  background: #eafaf0;
}
tr.zeile-bezahlt:hover { background: #ddf3e4; }

/* Finanzsheet: Tage-im-Programm-Badge */
.tage-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.tage-gruen { background: #eafaf0; color: var(--success); }
.tage-gelb { background: #fef3c7; color: #1a1a1a; }
.tage-rot { background: #fdecec; color: var(--danger); }

/* Verkaufsabschluss-Formular: Pakete + "später ausfüllen" */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
  margin: 0;
  width: auto;
  white-space: nowrap;
}
.checkbox-inline input { width: auto; }
.row-field {
  display: flex;
  align-items: center;
  gap: 12px;
}
.row-field > input, .row-field > select { flex: 1; }
.checkbox-inline.later { color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }

/* Aufgaben-Tab */
.aufgabe-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
.aufgabe-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fef3c7;
  color: #1a1a1a;
}
.aufgabe-badge.ueberfaellig { background: #fdecec; color: var(--danger); }
.aufgabe-felder { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.aufgabe-feld-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #eee;
  color: var(--text-muted);
}
