/* Abfindungsrechner – mobil zuerst, gut lesbar, große Bedienflächen, sichtbarer Fokus. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #4a525c;
  --line: #c9ced6;
  --primary: #0b4f9c;
  --primary-dark: #083b75;
  --focus: #ffbf47;
  --error: #b3261e;
  --error-bg: #fdecea;
  --ok: #1e6b35;
  --ok-bg: #e7f4ea;
  --warn: #7a4b00;
  --warn-bg: #fff4dc;
  --info-bg: #e8f0fb;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125rem; /* 18px */
  line-height: 1.55;
}

.wrap { width: 100%; max-width: 44rem; margin: 0 auto; padding: 0 16px; }

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-dark); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--text); }

.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 12px 16px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopfzeile */
.top { background: var(--primary-dark); color: #fff; }
.top__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
.brand { font-weight: 700; font-size: 1.15rem; }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.who { font-size: 0.95rem; }

/* Schritte */
.steps ol { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 16px 0 4px; }
.steps li { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 0.85rem; color: var(--muted); }
.steps__n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font-weight: 700; }
.steps li.is-current { color: var(--text); font-weight: 700; }
.steps li.is-current .steps__n { border-color: var(--primary); background: var(--primary); color: #fff; }
.steps li.is-done .steps__n { border-color: var(--ok); color: var(--ok); }

main { padding-top: 8px; padding-bottom: 32px; }
main:focus { outline: none; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 16px 0 8px; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 8px; }
.lead { color: var(--muted); margin-top: 0; }
.small { font-size: 0.95rem; color: var(--muted); }

/* Formulare */
.form { margin: 16px 0; }
.field { margin: 0 0 20px; padding: 0; border: 0; min-width: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 4px; }
legend { padding: 0; }
.optional { font-weight: 400; color: var(--muted); }
.hint { margin: 0 0 6px; color: var(--muted); font-size: 0.95rem; }
.error-msg { margin: 0 0 6px; color: var(--error); font-weight: 600; }
.error-msg::before { content: "Fehler: "; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"] {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid #6b7480;
  border-radius: 8px;
}
input[readonly] { background: #eceef1; border-style: dashed; }
.field--error input:not([type="radio"]):not([type="checkbox"]) { border-color: var(--error); border-width: 3px; }
.field--error { border-left: 4px solid var(--error); padding-left: 12px; }

.choices { display: flex; gap: 12px; flex-wrap: wrap; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; border: 2px solid #6b7480; border-radius: 8px; background: var(--surface); font-weight: 400; cursor: pointer; flex: 1 1 8rem; }
.choice input { width: 26px; height: 26px; margin: 0; flex: none; accent-color: var(--primary); }
.choice--check { align-items: flex-start; }
.choice--check input { margin-top: 2px; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--info-bg); }

/* Schaltflächen */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px;
  font: inherit; font-weight: 700; text-align: center; text-decoration: none;
  border-radius: 8px; border: 2px solid transparent; cursor: pointer;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); color: #fff; }
.btn--secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn--ghost { background: transparent; color: #fff; border-color: #fff; }
.btn--small { min-height: 44px; padding: 6px 14px; font-size: 1rem; }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: #9aa3ad; border-color: #9aa3ad; color: #1b1f24; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::before { content: ""; width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn[aria-busy="true"]::before { animation: none; } }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.actions form { margin: 0; }

/* Meldungen */
.error-summary { border: 3px solid var(--error); background: var(--error-bg); padding: 16px; border-radius: var(--radius); margin: 16px 0; }
.error-summary h2 { color: var(--error); font-size: 1.15rem; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: var(--error); font-weight: 600; }
.notice { border-left: 6px solid var(--primary); background: var(--info-bg); padding: 12px 16px; border-radius: 6px; margin: 16px 0; }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin: 0; }
.notice--success { border-color: var(--ok); background: var(--ok-bg); }
.notice--warning { border-color: var(--warn); background: var(--warn-bg); }
.notice--error { border-color: var(--error); background: var(--error-bg); }

/* Ergebnis */
.result, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 24px 0; }
.result:focus { outline: 3px solid var(--focus); }
.result.is-stale .total, .result.is-stale .breakdown { opacity: .55; }
.stale-note { background: var(--warn-bg); border-left: 6px solid var(--warn); padding: 10px 12px; font-weight: 600; }
.total { display: flex; flex-direction: column; margin: 0 0 16px; }
.total__label { color: var(--muted); }
.total__value { font-size: 2rem; font-weight: 800; line-height: 1.2; }

.breakdown { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 1rem; }
.breakdown caption { text-align: left; font-weight: 700; padding-bottom: 6px; }
.breakdown th, .breakdown td { text-align: left; vertical-align: top; padding: 8px 0; border-bottom: 1px solid var(--line); }
.breakdown th { font-weight: 400; color: var(--muted); padding-right: 12px; width: 48%; }
.breakdown td { font-variant-numeric: tabular-nums; }
.breakdown tr.is-total th, .breakdown tr.is-total td { font-weight: 800; color: var(--text); border-bottom: 3px double var(--text); }
@media (max-width: 30rem) {
  .breakdown th, .breakdown td { display: block; width: auto; padding: 0; border: 0; }
  .breakdown tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .breakdown td { font-weight: 600; }
}

.disclaimer { border: 3px solid var(--text); background: #fffdf3; padding: 16px; border-radius: var(--radius); margin: 16px 0 20px; }
.disclaimer__title { font-size: 1.1rem; }
.disclaimer p { margin: 0; font-weight: 600; }

.kv { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0 0 10px; font-weight: 600; overflow-wrap: anywhere; }
@media (min-width: 36rem) { .kv { grid-template-columns: 14rem 1fr; } .kv dd { margin: 0 0 6px; } }
.plain { list-style: none; padding: 0; margin: 0; }

.qr { margin: 16px 0; text-align: center; background: var(--surface); padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); }
.qr img { width: min(280px, 80vw); height: auto; }
.qr code { overflow-wrap: anywhere; }

.foot { padding-top: 16px; padding-bottom: 32px; font-size: 0.9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.card li, .card p { overflow-wrap: anywhere; }

.howto { padding-left: 1.4rem; margin: 16px 0; }
.howto li { margin-bottom: 18px; }
.howto h2 { font-size: 1.15rem; margin: 0 0 6px; }
details.card summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
