/* ============================================================
   Urteilslotse – minimalistisches, lokales Design
   Nur System-Schriften, keine externen Ressourcen.
   ============================================================ */

:root {
    --bg:       #fbfbf9;
    --surface:  #ffffff;
    --ink:      #1a1c20;
    --ink-soft: #3a3d44;
    --muted:    #6b7077;
    --line:     #e6e7e2;
    --line-2:   #f0f1ec;

    --urteil:   #2b5c8a;   /* Blau */
    --bgbl:     #9a3b34;   /* Rot */
    --eu:       #8a6d1f;   /* Ocker */

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono:  ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;

    --r:    10px;
    --r-sm: 7px;
    --pill: 999px;
    --shadow-sm: 0 1px 2px rgba(20,22,28,.04), 0 1px 3px rgba(20,22,28,.05);
    --shadow:    0 4px 14px rgba(20,22,28,.07), 0 2px 6px rgba(20,22,28,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--urteil); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--urteil); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 940px; margin: 0 auto; padding: 0 24px; }

/* ---- Kopf / Navigation ---- */
.site-head {
    position: sticky; top: 0; z-index: 20;
    background: rgba(251,251,249,.85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.site-head .wrap {
    display: flex; align-items: center; gap: 16px;
    padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap;
}
.brand { font-family: var(--serif); font-size: 1.3rem; letter-spacing: -0.01em; }
.brand a { color: var(--ink); }
.brand a:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 20px; width: 100%; }
.site-head .brand { margin-right: 4px; }
.nav > a {
    font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--muted);
}
.nav > a:hover { color: var(--ink); text-decoration: none; }
.nav-user { color: var(--muted); font-size: 0.85rem; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.nav-rolle {
    font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase;
    letter-spacing: 0.05em; border: 1px solid var(--line); border-radius: var(--pill);
    padding: 1px 8px; color: var(--muted); background: var(--surface);
}

main { padding: 36px 0 90px; }

/* ---- Formularelemente ---- */
label {
    display: block; font-family: var(--mono); font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 7px;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]),
select, textarea {
    width: 100%; padding: 11px 13px;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    background: var(--surface); font: inherit; color: var(--ink);
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--urteil);
    box-shadow: 0 0 0 3px rgba(43,92,138,.15);
}
input[type=file] { font: inherit; color: var(--ink-soft); }
textarea { line-height: 1.55; }
.field { margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 11px 20px; border: 1px solid var(--ink); border-radius: var(--r-sm);
    background: var(--ink); color: #fff; font-family: var(--mono);
    font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase;
    cursor: pointer; transition: background .12s, border-color .12s, transform .04s;
    white-space: nowrap;
}
.btn:hover { background: #33363f; border-color: #33363f; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); border-color: var(--muted); }
.btn-danger { background: var(--bgbl); border-color: var(--bgbl); }
.btn-danger:hover { background: #84322c; border-color: #84322c; }

/* ---- Suche allgemein ---- */
.searchbar { display: flex; gap: 10px; }
.searchbar input { font-size: 1.02rem; padding: 13px 16px; border-radius: var(--r); }

.filters {
    display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end;
    margin-top: 16px;
}
.filters .field { margin-bottom: 0; }
.filters label { margin-bottom: 5px; }

/* ---- Startseite: Such-Hero ---- */
.suche-hero {
    max-width: 640px; margin: 6vh auto 0; text-align: center;
}
.suche-hero .hero-title {
    font-family: var(--serif); font-size: 2.4rem; line-height: 1.1;
    letter-spacing: -0.02em; margin: 0 0 10px;
}
.suche-hero .hero-sub { color: var(--muted); font-size: 1.05rem; margin: 0 0 26px; }
.suche-hero .searchbar { box-shadow: var(--shadow); border-radius: var(--r); }
.suche-hero .searchbar input { box-shadow: none; }
.suche-hero .filters { justify-content: center; text-align: left; }
.suche-hero .hero-count {
    margin-top: 22px; font-family: var(--mono); font-size: 0.74rem;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.adv { margin-top: 16px; }
.adv > summary {
    cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--muted);
}
.adv > summary::-webkit-details-marker { display: none; }
.adv > summary::before { content: "+"; font-size: 0.95rem; }
.adv[open] > summary::before { content: "–"; }
.adv > summary:hover { color: var(--ink); }

/* ---- Trefferliste ---- */
.count {
    font-family: var(--mono); font-size: 0.74rem; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.06em; margin: 26px 0 14px;
}
.treffer { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.treffer li {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r); padding: 18px 20px;
    transition: box-shadow .12s, border-color .12s;
}
.treffer li:hover { box-shadow: var(--shadow-sm); border-color: #dcddd7; }
.treffer h2 {
    font-family: var(--serif); font-size: 1.22rem; font-weight: 600;
    line-height: 1.3; margin: 6px 0 6px;
}

.art-tag {
    display: inline-block; font-family: var(--mono); font-size: 0.66rem;
    text-transform: uppercase; letter-spacing: 0.09em;
    border-left: 3px solid var(--muted); padding: 1px 0 1px 8px; color: var(--muted);
}
.art-urteil { border-color: var(--urteil); color: var(--urteil); }
.art-bgbl   { border-color: var(--bgbl);   color: var(--bgbl); }
.art-eu     { border-color: var(--eu);     color: var(--eu); }

.meta { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); margin-bottom: 6px; }
.meta span + span::before { content: " · "; }
.snippet { color: var(--ink-soft); font-size: 0.95rem; margin: 6px 0 0; }
.snippet mark { background: #fdeeb6; color: inherit; padding: 0 2px; border-radius: 2px; }

.tags { margin-top: 10px; }
.tag {
    display: inline-block; font-size: 0.75rem; color: var(--muted);
    border: 1px solid var(--line); border-radius: var(--pill);
    padding: 2px 11px; margin: 0 5px 5px 0; background: var(--surface);
}
a.tag:hover { border-color: var(--muted); color: var(--ink); text-decoration: none; }

/* ---- Detailseite ---- */
.doc-head { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 24px; }
.doc-head h1 { font-family: var(--serif); font-size: 1.95rem; line-height: 1.18; margin: 10px 0 0; letter-spacing: -0.01em; }
.dl { display: grid; grid-template-columns: 190px 1fr; gap: 0; margin: 0 0 26px; }
.dl dt {
    font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--muted); padding: 10px 0; border-bottom: 1px solid var(--line-2);
}
.dl dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.kennung { font-family: var(--mono); }

.volltext {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 22px; max-height: 440px; overflow: auto;
    white-space: pre-wrap; font-size: 0.9rem; line-height: 1.65; color: var(--ink-soft);
}

/* ---- Normenfolge ---- */
.normenfolge { margin: 0 0 26px; }
.nf-label { display: block; font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 9px; }
.nf-kette { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; align-items: center; }
.nf-kette li { display: flex; align-items: center; }
.nf-kette li:not(:last-child)::after { content: "→"; color: var(--muted); margin-left: 8px; }
.norm-chip {
    display: inline-block; background: #fbeedb; color: #7a5212;
    border: 1px solid #ecd3a6; border-radius: var(--pill);
    padding: 3px 12px; font-size: 0.85rem; font-family: var(--mono); text-decoration: none;
}
.norm-chip:hover { background: #f6e3c4; text-decoration: none; }

/* ---- Bezugsnetz ---- */
.bezug { margin: 8px 0 32px; }
.bezug-h { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.bezug-sub { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 18px 0 8px; font-weight: 400; }
.bezug-list { list-style: none; margin: 0; padding: 0; }
.bezug-list li { padding: 9px 0; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bezug-list .art-tag { margin: 0; }
.q-badge { font-family: var(--mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border: 1px solid var(--line); border-radius: var(--pill); padding: 1px 8px; }
.vdel { margin-left: auto; color: var(--muted); text-decoration: none; font-size: 1.15rem; line-height: 1; padding: 0 4px; }
.vdel:hover { color: var(--bgbl); text-decoration: none; }
.bezug-leer, .netz-leer { color: var(--muted); font-size: 0.95rem; }
.bezug-add { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.bezug-add select, .bezug-add input { width: auto; min-width: 160px; flex: 1; }
.bezug-add .btn { white-space: nowrap; }

.netz { margin: 6px 0 22px; }
.netz svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.netz svg text { font-family: var(--sans); fill: var(--ink-soft); }
.netz-knoten:hover circle, .netz-knoten:hover rect { stroke-width: 2.6; }
.netz-legende { margin-top: 10px; }
.netz-legende .leg { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-size: 0.76rem; color: var(--muted); }
.netz-legende .leg i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

/* ---- Hinweise / Leerzustand ---- */
.notice { padding: 13px 16px; border-radius: var(--r-sm); margin-bottom: 22px; font-size: 0.95rem; }
.notice-ok  { background: #e9f1e9; border: 1px solid #c2dcc2; color: #2c5a2c; }
.notice-err { background: #f6e5e3; border: 1px solid #e0bbb7; color: #7a2723; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty p { font-size: 1.05rem; }

/* art-spezifische Feldgruppen */
.art-felder { display: none; }
.art-felder.aktiv { display: block; }

/* ---- Auth ---- */
.auth-box { max-width: 360px; margin: 8vh auto 0; }
.auth-box h1 { font-family: var(--serif); font-size: 1.6rem; margin: 0 0 20px; text-align: center; }
.auth-box .btn { width: 100%; }
.auth-box .field { margin-bottom: 16px; }

/* ---- Benutzer-Tabelle ---- */
.utab { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.utab th, .utab td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.utab th { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 400; }
.utab .aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }
.utab select { width: auto; min-width: 120px; }

/* ---- Fußzeile ---- */
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; }
.site-foot .wrap { display: flex; gap: 22px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 44px; }
.site-foot a { font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.site-foot a:hover { color: var(--ink); }

/* ---- Rechtstexte ---- */
.legal { max-width: 720px; }
.legal h1 { font-family: var(--serif); font-size: 1.9rem; line-height: 1.2; margin: 0 0 8px; }
.legal .stand { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 26px; }
.legal h2 { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; margin: 30px 0 10px; }
.legal h3 { font-size: 1.02rem; font-weight: 600; margin: 20px 0 6px; }
.legal p, .legal li { color: var(--ink-soft); line-height: 1.7; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 5px; }
.legal .ph { background: #fbe8a6; color: #5a4500; padding: 0 4px; border-radius: 3px; font-style: normal; }
.legal address { font-style: normal; line-height: 1.7; }

/* ---- Responsiv ---- */
@media (max-width: 640px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .dl { grid-template-columns: 1fr; }
    .dl dt { border-bottom: none; padding-bottom: 0; }
    .dl dd { padding-top: 2px; }
    .suche-hero .hero-title { font-size: 1.9rem; }
    .nav { gap: 14px; }
    .nav-user { width: 100%; margin-left: 0; }
}

/* ---- Lesefassung (Volltext mit Randnummern) ---- */
html { scroll-behavior: smooth; }
.lese { max-width: 760px; }
.lese-h {
    font-family: var(--serif); font-size: 1.5rem; font-weight: 600;
    line-height: 1.25; letter-spacing: -0.01em; margin: 1.8em 0 .6em;
    scroll-margin-top: 84px;
}
.lese-h:first-child { margin-top: 0; }
.lese-p { margin: 0 0 1em; text-align: justify; hyphens: auto; color: var(--ink-soft); }
.rn-block {
    display: grid; grid-template-columns: 2.4rem 1fr; gap: 0 .7rem;
    margin: 0 0 1em; align-items: start; scroll-margin-top: 84px;
}
.rn-num {
    font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
    text-align: right; padding-top: .35em; text-decoration: none;
    -webkit-user-select: none; user-select: none; font-variant-numeric: tabular-nums;
}
.rn-num:hover { color: var(--urteil); text-decoration: none; }
.rn-text { text-align: justify; hyphens: auto; }
.rn-block:target .rn-text {
    background: #fdeeb6; border-radius: 6px;
    padding: 4px 10px; margin: -4px -10px;
}
.lese-toc {
    display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 24px;
    padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.lese-toc a {
    font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--muted);
}
.lese-toc a:hover { color: var(--ink); text-decoration: none; }

@media (max-width: 640px) {
    .rn-block { grid-template-columns: 1.9rem 1fr; gap: 0 .5rem; }
}
