/* Wiki-Tab — nutzt die Farbvariablen aus index.html (--muted, --bg, --fg …). */

.wiki-searchbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
/* P2-8: 33 px hoch und damit unter dem 44-px-Mindestmass fuer Bedienelemente
   (Spec §6). Die Schaltflaechen daneben sind seit P2-2 bereits 44 px hoch. */
.wiki-searchbar input[type="search"] {
  flex: 1 1 260px;
  min-width: 200px;
  padding: 10px 12px;
  min-height: 44px;
  box-sizing: border-box;
}

.wiki-hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.wiki-muted { color: var(--muted); font-size: 13px; }

.wiki-cat { margin-bottom: 18px; }
.wiki-cat h3 { margin: 0 0 6px; font-size: 14px; }
.wiki-list { list-style: none; margin: 0; padding: 0; }
/* Nachtrag Phase 3: Die Seitenliste ist eine NAVIGATION, keine Textliste. Bei
   der Regressionsprüfung waren die 48 Verweise nur rund 20 px hoch und damit
   unter dem Mindestmaß von 44 px aus Spec §6. Der Verweis füllt jetzt die
   Zeilenhöhe aus — anklickbar ist die ganze Zeile, nicht nur die Schrift. */
.wiki-list li {
  padding: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 44px;
}
.wiki-list li > a {
  display: flex;
  align-items: center;
  min-height: 44px;
  flex: 1 1 auto;
}

.wiki-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--border);
  color: var(--muted);
  margin-left: 4px;
}
/* Toenung als Flaeche, Volltonfarbe als Schrift — ein Volltonhintergrund mit
   geerbter dunkler Schrift waere auf Hell nicht lesbar (P2-1). */
.wiki-badge-file { background: var(--accent-weak); color: var(--accent); }
.wiki-badge-warn { background: var(--orange-weak); color: var(--orange); }

/* Dieselbe Regel für die Suchtreffer: der Titel ist der Verweis zur Seite. */
.wiki-hit {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.wiki-hit > div:first-child > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.wiki-snippet { color: var(--muted); font-size: 13px; margin-top: 3px; }

.wiki-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.wiki-title { margin: 0 0 4px; }
.wiki-meta { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

.wiki-warn {
  border: 1px solid var(--orange);
  background: var(--orange-weak);
  padding: 9px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
}

.wiki-body { line-height: 1.55; }
.wiki-body h1 { font-size: 20px; margin: 18px 0 8px; }
.wiki-body h2 { font-size: 17px; margin: 16px 0 7px; }
.wiki-body h3 { font-size: 15px; margin: 14px 0 6px; }
.wiki-body table { margin: 10px 0; }
.wiki-body th, .wiki-body td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
}
.wiki-body pre {
  background: var(--surface-2);
  padding: 9px 11px;
  border-radius: 5px;
  overflow-x: auto;
}
.wiki-body code { background: var(--border-soft); padding: 1px 4px; border-radius: 3px; }
.wiki-body img { max-width: 100%; height: auto; }
.wiki-body blockquote {
  margin: 10px 0;
  padding-left: 11px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}

.wiki-section { margin-top: 24px; }
.wiki-section h3 { font-size: 14px; margin: 0 0 8px; }

.wiki-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wiki-gallery img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.wiki-attach { width: 100%; font-size: 13px; }
.wiki-attach th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; }
.wiki-attach td, .wiki-attach th {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}

.wiki-upload { margin-top: 10px; display: flex; gap: 10px; align-items: center; }

/* P2-4: Beschriftung und Feld sind jetzt Geschwister (label[for] + Feld)
   statt ineinander verschachtelt — damit zeigt die Beschriftung auf ihr Feld
   und Hilfsmittel lesen beides zusammen. Der schmale Abstand zwischen
   Beschriftung und Feld entsteht ueber `gap` am Formular. */
.wiki-form { display: flex; flex-direction: column; gap: 4px; max-width: 900px; }
.wiki-form label { font-size: 13px; color: var(--muted); }
.wiki-form input, .wiki-form select, .wiki-form textarea {
  padding: 10px 12px;
  font-size: 14px;
  color: inherit;
  min-height: 44px;
  margin-bottom: 8px;
}
.wiki-form textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.45;
  resize: vertical;
}

/* Die Freigabe-Markierung behaelt ihre Form: Kaestchen links, langer
   Erklaertext rechts. */
.wiki-form .wiki-check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 2px; line-height: 1.45; }
.wiki-form .wiki-check input { min-height: 20px; width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; }

.wiki-raw {
  background: var(--surface-2);
  padding: 11px;
  border-radius: 5px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
}

.wiki-check {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 8px !important;
  line-height: 1.45;
}
.wiki-check input { flex: 0 0 auto; margin-top: 2px; }

/* Tabellen ohne Kopfzeile im Quellwiki.
   JSPWiki rendert dort durchgehend <td>, nie <th>. Markdown verlangt aber eine
   Kopfzeile, deshalb erzeugt der Konverter eine leere — sachlich richtig, nur
   optisch ein leerer Streifen. Hier wird er ausgeblendet. */
.wiki-body thead tr:has(th:empty:only-child),
.wiki-body thead tr.wiki-leerer-kopf { display: none; }
.wiki-body thead th:empty { padding: 0; border: 0; height: 0; }

/* Hervorhebung der Fundstelle im Suchausschnitt (P2-6).
   Die Marke kommt aus `ts_headline` im Core; das Dashboard setzt sie erst
   NACH dem Escapen und nur für genau diese eine Ersetzung (siehe wiki.js). */
.wiki-snippet mark {
  background: var(--yellow-weak);
  color: var(--text);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}
