/* Nunito – lokal eingebunden (kein Abruf bei Google), Lizenz: fonts/OFL-Nunito.txt */
@font-face {
  font-family: "Nunito Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("../fonts/nunito-latin-ext-wght-normal.ffdc8b0c86fb.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Nunito Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("../fonts/nunito-latin-wght-normal.166202cc391c.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  /* Markenfarben (Logo: Rot #aa2b37, Grau) */
  --brand: #aa2b37;
  --brand-2: #8e222d;
  --brand-soft: #f8ecee;
  --brand-line: #ecc9cd;
  --gray: #8b8e93;
  --ink: #26282c;
  --ink-2: #4f535a;
  --ink-3: #81868d;
  --line: #e6e6e9;
  --bg: #f6f6f7;
  --card: #ffffff;
  --ok: #15803d;
  --ok-bg: #ecfdf3;
  --warn: #b45309;
  --warn-bg: #fff7e6;
  --err: #b91c1c;
  --err-bg: #fef2f2;
  --info: #1d4ed8;
  --info-bg: #eff6ff;
  --radius: 10px;
  --font: "Nunito Variable", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
a { color: var(--brand-2); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; font-weight: 800; letter-spacing: -.005em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; font-weight: 800; }
h3 { font-size: 1rem; margin: 0 0 .5rem; font-weight: 700; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* --- Kopfzeile --- */
.topbar {
  background: #fff; color: var(--ink); display: flex; align-items: center; gap: 1.75rem;
  padding: 0 1.5rem; height: 74px; position: sticky; top: 0; z-index: 10;
  border-top: 4px solid var(--brand); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(38,40,44,.04);
}
.topbar .brand { display: flex; align-items: center; gap: .9rem; color: var(--ink); text-decoration: none; }
.topbar .brand img { height: 54px; width: auto; display: block; }
.topbar .brand .tagline {
  font-weight: 700; color: var(--gray); font-size: .95rem; padding-left: .9rem;
  border-left: 1px solid var(--line); letter-spacing: .02em;
}
.topbar nav { display: flex; gap: .2rem; flex: 1; }
.topbar nav a {
  color: var(--ink-2); padding: .45rem .8rem; border-radius: 8px; font-size: .95rem; font-weight: 600;
}
.topbar nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.topbar nav a.active { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.topbar .user { display: flex; align-items: center; gap: .75rem; font-size: .92rem; }
.topbar .user form { margin: 0; }
.topbar .user a { color: var(--ink-2); font-weight: 600; }
.topbar .user button {
  background: #fff; border: 1px solid #d5d6da; color: var(--ink-2);
  padding: .32rem .75rem; border-radius: 8px; cursor: pointer; font-size: .85rem; font-weight: 600;
}
.topbar .user button:hover { border-color: var(--brand); color: var(--brand); }

main { max-width: 1320px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: .6rem; font-weight: 700;
  color: var(--ink-2); font-size: .92rem; }
.back-link:hover { color: var(--brand); text-decoration: none; }
tr:target td { background: var(--brand-soft); transition: background 1.5s; }
tr[id^="fz-"] { scroll-margin-top: 90px; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* --- Karten & Raster --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 1rem 1.25rem 0; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } .topbar nav, .topbar .brand .tagline { display: none; } }

.stat { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat .num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; color: var(--ink); }
.stat .label { color: var(--ink-3); font-size: .85rem; }
.stat.alert .num { color: var(--err); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; }
h2.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.contact-list li:first-child { padding-top: 0; }
.contact-list li:last-child { border-bottom: none; padding-bottom: 0; }
.contact-main strong { margin-right: .35rem; }
.contact-ways { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .25rem; }
.contact-actions { display: flex; gap: .35rem; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }

/* --- Tabellen --- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--ink-2); background: #fafafb; font-size: .82rem; white-space: nowrap; }
tbody tr:hover { background: #fdf8f8; }
tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Badges --- */
.badge {
  display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: #eeeff1; color: var(--ink-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* --- Meldungen --- */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.msg { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; border: 1px solid transparent; }
.msg.success { background: var(--ok-bg); border-color: #bbf7d0; color: #14532d; }
.msg.error { background: var(--err-bg); border-color: #fecaca; color: #7f1d1d; }
.msg.warning { background: var(--warn-bg); border-color: #fde68a; color: #78350f; }
.msg.info { background: var(--info-bg); border-color: #bfdbfe; color: #1e3a8a; }

.hint-list { list-style: none; margin: 0; padding: 0; }
.hint-list li { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.hint-list li:last-child { border-bottom: none; }
.hint-list a { color: var(--ink); }
.hint-list a:hover { color: var(--brand); }

/* --- Formulare --- */
form.stack { display: grid; gap: 1rem; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .3rem; }
.field .help { color: var(--ink-3); font-size: .8rem; margin-top: .25rem; }
.field .help ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.field .errors { color: var(--err); font-size: .85rem; margin-top: .25rem; }
.field.checkbox { display: flex; align-items: center; gap: .5rem; }
.field.checkbox label { margin: 0; font-weight: 500; }
.field div[id$="_betreuer"] { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; }
.field div[id$="_betreuer"] label { font-weight: 500; display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=search], input[type=file], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #d5d6da; border-radius: 8px; font: inherit;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(170,43,55,.18); outline-offset: 0; border-color: var(--brand); }
input.otp-input { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .25em; text-align: center; max-width: 14rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.nonfield { background: var(--err-bg); color: var(--err); padding: .6rem .9rem; border-radius: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: 8px;
  border: 1px solid #d5d6da; background: #fff; color: var(--ink); font: inherit; font-size: .92rem; font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f4f4f5; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { color: var(--err); border-color: #f1b5b5; }
.btn.danger:hover { background: var(--err-bg); }
.btn.small { padding: .25rem .6rem; font-size: .82rem; }
.btn.link { border: none; background: none; color: var(--brand-2); padding: 0; }
form.inline { display: inline; margin: 0; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); background: #fbfbfc; }
.filters .field { min-width: 150px; }
.filters .field label { font-size: .78rem; color: var(--ink-3); font-weight: 700; }
.filters input, .filters select { padding: .4rem .55rem; }

.pager { display: flex; gap: .5rem; justify-content: center; padding: 1rem; align-items: center; }

/* --- Anmeldeseiten --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background:
  radial-gradient(900px 500px at 0% 0%, #f3e3e5 0%, transparent 60%),
  radial-gradient(900px 500px at 100% 100%, #ececee 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--brand);
  border-radius: 14px; padding: 2rem 2.1rem; box-shadow: 0 12px 34px rgba(38,40,44,.07); }
.auth-card.wide { max-width: 580px; }
.auth-card .brand { display: flex; flex-direction: column; align-items: center; gap: .35rem; margin-bottom: 1.5rem; }
.auth-card .brand img { height: 78px; width: auto; }
.auth-card .brand .tagline { color: var(--gray); font-weight: 700; font-size: .9rem; letter-spacing: .04em; }
.auth-card h1 { font-size: 1.3rem; }
.auth-card .sub { color: var(--ink-3); margin: 0 0 1.25rem; }
.auth-foot { margin-top: 1.25rem; font-size: .88rem; color: var(--ink-3); display: flex; justify-content: space-between; }
.qr { display: flex; gap: 1.25rem; align-items: center; margin: 1rem 0; flex-wrap: wrap; }
.qr svg { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.secret { font-family: var(--mono); background: #f4f4f5; padding: .5rem .7rem; border-radius: 6px; font-size: .95rem; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; font-family: var(--mono); font-size: 1.05rem; margin: 1rem 0; }
.codes span { background: #f4f4f5; border-radius: 6px; padding: .45rem .6rem; text-align: center; letter-spacing: .08em; }
ol.steps { padding-left: 1.2rem; margin: 0 0 1rem; color: var(--ink-2); }
ol.steps li { margin-bottom: .3rem; }

.copybox { display: flex; gap: .5rem; }
.copybox input { font-family: var(--mono); font-size: .85rem; }

.bar { height: 6px; background: #eeeff1; border-radius: 3px; overflow: hidden; margin-top: .3rem; }
.bar span { display: block; height: 100%; background: var(--brand-2); }

/* Dokumente */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.thumbs figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fafafa; }
.thumbs img { width: 100%; height: 120px; object-fit: cover; display: block; }
.thumbs figcaption { font-size: .78rem; padding: .3rem .5rem; display: flex; justify-content: space-between; align-items: center; gap: .3rem; }
.doc-list td { padding: .45rem .5rem; }
.upload-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
input[type=file] { padding: .4rem; background: #fafafa; }

/* Schaden-Status */
.badge.status-gemeldet { background: var(--brand-soft); color: var(--brand); }
.badge.status-in_bearbeitung, .badge.status-beim_versicherer, .badge.status-in_regulierung { background: var(--info-bg); color: var(--info); }
.badge.status-reguliert, .badge.status-erledigt { background: var(--ok-bg); color: var(--ok); }
.badge.status-abgelehnt { background: var(--err-bg); color: var(--err); }
h1 .badge { vertical-align: middle; font-size: .8rem; }
.progress { display: flex; list-style: none; margin: 0; padding: 0; gap: .35rem; counter-reset: step; }
.progress li { flex: 1; text-align: center; font-size: .82rem; color: var(--ink-3); padding-top: .9rem; position: relative; font-weight: 600; }
.progress li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: 3px; background: #e7e7ea; }
.progress li.done::before { background: #d9a2a8; }
.progress li.current::before { background: var(--brand); }
.progress li.current { color: var(--brand); }
.progress li.done { color: var(--ink-2); }

/* Verlauf */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { padding: .2rem 0 .9rem 1rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: #c9cbd0; }
.timeline li.tl-status::before { background: var(--brand); }
.timeline li.tl-intern { background: #fffbeb; border-radius: 6px; }
.tl-meta { font-size: .8rem; color: var(--ink-3); }
.tl-text { margin-top: .15rem; }

img.scan { width: 100%; border: 1px solid var(--line); border-radius: 8px; }
table.review td { vertical-align: middle; }
table.review tr.muted td { color: var(--ink-3); }
table.review input[type=text], table.review input[type=number], table.review input[type=date] { padding: .35rem .5rem; min-width: 21ch; font-family: var(--mono); font-size: .9rem; }

/* Notizen & Mails */
.notiz-list { list-style: none; margin: 0; padding: 0; }
.notiz-list li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.notiz-list li:last-child { border-bottom: none; }
.notiz-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.notiz-text { color: var(--ink-2); margin-top: .2rem; }
.notiz-volltext, .mail-body { white-space: normal; line-height: 1.6; overflow-wrap: anywhere; }
.mail-head dd { overflow-wrap: anywhere; }
.mail-head .btn { margin: 0 .3rem .3rem 0; }
h2.card-head .actions { gap: .4rem; }

/* Hilfe */
.topbar .user a.hilfe-link { color: var(--brand); border: 1px solid var(--brand-line); border-radius: 8px; padding: .3rem .65rem; font-size: .85rem; }
.topbar .user a.hilfe-link:hover { background: var(--brand-soft); text-decoration: none; }
.hilfe-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.75rem; align-items: start; }
@media (max-width: 900px) { .hilfe-layout { grid-template-columns: 1fr; } }
.hilfe-nav { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; font-size: .92rem; }
.hilfe-nav ul { list-style: none; margin: 0 0 .75rem; padding: 0; }
.hilfe-nav li a { display: block; padding: .28rem .6rem; border-radius: 6px; color: var(--ink-2); }
.hilfe-nav li a:hover { background: #fff; text-decoration: none; color: var(--ink); }
.hilfe-nav li a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.hilfe-kapitel { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 800; margin: .9rem 0 .3rem .6rem; }
.hilfe-suche input { width: 100%; }
.hilfe-pfad { font-size: .85rem; color: var(--ink-3); margin-bottom: .3rem; }
.hilfe-liste { margin: 0; padding-left: 1.1rem; line-height: 1.9; }
.hilfe-text { line-height: 1.65; max-width: 860px; }
.hilfe-text h2 { margin-top: 1.6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.hilfe-text h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.hilfe-text h3 { margin-top: 1.2rem; }
.hilfe-text table { margin: .75rem 0 1rem; border: 1px solid var(--line); }
.hilfe-text th, .hilfe-text td { border-bottom: 1px solid var(--line); }
.hilfe-text code { background: #f4f4f5; padding: .05rem .35rem; border-radius: 4px; font-size: .88em; }
.hilfe-text pre { background: #26282c; color: #f4f4f5; padding: .8rem 1rem; border-radius: 8px; overflow-x: auto; }
.hilfe-text pre code { background: none; padding: 0; color: inherit; }
.hilfe-text kbd, .hilfe-text strong.pfad { white-space: nowrap; }
.hilfe-text .admonition { border-left: 4px solid var(--info); background: var(--info-bg); padding: .6rem 1rem; border-radius: 0 8px 8px 0; margin: 1rem 0; }
.hilfe-text .admonition.tipp { border-color: var(--ok); background: var(--ok-bg); }
.hilfe-text .admonition.achtung { border-color: var(--warn); background: var(--warn-bg); }
.hilfe-text .admonition-title { font-weight: 800; margin: 0 0 .2rem; }
.hilfe-text .admonition p:last-child { margin-bottom: 0; }
.hilfe-blaettern { display: flex; justify-content: space-between; margin-top: 1rem; }
.handbuch { background: #fff; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius); }
.handbuch-titel img { height: 90px; }
.handbuch-toc { line-height: 1.9; columns: 2; }
.handbuch-seite { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 3px solid var(--brand); }
@media print {
  .hilfe-layout { display: block; }
  .handbuch { border: none; padding: 0; }
  .handbuch-seite { break-before: page; border-top: none; margin-top: 0; }
  .handbuch-toc { columns: 1; }
  .hilfe-text .admonition { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.print-only { display: none; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  .topbar, .actions, .filters, .messages, .no-print, .back-link, form.inline { display: none !important; }
  .print-only { display: block !important; }
  .print-header { display: flex !important; justify-content: space-between; align-items: flex-end;
    border-bottom: 3px solid var(--brand); padding-bottom: .5rem; margin-bottom: 1rem; color: var(--ink-2); font-size: 10pt;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-header img { height: 52px; }
  body { background: #fff; font-size: 10.5pt; }
  main { max-width: none; padding: 0; }
  .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  .stat { border-top-color: var(--brand); }
  .grid-2 { grid-template-columns: 1fr 1fr !important; }
  a { color: inherit; }
  .badge { border: 1px solid #ccc; }
}

/* Zu-/Abgänge */
.evb-box { border-left: 4px solid var(--brand); }
.evb-box .evb { font-size: 1.6rem; font-weight: 800; letter-spacing: .12em; margin: .25rem 0 .5rem; }
.nav-count { display: inline-block; min-width: 1.25rem; padding: 0 .35rem; margin-left: .2rem; border-radius: 999px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 800; line-height: 1.25rem; text-align: center; }
