/* Privatgeräte-Erklärung – Stylesheet
   Systemschriften, keine externen Ressourcen (Datenschutz). */

:root {
  --pri: #1f6f78; --pri-dk: #164f56; --pri-lt: #e4f0f1;
  --ink: #1d2327; --ink-2: #4b555c; --line: #d5dadd; --bg: #f6f7f8; --white: #fff;
  --st-rot: #fbe4e2; --st-orange: #fdebd2; --st-gelb: #fbf4c6; --st-gruen: #e0f1dc;
  --st-rot-b: #d9a19b; --st-orange-b: #e3b57a; --st-gelb-b: #d6c66a; --st-gruen-b: #92c189;
  --err: #a5281b; --ok: #2f6b2a;
  --r: 4px;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--pri-dk); }
a:hover { color: var(--pri); }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
code { font-family: Consolas, "DejaVu Sans Mono", monospace; font-size: .92em; }

/* Kopf */
header.site { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--white); border-top: 5px solid var(--pri); border-bottom: 1px solid var(--line); padding: .7rem 1.5rem; }
.brand { display: flex; align-items: center; gap: .9rem; }
.brand img { max-height: 46px; max-width: 160px; }
.brand .inst { font-weight: 600; font-size: 1.08rem; }
.brand .app { color: var(--ink-2); font-size: .88rem; }
.who { display: flex; gap: .9rem; align-items: center; font-size: .9rem; color: var(--ink-2); flex-wrap: wrap; }
.who .role { background: var(--pri-lt); color: var(--pri-dk); padding: .05rem .5rem; border-radius: var(--r); }
nav.main { background: var(--white); border-bottom: 1px solid var(--line); padding: 0 1.5rem; display: flex; gap: .2rem; flex-wrap: wrap; }
nav.main a { padding: .65rem .8rem; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; }
nav.main a[aria-current] { color: var(--pri-dk); border-bottom-color: var(--pri); font-weight: 600; }
nav.main a:hover { color: var(--ink); }

main { max-width: 1400px; margin: 0 auto; padding: 1.4rem 1.5rem 3rem; }
main.narrow, .narrow { max-width: 640px; }
h1 { font-size: 1.55rem; font-weight: 600; margin: .2rem 0 1.1rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; font-weight: 600; margin: 1.6rem 0 .6rem; }
footer.site { text-align: center; color: var(--ink-2); font-size: .8rem; padding: 1rem; }
.hint { color: var(--ink-2); font-size: .9rem; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.c { text-align: center; }

/* Meldungen */
.msg { padding: .7rem 1rem; border-radius: var(--r); margin: 0 0 1rem; border-left: 4px solid; background: var(--white); }
.msg ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.msg-ok { border-color: var(--ok); background: #eef6ec; }
.msg-err { border-color: var(--err); background: #fbecea; }
.msg-info { border-color: var(--pri); background: var(--pri-lt); }
.warn { color: var(--err); font-weight: 600; }
.report { margin-bottom: 1.4rem; }
.report h2 { margin-top: 0; }
tr.r-ok td:last-child { color: var(--ok); }
tr.r-err td:last-child { color: var(--err); }

/* Schaltflächen */
.btn { display: inline-block; background: var(--pri); color: #fff; border: 1px solid var(--pri); border-radius: var(--r);
  padding: .5rem 1rem; font: inherit; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { background: var(--pri-dk); color: #fff; }
.btn-sec { background: var(--white); color: var(--pri-dk); border-color: var(--line); }
.btn-sec:hover { background: var(--pri-lt); color: var(--pri-dk); }
.btn-link { background: none; border-color: transparent; color: var(--ink-2); }
.btn-link:hover { background: none; color: var(--ink); text-decoration: underline; }
.btn-sm { padding: .3rem .65rem; font-size: .88rem; }
.btn-x { background: none; border: none; color: var(--pri-dk); cursor: pointer; font: inherit; font-size: .88rem; padding: .1rem .25rem; text-decoration: underline; }
.btn-x.danger { color: var(--err); }
form.inline { display: inline; }

/* Formulare */
.form label { display: block; margin: 0 0 .85rem; font-size: .92rem; color: var(--ink-2); }
.form input[type=text], .form input:not([type]), .form input[type=email], .form input[type=password], .form input[type=number],
.form input[type=search], .form input[type=file], .form select, .form textarea, .tools input[type=search] {
  display: block; width: 100%; margin-top: .25rem; padding: .48rem .6rem; border: 1px solid #bfc6ca; border-radius: var(--r);
  font: inherit; color: var(--ink); background: var(--white); }
.form textarea { resize: vertical; }
.form input.num { width: 7rem; }
.form label.opt { display: block; position: relative; padding-left: 1.65rem; color: var(--ink); font-size: .95rem; }
.form label.opt > input { position: absolute; left: 0; top: .3rem; margin: 0; }
.form label.inl { display: inline-flex; gap: .4rem; align-items: center; margin: 0; white-space: nowrap; color: var(--ink); font-size: .95rem; }
.form label.inl input { margin: 0; flex: none; }
.form label.strong { font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; margin: 0 0 1rem; background: var(--white); }
legend { font-weight: 600; padding: 0 .3rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.block { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.block h2 { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.2rem; }
.addrow { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .6rem 0 1.4rem; }
.addrow input:not([type=checkbox]), .addrow select { display: inline-block; width: auto; flex: 1 1 240px; margin: 0; }
.addrow input.num { flex: 0 0 6rem; }
.preview { max-height: 60px; border: 1px solid var(--line); padding: 4px; background: #fff; }
.preview.fav { max-height: 32px; }
.schemes { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; }
.scheme { display: inline-flex !important; align-items: center; gap: .35rem; margin: 0 !important; color: var(--ink) !important; }
.sw { width: 1.1rem; height: 1.1rem; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); display: inline-block; }
.tplform { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.2rem; margin: 1rem 0; }
.tplform h2 { margin-top: 0; }
.tplform textarea { font-family: Consolas, "DejaVu Sans Mono", monospace; font-size: .9rem; }

/* Erklärungsformular */
.decl .sub { margin: .3rem 0 .8rem 1.7rem; padding-left: .9rem; border-left: 3px solid var(--pri-lt); }
.decl .rows .row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.decl .rows .row input:not([type=checkbox]) { flex: 1 1 200px; margin: 0; display: inline-block; width: auto; }
.decl .tbl.apps td:first-child { width: 2rem; }
.decl-list li { margin-bottom: .45rem; }
.signrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; max-width: 640px; margin-top: .8rem; }
[hidden] { display: none !important; }

/* Tabs und Werkzeugleisten */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .45rem .8rem; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--pri-dk); border-bottom-color: var(--pri); font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .8rem; }
.toolbar .tabs { margin-bottom: 0; border-bottom: none; }
.tools { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.tools input[type=search] { width: 15rem; margin: 0; }
.tools label.inl { display: inline-flex; gap: .35rem; align-items: center; font-size: .9rem; color: var(--ink-2); }
.legend { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: .28rem .8rem; font: inherit; font-size: .86rem; cursor: pointer; color: var(--ink); }
.chip[aria-pressed=true] { outline: 2px solid var(--pri); outline-offset: 0; font-weight: 600; }
.chip.st-rot { background: var(--st-rot); border-color: var(--st-rot-b); }
.chip.st-orange { background: var(--st-orange); border-color: var(--st-orange-b); }
.chip.st-gelb { background: var(--st-gelb); border-color: var(--st-gelb-b); }
.chip.st-gruen { background: var(--st-gruen); border-color: var(--st-gruen-b); }
.bulk { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; padding: .6rem .8rem; background: var(--white);
  border: 1px solid var(--line); border-bottom: none; border-radius: var(--r) var(--r) 0 0; }
.bulk #selcount { font-weight: 600; margin-right: .4rem; min-width: 7.5rem; }
.bulk .sep { flex: 0 0 1px; align-self: stretch; background: var(--line); margin: 0 .3rem; }

/* Tabellen */
.tblwrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.tbl { width: 100%; border-collapse: collapse; background: var(--white); font-size: .92rem; }
.tbl th, .tbl td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl thead th { background: #eef0f2; font-weight: 600; font-size: .86rem; color: var(--ink-2); vertical-align: bottom; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]::after { content: " ↕"; color: #a7afb4; font-weight: normal; }
.tbl th[aria-sort=ascending]::after { content: " ↑"; color: var(--ink); }
.tbl th[aria-sort=descending]::after { content: " ↓"; color: var(--ink); }
.tbl td input:not([type=checkbox]), .tbl td textarea { margin: 0; }
.tbl small { color: var(--ink-2); }
.tbl td.dt { white-space: nowrap; }
tr.st-rot td, tbody.st-rot > tr:first-child > td { background: var(--st-rot); }
tr.st-orange td, tbody.st-orange > tr:first-child > td { background: var(--st-orange); }
tr.st-gelb td, tbody.st-gelb > tr:first-child > td { background: var(--st-gelb); }
tr.st-gruen td, tbody.st-gruen > tr:first-child > td { background: var(--st-gruen); }
tr.st-grau td { background: #eceeef; color: #59636a; }
tbody.inactive td { color: #8a9398; }
tr.inactive td { color: #8a9398; }
.badge-keine { display: inline-block; border: 1px solid var(--ink-2); border-radius: var(--r); padding: 0 .4rem; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.actions-cell a, .actions-cell .btn-x { margin-right: .3rem; }
td.actions-cell { white-space: nowrap; }
td.actions-cell form.inline, td.actions-cell a { display: block; }
td.actions-cell .btn-x { padding: 0; }
.key { letter-spacing: .05em; }

/* Statusleiste */
.statusbar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center;
  padding: 1rem 1.2rem; border-radius: var(--r); border: 1px solid; margin-bottom: 1rem; }
.statusbar.st-rot { background: var(--st-rot); border-color: var(--st-rot-b); }
.statusbar.st-orange { background: var(--st-orange); border-color: var(--st-orange-b); }
.statusbar.st-gelb { background: var(--st-gelb); border-color: var(--st-gelb-b); }
.statusbar.st-gruen { background: var(--st-gruen); border-color: var(--st-gruen-b); }
.st-label { font-weight: 600; font-size: 1.1rem; }
.st-sub { color: var(--ink-2); font-size: .92rem; }
.st-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.signbox { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--pri); border-radius: var(--r); padding: 1rem 1.2rem; margin-bottom: 1rem; max-width: 760px; }
.signbox h2 { margin-top: 0; }
.keyshow { font-family: Consolas, "DejaVu Sans Mono", monospace; font-size: 1.6rem; letter-spacing: .08em; background: var(--white); border: 1px dashed var(--pri); padding: .8rem 1rem; text-align: center; }

/* Dokumentansicht */
.docview { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 1.4rem 1.8rem; max-width: 900px; font-family: Georgia, "Times New Roman", serif; line-height: 1.6; }
.doc h2 { margin-top: .2rem; font-family: inherit; }
.doc h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; font-family: inherit; }
.doc p { margin: 0 0 .5rem; }
.doc .cb { font-family: "Segoe UI Symbol", "DejaVu Sans", sans-serif; }
.doc-src, .doc-muted { color: var(--ink-2); font-size: .85rem; }
.doc-head { border-collapse: collapse; margin-bottom: .6rem; }
.doc-head th { text-align: left; font-weight: normal; color: var(--ink-2); padding: .15rem 1.2rem .15rem 0; vertical-align: top; }
.doc-list { list-style: none; padding-left: 1.4rem; margin: 0 0 .6rem; }
.doc-tab { border-collapse: collapse; width: 100%; margin: .3rem 0 .8rem; font-family: "Segoe UI", system-ui, sans-serif; font-size: .92rem; }
.doc-tab th, .doc-tab td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: left; vertical-align: top; }
.doc-tab th { background: #eef0f2; }
.doc-tab td.c { text-align: center; }
.doc-keine { font-weight: 600; margin: 1rem 0; }
.sig { border: 1px solid var(--line); padding: .6rem .9rem; margin: .4rem 0 .9rem; background: #fafbfb; font-family: "Segoe UI", system-ui, sans-serif; font-size: .92rem; }
.sig-open { color: var(--err); margin: 0; }
.hash { font-family: Consolas, monospace; font-size: .78rem; color: var(--ink-2); word-break: break-all; }

.printhead { display: none; }

/* Aufklappen */
.tog { border: 1px solid var(--line); background: var(--white); border-radius: var(--r); min-width: 1.9rem; font: inherit; font-size: .8rem; cursor: pointer; color: var(--pri-dk); padding: .05rem .3rem; }
.tog[aria-expanded=true] { background: var(--pri-lt); border-color: var(--pri); }
tr.sub > td { background: #fafbfb; padding-top: .2rem; padding-bottom: .7rem; }
.tbl.inner { font-size: .85rem; border: 1px solid var(--line); }
.tbl.inner thead th { font-size: .8rem; }

/* Kontexthilfe */
details.help { margin: .1rem 0 .7rem; font-size: .9rem; }
details.help summary { cursor: pointer; color: var(--pri-dk); display: inline-block; list-style: none; padding: .1rem .55rem; border: 1px solid var(--pri-lt); border-radius: 999px; background: var(--pri-lt); font-size: .82rem; }
details.help summary::-webkit-details-marker { display: none; }
details.help summary::before { content: "? "; font-weight: 700; }
details.help > div { margin-top: .45rem; padding: .6rem .8rem; border-left: 3px solid var(--pri); background: #fafbfb; color: var(--ink); }

/* Unterschrift */
.sigpad { margin: .6rem 0 1rem; max-width: 600px; }
.sigpad-label { display: block; font-size: .92rem; color: var(--ink-2); margin-bottom: .25rem; }
.sigpad canvas { display: block; width: 100%; height: auto; aspect-ratio: 10 / 3; background: #fff; border: 1px dashed #9aa4aa; border-radius: var(--r); touch-action: none; cursor: crosshair; }
.sigimg { display: block; max-height: 70px; max-width: 260px; margin-bottom: .3rem; }
dialog.sigdialog { border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.4rem; max-width: 680px; width: calc(100% - 2rem); }
dialog.sigdialog::backdrop { background: rgba(20, 28, 34, .45); }
dialog.sigdialog h2 { margin-top: 0; }

/* Listen: Drag & Drop */
td.handle { cursor: grab; color: #8a9398; width: 1.6rem; text-align: center; user-select: none; font-size: 1.1rem; }
tr.dragging td { opacity: .45; }

/* Personen */
.roleform select { display: inline-block; width: auto; max-width: 11.5rem; margin: 0; padding: .15rem .3rem; font: inherit; font-size: .88rem; border: 1px solid #bfc6ca; border-radius: var(--r); background: var(--white); }
.dupbox summary { cursor: pointer; }
.dupbox[open] summary { margin-bottom: .6rem; }
.btn.danger { color: var(--err); }

/* Hilfe / Markdown */
.md { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.6rem; max-width: 960px; }
.md h1 { font-size: 1.4rem; } .md h2 { font-size: 1.15rem; margin-top: 1.6rem; } .md h3 { font-size: 1rem; }
.md table { border-collapse: collapse; margin: .6rem 0 1rem; font-size: .9rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: .35rem .55rem; text-align: left; vertical-align: top; }
.md th { background: #eef0f2; }
.md pre { background: #f2f4f5; padding: .7rem .9rem; overflow-x: auto; border-radius: var(--r); }
.md code { background: #f2f4f5; padding: 0 .2rem; border-radius: 3px; }
.md pre code { background: none; padding: 0; }
.narrowtbl { max-width: 640px; }
.narrowtbl th { width: 40%; }

@media (max-width: 720px) {
  main { padding: 1rem; }
  header.site, nav.main { padding-left: 1rem; padding-right: 1rem; }
  .tools input[type=search] { width: 100%; }
  .docview { padding: 1rem; }
}

@media print {
  @page { size: A4 landscape; margin: 12mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 10pt; }
  header.site, nav.main, footer.site, .noprint, .msg, .report, h1 { display: none !important; }
  .printhead { display: block; margin-bottom: 4mm; font-size: 11pt; }
  main { padding: 0; max-width: none; }
  .tblwrap { border: none; overflow: visible; }
  .tbl { font-size: 8.5pt; }
  .tbl th, .tbl td { padding: 1.2mm 1.6mm; border-bottom: .3pt solid #999; }
  .tbl th[data-sort]::after { content: ""; }
  tr[hidden], tbody[hidden] { display: none !important; }
  a { color: inherit; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
