:root {
  color-scheme: light only;
  --brand: #006CB5;
  --brand2: #DE1E56;
  --brand-dark: #00508a;
  --brand-soft: #e6f0f8;
  --ink: #16202b;
  --ink-2: #4a5866;
  --ink-3: #7b8794;
  --line: #dbe2e9;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #1f7a4a;
  --ok-soft: #e3f3ea;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --err: #b42318;
  --err-soft: #fde8e6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 15px; line-height: 1.45; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* Kopfzeile mit Praxis-Briefkopf */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 20px 12px;
  background: var(--card); position: sticky; top: 0; z-index: 20;
}
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(to right, var(--brand2) 0 9%, var(--brand) 9% 100%); }
.topbar nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.topbar .app { font-size: 12px; color: var(--ink-3); margin-right: 8px; white-space: nowrap; }

.bk { display: flex; align-items: center; gap: 12px; }
.bk img { height: 46px; width: auto; }
.bk .z { font-weight: 700; font-size: 15px; line-height: 1.2; color: var(--ink); }
.bk .f { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-top: 2px; }
.bk .a { font-size: 11px; color: var(--ink-2); margin-top: 3px; }
.bk.gross { flex-direction: row; gap: 22px; }
.bk.gross img { height: 120px; }
.bk.gross .z { font-size: 28px; }
.bk.gross .f { font-size: 14px; margin-top: 6px; }
.bk.gross .a { font-size: 15px; margin-top: 10px; line-height: 1.5; }
.bkbar { height: 5px; background: linear-gradient(to right, var(--brand2) 0 15%, var(--brand) 15% 100%); border-radius: 2px; }
@media (max-width: 760px) { .bk .a { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-weight: 550; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { border-color: #b9c4cf; background: #fafbfc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--err); border-color: #f1c4bf; }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 14px 22px; font-size: 18px; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.tab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

/* Karten & Formulare */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
label.f { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
label.f > input, label.f > select, label.f > textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); font-size: 15px;
}
label.chk { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 3px 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: #eef1f4; color: var(--ink-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.blue { background: var(--brand-soft); color: var(--brand-dark); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); font-weight: 600; }
table.tbl th, table.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:hover td { background: #fafbfc; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 10px; z-index: 1000; box-shadow: var(--shadow); max-width: 90vw;
}
.toast.err { background: var(--err); }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15, 25, 40, .45); display: flex; align-items: center;
  justify-content: center; z-index: 500; padding: 16px;
}
.modal { background: #fff; border-radius: 14px; padding: 22px; width: min(520px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 92vh; overflow: auto; }

/* PIN-Feld */
.pinpad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; margin: 16px 0 6px; }
.pinpad button { height: 64px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 24px; font-weight: 600; cursor: pointer; }
.pinpad button:active { background: var(--brand-soft); }
.pindots { display: flex; gap: 12px; justify-content: center; margin-top: 8px; min-height: 18px; }
.pindots span { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.pindots span.on { background: var(--brand); }

/* Hochgeladene Unterlagen */
.anl-list { display: grid; gap: 10px; }
.anl { display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.anl img, .anl .noprev { width: 110px; height: 140px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); background: #f3f6f9; flex: none; }
.anl .noprev { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--brand); }

.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; font-size: 15px; }
.linkbtn:hover { color: var(--ink); }
