:root {
  --blau: #0b3c5d;
  --blau-hell: #e8f0f6;
  --akzent: #1f6fa8;
  --text: #1d2730;
  --grau: #5b6873;
  --linie: #d5dde3;
  --hinter: #f5f7f9;
  --zeile-hover: #eef5fb;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--hinter);
  display: flex;
  flex-direction: column;
}

.kopf {
  background: var(--blau);
  color: #fff;
  padding: 1rem 1.5rem .8rem;
}
.kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.kopf h1 { margin: 0; font-size: 1.55rem; font-weight: 600; letter-spacing: .01em; }
.btn-schliessen {
  flex-shrink: 0; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
  padding: .45rem 1rem; border-radius: 4px; border: 1px solid #c62828;
  background: #c62828; color: #fff; white-space: nowrap;
}
.btn-schliessen:hover, .btn-schliessen:focus-visible { background: #a31f1f; border-color: #a31f1f; }
.stand { margin: .25rem 0 0; font-size: .85rem; opacity: .8; }

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
}

/* ---------- Trefferliste (links) ---------- */
.liste {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--linie);
  border-radius: 6px;
}
.liste-kopf {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: .7rem 1rem; border-bottom: 1px solid var(--linie);
}
.liste-kopf h2 { margin: 0; font-size: 1.1rem; color: var(--blau); }
.trefferzahl { color: var(--grau); font-size: .9rem; }
.tabelle-wrap { flex: 1; overflow: auto; min-height: 0; }

table.treffer { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .92rem; }
col.c-bez { width: 29%; }
col.c-dat { width: 20%; }
col.c-tit { width: 51%; }
.treffer th {
  position: sticky; top: 0; z-index: 1;
  background: var(--blau-hell); color: var(--blau);
  text-align: left; font-weight: 600; font-size: .85rem;
  padding: .5rem .6rem; border-bottom: 2px solid var(--linie);
  cursor: pointer; user-select: none; line-height: 1.2;
}
.treffer th::after { content: ""; margin-left: .3em; font-size: .75em; }
.treffer th[aria-sort="ascending"]::after { content: "▲"; }
.treffer th[aria-sort="descending"]::after { content: "▼"; }
.treffer td {
  padding: .45rem .6rem; border-bottom: 1px solid #edf0f2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top;
}
.treffer tbody tr { cursor: pointer; }
.treffer tbody tr:hover, .treffer tbody tr:focus { background: var(--zeile-hover); outline: none; }
.treffer tbody tr:focus-visible { box-shadow: inset 3px 0 0 var(--akzent); }
.treffer .bez { font-weight: 600; }
.treffer .dat small { display: block; color: var(--grau); font-size: .78rem; }
.badge {
  display: inline-block; font-size: .7rem; font-weight: 600; padding: 0 .35em; margin-left: .3em;
  border-radius: 3px; background: #fff3d6; color: #7a5600; border: 1px solid #f0d58c; vertical-align: 1px;
}
.leer { padding: 1.5rem; color: var(--grau); text-align: center; }

/* ---------- Recherche (rechts) ---------- */
.recherche {
  order: -1;               /* Recherche links, Trefferliste rechts */
  overflow: auto; min-height: 0;
  background: #fff; border: 1px solid var(--linie); border-radius: 6px;
  padding: .9rem 1.25rem 1.25rem;
}
.recherche h2 { margin: 0 0 .5rem; font-size: 1.35rem; color: var(--blau); }
.intro { display: flex; gap: 1rem; align-items: flex-start; margin: 0 0 1rem; line-height: 1.5; color: #33414d; }
.intro p { margin: 0; }
.portrait {
  width: 96px; height: auto; flex-shrink: 0;
  border-radius: 6px; border: 1px solid var(--linie); box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
fieldset {
  border: 1px solid var(--linie); border-radius: 6px;
  margin: 0 0 .9rem; padding: .6rem .9rem .8rem;
}
legend { font-weight: 600; color: var(--blau); padding: 0 .35rem; }
.nr {
  display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; margin-right: .3em;
  border-radius: 50%; background: var(--blau); color: #fff; font-size: .8rem;
}
.optionen { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.optionen label, .check { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.check { margin-top: .5rem; }
.zeile { display: flex; flex-wrap: wrap; gap: .8rem; }
.zeile .feld { flex: 1 1 10rem; }
.zeile .feld.breit { flex: 2 1 14rem; }
.feld { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--grau); margin-top: .35rem; }
select, input[type="search"] {
  font: inherit; font-size: .95rem; color: var(--text);
  padding: .4rem .5rem; border: 1px solid #b9c5ce; border-radius: 4px; background: #fff; width: 100%;
}
select:focus, input:focus { outline: 2px solid var(--akzent); outline-offset: 0; border-color: var(--akzent); }
.aktionen { display: flex; justify-content: flex-end; }
.hinweis { font-size: .78rem; color: var(--grau); line-height: 1.35; }

.btn {
  font: inherit; font-size: .92rem; cursor: pointer;
  padding: .45rem 1rem; border-radius: 4px; border: 1px solid var(--blau);
  background: var(--blau); color: #fff;
}
.btn:hover { background: var(--akzent); border-color: var(--akzent); }
.btn.sekundaer { background: #fff; color: var(--blau); }
.btn.sekundaer:hover { background: var(--blau-hell); }

/* ---------- Detailfenster ---------- */
dialog#detail {
  width: min(900px, 94vw); max-height: 90vh; padding: 0;
  border: none; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: none; flex-direction: column;
}
dialog#detail[open] { display: flex; }
dialog::backdrop { background: rgba(11, 30, 45, .55); }
.detail-kopf {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  background: var(--blau); color: #fff; padding: 1rem 1.25rem;
}
.detail-kopf h2 { margin: .15rem 0 0; font-size: 1.3rem; }
.d-bereich { margin: 0; font-size: .85rem; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.detail-inhalt { overflow: auto; padding: 1rem 1.25rem; }
.felder { display: grid; grid-template-columns: 13rem 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.felder dt { font-weight: 600; color: var(--grau); font-size: .9rem; }
.felder dd { margin: 0; overflow-wrap: anywhere; }
.felder a { color: var(--akzent); }
.detail-inhalt h3 { font-size: 1rem; color: var(--blau); border-bottom: 1px solid var(--linie); padding-bottom: .3rem; }
.fliesstext p { margin: 0 0 .6rem; line-height: 1.55; }
.detail-fuss { padding: .75rem 1.25rem; border-top: 1px solid var(--linie); display: flex; justify-content: flex-end; }
mark { background: #ffe58a; padding: 0 .1em; }

/* ---------- schmale Bildschirme ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .liste { min-height: 70vh; }
  .felder { grid-template-columns: 1fr; }
  .felder dt { margin-top: .4rem; }
}
@media print {
  .recherche, .kopf .stand, .btn-schliessen { display: none; }
  .layout { display: block; }
  .tabelle-wrap { overflow: visible; }
}
