* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  background: #f2f4f7;
  color: #1f2937;
}

.app-header {
  background: #353535;
  color: #fff;
  padding: 14px 24px;
  border-bottom: 3px solid #EA7926;
}
.app-header h1 {
  margin: 0 0 10px 0;
  font-size: 1.3rem;
  font-family: "Vitesse Bold", "Segoe UI", Arial, sans-serif;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.95rem;
}
.tab-btn:hover { background: rgba(255,255,255,0.22); }
.tab-btn.active { background: #f2f4f7; color: #353535; font-weight: 600; }
.admin-only { display: none; }
body.admin-unlocked .admin-only { display: inline-block; }
.admin-toggle-btn { margin-left: auto; background: rgba(255,255,255,0.12); opacity: 0.7; }
.admin-toggle-btn:hover { opacity: 1; }
body.admin-unlocked .admin-toggle-btn { background: #EA7926; opacity: 1; }

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

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

.box {
  background: #fff;
  border: 1px solid #dbe1e8;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.box legend {
  font-weight: 600;
  padding: 0 6px;
  color: #353535;
}
.hint { color: #6b7280; font-size: 0.85rem; font-weight: normal; }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 10px;
}
label.full { grid-column: 1 / -1; }

input[type=text], input[type=date], input[type=time], input[type=file],
select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 7px 9px;
  border: 1px solid #c7ced8;
  border-radius: 5px;
  background: #fff;
}
textarea { resize: vertical; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.grid-note-entry {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 0 16px;
  align-items: start;
}
.grid-note-entry .full { grid-column: 1 / -1; }

.checkbox-label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; }

.foto-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.foto-gallery:empty { display: none; margin: 0; }
.foto-thumb { position: relative; width: 90px; height: 90px; }
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid #c7ced8; }
.foto-thumb .foto-remove {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0;
  border-radius: 50%; background: #b3261e; color: #fff; font-size: 0.75rem; line-height: 1;
}
.foto-count { color: #6b7280; font-size: 0.8rem; white-space: nowrap; }

.actions { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; }

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}
button.primary { background: #353535; color: #fff; }
button.primary:hover { background: #202020; }
button.secondary { background: #e5e9ef; color: #353535; }
button.secondary:hover { background: #d5dbe3; }
button.danger { background: #b3261e; color: #fff; }
button.hidden { display: none; }
.hidden { display: none !important; }

.ai-suggest-row { display: flex; align-items: center; gap: 10px; margin: -4px 0 10px; }
.ai-suggestion-box {
  background: #f4f0fb;
  border: 1px solid #cbb8ee;
  border-radius: 6px;
  padding: 10px 14px;
  margin: -4px 0 10px;
}
.ai-suggestion-box #ai-suggestion-text { font-style: italic; margin-bottom: 8px; }
button.icon-btn {
  background: none;
  color: #6b7280;
  padding: 4px 8px;
  font-weight: normal;
}
button.icon-btn:hover { color: #b3261e; }

table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
th, td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid #e5e9ef;
  font-size: 0.88rem;
  vertical-align: top;
}
th { color: #353535; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .02em; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-beschluss { background: #fde68a; color: #7c4a03; }
.badge-aufgabe { background: #bfdbfe; color: #1e3a8a; }
.badge-information { background: #d1fae5; color: #065f46; }
.badge-entschluss { background: #fde68a; color: #7c4a03; }
.badge-pendenz { background: #bfdbfe; color: #1e3a8a; }
.badge-erledigt { background: #d1fae5; color: #065f46; }
.badge-offen { background: #f3f4f6; color: #6b7280; }

.protocol-preview {
  border: 1px solid #dbe1e8;
  border-radius: 6px;
  padding: 24px;
  background: #fdfdfd;
  font-size: 0.95rem;
  line-height: 1.5;
}
.protocol-preview h2 { margin-top: 0; }
.protocol-preview .letterhead { margin-bottom: 18px; }
.protocol-preview .gruppe-title {
  background: #eef2f7;
  padding: 6px 10px;
  border-left: 4px solid #EA7926;
  margin: 22px 0 8px;
  font-weight: 600;
}
.protocol-preview .signature-block { margin-top: 32px; }
.protocol-preview .signature-line { margin-top: 28px; border-top: 1px solid #999; padding-top: 4px; max-width: 260px; }
.protocol-preview .kategorie-title {
  font-weight: 600;
  margin: 10px 0 4px 6px;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: #444;
}
.protocol-preview ul { margin: 0 0 4px 0; padding-left: 22px; }
.protocol-preview li { margin-bottom: 4px; }
.protocol-preview .meta-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.protocol-preview .meta-table td { border: none; padding: 2px 6px 2px 0; font-size: 0.9rem; }
.protocol-preview .pendenzen-export-table,
.protocol-preview .bj-export-table,
.protocol-preview .mg-export-table { margin-bottom: 14px; }
.protocol-preview .pendenzen-export-table th, .protocol-preview .pendenzen-export-table td,
.protocol-preview .bj-export-table th, .protocol-preview .bj-export-table td,
.protocol-preview .mg-export-table th, .protocol-preview .mg-export-table td {
  border: 1px solid #c7ced8; padding: 5px 8px; font-size: 0.85rem;
}
.protocol-preview .doc-foto { max-width: 180px; max-height: 180px; border-radius: 4px; margin: 4px 6px 4px 0; border: 1px solid #c7ced8; }
.protocol-preview .doc-foto-row { margin-top: 4px; }

.letterhead {
  border: 1px dashed #c7ced8;
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.letterhead img { max-height: 60px; }
.letterhead .lh-name { font-weight: 700; font-size: 1.1rem; color: #353535; }
.letterhead .lh-details { font-size: 0.85rem; color: #4b5563; }

@media print {
  .app-header, .box legend, .box > *:not(.protocol-preview), nav, .actions { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .box { border: none; padding: 0; margin: 0; }
  #tab-protokoll .box:not(:last-of-type) { display: none !important; }
  .protocol-preview { border: none; padding: 0; }
}
