/* bAV · bKV Portal – Design-System. Systemschriften (keine externen Fonts → DSGVO-freundlich), Desktop + iPad. */
:root {
  --bg: #f4f5f9; --surface: #ffffff; --surface-2: #f8f9fc; --ink: #181d2f; --muted: #646d82; --line: #e2e6ef;
  --brand: #4338ca; --brand-ink: #ffffff; --brand-soft: #eceefe; --brand-strong: #3730a3;
  --ok: #0f7a56; --ok-soft: #e3f6ee; --warn: #a65b07; --warn-soft: #fdf1dc; --bad: #b8232b; --bad-soft: #fde8e9; --info: #1d6fa5; --info-soft: #e4f1fa;
  --radius: 14px; --radius-sm: 9px; --shadow: 0 1px 2px rgba(20, 28, 55, .06), 0 4px 16px rgba(20, 28, 55, .05);
  --side-w: 262px; --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
[data-portal="arbeitgeber"] { --brand: #0b7a70; --brand-soft: #e2f4f1; --brand-strong: #075f57; }
[data-portal="mitarbeiter"] { --brand: #0b64a8; --brand-soft: #e3f0fb; --brand-strong: #084f87; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1220; --surface: #181c2e; --surface-2: #1d2236; --ink: #eceef6; --muted: #9aa3ba; --line: #2a3048;
    --brand: #8b93ff; --brand-ink: #0f1220; --brand-soft: #23274a; --brand-strong: #a9afff;
    --ok: #4cd1a1; --ok-soft: #12352a; --warn: #f0b45c; --warn-soft: #3a2a10; --bad: #ff8087; --bad-soft: #3d1a1d; --info: #6cb8ec; --info-soft: #14304a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
  :root:not([data-theme="light"])[data-portal="arbeitgeber"] { --brand: #3dd1c1; --brand-soft: #113a37; --brand-strong: #7ee6da; }
  :root:not([data-theme="light"])[data-portal="mitarbeiter"] { --brand: #6cb8ec; --brand-soft: #14304a; --brand-strong: #9ccff3; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
p { margin: 0 0 .8em; } small, .muted { color: var(--muted); } .small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .center { text-align: center; }
svg.i { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.2em; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 18px 14px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; font-weight: 700; letter-spacing: -.01em; }
.brand .logo { width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 1.1rem; }
.brand small { display: block; font-weight: 500; font-size: .76rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 14px 12px 4px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-weight: 500; min-height: 42px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 650; }
.nav a .count { margin-left: auto; background: var(--brand); color: var(--brand-ink); border-radius: 99px; font-size: .72rem; padding: 1px 8px; font-weight: 650; }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); font-size: .85rem; }
.who { display: flex; gap: 10px; align-items: center; padding: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 30; border-bottom: 1px solid transparent; }
.topbar .grow { flex: 1; }
.btn.menu-btn { display: none; }
.content { padding: 8px 28px 48px; width: 100%; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 20px; }
.page-head h1 { margin: 0; } .page-head .sub { color: var(--muted); margin: 2px 0 0; } .page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: .85rem; margin-bottom: 4px; } .crumbs a { color: var(--muted); }
.banner { margin: 0; padding: 9px 28px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner form { margin-left: auto; }
.scrim { display: none; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; } .card + .card { margin-top: 18px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; } .card-h h2, .card-h h3 { margin: 0; } .card-h .right { margin-left: auto; }
.flush .card-h { padding: 16px 20px 0; margin-bottom: 8px; }
.grid { display: grid; gap: 18px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .mt { margin-top: 18px; } .mb { margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; position: relative; }
.kpi .label { color: var(--muted); font-size: .84rem; display: flex; gap: 8px; align-items: center; } .kpi .value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.kpi .hint { color: var(--muted); font-size: .82rem; } .kpi .ico { position: absolute; right: 0; top: 0; width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; } .badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; } .badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); } .btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.danger { color: var(--bad); } .btn.danger:hover { background: var(--bad-soft); } .btn.small { min-height: 32px; padding: 4px 12px; font-size: .86rem; } .btn.ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert.ok { background: var(--ok-soft); color: var(--ok); } .alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.info { background: var(--info-soft); color: var(--info); }
.alert > div { color: var(--ink); } .alert svg { margin-top: 3px; }
.empty { text-align: center; color: var(--muted); padding: 38px 16px; } .empty svg { width: 34px; height: 34px; opacity: .5; display: block; margin: 0 auto 8px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.t td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; } .t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--surface-2); } .t td.right, .t th.right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .who2 { display: flex; flex-direction: column; } .t .who2 b { font-weight: 600; } .t .who2 span { color: var(--muted); font-size: .82rem; }
.t a.row-link { color: inherit; font-weight: 600; } .t tfoot td { font-weight: 700; background: var(--surface-2); }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 16px; } .row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; } .field label { font-size: .84rem; font-weight: 600; color: var(--ink); } .field .help { font-size: .8rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid color-mix(in srgb, var(--ink) 18%, var(--line)); border-radius: 10px; padding: 9px 12px; min-height: 42px; width: 100%; }
textarea { min-height: 90px; resize: vertical; } input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; border-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); } .check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
input[type="range"] { padding: 0; accent-color: var(--brand); min-height: 32px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; } .req::after { content: " *"; color: var(--bad); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; } .filters input[type="search"], .filters input[type="text"] { max-width: 320px; } .filters select { width: auto; min-width: 160px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; } .seg a, .seg button { padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; } .seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; } .tabs a { padding: 11px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; } .tabs a.on { color: var(--brand-strong); border-color: var(--brand); } .tabs .count { background: var(--surface-2); border-radius: 99px; padding: 0 7px; font-size: .75rem; margin-left: 4px; }
dl.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 9px 16px; margin: 0; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Diagramme / Fortschritt ---------- */
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); } .bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.donut { width: 132px; height: 132px; } .donut .bg { stroke: var(--surface-2); } .donut .fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dasharray .4s; } .donut text { fill: var(--ink); font-weight: 700; }
.chart { width: 100%; height: 150px; } .chart rect { fill: var(--brand); opacity: .85; } .chart rect:hover { opacity: 1; } .chart text { fill: var(--muted); font-size: 10px; }
.result-big { font-size: 2.2rem; font-weight: 750; letter-spacing: -.02em; color: var(--brand-strong); line-height: 1.1; }
.steps { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; } .step { flex: 1; min-width: 110px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .86rem; display: flex; gap: 8px; align-items: center; } .step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--line); color: var(--ink); display: grid; place-items: center; font-size: .75rem; } .step.on { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; } .step.on .n { background: var(--brand); color: var(--brand-ink); } .step.done .n { background: var(--ok); color: #fff; }

/* ---------- Kanban / Timeline ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; } .col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 140px; } .col h3 { font-size: .86rem; display: flex; justify-content: space-between; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px; margin-bottom: 10px; display: block; color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); } .kcard:hover { border-color: var(--brand); } .kcard b { display: block; margin-bottom: 2px; } .kcard .small { color: var(--muted); }
.timeline { display: grid; gap: 14px; } .tl { display: grid; grid-template-columns: 38px 1fr; gap: 12px; } .tl .bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; } .tl .bubble.internal { background: var(--warn-soft); border-color: transparent; } .tl .meta { color: var(--muted); font-size: .8rem; margin-bottom: 3px; }

/* ---------- Dialog / Toast ---------- */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 28px)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); } dialog::backdrop { background: rgba(10, 14, 30, .5); backdrop-filter: blur(2px); } dialog .dlg { padding: 22px; } dialog h2 { margin-bottom: 12px; }
.copybox { display: flex; gap: 8px; } .copybox input { font-family: ui-monospace, monospace; font-size: .85rem; }
.htmx-request { opacity: .6; transition: opacity .2s; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-hero { background: linear-gradient(150deg, #312e81 0%, #4338ca 45%, #0b7a70 120%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h1 { font-size: 2.2rem; max-width: 18ch; } .auth-hero ul { list-style: none; padding: 0; display: grid; gap: 14px; max-width: 46ch; } .auth-hero li { display: flex; gap: 12px; align-items: flex-start; opacity: .95; } .auth-hero li svg { margin-top: 3px; }
.auth-box { display: grid; place-items: center; padding: 28px; } .auth-card { width: min(420px, 100%); } .auth-card h2 { font-size: 1.5rem; }

/* ---------- Responsiv: iPad & kleiner ---------- */
.calc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); align-items: start; }
.calc-grid > form { position: sticky; top: 76px; align-content: start; }
@media (max-width: 1100px) { .calc-grid { grid-template-columns: 1fr; } .calc-grid > form { position: static; } }
@media (max-width: 1280px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } :root { --side-w: 232px; } .content, .topbar { padding-left: 22px; padding-right: 22px; } }
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; width: min(310px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: none; padding-top: max(18px, env(safe-area-inset-top)); }
  body.nav-open .side { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .4); } body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 14, 30, .45); z-index: 35; }
  .btn.menu-btn { display: inline-flex; } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .auth { grid-template-columns: 1fr; } .auth-hero { display: none; }
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
}
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .content, .topbar { padding-left: 14px; padding-right: 14px; } .page-head .actions { margin-left: 0; width: 100%; } dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dt { margin-top: 8px; } }
@media (pointer: coarse) { .btn, .nav a, input, select { min-height: 46px; } .btn.small { min-height: 38px; } .t td { padding-top: 15px; padding-bottom: 15px; } select { font-size: 16px; } input, textarea { font-size: 16px; } }
@media print { .side, .topbar, .actions, .btn, .scrim, .banner { display: none !important; } .app { display: block; } .card { box-shadow: none; } body { background: #fff; } }

/* ---------- Gehaltsabrechnung (Simulation) ---------- */
.slip-paper { background: #fff; color: #1b2033; border: 1px solid #d9dde8; border-radius: 6px; padding: 18px 20px; box-shadow: 0 1px 0 rgba(0, 0, 0, .04); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .slip-paper { background: #f7f8fb; } }
.slip-paper .muted { color: #5d6579; }
.slip-head { display: flex; gap: 18px; justify-content: space-between; flex-wrap: wrap; border-bottom: 2px solid #1b2033; padding-bottom: 10px; margin-bottom: 8px; }
.slip-title { font-size: 1.15rem; font-weight: 750; letter-spacing: .01em; text-transform: uppercase; }
.slip-meta { display: grid; grid-template-columns: repeat(3, minmax(90px, auto)); gap: 4px 18px; font-size: .84rem; } .slip-meta span { display: block; color: #6b7388; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.slip-t { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.slip-t th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #5d6579; padding: 6px 8px; border-bottom: 1px solid #c9cedb; white-space: nowrap; }
.slip-t th.right, .slip-t td.right { text-align: right; white-space: nowrap; } .slip-t td { padding: 5px 8px; border-bottom: 1px dotted #dfe3ec; } .slip-t td.la, .slip-t th.la { width: 52px; color: #6b7388; }
.slip-t tr.sec td { padding-top: 12px; font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: #3a4258; border-bottom: 1px solid #c9cedb; }
.slip-t tr.info td { color: #5d6579; font-size: .84rem; } .slip-t tr.sub td { font-weight: 650; border-top: 1px solid #c9cedb; }
.slip-t tr.total td { font-weight: 750; background: #eef0f7; border-top: 1px solid #1b2033; border-bottom: 1px solid #1b2033; }
.slip-t td.good, .slip-sum .good { color: #0f7a56; font-weight: 650; } .slip-t td.bad { color: #b8232b; font-weight: 650; }
.slip-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 2px solid #1b2033; } .slip-sum span { display: block; } .slip-sum b { font-size: 1.1rem; }
@media (max-width: 700px) { .slip-sum, .slip-meta { grid-template-columns: 1fr 1fr; } }
@media print { .calc-grid > form, .page-head, .alert, #result > .card:not(.slip) { display: none !important; } .calc-grid { display: block; } .slip { border: 0; } }
