/* Vertragsboard Web-App – ruhiges, professionelles Arbeitsdesign (an die Windows-App angelehnt) */
:root {
  --blau: #0F62FE; --blau-dunkel: #0B4FD1; --blau-hell: #EAF1FF; --tinte: #111827; --text: #1F2937; --leise: #6B7280;
  --linie: #E5E7EB; --linie2: #D1D5DB; --flaeche: #FFFFFF; --grund: #F5F7FA; --zeile: #F9FAFB;
  --gruen: #166534; --gruen-bg: #DCFCE7; --rot: #B91C1C; --rot-bg: #FEE2E2; --gelb: #B45309; --gelb-bg: #FEF3C7;
  --violett: #5B21B6; --violett-bg: #EDE9FE; --tuerkis: #065F46; --tuerkis-bg: #D1FAE5; --grau-bg: #F3F4F6;
  --radius: 10px; --schatten: 0 1px 2px rgb(17 24 39 / .05), 0 6px 20px -10px rgb(17 24 39 / .18);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-size: 14px; line-height: 1.45; color: var(--text); background: var(--grund); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blau); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }
.laden, .noscript { padding: 3rem; text-align: center; color: var(--leise); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Knöpfe, Felder ---------- */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 34px; padding: 0 .9rem; font-weight: 600; font-size: 13.5px;
  color: var(--text); background: var(--flaeche); border: 1px solid var(--linie2); border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.knopf:hover { background: var(--zeile); border-color: #9CA3AF; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
.knopf.primaer { color: #fff; background: var(--blau); border-color: var(--blau); }
.knopf.primaer:hover { background: var(--blau-dunkel); border-color: var(--blau-dunkel); }
.knopf.gefahr { color: var(--rot); border-color: #FCA5A5; }
.knopf.gefahr:hover { color: #fff; background: var(--rot); border-color: var(--rot); }
.knopf.klein { height: 28px; padding: 0 .6rem; font-size: 12.5px; }
.knopf.symbol { width: 34px; padding: 0; }
.feld { display: block; margin-bottom: .8rem; }
.feld > span { display: block; margin-bottom: .25rem; font-size: 12.5px; font-weight: 600; color: var(--leise); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; height: 34px; padding: 0 .6rem; background: var(--flaeche); border: 1px solid var(--linie2); border-radius: 8px; }
textarea { height: auto; min-height: 80px; padding: .5rem .6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blau); box-shadow: 0 0 0 3px rgb(15 98 254 / .16); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--zeile); color: var(--leise); }
input[type=checkbox], input[type=radio] { accent-color: var(--blau); }
.haken { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.drei { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }

/* ---------- Anmeldung ---------- */
.login-seite { min-height: 100%; display: grid; place-items: center; padding: 2rem 1rem; background: linear-gradient(160deg, #F5F7FA 0%, #EAF1FF 100%); }
.login-karte { width: 100%; max-width: 400px; padding: 2rem 2rem 1.6rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 16px; box-shadow: var(--schatten); }
.login-karte .marke { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.4rem; }
.login-karte .marke img { width: 44px; height: 44px; }
.login-karte h1 { margin: 0; font-size: 1.35rem; color: var(--tinte); }
.login-karte .marke p { margin: 0; color: var(--leise); font-size: 13px; }
.login-karte .knopf.primaer { width: 100%; height: 40px; margin-top: .4rem; }
.login-fuss { margin-top: 1.2rem; font-size: 12px; text-align: center; color: var(--leise); }

/* ---------- Rahmen ---------- */
.rahmen { display: flex; flex-direction: column; height: 100vh; }
.kopf { display: flex; align-items: center; gap: .75rem; height: 54px; padding: 0 1rem; color: #fff; background: #0B1F44; flex: none; }
.kopf .marke { display: flex; align-items: center; gap: .6rem; min-width: 0; font-weight: 700; font-size: 15px; color: #fff; text-decoration: none; }
.kopf .marke img { width: 30px; height: 30px; }
.kopf .marke small { display: block; font-weight: 400; font-size: 11.5px; color: #A8B8D8; }
.kopf .rechts { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.kopf .knopf { color: #E5ECF8; background: transparent; border-color: rgb(255 255 255 / .22); }
.kopf .knopf:hover { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .4); }
.online { display: inline-flex; align-items: center; gap: .4rem; padding: 0 .6rem; height: 30px; font-size: 12.5px; color: #CFE0FF; background: rgb(255 255 255 / .08); border: 0; border-radius: 999px; cursor: pointer; }
.online i { width: 8px; height: 8px; border-radius: 50%; background: #34D399; }
.menue { position: relative; }
.menue-liste { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: .35rem; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; box-shadow: var(--schatten); }
.menue-liste button { display: block; width: 100%; padding: .5rem .7rem; text-align: left; background: none; border: 0; border-radius: 6px; cursor: pointer; }
.menue-liste button:hover { background: var(--blau-hell); }
.menue-liste hr { margin: .3rem 0; border: 0; border-top: 1px solid var(--linie); }
.menue-liste .wer { padding: .45rem .7rem .55rem; font-size: 12.5px; color: var(--leise); border-bottom: 1px solid var(--linie); margin-bottom: .3rem; }

.werkzeug { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; padding: .6rem 1rem; background: var(--flaeche); border-bottom: 1px solid var(--linie); flex: none; }
.segment { display: inline-flex; padding: 3px; background: var(--grau-bg); border-radius: 9px; }
.segment button { height: 28px; padding: 0 .9rem; font-weight: 600; font-size: 13px; color: var(--leise); background: none; border: 0; border-radius: 7px; cursor: pointer; }
.segment button[aria-pressed="true"] { color: var(--tinte); background: var(--flaeche); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.segment button b { margin-left: .3rem; font-weight: 600; color: var(--leise); }
.werkzeug select { width: auto; min-width: 180px; }
.werkzeug .suche { width: 260px; }
.werkzeug .rechts { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

.haupt { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(520px, 1.25fr); flex: 1; min-height: 0; }
.liste { min-height: 0; overflow: auto; background: var(--flaeche); border-right: 1px solid var(--linie); }
.detail { min-height: 0; display: flex; flex-direction: column; background: var(--grund); }

/* ---------- Tabelle ---------- */
table.vorgaenge { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.vorgaenge th { position: sticky; top: 0; z-index: 2; padding: .5rem .55rem; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  color: var(--leise); background: #F8FAFC; border-bottom: 1px solid var(--linie); white-space: nowrap; cursor: pointer; user-select: none; }
.vorgaenge th[aria-sort]::after { content: " ▲"; font-size: 9px; }
.vorgaenge th[aria-sort="descending"]::after { content: " ▼"; }
.vorgaenge td { padding: .5rem .55rem; border-bottom: 1px solid #F0F2F5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.vorgaenge tbody tr { cursor: pointer; }
.vorgaenge tbody tr:hover td { background: #F5F8FF; }
.vorgaenge tbody tr.gewaehlt td { background: var(--blau-hell); }
.vorgaenge tbody tr.gewaehlt td:first-child { box-shadow: inset 3px 0 0 var(--blau); }
.vorgaenge tr.warn td.w { color: var(--gelb); font-weight: 700; }
.vorgaenge td.name { font-weight: 600; color: var(--tinte); }
.vorgaenge td.klein { color: var(--leise); font-size: 12px; }
.leer-liste { padding: 3rem 1rem; text-align: center; color: var(--leise); }

.pill { display: inline-block; padding: .1rem .55rem; font-size: 11.5px; font-weight: 600; border-radius: 999px; white-space: nowrap; }
.st-offen { color: var(--rot); background: var(--rot-bg); }
.st-erstellt { color: #1E40AF; background: #DBEAFE; }
.st-unterschrift { color: var(--violett); background: var(--violett-bg); }
.st-ra { color: var(--tuerkis); background: var(--tuerkis-bg); }
.st-fertig { color: var(--gruen); background: var(--gruen-bg); }
.st-archiv { color: #4B5563; background: var(--grau-bg); }
.pill.warn { color: var(--gelb); background: var(--gelb-bg); }
.pill.blass { color: var(--leise); background: var(--grau-bg); }
.balken { display: inline-flex; align-items: center; gap: .4rem; font-size: 12px; color: var(--leise); }
.balken span { display: inline-block; width: 44px; height: 6px; overflow: hidden; background: #E5E7EB; border-radius: 999px; }
.balken span i { display: block; height: 100%; background: var(--blau); border-radius: 999px; }

/* ---------- Detail ---------- */
.detail-leer { margin: auto; text-align: center; color: var(--leise); }
.detail-leer .gross { font-size: 40px; }
.detail-kopf { padding: 1rem 1.25rem .8rem; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.detail-kopf h2 { margin: 0; font-size: 19px; color: var(--tinte); }
.detail-kopf .unter { margin: .1rem 0 .55rem; color: var(--leise); font-size: 13px; }
.detail-kopf .reihe { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.detail-kopf .meta { margin-left: auto; font-size: 12px; color: var(--leise); }
.reiter { display: flex; gap: .2rem; padding: 0 1rem; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.reiter button { height: 38px; padding: 0 .9rem; font-weight: 600; color: var(--leise); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
.reiter button[aria-selected="true"] { color: var(--blau); border-bottom-color: var(--blau); }
.detail-inhalt { flex: 1; min-height: 0; overflow: auto; padding: 1rem 1.25rem 1.5rem; }
.abschnitt { margin: .3rem 0 .6rem; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--leise); }
.karte { padding: 1rem 1.1rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.karte + .abschnitt { margin-top: 1.3rem; }
.schritt { display: grid; grid-template-columns: 18px minmax(150px, 230px) 1fr auto auto 58px; align-items: center; gap: .5rem; padding: .4rem .5rem; border-radius: 8px; }
.schritt + .schritt { border-top: 1px solid #F2F4F7; }
.schritt.warn { background: #FFFBEB; box-shadow: inset 3px 0 0 #F59E0B; }
.schritt .punkt { font-size: 14px; text-align: center; color: #9CA3AF; }
.schritt .punkt.done { color: #16A34A; }
.schritt .punkt.unclear { color: #D97706; }
.schritt label { font-weight: 600; color: var(--tinte); }
.schritt input { height: 30px; }
.schritt .wer { justify-self: center; padding: .05rem .45rem; font-size: 11.5px; font-weight: 700; color: #1E40AF; background: #DBEAFE; border-radius: 6px; }
.schritt .wer.leer { color: #9CA3AF; background: none; font-weight: 400; }
.schritt .warnknopf { width: 30px; height: 30px; font-weight: 800; color: #9CA3AF; background: var(--flaeche); border: 1px solid var(--linie2); border-radius: 7px; cursor: pointer; }
.schritt .warnknopf.an { color: #fff; background: #F59E0B; border-color: #F59E0B; }
.schritt .notiz { grid-column: 2 / -1; margin-top: -.1rem; font-size: 12.5px; color: var(--gelb); }
.formular-raster { display: grid; grid-template-columns: 190px 1fr; gap: .55rem 1rem; align-items: center; }
.formular-raster > label { text-align: right; font-weight: 600; color: var(--leise); font-size: 13px; }
.formular-raster .mit-knopf { display: flex; gap: .4rem; }
.formular-raster .plzort { display: grid; grid-template-columns: 100px 1fr; gap: .5rem; }
.aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .7rem 1.25rem; background: var(--flaeche); border-top: 1px solid var(--linie); }
.aktionen .rechts { margin-left: auto; display: flex; flex-wrap: wrap; gap: .45rem; }
.ungespeichert { font-size: 12.5px; font-weight: 600; color: var(--gelb); }

/* ---------- Dialoge ---------- */
dialog { padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 64px -16px rgb(0 0 0 / .35); max-width: min(94vw, 560px); width: 100%; color: var(--text); }
dialog.breit { max-width: min(96vw, 860px); }
dialog::backdrop { background: rgb(15 23 42 / .45); }
.dlg-kopf { padding: 1.1rem 1.4rem .3rem; }
.dlg-kopf h3 { margin: 0; font-size: 17px; color: var(--tinte); }
.dlg-kopf p { margin: .25rem 0 0; color: var(--leise); }
.dlg-inhalt { padding: .8rem 1.4rem 1rem; max-height: 70vh; overflow: auto; }
.dlg-fuss { display: flex; gap: .5rem; justify-content: flex-end; padding: .8rem 1.4rem 1.1rem; border-top: 1px solid var(--linie); }
.dlg-fuss .links { margin-right: auto; }
.va-karte { padding: .9rem 1rem .3rem; margin-bottom: .8rem; border: 1px solid var(--linie); border-radius: 10px; }
.va-karte h4 { margin: 0 0 .7rem; font-size: 14px; color: var(--tinte); }
.va-karte h4 small { font-weight: 400; color: var(--leise); }

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 220px 1fr; flex: 1; min-height: 0; }
.admin nav { padding: 1rem .6rem; background: var(--flaeche); border-right: 1px solid var(--linie); }
.admin nav button { display: block; width: 100%; padding: .55rem .8rem; margin-bottom: .15rem; text-align: left; font-weight: 600; color: var(--leise); background: none; border: 0; border-radius: 8px; cursor: pointer; }
.admin nav button[aria-current="true"] { color: var(--blau); background: var(--blau-hell); }
.admin nav h3 { margin: 0 .8rem .8rem; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); }
.admin-inhalt { min-height: 0; overflow: auto; padding: 1.4rem 1.8rem 3rem; }
.admin-inhalt h2 { margin: 0 0 .25rem; font-size: 20px; color: var(--tinte); }
.admin-inhalt > p.hinweis { margin: 0 0 1.2rem; color: var(--leise); max-width: 70ch; }
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; overflow: hidden; }
.tabelle th { padding: .5rem .6rem; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--leise); background: #F8FAFC; border-bottom: 1px solid var(--linie); }
.tabelle td { padding: .35rem .6rem; border-bottom: 1px solid #F0F2F5; vertical-align: middle; }
.tabelle td.mitte { text-align: center; }
.tabelle input[type=text], .tabelle input[type=number], .tabelle select { height: 30px; }
.tabelle input[type=number] { width: 80px; }
.admin-leiste { display: flex; gap: .5rem; margin-top: 1rem; }
.aktivitaet { font-size: 13px; }
.aktivitaet td { white-space: nowrap; }
.aktivitaet td.text { white-space: normal; }

/* ---------- Meldungen ---------- */
.toast-bereich { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.toast { max-width: 380px; padding: .7rem 1rem; color: #fff; background: #111827; border-radius: 10px; box-shadow: var(--schatten); font-size: 13.5px; animation: rein .2s ease-out; }
.toast.fehler { background: var(--rot); }
.toast.ok { background: #065F46; }
@keyframes rein { from { transform: translateY(8px); opacity: 0; } }
.fehlerzeile { margin: 0 0 .8rem; padding: .6rem .8rem; color: var(--rot); background: var(--rot-bg); border-radius: 8px; font-size: 13px; }
.hinweiszeile { margin: 0 0 .8rem; padding: .6rem .8rem; color: #1E3A8A; background: var(--blau-hell); border-radius: 8px; font-size: 13px; }

/* ---------- Schmale Bildschirme ---------- */
.zurueck-mobil { display: none !important; }
@media (max-width: 1100px) {
  .haupt { grid-template-columns: 1fr; }
  .detail { position: fixed; inset: 54px 0 0 0; z-index: 20; }
  .haupt:not(.mit-detail) .detail { display: none; }
  .zurueck-mobil { display: inline-flex !important; }
  .werkzeug .suche { width: 100%; order: 5; }
  .formular-raster { grid-template-columns: 1fr; }
  .formular-raster > label { text-align: left; margin-bottom: -.35rem; }
  .schritt { grid-template-columns: 18px 1fr auto auto; }
  .schritt label { grid-column: 2 / -1; }
  .schritt input { grid-column: 1 / 3; }
  .schritt .notiz { grid-column: 1 / -1; }
  .detail-kopf .zurueck-mobil { margin-bottom: .5rem; }
  .aktionen { flex-wrap: wrap; }
  .schritt .wer { display: none; }
  .admin { grid-template-columns: 1fr; }
  .admin nav { display: flex; overflow-x: auto; gap: .2rem; padding: .5rem; border-right: 0; border-bottom: 1px solid var(--linie); }
  .admin nav h3 { display: none; }
  .admin nav button { width: auto; white-space: nowrap; }
  .kopf .marke small, .online span { display: none; }
}
@media print {
  .kopf, .werkzeug, .liste, .aktionen, .reiter { display: none !important; }
  .haupt { display: block; }
}
