:root {
  --fg-bg: #f3f4f6;
  --fg-surface: #ffffff;
  --fg-border: #e5e7eb;
  --fg-text: #111827;
  --fg-muted: #6b7280;
  --fg-primary: #2563eb;
  --fg-primary-dark: #1d4ed8;
  --fg-success: #15803d;
  --fg-warn: #b45309;
}

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

body {
  margin: 0;
  background: var(--fg-bg);
  color: var(--fg-text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
}

/* Links */

a {
  color: var(--fg-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout-Container */

.wrap,
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

.section {
  padding: 1.5rem 0 2.5rem;
}

/* Header / Navigation */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--fg-border);
}

.site-header > .wrap,
.site-header.wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

/* --- Patch: Logo im Header links bündiger ---
   Viele Seiten nutzen:
   <div class="wrap section">
     <header class="site-header wrap">
   Das führt optisch zu einer doppelten horizontalen Einrückung.
   Dieser Override entfernt nur die zusätzliche Innen-Padding-Zeile
   des Headers, ohne das restliche Layout zu verändern. */
.wrap.section > .site-header.wrap {
  padding-left: 0;
  padding-right: 0;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  height: 80px;
  width: auto;
  display: block;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.top-nav a {
  color: var(--fg-muted);
  text-decoration: none;
  padding: 0.25rem 0;
}

.top-nav a:hover {
  color: var(--fg-primary);
}

/* Karten, Inhalte */

.card {
  background: var(--fg-surface);
  border-radius: 14px;
  border: 1px solid var(--fg-border);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.meta {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* Suchkarte Startseite */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.actions {
  margin-top: 0.75rem;
  text-align: right;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .site-header > .wrap,
  .site-header.wrap {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .top-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .actions {
    text-align: left;
  }
}

/* Formulare */

label {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.15rem;
}

input,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="email"],
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid var(--fg-border);
  background: #f9fafb;
  color: var(--fg-text);
}

input:focus,
select:focus {
  outline: 2px solid var(--fg-primary);
  outline-offset: 1px;
  background: #ffffff;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: none;
  background: var(--fg-primary);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover,
.btn:hover {
  background: var(--fg-primary-dark);
}

button:active,
.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: #e5e7eb;
  color: #111827;
}

/* Tabelle (Startseite + Suche) */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

.table th,
.table td,
table th,
table td {
  padding: 0.55rem 0.4rem;
  text-align: left;
  border-bottom: 1px solid var(--fg-border);
}

.table th,
table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
}

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

.table tr:hover td,
table tr:hover td {
  background: #f9fafb;
}

/* Key-Value-Infos im Gutachten */

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.kv div {
  padding: 0.3rem 0.4rem;
  background: #f9fafb;
  border-radius: 0.5rem;
}

/* Alerts */

.alert {
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.alert.ok {
  background: #dcfce7;
  color: var(--fg-success);
}

.alert.warn {
  background: #fef3c7;
  color: var(--fg-warn);
}

/* E-Mail-Formular auf Detailseite */

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.action-row input[type="email"] {
  flex: 1 1 220px;
}

.action-row .btn {
  flex: 0 0 auto;
}

@media (max-width: 520px) {
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .action-row .btn {
    width: 100%;
    justify-content: center;
  }
}

.hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 0.4rem;
}

/* Footer */

.site-footer,
.footer {
  border-top: 1px solid var(--fg-border);
  background: #f9fafb;
  margin-top: 2.5rem;
}

.site-footer > .wrap,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.site-footer nav,
.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-footer a,
.footer a {
  color: var(--fg-muted);
}

.site-footer a:hover,
.footer a:hover {
  color: var(--fg-primary);
}

/* Responsiv Footer */

@media (max-width: 640px) {
  .site-footer > .wrap,
  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Sonstiges */

.small {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.alert.err {
  background: #fee2e2;
  color: #b91c1c;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

.donate {
  margin-top: 0.8rem;
}

button.button {
  /* manche Seiten benutzen class="button" */
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: none;
  background: var(--fg-primary);
  color: #fff;
}
/* Klickbare Ergebniszeilen / Mobile-Optimierung der Tabelle */
.result-row {
  cursor: pointer;
}

.result-kba-arrow {
  display: none;
  font-weight: 600;
  margin-left: 4px;
  color: #2563eb; /* gleiche Blau-Farbe wie Links/Buttons, falls vorhanden */
}

/* Mobile: Öffnen-Spalte ausblenden, Pfeil neben KBA anzeigen */
@media (max-width: 640px) {
  .table th.result-open,
  .table td.result-open {
    display: none;
  }

  .result-kba {
    white-space: nowrap;
  }

  .result-kba-arrow {
    display: inline-block;
  }
}
